Well I discovered that my .Net app does actually work on 32 bit operating systems too. Assuming I'm reading the data correctly, I can read CIDs in XP SP2, on an old Asus W5 laptop. It also has an integral card reader. BUT: it didn't work at first. DeviceIOControl returned "Invalid Function" (Win32 Error code 1). I went in to device manager and changed the driver over:
So, It looks like the driver plays an important role too...
So to read the CID, so far I've found:
1) You can't get it if the reader is a USB device. 2) You can't get it if the driver doesn't like the DeviceIOControl call.
CreateFile path for the Volume:
There are 2 choices mentioned on forums/in documentation. "//./X:" or "//./PhysicalDriveX". There's another one with a guid too.
I've been using "//./X:" as it worked. Maybe using the other path to get the handle will make a difference on the machine where I can't get it to work:
C:\Users\SEP>wmic diskdrive get name,size,model Model Name Size FUJITSU MHW2160BJ G2 \\.\PHYSICALDRIVE0 160039272960 SD Memory Card \\.\PHYSICALDRIVE1 8225280
Edit: I'm now on about version 5 of my program and I'm using C#! So, I've moved from C++/CLI -> VB.Net -> C#... It now works on the machine I mentioned above, and I'm using the physicaldrive string. I'm trying to get Overlapped to work on x64 and x32, it seems there are some problems with NativeOverlapped. This will allow the call to read the CID and CSD to run on another thread, and the user to be notified when the results come back. (Reading the CID takes a noticable amount of time.) It requires a pointer, hence the move to C#.