[PATCH 1/2] localspl: Clear LastError on success in AddMonitor [v2]

Detlef Riekenberg wine.dev at web.de
Tue Feb 7 16:22: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 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:
Call SetLastError(EROR_SUCCESS) unconditional, as suggested by Huw

bye bye ... Detlef

Signed-off-by: Detlef Riekenberg <wine.dev at web.de>
 dlls/localspl/provider.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c
index f359b73..3a912b1 100644
--- a/dlls/localspl/provider.c
+++ b/dlls/localspl/provider.c
@@ -1507,6 +1507,8 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors)
+    SetLastError(ERROR_SUCCESS); /* Monitor installer depend on this */
     if (RegCreateKeyW(HKEY_LOCAL_MACHINE, monitorsW, &hroot) != ERROR_SUCCESS) {
         ERR("unable to create key %s\n", debugstr_w(monitorsW));
         return FALSE;

More information about the wine-patches mailing list