win32u: Check GUID_NULL display device if desktop atom is missing.

When using nulldrv, there's no module to call __wine_set_user_driver and
the user driver is still lazy_load_driver when get_display_driver gets
called during desktop windows creation.

Then, load_desktop_driver fails as it cannot find the not-yet-created
desktop window atom, and fails later explorer.exe window creations such
as the systray window.

Other processes don't suffer from this as they wait for the desktop
window to be fully created, and its atom will be eventually set.

This change makes sure that we succeed in the case nulldrv was selected
by explorer.exe, while still failing in case of error with another user
driver as it would fail to open the right display device GUID.
This commit is contained in:
Rémi Bernon 2023-03-03 09:30:37 +01:00 committed by Alexandre Julliard
parent 992d60e122
commit 9c22a5ea63

View file

@ -923,6 +923,8 @@ static const WCHAR guid_key_suffixW[] = {'}','\\','0','0','0','0'};
static BOOL load_desktop_driver( HWND hwnd )
{
static const WCHAR guid_nullW[] = {'0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-',
'0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0',0};
WCHAR key[ARRAYSIZE(guid_key_prefixW) + 40 + ARRAYSIZE(guid_key_suffixW)], *ptr;
char buf[4096];
KEY_VALUE_PARTIAL_INFORMATION *info = (void *)buf;
@ -946,9 +948,15 @@ static BOOL load_desktop_driver( HWND hwnd )
memcpy( key, guid_key_prefixW, sizeof(guid_key_prefixW) );
ptr = key + ARRAYSIZE(guid_key_prefixW);
if (NtQueryInformationAtom( guid_atom, AtomBasicInformation, buf, sizeof(buf), NULL ))
return FALSE;
memcpy( ptr, abi->Name, abi->NameLength );
ptr += abi->NameLength / sizeof(WCHAR);
{
wcscpy( ptr, guid_nullW );
ptr += ARRAY_SIZE(guid_nullW) - 1;
}
else
{
memcpy( ptr, abi->Name, abi->NameLength );
ptr += abi->NameLength / sizeof(WCHAR);
}
memcpy( ptr, guid_key_suffixW, sizeof(guid_key_suffixW) );
ptr += ARRAY_SIZE(guid_key_suffixW);