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

Alexandre Julliard julliard at winehq.org
Mon Aug 23 16:24:14 CDT 2021


Module: wine
Branch: master
Commit: 37f492ae550f937c9c76fe74b0498126bfa66847
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=37f492ae550f937c9c76fe74b0498126bfa66847

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Aug 23 11:30:11 2021 +0800

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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");
 




More information about the wine-cvs mailing list