services/tests: Vista+ returns fixed 1024x768 WinDisc monitor information.

Unlike Windows XP which returned the actual display information to
non-interactive services.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2021-08-23 11:30:11 +08:00 committed by Alexandre Julliard
parent 68a3863470
commit 37f492ae55
2 changed files with 10 additions and 13 deletions

View File

@ -3980,12 +3980,12 @@ BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info )
/* Fallback to report one monitor */
if (handle == NULLDRV_DEFAULT_HMONITOR)
{
RECT default_rect = {0, 0, 640, 480};
RECT default_rect = {0, 0, 1024, 768};
info->rcMonitor = default_rect;
info->rcWork = default_rect;
info->dwFlags = MONITORINFOF_PRIMARY;
if (info->cbSize >= sizeof(MONITORINFOEXW))
lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, L"\\\\.\\DISPLAY1" );
lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, L"WinDisc" );
return TRUE;
}
@ -4145,7 +4145,7 @@ BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC pro
}
/* Fallback to report one monitor if using SetupAPI failed */
SetRect( &monitor_rect, 0, 0, 640, 480 );
SetRect( &monitor_rect, 0, 0, 1024, 768 );
if (!proc( NULLDRV_DEFAULT_HMONITOR, hdc, &monitor_rect, lp ))
return FALSE;
return TRUE;

View File

@ -131,6 +131,7 @@ static void test_create_window(void)
static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc, LPARAM lparam)
{
static const RECT expected_rect = {0, 0, 1024, 768};
BOOL r;
MONITORINFOEXA mi;
@ -148,16 +149,12 @@ static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc, LPAR
r = GetMonitorInfoA(hmon, (MONITORINFO*)&mi);
service_ok(r, "GetMonitorInfo failed.\n");
service_ok(mi.rcMonitor.left == 0 && mi.rcMonitor.top == 0 && mi.rcMonitor.right >= 640 && mi.rcMonitor.bottom >= 480,
"Unexpected monitor rcMonitor values: {%d,%d,%d,%d}\n",
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom);
service_ok(mi.rcWork.left == 0 && mi.rcWork.top == 0 && mi.rcWork.right >= 640 && mi.rcWork.bottom >= 480,
"Unexpected monitor rcWork values: {%d,%d,%d,%d}\n",
mi.rcWork.left, mi.rcWork.top, mi.rcWork.right, mi.rcWork.bottom);
service_ok(!strcmp(mi.szDevice, "WinDisc") || !strcmp(mi.szDevice, "\\\\.\\DISPLAY1"),
"Unexpected szDevice received: %s\n", mi.szDevice);
service_ok(EqualRect(lprc, &expected_rect), "Unexpected rect: %s\n", wine_dbgstr_rect(lprc));
service_ok(EqualRect(&mi.rcMonitor, &expected_rect), "Unexpected rcMonitor: %s\n",
wine_dbgstr_rect(&mi.rcMonitor));
service_ok(EqualRect(&mi.rcWork, &expected_rect), "Unexpected rcWork: %s\n",
wine_dbgstr_rect(&mi.rcWork));
service_ok(!strcmp(mi.szDevice, "WinDisc"), "Unexpected szDevice received: %s\n", mi.szDevice);
service_ok(mi.dwFlags == MONITORINFOF_PRIMARY, "Unexpected secondary monitor info.\n");