Hello everyone, hope you are having a nice day.
This is an issue I need help with, I need to uniquely identify the usbs which get plugged in to the system.
What I have tried:
I send IOCTL_STORAGE_QUERY_PROPERTY down to the device which returns me a STORAGE_ADAPTER_DESCRIPTOR structure from which I can get vendorId(ASCII), productID(ASCII) but the serial number is not of the physical device as seen from the thread here : http://www.osronline.com/cf.cfm?PageURL=showlists.cfm?list=NTFSD
Since it would be easier to get the serial number from a user level application, I created a communication port from which I send the vendorId, productID to the user level service.
In the user level service I get the output of
wmic diskdrive get pnpdeviceid
which gives me an output like so,
Here I match the vendorID and the productID to get the serial number, but the issue is that if two USBs have the same vendor & productID I would not be able to distinguish between them.
I also wanted the true vendorID and productID ie aplhanumeric, so in the serivice after I get the serialnumber of the said device I use SetupApi to get the devicepath, which gives me an output like so.
I compare the serial number and send back the VID,PID(alphanumeric) and serial number to the driver.
Again the major problem here is that I filter based on the vendorID and productID which can be common across devices.
Is there any other parameter that can be obtained through the minifilter and the user level which would uniquely identify USB.
I thought of using VolumeGUID but then at the userlevel how would I map the volumeGuid to a VID/PID/SerialNumber.