[PATCH 0/1] MR10280: win32u: Set VendorId / DeviceId in DirectX registry key with correct size.
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/win32u/sysparams.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index b8bde1a9bd6..5bf8ce3a7ea 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1642,10 +1642,14 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p set_reg_value( hkey, bufferW, REG_SZ, gpu->name, name_size ); if (pci->vendor && pci->device) { + DWORD val; + asciiz_to_unicode( bufferW, "DeviceId" ); - set_reg_value( hkey, bufferW, REG_DWORD, &pci->device, sizeof(pci->device) ); + val = pci->device; + set_reg_value( hkey, bufferW, REG_DWORD, &val, sizeof(val) ); asciiz_to_unicode( bufferW, "VendorId" ); - set_reg_value( hkey, bufferW, REG_DWORD, &pci->vendor, sizeof(pci->vendor) ); + val = pci->vendor; + set_reg_value( hkey, bufferW, REG_DWORD, &val, sizeof(val) ); } NtClose( hkey ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10280
Currently that does NtSetValueKey() with the size of 2. That succeeds and later results in RegQueryValueEx() or RegEnumValue() to return only 2 byte length of the data and fill only 2 bytes in the requested data, even though the type is DWORD. That breaks things for apps if, e. g., they don't nullify output data before RegEnumValue(). We already have some tests around that for registry API behaviour, and I tested that separately just in case and it looks like registry API Windows behaviour: it is possible to create DWORD key with shorter data length, and then the shorted data length is returned. So fixing that in win32u where we set that data looks like the only correct place. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10280#note_131655
participants (2)
-
Paul Gofman -
Paul Gofman (@gofman)