[PATCH v2 7/7] explorer: Remove setting primary adapter key via Atoms.

Zhiyi Zhang zzhang at codeweavers.com
Wed Mar 6 02:44:10 CST 2019


The Atom mechanism is no longer used to store primary adapter key.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/user32/desktop.c       | 23 +----------------------
 programs/explorer/desktop.c | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/dlls/user32/desktop.c b/dlls/user32/desktop.c
index fe6649446e..bb958b5225 100644
--- a/dlls/user32/desktop.c
+++ b/dlls/user32/desktop.c
@@ -98,33 +98,12 @@ static void init_wallpaper( const WCHAR *wallpaper )
  */
 LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
-    static const WCHAR display_device_guid_propW[] = {
-        '_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
-        'd','e','v','i','c','e','_','g','u','i','d',0 };
-    static const WCHAR guid_formatW[] = {
-        '%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0','2','x','%','0','2','x','-',
-        '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x',0};
-
     switch (message)
     {
     case WM_NCCREATE:
     {
-        CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
-        const GUID *guid = cs->lpCreateParams;
-
-        if (guid)
-        {
-            ATOM atom;
-            WCHAR buffer[37];
+        if (GetAncestor( hwnd, GA_PARENT )) return FALSE;  /* refuse to create non-desktop window */
 
-            if (GetAncestor( hwnd, GA_PARENT )) return FALSE;  /* refuse to create non-desktop window */
-
-            sprintfW( buffer, guid_formatW, guid->Data1, guid->Data2, guid->Data3,
-                      guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
-                      guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
-            atom = GlobalAddAtomW( buffer );
-            SetPropW( hwnd, display_device_guid_propW, ULongToHandle( atom ) );
-        }
         return TRUE;
     }
     case WM_NCCALCSIZE:
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index 97fc7a219d..df5fb7f6aa 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -773,7 +773,7 @@ static BOOL get_default_enable_shell( const WCHAR *name )
     return result;
 }
 
-static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
+static HMODULE load_graphics_driver( const WCHAR *driver )
 {
     static const WCHAR video_keyW[] = {'H','A','R','D','W','A','R','E','\\',
                                        'D','E','V','I','C','E','M','A','P','\\',
@@ -796,6 +796,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
     static const WCHAR graphicsW[] = {'G','r','a','p','h','i','c','s',0};
     static const WCHAR drv_formatW[] = {'w','i','n','e','%','s','.','d','r','v',0};
 
+    GUID guid;
     WCHAR buffer[MAX_PATH], libname[32], *name, *next;
     WCHAR key[ARRAY_SIZE( device_keyW ) + 39];
     HMODULE module = 0;
@@ -851,9 +852,12 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
             return module;
         }
 
-        sprintfW( key, device_keyW, guid->Data1, guid->Data2, guid->Data3,
-                  guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
-                  guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
+        /* Create a GUID for primary adapter */
+        UuidCreate( &guid );
+        TRACE( "primary adapter guid %s\n", debugstr_guid(&guid) );
+        sprintfW( key, device_keyW, guid.Data1, guid.Data2, guid.Data3,
+                  guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
+                  guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7] );
 
         strcpyW( buffer, device_video_prefixW );
         strcatW( buffer, key);
@@ -877,7 +881,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
             if (module)
             {
                 GetModuleFileNameW( module, buffer, MAX_PATH );
-                TRACE( "display %s driver %s\n", debugstr_guid(guid), debugstr_w(buffer) );
+                TRACE( "display %s driver %s\n", debugstr_guid(&guid), debugstr_w(buffer) );
                 RegSetValueExW( hkey, graphics_driverW, 0, REG_SZ,
                                 (BYTE *)buffer, (strlenW( buffer ) + 1) * sizeof(WCHAR) );
             }
@@ -946,7 +950,6 @@ void manage_desktop( WCHAR *arg )
 {
     static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0};
     HDESK desktop = 0;
-    GUID guid;
     MSG msg;
     HWND hwnd;
     HMODULE graphics_driver;
@@ -998,13 +1001,11 @@ void manage_desktop( WCHAR *arg )
         SetThreadDesktop( desktop );
     }
 
-    UuidCreate( &guid );
-    TRACE( "display guid %s\n", debugstr_guid(&guid) );
-    graphics_driver = load_graphics_driver( driver, &guid );
+    graphics_driver = load_graphics_driver( driver );
 
     /* create the desktop window */
     hwnd = CreateWindowExW( 0, DESKTOP_CLASS_ATOM, NULL,
-                            WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, &guid );
+                            WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, 0 );
 
     if (hwnd)
     {
-- 
2.20.1




More information about the wine-devel mailing list