From: Tatsuyuki Ishi ishitatsuyuki@gmail.com
Both window station visibility and session id are related to services being spawned in a non-interactive session, however the process window station can be manually set by the application while the session id can not be.
The enumerated display config should not change even in the case of a window station update, hence testing for SessionId == 0 is more reliable here.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55074 --- dlls/win32u/driver.c | 7 +------ dlls/win32u/sysparams.c | 5 +---- 2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index ed2e0973d39..2b39e239ac5 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -1016,14 +1016,9 @@ static BOOL load_desktop_driver( HWND hwnd )
static const struct user_driver_funcs *load_driver(void) { - USEROBJECTFLAGS flags; - HWINSTA winstation; - if (!load_desktop_driver( get_desktop_window() ) || user_driver == &lazy_load_driver) { - winstation = NtUserGetProcessWindowStation(); - if (!NtUserGetObjectInformation( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL ) - || (flags.dwFlags & WSF_VISIBLE)) + if (NtCurrentTeb()->Peb->SessionId != 0) null_user_driver.pCreateWindow = nodrv_CreateWindow;
__wine_set_user_driver( &null_user_driver, WINE_GDI_DRIVER_VERSION ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 4f69cac7040..b1e8f5d7bc0 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1720,13 +1720,10 @@ static BOOL is_same_devmode( const DEVMODEW *a, const DEVMODEW *b )
static BOOL update_display_cache( BOOL force ) { - HWINSTA winstation = NtUserGetProcessWindowStation(); struct device_manager_ctx ctx = {0}; - USEROBJECTFLAGS flags;
/* services do not have any adapters, only a virtual monitor */ - if (NtUserGetObjectInformation( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL ) - && !(flags.dwFlags & WSF_VISIBLE)) + if (NtCurrentTeb()->Peb->SessionId == 0) { pthread_mutex_lock( &display_lock ); clear_display_devices();