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 aadae4d1ea, which adds ~100ms to the
initialization process.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49762
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-09-01 15:03:26 +08:00 committed by Alexandre Julliard
parent c0ab7af1b0
commit 23ce18d5e5
1 changed files with 3 additions and 6 deletions

View File

@ -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 );