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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-08-17 16:29:59 +08:00 committed by Alexandre Julliard
parent 7341bee1dc
commit f8ce819ab5
2 changed files with 16 additions and 1 deletions

View File

@ -4111,12 +4111,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)
{

View File

@ -1563,6 +1563,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;
@ -1602,6 +1603,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);