[PATCH] appwiz.cpl: Remove list entries left over from an earlier uninstall

Hugh McMaster hugh.mcmaster at outlook.com
Thu Dec 15 06:25:19 CST 2016


Fixes bugs 41609 and 40845.

Currently, the root HKEY is closed before use, making it invalid.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 dlls/appwiz.cpl/Makefile.in | 2 +-
 dlls/appwiz.cpl/appwiz.c    | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/appwiz.cpl/Makefile.in b/dlls/appwiz.cpl/Makefile.in
index a8341fa..1597d7b 100644
--- a/dlls/appwiz.cpl/Makefile.in
+++ b/dlls/appwiz.cpl/Makefile.in
@@ -1,5 +1,5 @@
 MODULE    = appwiz.cpl
-IMPORTS   = uuid urlmon advpack comctl32 advapi32 shell32 ole32 user32 comdlg32
+IMPORTS   = uuid urlmon advpack comctl32 advapi32 shell32 ole32 user32 comdlg32 shlwapi
 DELAYIMPORTS = msi
 
 C_SRCS = \
diff --git a/dlls/appwiz.cpl/appwiz.c b/dlls/appwiz.cpl/appwiz.c
index 9d53e79..4008354 100644
--- a/dlls/appwiz.cpl/appwiz.c
+++ b/dlls/appwiz.cpl/appwiz.c
@@ -38,6 +38,7 @@
 #include <wingdi.h>
 #include <winreg.h>
 #include <shellapi.h>
+#include <shlwapi.h>
 #include <commctrl.h>
 #include <commdlg.h>
 #include <cpl.h>
@@ -298,7 +299,7 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
             }
 
             /* registry key */
-            info->regroot = root;
+            info->regroot = SHRegDuplicateHKey(root);
             lstrcpyW(info->regkey, subKeyName);
             info->path = command;
 
@@ -497,7 +498,6 @@ static void UninstallProgram(int id, DWORD button)
     PROCESS_INFORMATION info;
     WCHAR errormsg[MAX_STRING_LEN];
     WCHAR sUninstallFailed[MAX_STRING_LEN];
-    HKEY hkey;
     BOOL res;
 
     LoadStringW(hInst, IDS_UNINSTALL_FAILED, sUninstallFailed,
@@ -533,9 +533,8 @@ static void UninstallProgram(int id, DWORD button)
                     MB_ICONQUESTION) == IDYES)
                 {
                     /* delete the application's uninstall entry */
-                    RegOpenKeyExW(iter->regroot, PathUninstallW, 0, KEY_READ, &hkey);
-                    RegDeleteKeyW(hkey, iter->regkey);
-                    RegCloseKey(hkey);
+                    RegDeleteKeyW(iter->regroot, iter->regkey);
+                    RegCloseKey(iter->regroot);
                 }
             }
 
-- 
2.7.4




More information about the wine-patches mailing list