-- v2: win32u: Fill some GPU info in HKLM\Software\Microsoft\DirectX.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/win32u/sysparams.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 48b6e034be1..0a578e77b78 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -49,6 +49,7 @@ static const char devicemap_video_keyA[] = "\Registry\Machine\HARDWARE\DEVIC static const char enum_keyA[] = "\Registry\Machine\System\CurrentControlSet\Enum"; static const char control_keyA[] = "\Registry\Machine\System\CurrentControlSet\Control"; static const char config_keyA[] = "\Registry\Machine\System\CurrentControlSet\Hardware Profiles\Current"; +static const char directx_keyA[] = "\Registry\Machine\Software\Microsoft\DirectX";
static const char devpropkey_gpu_vulkan_uuidA[] = "Properties\{233A9EF3-AFC4-4ABD-B564-C32F21F1535C}\0002"; static const char devpropkey_gpu_luidA[] = "Properties\{60B193CB-5276-4D0F-96FC-F173ABAD3EC6}\0002"; @@ -863,6 +864,11 @@ static void prepare_devices(void) set_reg_ascii_value( hkey, "", "Display adapters" ); set_reg_ascii_value( hkey, "Class", "Display" ); NtClose( hkey ); + if ((hkey = reg_create_ascii_key( NULL, directx_keyA, 0, NULL ))) + { + reg_empty_key( hkey, NULL ); + NtClose( hkey ); + }
hkey = reg_open_ascii_key( enum_key, "PCI" );
@@ -1281,6 +1287,27 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p link_device( gpu->path, guid_devinterface_display_adapterA ); link_device( gpu->path, guid_display_device_arrivalA );
+ snprintf( buffer, sizeof(buffer), "%s\%s", directx_keyA, gpu->guid ); + hkey = reg_create_ascii_key( NULL, buffer, REG_OPTION_VOLATILE, NULL ); + if (hkey) + { + UINT64 ver = 0x230000000f1ff4; /* Some version in the future. */ + + asciiz_to_unicode( bufferW, "AdapterLuid" ); + set_reg_value( hkey, bufferW, REG_QWORD, &gpu->luid, sizeof(gpu->luid) ); + asciiz_to_unicode( bufferW, "DriverVersion" ); + set_reg_value( hkey, bufferW, REG_QWORD, &ver, sizeof(ver) ); + asciiz_to_unicode( bufferW, "Description" ); + set_reg_value( hkey, bufferW, REG_SZ, desc, (lstrlenW( desc ) + 1) * sizeof(WCHAR) ); + if (pci->vendor && pci->device) + { + asciiz_to_unicode( bufferW, "DeviceId" ); + set_reg_value( hkey, bufferW, REG_DWORD, &pci->device, sizeof(pci->device) ); + asciiz_to_unicode( bufferW, "VendorId" ); + set_reg_value( hkey, bufferW, REG_DWORD, &pci->vendor, sizeof(pci->vendor) ); + } + NtClose( hkey ); + } return TRUE; }
v2: - empty the key in prepare_devices().
On Wed Nov 12 15:06:09 2025 +0000, Zhiyi Zhang wrote:
I don't see the keys being created. Could you double-check?
Weird, those were appearing fine for me (and the parent key is created from wine.inf.in, I also tested that on clean prefix). Could it be you looked at registry files and not regedit? I created those keys volatile so they won't be saved.
Regarding that REG_OPTION_VOLATILE, I am not sure they are volatile on Windows but it seems to me (unless we meet unlikely case something checks and depends on such a key option) it is easier to create those configuration keys to be filled on each boot volatile, making perfectly sure we don't have any leftovers on clean start. While the devices can be recreated and the keys should still be deleted, I forgot about that at once, fixed in v2.
On Wed Nov 12 15:06:09 2025 +0000, Paul Gofman wrote:
Weird, those were appearing fine for me (and the parent key is created from wine.inf.in, I also tested that on clean prefix). Could it be you looked at registry files and not regedit? I created those keys volatile so they won't be saved. Regarding that REG_OPTION_VOLATILE, I am not sure they are volatile on Windows but it seems to me (unless we meet unlikely case something checks and depends on such a key option) it is easier to create those configuration keys to be filled on each boot volatile, making perfectly sure we don't have any leftovers on clean start. While the devices can be recreated and the keys should still be deleted, I forgot about that at once, fixed in v2.
Somehow, the branch didn't check out on my machine using the command gitlab "check out branch" feature. Now I can see the info.
This merge request was approved by Zhiyi Zhang.