I was wondering if it is possible to get the USB device descriptor with the SetupAPI functions (like SetupDiGetDeviceRegistryProperty
)?
Thank you!
EDIT
So far I am only able to receive the windows friendly name:
SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_DEVICEDESC,
&dwPropertyRegDataType, (BYTE*)szDesc, sizeof(szDesc), &dwSize)
we need have/got string representing Device Instance ID of a device. with this we first obtains a device instance handle to the device node via
CM_Locate_DevNode
and then callCM_Get_DevNode_Property
withDEVPKEY_NAME
:if we have the string that identifies the device interface instance - we can obtaining the device instance identifier from it via call
CM_Get_Device_Interface_Property
withDEVPKEY_Device_InstanceId
key and then callPrintFriendlyNameByDeviceID
and at begin we have 2 choice: of just retrieves a list of device instance IDs via call
CM_Get_Device_ID_List
withCM_GETIDLIST_FILTER_CLASS|CM_GETIDLIST_FILTER_PRESENT
and use"{36fc9e60-c465-11cf-8056-444553540000}"
as filter - this is string representation of well knownGUID_DEVCLASS_USB
defined indevguid.h
:or enumerate device interfaces via CM_Get_Device_Interface_List and call
PrintFriendlyNameByInterface
for every device interface.you can use say
GUID_DEVINTERFACE_USB_DEVICE
the result of methods (which devices /interfaces) will be listed can be different. say om my comp when enum by
GUID_DEVINTERFACE_USB_DEVICE
:and when enum by
GUID_DEVCLASS_USB
string filter: