[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH 2/4] localspl: AddMonitor should create registry entry for a monitor before initializing it.
From:       Dmitry Timoshkov <dmitry () baikal ! ru>
Date:       2019-08-30 8:06:26
Message-ID: 20190830160626.4e23a4598be7792c4b4d109e () baikal ! ru
[Download RAW message or body]

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
---
 dlls/localspl/provider.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c
index ccd19811cf..8e5e3428d5 100644
--- a/dlls/localspl/provider.c
+++ b/dlls/localspl/provider.c
@@ -1499,12 +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) {
@@ -1538,7 +1532,17 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors)
             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)
+            res = FALSE;
+
+        monitor_unload(pm);
+
         RegCloseKey(hentry);
+
+        if (!res)
+            RegDeleteKeyW(hroot, mi2w->pName);
     }
 
     RegCloseKey(hroot);
-- 
2.20.1




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic