I'm switching an application from DirectInput to RawInput for gamepad handling, and I'd like to present a human readable description for each gamepad. The ideal would be the device text that appears in device manager, but the USB product description would also do. Any method should work without administrator permission.
So far I've found one set of clues: there seems to be a text field in the registry under HKLM\SYSTEM\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM
Is there a way to get from the HANDLE provided by WM_INPUT
to the device manager description? HidD_GetProductString
looks promising, but I don't know how to get the Hid top level collection handle from the RawInput handle.
Edit: I have got a device instance path (eg. \\?\HID#VID_1267&PID_A001#8&1d630df6&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
, which may be enough to extract the information I need from SetupAPI. Does anybody know how to reach this given an instance path?