I am developing a C# windows application using .NET Framework v3.5.
Every USB device should have a unique instance id that distinguishes a it from other devices of the same type on a computer.
In case that the device InstanceID is not unique, the PnP manager modifies the InstanceID, and combines it with the corresponding DeviceTypeID, to create a device instance ID that is unique in the system.
I need to find if the USB Device Instance Id is unique system-wide.
I can use IRP_MN_QUERY_CAPABILITIES to retrieve the device capabilities, and then check the UniqueID member of the DEVICE_CAPABILITIES to indicate if a instance ID is unique across the system.
My questions are:
- How can I use IRP_MN_QUERY_CAPABILITIES in c#
- Is there a C++ sample code on how to use this query?
- Is there any other way to know if the instance id is not unique?
I found a solution, I used SetupDiGetDeviceRegistryProperty and asked for the DEVICE_CAPABILITIES structure