DIDEVICEINSTANCE guidInstance and guidProduct chan

2019-07-21 09:48发布

I am using DirectInput8 in a project at work that monitors various components of the pc. To monitor joysticks we use DirectInput8. The data is retrieved by enumerating all joysticks with DI8DEVCLASS_GAMECTRL as the type and DIEDFL_ATTACHEDONLY as a flag. Recently it was brought to my attention that we were having multiple joysticks showing up. First I looked at the xml file we store the components in between reboots. There were two entries for the joysticks, Logitech Extreme 3d pro, and each had a unique product guid. I backed the file up and removed it, effectively forcing a rescan of the machine next time the app started after I rebooted the machine. I was able to get the same problem to occur and logged out the guids and they are different for each. The system only has a single joystick plugged in however it plugs in through a usb hub. Is the hub affecting the guids I am seeing? I could also only get this to occur maybe 1 out of 5 attempts.

Example:

Joystick Product GUID: 3C6A972000000000504944564944 Joystick Instance GUID: 3C6A972097C11E3800144455354

Joystick Product GUID: DA83AFB000000000504944564944 Joystick Instance GUID: DA83AFB0D7B211E2800144455354

3条回答
可以哭但决不认输i
2楼-- · 2019-07-21 10:36

Had a similar issue... I just exported the DirectInput registry settings for the VID/PIDs I wanted to replicate GUIDs across machines.

So, in regedit navigate to:

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\DirectInput\VID_[Whatever]&PID_[Whatever]\

Right click, choose Export to create the .reg file, the move it to the machine you want and double click.

查看更多
你好瞎i
3楼-- · 2019-07-21 10:42

I'm having the exact same problem as the original poster. To clarify his answer, its the instance GUID that is different for each user. And here is the MSDN documentation that incorrectly asserts that the InstanceGUID should stay the same on a given computer. Without someone from Mircosoft weighing in I don't know that I'll ever know the answer why this is - is it a bug or is the documentation incorrect.

The bottom line is you'll have a heck of a time sharing keybindings for a joystick among multiple users without a solution to this problem, which is my situation.

查看更多
欢心
4楼-- · 2019-07-21 10:47

This was a pain to find but after watching our testers I found they were logging into multiple user accounts and the GUID returned was different per user which is what caused the problem, would be nice if the documentation would be updated to reflect this.

查看更多
登录 后发表回答