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

Detlef Riekenberg wine.dev at web.de
Tue Feb 7 16:22:36 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 text in the Dialog after the successful installation
has the message for the code from GetLastError() appended,
which is not present on windows.

version 2:
check result of GetLastError unconditional, as suggested by Huw

bye bye ... Detlef

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

diff --git a/dlls/winspool.drv/tests/info.c b/dlls/winspool.drv/tests/info.c
index f6527c5..3c28bc0 100644
--- a/dlls/winspool.drv/tests/info.c
+++ b/dlls/winspool.drv/tests/info.c
@@ -434,7 +434,9 @@ static void test_AddMonitor(void)
     mi2a.pDLLName = entry->dllname;
     res = AddMonitorA(NULL, 2, (LPBYTE) &mi2a);
-    ok(res, "returned %d with %d (expected '!= 0')\n", res, GetLastError());
+    /* Some apps depend on the result of GetLastError() also on success of AddMonitor */
+    ok(res && (GetLastError() == ERROR_SUCCESS),
+        "returned %d with %d (expected '!= 0' with ERROR_SUCCESS)\n", res, GetLastError());
     /* add a monitor twice */

More information about the wine-patches mailing list