I have C++ code (works well with VS6 up to VS2017) that enumerates USB devices and retrieves several properties. I recently added SPDRP_DEVTYPE
:
SetupDiGetDeviceRegistryProperty(hDevInfo, &DevData, SPDRP_DEVTYPE, 0L, (BYTE*) &dwData, 4, 0);
The call returns with 'false' and GetLastError()
then returns 13
("The data is invalid"). The same happens when trying to query for SPDRP_CHARACTERISTICS
.
Most other PropertyKey
values I have tried work well (for example, SPDRP_CAPABILITIES
, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME
, SPDRP_FRIENDLYNAME
, and so on) but these two keep failing.
Running the EXE as administrator does not change anything. I tested on Windows 7 (32/64) and on Windows 10.
In addition, I tried to open the device with CreateFile (which succeeds) and then use DeviceIoControl(), but every call to DeviceIoControl fails with Error 50 "not supported"
Any idea why these calls are not working?