I'm the author of an open source tool (devreorder) that allows users to specify a stable order for their DirectInput devices. In order for it to work, I need to be able to consistently distinguish between all of the input device connected to the system while enumerating devices using DirectInput 8.
While the DIDEVICEINSTANCE
structure passed to a DIEnumDevicesCallback
function does contain information that helps identify a device, it does not uniquely identify a device. Even the guidInstance
field, which is supposed to always uniquely identify a specific device, is in practice not actually reliable, and it will in some cases change or use the same UUID between two different devices.
Windows does have unique identifiers for devices, though, called its device instance ID. This is also known as the full instance path. I want to use this identifier for DirectInput 8 devices.
So when enumerating devices using IDirectInput8::EnumDevices
and being provided a DIDEVICEINSTANCE
, is there any way to get the corresponding device instance ID for a particular device?