On Thu Apr 9 14:46:20 2026 +0000, Connor McAdams wrote:
I think the test here shows this behavior: ``` /* * Stop devices 0 and 2. After enumeration, their guidInstance values will * be assigned to devices 1 and 3. */ hid_device_stop( &descs[0], 1 ); hid_device_stop( &descs[2], 1 ); /* Stopped devices should return E_FAIL. */ hr = dinput_create_device( &di, &instances[0], &device ); ok( hr == E_FAIL, "Unexpected hr %#lx.\n", hr ); hr = dinput_create_device( &di, &instances[2], &device ); ok( hr == E_FAIL, "Unexpected hr %#lx.\n", hr ); ``` The local cache was populated by `EnumDevices()` when devices 0 and 2 were present. At that time, the devices were: - device 0, `0x1209/0x0001/0`. - device 1, `0x1209/0x0001/1`. - device 2, `0x1209/0x0002/0`. - device 3, `0x1209/0x0002/1`. After stopping devices 0 and 2, attempting to use those `guidInstance` values will fail. However, after calling `EnumDevices()` again, the local cache changes: ``` /* After calling EnumDevices(), guidInstance values will be reassigned. */ instances_end = instances; hr = dinput_enum_devices( &di, find_test_device_instances, &instances_end ); ok( hr == DI_OK, "Unexpected hr %#lx.\n", hr ); ok( instances_end == instances + 2, "Unexpected count %Iu.\n", instances_end - instances ); for (UINT i = 0; i < instances_end - instances; i++) { const unsigned int expected_joystick = !i ? 1 : 3;
winetest_push_context( "device %d", i );
ok( IsEqualGUID( &expect_instances[expected_joystick - 1], &instances[i] ), "Unexpected instance %s.\n", debugstr_guid( &instances[i] ) ); hr = dinput_create_device( &di, &instances[i], &device ); ok( hr == DI_OK, "Unexpected hr %#lx.\n", hr );
check_device_hid_serial( device, descs[expected_joystick].serial_str ); IDirectInputDevice8_Release( device ); winetest_pop_context(); } ``` Now the local cache looks like: - device 1, `0x1209/0x0001/0`. - device 3, `0x1209/0x0002/0`. Attempting to use the `guidInstance` values representing `0x1209/0x0001/1` or `0x1209/0x0002/1` no longer works. When devices 0 and 2 are started again, they do get their old `guidInstance` value back, but that's only because the enumeration order stays consistent based on when a particular `DeviceInstance` was first created. Right okay, I got a bit confused and assumed instance meant a particular device path. Let me look at it again with that in mind.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10364#note_135701