[PATCH 2/2] winspool/tests: Test for LastError also on success of AddMonitor

Detlef Riekenberg wine.dev at web.de
Mon Jan 30 12:43:35 CST 2017


This is ugly, but there are printmonitor installers,
which depend on GetLastError() even on success of AddMonitor

The old example monitor code from Microsoft has the broken code
and many monitors used the Mircosoft example as start,
so we need to duplicate this behavior...

redmon is an example.
The test in the Dialog after the successful installation
has the message for the code from GetLastError() appended,
which is not shown on windows.

https://bugs.winehq.org/show_bug.cgi?id=3864#c22

--
bye bye ... Detlef

Signed-off-by: Detlef Riekenberg <wine.dev at web.de>
---
 dlls/winspool.drv/tests/info.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/winspool.drv/tests/info.c b/dlls/winspool.drv/tests/info.c
index f6527c5..602e935 100644
--- a/dlls/winspool.drv/tests/info.c
+++ b/dlls/winspool.drv/tests/info.c
@@ -435,6 +435,12 @@ static void test_AddMonitor(void)
     SetLastError(MAGIC_DEAD);
     res = AddMonitorA(NULL, 2, (LPBYTE) &mi2a);
     ok(res, "returned %d with %d (expected '!= 0')\n", res, GetLastError());
+    if (res)
+    {
+        /* Some apps depend on the result of GetLastError() */
+        res = GetLastError();
+        ok(res == ERROR_SUCCESS, "got 0x%x/%u (expected ERROR_SUCCESS)\n", res, res);
+    }
 
     /* add a monitor twice */
     SetLastError(MAGIC_DEAD);
-- 
2.7.4




More information about the wine-patches mailing list