From: cold80 on
I'm wondering how I can read the serial id (if any) and other device
dipendent data (such as capacity, number of blocks, etc) of a usb
device (actually, just memories sticks). I would like to attach to
these informations some security I want to implement in my application.
I read a lot of stuff about the subject, and the most interesting one
is about using DeviceIoControl. The problem is that I can't get any
information with it. I use it with the parameter
IOCTL_CHANGER_GET_PRODUCT_DATA and I always receive errors like
"Incorrect function" or "The request is not supported", even for normal
IDE hard disks. Instead, using GetVolumeInformation I can get some
information, even a kind of serial that I don't know if it's really
device dependent. Can you help me in some way?

Cheers

Sebastiano

From: Uwe Sieber on
cold80 wrote:
> I'm wondering how I can read the serial id (if any) and other device
> dipendent data (such as capacity, number of blocks, etc) of a usb
> device (actually, just memories sticks). I would like to attach to
> these informations some security I want to implement in my application.
> I read a lot of stuff about the subject, and the most interesting one
> is about using DeviceIoControl. The problem is that I can't get any
> information with it. I use it with the parameter
> IOCTL_CHANGER_GET_PRODUCT_DATA and I always receive errors like
> "Incorrect function" or "The request is not supported", even for normal
> IDE hard disks. Instead, using GetVolumeInformation I can get some
> information, even a kind of serial that I don't know if it's really
> device dependent. Can you help me in some way?

As the name implies IOCTL_CHANGER_GET_PRODUCT_DATA can be used
with changer devices only. There is no relation to USB devices.

It can be done thru a SetupDi enumeration. I've shown this in
a sample:
http://www.codeproject.com/system/RemoveDriveByLetter.asp

Download the demo project. It includes some comment lines about
the USB serial number.


Uwe