From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58831 --- dlls/win32u/sysparams.c | 30 ++++++++++++------------------ dlls/wineandroid.drv/init.c | 2 +- dlls/winewayland.drv/display.c | 2 +- dlls/winex11.drv/xinerama.c | 1 - dlls/winex11.drv/xrandr.c | 1 - 5 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 0a578e77b78..9b05351b432 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1119,17 +1119,15 @@ static const char* driver_vendor_to_name( UINT16 vendor ) static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *pci, ULONGLONG memory_size ) { - const WCHAR *desc; + unsigned int size, name_size = (wcslen( gpu->name ) + 1) * sizeof(WCHAR); char buffer[4096], *tmp; WCHAR bufferW[512]; - unsigned int size; HKEY subkey; LARGE_INTEGER ft; ULONG value; HKEY hkey;
static const BOOL present = TRUE; - static const WCHAR wine_adapterW[] = {'W','i','n','e',' ','A','d','a','p','t','e','r',0}; static const WCHAR driver_date_dataW[] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0}; static const WCHAR adapter_stringW[] = @@ -1195,7 +1193,7 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p
if ((subkey = reg_create_ascii_key( hkey, devpkey_device_driver_desc, 0, NULL ))) { - set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_STRING, gpu->name, (wcslen( gpu->name ) + 1) * sizeof(WCHAR) ); + set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_STRING, gpu->name, name_size ); NtClose( subkey ); }
@@ -1225,9 +1223,7 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p NtClose( subkey ); }
- desc = gpu->name; - if (!desc[0]) desc = wine_adapterW; - set_reg_value( hkey, device_descW, REG_SZ, desc, (lstrlenW( desc ) + 1) * sizeof(WCHAR) ); + set_reg_value( hkey, device_descW, REG_SZ, gpu->name, name_size );
if ((subkey = reg_create_ascii_key( hkey, "Device Parameters", 0, NULL ))) { @@ -1263,14 +1259,11 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p if (!(hkey = reg_create_ascii_key( control_key, buffer, 0, NULL ))) return FALSE;
set_reg_value( hkey, driver_dateW, REG_SZ, bufferW, format_date( bufferW, ft.QuadPart )); - set_reg_value( hkey, driver_date_dataW, REG_BINARY, &ft, sizeof(ft) ); - - size = (lstrlenW( desc ) + 1) * sizeof(WCHAR); - set_reg_value( hkey, driver_descW, REG_SZ, desc, size ); - set_reg_value( hkey, adapter_stringW, REG_SZ, desc, size ); - set_reg_value( hkey, bios_stringW, REG_SZ, desc, size ); - set_reg_value( hkey, chip_typeW, REG_SZ, desc, size ); + set_reg_value( hkey, driver_descW, REG_SZ, gpu->name, name_size ); + set_reg_value( hkey, adapter_stringW, REG_SZ, gpu->name, name_size ); + set_reg_value( hkey, bios_stringW, REG_SZ, gpu->name, name_size ); + set_reg_value( hkey, chip_typeW, REG_SZ, gpu->name, name_size ); set_reg_value( hkey, dac_typeW, REG_SZ, ramdacW, sizeof(ramdacW) );
/* If we failed to retrieve the gpu memory size set a default of 1Gb */ @@ -1298,7 +1291,7 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p 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) ); + set_reg_value( hkey, bufferW, REG_SZ, gpu->name, name_size ); if (pci->vendor && pci->device) { asciiz_to_unicode( bufferW, "DeviceId" ); @@ -1383,8 +1376,9 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID *
if (!pci_id->vendor && !pci_id->device && vulkan_gpu) pci_id = &vulkan_gpu->pci_id;
- if ((!name || !strcmp( name, "Wine GPU" )) && vulkan_gpu) name = vulkan_gpu->name; - if (name) RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name) - sizeof(WCHAR), &len, name, strlen( name ) ); + if (!name) name = "Wine Adapter"; + if (!strcmp( name, "Wine Adapter" ) && vulkan_gpu) name = vulkan_gpu->name; + RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name) - sizeof(WCHAR), &len, name, strlen( name ) );
snprintf( gpu->path, sizeof(gpu->path), "PCI\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X\%08X", pci_id->vendor, pci_id->device, pci_id->subsystem, pci_id->revision, gpu->index ); @@ -2277,7 +2271,7 @@ static NTSTATUS default_update_display_devices( struct device_manager_ctx *ctx ) DEVMODEW mode = {.dmSize = sizeof(mode)}; struct source *source;
- add_gpu( "Wine GPU", &pci_id, NULL, ctx ); + add_gpu( NULL, &pci_id, NULL, ctx ); add_source( "Default", source_flags, system_dpi, ctx );
assert( !list_empty( &sources ) ); diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index da889beacb6..472de7b8317 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -283,7 +283,7 @@ UINT ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag UINT dpi = NtUserGetSystemDpiForProcess( NULL ); DEVMODEW current = mode;
- device_manager->add_gpu( "Wine GPU", &pci_id, NULL, param ); + device_manager->add_gpu( NULL, &pci_id, NULL, param ); device_manager->add_source( "Default", source_flags, dpi, param ); device_manager->add_monitor( &gdi_monitor, param );
diff --git a/dlls/winewayland.drv/display.c b/dlls/winewayland.drv/display.c index 851c9638252..b2a94289abb 100644 --- a/dlls/winewayland.drv/display.c +++ b/dlls/winewayland.drv/display.c @@ -193,7 +193,7 @@ static void wayland_add_device_gpu(const struct gdi_device_manager *device_manag
TRACE("\n");
- device_manager->add_gpu("Wine GPU", &pci_id, NULL, param); + device_manager->add_gpu(NULL, &pci_id, NULL, param); }
static void wayland_add_device_source(const struct gdi_device_manager *device_manager, diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index 5086f3ee766..aea6be0c5a0 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -188,7 +188,6 @@ static BOOL xinerama_get_gpus( struct x11drv_gpu **new_gpus, int *count, BOOL ge if (!gpus) return FALSE;
- gpus[0].name = strdup( "Wine GPU" ); *new_gpus = gpus; *count = 1;
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 979cbc8645f..cae63691ecf 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -850,7 +850,6 @@ static BOOL xrandr14_get_gpus( struct x11drv_gpu **new_gpus, int *count, BOOL ge if (!provider_resources->nproviders) { WARN("XRandR implementation doesn't report any providers, faking one.\n"); - gpus[0].name = strdup( "Wine GPU" ); *new_gpus = gpus; *count = 1; ret = TRUE;