Commit f8ce819a authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

user32: Report a fake monitor when running on an invisible window station.

The visible window station check was accidentally deleted in 95be042b. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51590Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7341bee1
......@@ -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)
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment