22 December 2008

Read SD Card CID (serial number)

I just moved blogs, so here's an overview of the SD card CID stuff. I've had some success reading the CID from an SD Card:


1) The OS is XP or Vista 2) The device is not attached via any USB gizmo. It works only in a card reader attached directly to the PCI bus. (Can scsi pass through get around this? It's not an ATA or SCSI command...) 3) Admin privileges...

What not to do:

1) IOCTL_DISK_GET_STORAGEID 2) GetFileInformationByHandle

As both these return a number assigned when the volume is created. It will change next time the drive is formatted. What I did:

Use IOCTL_SFFDISK_DEVICE_COMMAND to send command 10 (see the SD spec).

Read Secure Digital (SD) Card Serial Number from CID

SD Card Musings

Read CID and CSD C# implementation

Pocket PC?

I don't think it works.

The Future?

IEEE 1667


  1. Feedback I got by mail from someone:

    "I did a bit of debugging and found out the "GetPhysicalDriveStrings" is not working for me, it does not "give back" the correct device, thus the variable "result" is false, I had to set the physicalDrives variable manually, and the rest worked great, it retrieved the correct SID, first program on windows able to do that :)"

    So - it's a bit buggy, but does work for others!

  2. This is not working for me.

    I get a blank dos command screen until i hit any key and the dos screen goes away.

    Looks like the program is runing but nothing is happening.

    Any siggestions

  3. Anyone has this as a compiled .exe file?

  4. Hey jo0ls

    May I use some of your code in a freeware application I am developing? I will make mention of you on the app.

  5. hey...i jus found a way to get the cid number through command prompt,,and it says NONE for cod number...wat should i do...and wat is actually the problem ???

  6. I found your article at first, then also found Nexcopy who has a 20 target system to do this in bulk. This blog did the write up about it. www.getusb.info/how-to-read-cid-on-sd-card/ or the factory is nexcopy.com

  7. Hi could someone provide the source code. I don't seem to be able to find the link. Thanks.