[PATCH 4/9] gdi32: relaxing display driver lookup checks

Donat Enikeev donat at enikeev.net
Mon Apr 24 15:50:02 CDT 2017


Based on Ken Thomases <ken at codeweavers.com> staging patches

Signed-off-by: Donat Enikeev <donat at enikeev.net>
---
 dlls/gdi32/driver.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 18e109e..1dcd1ce 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -117,10 +117,11 @@ 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};
+    static const WCHAR device_prefixW[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'};
 
     /* display driver is a special case */
-    if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) return get_display_driver();
+    if (!strcmpiW( name, displayW ) || !strncmpiW( name, device_prefixW, sizeof(device_prefixW)/sizeof(WCHAR)))
+        return get_display_driver();
 
     if ((module = GetModuleHandleW( name )))
     {
@@ -770,13 +771,15 @@ 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 device_prefixW[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'};
     static const WCHAR empty_strW[] = { 0 };
     WCHAR *p;
 
+    TRACE("%s, %s, %d\n", debugstr_w(device), debugstr_w(driver), size);
+
     /* display is a special case */
     if (!strcmpiW( device, displayW ) ||
-        !strcmpiW( device, display1W ))
+        !strncmpiW( device, device_prefixW, sizeof(device_prefixW)/sizeof(WCHAR)))
     {
         lstrcpynW( driver, displayW, size );
         return TRUE;
-- 
2.7.4




More information about the wine-patches mailing list