Module: wine Branch: master Commit: cd771fa7131f56f99e9491a11cbe7f5f87858db0 URL: https://gitlab.winehq.org/wine/wine/-/commit/cd771fa7131f56f99e9491a11cbe7f5...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Tue Jun 20 15:51:02 2023 +0800
server: Allow creating a real explorer desktop window for invisible window stations.
The graphics driver information is stored as a property in the desktop window. When the server get_desktop_window handler simply returns a window handle when the window station is invisible, the window handle doesn't have the graphics driver property, which is set in desktop_window_proc() when handling WM_NCCREATE. Removing the invisible window station check allows an invisible explorer desktop window to be created and with the required property.
---
dlls/user32/tests/winstation.c | 1 - dlls/win32u/winstation.c | 12 +++++++++++- server/window.c | 8 ++------ 3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/tests/winstation.c b/dlls/user32/tests/winstation.c index ab64556a754..5f0925a7712 100644 --- a/dlls/user32/tests/winstation.c +++ b/dlls/user32/tests/winstation.c @@ -1049,7 +1049,6 @@ static void test_invisible_winstation_child(char *expected_info) ok(!!hwnd, "GetDesktopWindow failed, error %lu.\n", GetLastError());
ret = SendMessageW(hwnd, WM_NCHITTEST, 0, 0); - todo_wine ok(ret == HTCLIENT, "SendMessageW failed, error %lu.\n", GetLastError()); }
diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 7ca6346fb96..5d1d5254ae1 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -420,14 +420,24 @@ static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiB
HWND get_desktop_window(void) { + static const WCHAR wine_service_station_name[] = + {'_','_','w','i','n','e','s','e','r','v','i','c','e','_','w','i','n','s','t','a','t','i','o','n',0}; struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); + WCHAR name[MAX_PATH]; + BOOL is_service;
if (thread_info->top_window) return UlongToHandle( thread_info->top_window );
+ /* don't create an actual explorer desktop window for services */ + if (NtUserGetObjectInformation( NtUserGetProcessWindowStation(), UOI_NAME, name, sizeof(name), NULL ) + && !wcscmp( name, wine_service_station_name )) + is_service = TRUE; + else + is_service = FALSE;
SERVER_START_REQ( get_desktop_window ) { - req->force = 0; + req->force = is_service; if (!wine_server_call( req )) { thread_info->top_window = reply->top_window; diff --git a/server/window.c b/server/window.c index 328e3dfc64c..242e93f303a 100644 --- a/server/window.c +++ b/server/window.c @@ -2151,14 +2151,10 @@ DECL_HANDLER(destroy_window) DECL_HANDLER(get_desktop_window) { struct desktop *desktop = get_thread_desktop( current, 0 ); - int force;
if (!desktop) return;
- /* if winstation is invisible, then avoid roundtrip */ - force = req->force || !(desktop->winstation->flags & WSF_VISIBLE); - - if (!desktop->top_window && force) /* create it */ + if (!desktop->top_window && req->force) /* create it */ { if ((desktop->top_window = create_window( NULL, NULL, DESKTOP_ATOM, 0 ))) { @@ -2167,7 +2163,7 @@ DECL_HANDLER(get_desktop_window) } }
- if (!desktop->msg_window && force) /* create it */ + if (!desktop->msg_window && req->force) /* create it */ { static const WCHAR messageW[] = {'M','e','s','s','a','g','e'}; static const struct unicode_str name = { messageW, sizeof(messageW) };