From: Rémi Bernon rbernon@codeweavers.com
Adapter id/index is later used to describe the \.\DISPLAY#, as well as \Device\Video#. It matches the video_index in the device_manager_ctx, so lets rename it to be consistent. --- dlls/win32u/sysparams.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index e57407b6e79..b969cab90ee 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1121,8 +1121,8 @@ static unsigned int format_date( WCHAR *bufferW, LONGLONG time ) struct device_manager_ctx { unsigned int gpu_count; + unsigned int gpu_adapter_count; unsigned int adapter_count; - unsigned int video_count; unsigned int monitor_count; unsigned int output_count; unsigned int mode_count; @@ -1217,7 +1217,7 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) gpu->vendor_id, gpu->device_id, gpu->subsys_id, gpu->revision_id );
gpu_index = ctx->gpu_count++; - ctx->adapter_count = 0; + ctx->gpu_adapter_count = 0; ctx->monitor_count = 0; ctx->mode_count = 0;
@@ -1396,7 +1396,7 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) static void add_adapter( const struct gdi_adapter *adapter, void *param ) { struct device_manager_ctx *ctx = param; - unsigned int adapter_index, video_index, len; + unsigned int adapter_name, adapter_index, len; char name[64], buffer[MAX_PATH]; WCHAR nameW[64], bufferW[MAX_PATH]; HKEY hkey; @@ -1409,19 +1409,19 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param ) ctx->adapter_key = NULL; }
+ adapter_name = ctx->gpu_adapter_count++; adapter_index = ctx->adapter_count++; - video_index = ctx->video_count++; ctx->monitor_count = 0; ctx->mode_count = 0;
snprintf( buffer, ARRAY_SIZE(buffer), "\Registry\Machine\System\CurrentControlSet\Control\Video\%s\%04x", - ctx->gpu_guid, adapter_index ); + ctx->gpu_guid, adapter_name ); len = asciiz_to_unicode( bufferW, buffer ) - sizeof(WCHAR);
hkey = reg_create_key( NULL, bufferW, len, REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK, NULL ); if (!hkey) hkey = reg_create_key( NULL, bufferW, len, REG_OPTION_VOLATILE | REG_OPTION_OPEN_LINK, NULL );
- sprintf( name, "\Device\Video%u", video_index ); + sprintf( name, "\Device\Video%u", adapter_index ); asciiz_to_unicode( nameW, name ); set_reg_value( video_key, nameW, REG_SZ, bufferW, (lstrlenW( bufferW ) + 1) * sizeof(WCHAR) );
@@ -1436,7 +1436,7 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param ) else ERR( "failed to create link key\n" );
/* Following information is Wine specific, it doesn't really exist on Windows. */ - snprintf( buffer, ARRAY_SIZE(buffer), "System\CurrentControlSet\Control\Video\%s\%04x", ctx->gpu_guid, adapter_index ); + snprintf( buffer, ARRAY_SIZE(buffer), "System\CurrentControlSet\Control\Video\%s\%04x", ctx->gpu_guid, adapter_name ); ctx->adapter_key = reg_create_key( config_key, bufferW, asciiz_to_unicode( bufferW, buffer ) - sizeof(WCHAR), REG_OPTION_VOLATILE, NULL );
@@ -1468,7 +1468,7 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) strcpy( monitor_id_string, "Default_Monitor" );
sprintf( buffer, "MonitorID%u", monitor_index ); - sprintf( instance, "DISPLAY\%s\%04X&%04X", monitor_id_string, ctx->video_count - 1, monitor_index ); + sprintf( instance, "DISPLAY\%s\%04X&%04X", monitor_id_string, ctx->adapter_count - 1, monitor_index ); set_reg_ascii_value( ctx->adapter_key, buffer, instance );
hkey = reg_create_key( enum_key, bufferW, asciiz_to_unicode( bufferW, instance ) - sizeof(WCHAR), @@ -1524,7 +1524,7 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) if ((subkey = reg_create_key( hkey, wine_devpropkey_monitor_adapternameW, sizeof(wine_devpropkey_monitor_adapternameW), 0, NULL ))) { - sprintf( buffer, "\\.\DISPLAY%u", ctx->video_count ); + sprintf( buffer, "\\.\DISPLAY%u", ctx->adapter_count ); set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_STRING, bufferW, asciiz_to_unicode( bufferW, buffer )); NtClose( subkey ); @@ -1561,7 +1561,7 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) struct device_manager_ctx *ctx = param; DEVMODEW nopos_mode;
- if (!ctx->adapter_count) + if (!ctx->gpu_adapter_count) { static const struct gdi_adapter default_adapter = {