This idea is correct.
Use this GUID: 53f56307-b6bf-11d0-94f2-00a0c91efb8b
First, setupdigetclassdevs
Then setupdienumdeviceinterfaces
Setupdigetdeviceinterfacedetail can be used to obtain a device path. You can use this device path to createfile to open the device and obtain the handle. Then, use the deviceiocontrol function to obtain the serial number.
Structure: ioctl_storage_query_property?
In fact, based on your ideas, you can add several more actions to obtain the serial number of the USB mass storage device.
For me, there are two methods:
(1) send a command to the hardware through the driver to obtain the device instance IDs of the storage device instance. This is similar to the following string:
Hard Disk: pciide/idechannel/4 & e3ec092 & 0 & 0
USB memory: USB/vid_04a5 & pid_6130/0002f0eb6d990414
For example, 0002f0eb6d990414 is the serial number you want.
(2) access the USB device directly with DDK to obtain it.
You have compiled the USB view in the DDK, which is very good. The reason for this is: iserialnumber: 0x03, because you have not performed config descriptors on the device. You can try to make an action:
Start USB view.exe and plug the USB device in. select the "Config Descriptors" item under the "options" menu, and then under the "file" menu, click the "Refresh F5" sub-menu item, so that the serial number will be displayed.
The following are my results:
Device descriptor:
Bcdusb: 0x0110
Bdeviceclass: 0x00
Bdevicesubclass: 0x00
Bdeviceprotocol: 0x00
Bmaxpacketsize0: 0x40 (64)
Idvendor: 0x04a5 (Acer peripherals Inc .)
Idproduct: 0x6130
Bcddevice: 0x1001
Imanufacturer: 0x01
0x0409: "<usb mf>"
Iproduct: 0x02
0x0409: "<USB product>"
Iserialnumber: 0x03
0x0409: "0002f0eb6d9c050b"
Bnumconfigurations: 0x01
Connectionstatus: deviceconnected
Current Config value: 0x01
Device bus speed: full
Device address: 0x02
Open Pipes: 2
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.