Deviceiocontrol Serial Number
Your code works fine for me. I heard getting the SN (and other info) may be unrealiable by the DeviceIoControl Method depending on the USB Device. Have you tried multiple / other USB devices?
Windows Desktop SDK - DeviceIoControl() can not get the vendor ID, porduct ID, and serial number of USB device Windows Desktop SDK. Download Resume In Html Format Online. Retrieves the serial number of a USB device. To perform this operation, call the DeviceIoControl function with the following parameters. Retrieve serial number from USB memory (Windows environment c++) up vote 0 down vote favorite. The Common Welth Games - Free Software And Shareware on this page. Invalid handle when calling IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER. Why call new for getting the MEDIA_SERIAL_NUMBER_DATA. DeviceIoControl can accept a handle.
You can also get the device info by WMI or through the Setupapi functions (there are enough examples on you can find). However, I guess it's not a possibibility for you, since you surely stumbled upon these methods yourself. Edit: Code works for my Win7 Machine. Code doesn't work for my XP machine. Returns ')' as Serial Number. Code doesn't work for my WinCE machine. DeviceIoControl returns false.