Zhiyi Zhang : user32: Always wait for the desktop process to be ready in load_desktop_driver().

Alexandre Julliard julliard at winehq.org
Tue Sep 1 15:43:30 CDT 2020


Module: wine
Branch: master
Commit: 23ce18d5e5a31bf2712c2951a45cfda4747e0c54
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=23ce18d5e5a31bf2712c2951a45cfda4747e0c54

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Sep  1 15:03:26 2020 +0800

user32: Always wait for the desktop process to be ready in load_desktop_driver().

Having a __wine_display_device_guid property in the desktop window only guarantees that the window
is created. Explorer.exe still has to finish setting up virtual desktop, display settings etc.
load_desktop_driver() needs to make sure that the desktop initialization is done before allowing
applications to call user32 driver functions. Otherwise, they might get incorrect data. This race
condition became apparent after aadae4d1ea173dfa30e09d6cc816bb174e35f90d, which adds ~100ms to the
initialization process.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49762
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/driver.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index 6d916c7d65..abd8a34cce 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -59,17 +59,14 @@ static BOOL load_desktop_driver( HWND hwnd, HMODULE *module )
     DWORD size;
     WCHAR path[MAX_PATH];
     WCHAR key[ARRAY_SIZE(key_pathW) + ARRAY_SIZE(displayW) + 40];
-    UINT guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW ));
+    UINT guid_atom;
 
     USER_CheckNotLock();
 
     strcpy( driver_load_error, "The explorer process failed to start." );  /* default error */
+    SendMessageW( hwnd, WM_NULL, 0, 0 );  /* wait for the desktop process to be ready */
 
-    if (!guid_atom)
-    {
-        SendMessageW( hwnd, WM_NULL, 0, 0 );  /* wait for the desktop process to be ready */
-        guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW ));
-    }
+    guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW ));
     memcpy( key, key_pathW, sizeof(key_pathW) );
     if (!GlobalGetAtomNameW( guid_atom, key + strlenW(key), 40 )) return 0;
     strcatW( key, displayW );




More information about the wine-cvs mailing list