On Fri Dec 5 15:21:29 2025 +0000, Connor McAdams wrote:
According to the [docs](https://learn.microsoft.com/en-us/windows-hardware/drivers/install/avoiding-...), which lines up with what I've seen: - The operating system concatenates the USB device serial number, vendor ID, product ID, and revision number to generate a string. - The string that results is hashed into a GUID by using the UUID Version 5 (SHA-1) hash algorithm under a USB-specific namespace. The generated container ID will be unique, provided the independent hardware vendor (IHV) provides a unique serial number on each device. We probably don't need to find the exact same string layout, but I think the general idea sounds easy to implement. Oh, I also didn't realize this comment was unrelated to container ID and on the dinput code.
dinput creates instance GUIDs and stores them in the registry under `HKCU\\System\\CurrentControlSet\\Control\\MediaProperties\\PrivateProperties\\DirectInput`, they then get reused from there, at least for devices that lack a serial number. This seems unrelated to whatever bus or port they get plugged into, it just reuses the same instance GUID for a particular VID/PID pair, and generates a new one if there are multiple controllers of the same kind plugged in. I have tests for this and am currently working on an implementation, but they're not ready for an MR yet. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9687#note_124935