Dmitry Timoshkov : localspl: AddMonitor should create registry entry for a monitor before initializing it.

Alexandre Julliard julliard at winehq.org
Fri Sep 6 16:05:42 CDT 2019


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Sep  6 12:00:59 2019 +0800

localspl: AddMonitor should create registry entry for a monitor before initializing it.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/localspl/provider.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c
index ccd1981..29c5433 100644
--- a/dlls/localspl/provider.c
+++ b/dlls/localspl/provider.c
@@ -1499,14 +1499,6 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors)
         return FALSE;
     }
 
-    /* Load and initialize the monitor. SetLastError() is called on failure */
-    if ((pm = monitor_load(mi2w->pName, mi2w->pDLLName)) == NULL) {
-        return FALSE;
-    }
-    monitor_unload(pm);
-
-    SetLastError(ERROR_SUCCESS); /* Monitor installer depends on this */
-
     if (RegCreateKeyW(HKEY_LOCAL_MACHINE, monitorsW, &hroot) != ERROR_SUCCESS) {
         ERR("unable to create key %s\n", debugstr_w(monitorsW));
         return FALSE;
@@ -1537,7 +1529,20 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors)
             len = (lstrlenW(mi2w->pDLLName) +1) * sizeof(WCHAR);
             res = (RegSetValueExW(hentry, driverW, 0, REG_SZ,
                     (LPBYTE) mi2w->pDLLName, len) == ERROR_SUCCESS);
+
+            /* Load and initialize the monitor. SetLastError() is called on failure */
+            if ((pm = monitor_load(mi2w->pName, mi2w->pDLLName)) == NULL)
+            {
+                RegDeleteKeyW(hroot, mi2w->pName);
+                res = FALSE;
+            }
+            else
+            {
+                monitor_unload(pm);
+                SetLastError(ERROR_SUCCESS); /* Monitor installer depends on this */
+            }
         }
+
         RegCloseKey(hentry);
     }
 




More information about the wine-cvs mailing list