From: Francois Gouget fgouget@codeweavers.com
Unlike Windows XP which returned the actual display information to non-interactive services.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- v2: Supersede 212175. Change the rectangle passed to EnumDisplayMonitor() callback as well. Fix tests failures.
dlls/user32/sysparams.c | 6 +++--- programs/services/tests/service.c | 17 +++++++---------- 2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 24e39206746..d6f08654ab0 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -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; diff --git a/programs/services/tests/service.c b/programs/services/tests/service.c index aa9878b9769..4eebbc432df 100644 --- a/programs/services/tests/service.c +++ b/programs/services/tests/service.c @@ -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");
On Mon, 23 Aug 2021, Zhiyi Zhang wrote:
From: Francois Gouget fgouget@codeweavers.com
Unlike Windows XP which returned the actual display information to non-interactive services.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
v2: Supersede 212175. Change the rectangle passed to EnumDisplayMonitor() callback as well. Fix tests failures.
Thanks for the improvements and the WinDisc fix. I suspect at the last minute I confused the value returned by my patched Wine with the one returned by Windows.