how to get USB harddisk physical serial number ,vendor id ,product id
I would like to get USB hard disk serial number ,vendor id ,product id without WMI,I found the
USBSTOR\Disk&Ven_ST932042&Prod___5VJ101RR&Rev_SDM1\222256410122&0
the serial number is 5VJ101RR but it show in the product id which is wrong, how can i get the correct USB disk vendor id,product id, serial number My develop environment is visual开发者_StackOverflow中文版 c++ 2008
thanks
A simple way to get VID and PID would be to load the devices INI file from %WINDOWS%\System32, I think that is where the INIs are usually copied. If you know the name of the INI file then it is trivial. If you are looking for a programmatic method, you can enumerate the USB bus using the Win32 Setup API.
If you have installed the Wnidows Driver Kit on your machine, take a look at the USBVIEW sample application. It demonstrates how you can enumerate the USB bus and get a list of all devices including their PID and VID.
To get the serial number, look at the GetVolumeInformation() system call.
精彩评论