When using SetupDiGetDeviceInterfaceDetail to retrieve a SP_DEVICE_INTERFACE_DETAIL_DATA relating to a connected USB device, a string called DevicePath is returned.
The string being returned is formatted like the following example:
\?\usb#vid_abcd&pid_1234#000000000#{xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
Question : Is the formatting/syntax of this string documented anywhere and / or known to be dependable across all versions of Windows XP/Vista/7/8?
I am experimenting with code to extract the VID and PID values from this string in order to identify the device being referred to, and would like to know if this is a robust way to retrieve the VID and PID values.
While you may find it easy to just parse the device path to get this information, technically it is illegal because device paths in Windows are supposed to be opaque.
Take a look at the usbview sample to see the right way to do this.