[PATCH v4 3/3] gdi32: Also accept "\\.\DISPLAY<n>" devices names with <n> other than 1 as display devices.
From: Ken Thomases <ken(a)codeweavers.com> Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/gdi32/driver.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 96c2f1f129..dcbc480376 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -135,6 +135,32 @@ static const struct gdi_dc_funcs *get_display_driver(void) } +/********************************************************************** + * is_display_device + */ +static BOOL is_display_device( LPCWSTR name ) +{ + static const WCHAR display_deviceW[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'}; + const WCHAR *p = name; + + if (strncmpiW( name, display_deviceW, sizeof(display_deviceW) / sizeof(WCHAR) )) + return FALSE; + + p += sizeof(display_deviceW) / sizeof(WCHAR); + + if (!isdigitW( *p++ )) + return FALSE; + + for (; *p; p++) + { + if (!isdigitW( *p )) + return FALSE; + } + + return TRUE; +} + + /********************************************************************** * DRIVER_load_driver */ @@ -143,10 +169,9 @@ const struct gdi_dc_funcs *DRIVER_load_driver( LPCWSTR name ) HMODULE module; struct graphics_driver *driver, *new_driver; static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 }; - static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0}; /* display driver is a special case */ - if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) return get_display_driver(); + if (!strcmpiW( name, displayW ) || is_display_device( name )) return get_display_driver(); if ((module = GetModuleHandleW( name ))) { @@ -883,13 +908,12 @@ BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) { static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 }; static const WCHAR devicesW[] = { 'd','e','v','i','c','e','s',0 }; - static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0}; static const WCHAR empty_strW[] = { 0 }; WCHAR *p; /* display is a special case */ if (!strcmpiW( device, displayW ) || - !strcmpiW( device, display1W )) + is_display_device( device )) { lstrcpynW( driver, displayW, size ); return TRUE; -- 2.20.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=54106 Your paranoid android. === debian9 (32 bit report) === user32: msg.c:8713: Test failed: WaitForSingleObject failed 102 msg.c:8719: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8719: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8719: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000 === debian9 (32 bit WoW report) === user32: msg.c:8713: Test failed: WaitForSingleObject failed 102 msg.c:8719: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8719: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8719: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000
participants (2)
-
Marvin -
Zhiyi Zhang