Module: wine
Branch: master
Commit: 213ac0de422385fe133a7b483039cfc57dd4a0c8
URL: https://gitlab.winehq.org/wine/wine/-/commit/213ac0de422385fe133a7b483039cf…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com>
Date: Tue Jun 20 15:44:12 2023 +0800
win32u: Use the window station name to check if an application is running as a service.
Having an invisible window station doesn't mean an application is running in a service context. For
example, Chromium creates a sandbox process to run in an invisible window station and still expect
the physical monitor information to be returned, instead of the virtual monitor information for
services.
---
dlls/user32/tests/winstation.c | 1 -
dlls/win32u/sysparams.c | 8 +++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/winstation.c b/dlls/user32/tests/winstation.c
index 5902743c6ca..7829e3364b3 100644
--- a/dlls/user32/tests/winstation.c
+++ b/dlls/user32/tests/winstation.c
@@ -1042,7 +1042,6 @@ static void test_invisible_winstation_child(char *expected_info)
sprintf(buffer, "%d,%d,%d,%d,%d", GetSystemMetrics(SM_XVIRTUALSCREEN),
GetSystemMetrics(SM_YVIRTUALSCREEN), GetSystemMetrics(SM_CXVIRTUALSCREEN),
GetSystemMetrics(SM_CYVIRTUALSCREEN), GetSystemMetrics(SM_CMONITORS));
- todo_wine_if(strcmp(buffer, "0,0,1024,768,1"))
ok(!strcmp(buffer, expected_info), "Expected %s, got %s.\n", expected_info, buffer);
}
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index acda600b43c..233e5bb934b 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -1994,14 +1994,16 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct
BOOL update_display_cache( BOOL force )
{
+ 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};
HWINSTA winstation = NtUserGetProcessWindowStation();
struct device_manager_ctx ctx = {0};
BOOL was_virtual_desktop, ret;
- USEROBJECTFLAGS flags;
+ WCHAR name[MAX_PATH];
/* services do not have any adapters, only a virtual monitor */
- if (NtUserGetObjectInformation( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL )
- && !(flags.dwFlags & WSF_VISIBLE))
+ if (NtUserGetObjectInformation( winstation, UOI_NAME, name, sizeof(name), NULL )
+ && !wcscmp( name, wine_service_station_name ))
{
pthread_mutex_lock( &display_lock );
clear_display_devices();