Zhiyi Zhang : user32: Report a fake monitor when running on an invisible window station.
Alexandre Julliard
julliard at winehq.org
Fri Feb 25 07:30:24 CST 2022
Module: wine
Branch: oldstable
Commit: 493a7f4daad1692637681ef711a33e29246dfd08
URL: https://source.winehq.org/git/wine.git/?a=commit;h=493a7f4daad1692637681ef711a33e29246dfd08
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Tue Aug 17 16:29:59 2021 +0800
user32: Report a fake monitor when running on an invisible window station.
The visible window station check was accidentally deleted in 95be042.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51590
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit f8ce819ab57b42329b52d18fa29e5a79cfd1abf6)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/user32/sysparams.c | 10 +++++++++-
dlls/user32/tests/monitor.c | 7 +++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 55d6d7e53a7..8b45704a9f8 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -4006,12 +4006,20 @@ static BOOL CALLBACK enum_mon_callback( HMONITOR monitor, HDC hdc, LPRECT rect,
BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp )
{
+ BOOL is_winstation_visible = FALSE;
+ USEROBJECTFLAGS flags;
+ HWINSTA winstation;
RECT monitor_rect;
DWORD i = 0;
TRACE("(%p, %p, %p, 0x%lx)\n", hdc, rect, proc, lp);
- if (update_monitor_cache())
+ /* Report physical monitor information only if window station has visible display surfaces */
+ winstation = GetProcessWindowStation();
+ if (GetUserObjectInformationW( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL ))
+ is_winstation_visible = flags.dwFlags & WSF_VISIBLE;
+
+ if (is_winstation_visible && update_monitor_cache())
{
while (TRUE)
{
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index a587c7c6b16..a5be9021cbc 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -1560,6 +1560,7 @@ static void test_EnumDisplayMonitors(void)
static const DWORD DESKTOP_ALL_ACCESS = 0x01ff;
HWINSTA winstation, old_winstation;
HDESK desktop, old_desktop;
+ USEROBJECTFLAGS flags;
INT count, old_count;
DWORD error;
BOOL ret;
@@ -1599,6 +1600,12 @@ static void test_EnumDisplayMonitors(void)
ok(ret, "SetProcessWindowStation failed, error %#x.\n", GetLastError());
ok(winstation == GetProcessWindowStation(), "Expected %p, got %p.\n", GetProcessWindowStation(), winstation);
+ flags.fInherit = FALSE;
+ flags.fReserved = FALSE;
+ flags.dwFlags = WSF_VISIBLE;
+ ret = SetUserObjectInformationW(winstation, UOI_FLAGS, &flags, sizeof(flags));
+ ok(ret, "SetUserObjectInformationW failed, error %#x.\n", GetLastError());
+
desktop = CreateDesktopW(L"test_desktop", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
ok(!!desktop && desktop != old_desktop, "CreateDesktopW failed, error %#x.\n", GetLastError());
ret = SetThreadDesktop(desktop);
More information about the wine-cvs
mailing list