Hans Leidekker : uninstaller: Run msiexec if the WindowsInstaller value is set.

Alexandre Julliard julliard at winehq.org
Thu Dec 23 11:28:08 CST 2010


Module: wine
Branch: master
Commit: fea5767a025e24d4592eb1e89c6a9a402bc73442
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fea5767a025e24d4592eb1e89c6a9a402bc73442

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Dec 23 17:09:31 2010 +0100

uninstaller: Run msiexec if the WindowsInstaller value is set.

---

 programs/uninstaller/main.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c
index 912d23d..f781d3c 100644
--- a/programs/uninstaller/main.c
+++ b/programs/uninstaller/main.c
@@ -59,6 +59,7 @@ static const WCHAR PathUninstallW[] = {
         'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
         'U','n','i','n','s','t','a','l','l',0 };
 static const WCHAR UninstallCommandlineW[] = {'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0};
+static const WCHAR WindowsInstallerW[] = {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
 
 
 /**
@@ -192,9 +193,24 @@ static int FetchFromRootKey(HKEY root)
     {
         lstrcpyW(p, subKeyName);
         RegOpenKeyExW(root, key_app, 0, KEY_READ, &hkeyApp);
-        if ((RegQueryValueExW(hkeyApp, DisplayNameW, 0, 0, NULL, &displen) == ERROR_SUCCESS)
-         && (RegQueryValueExW(hkeyApp, UninstallCommandlineW, 0, 0, NULL, &uninstlen) == ERROR_SUCCESS))
+        if (!RegQueryValueExW(hkeyApp, DisplayNameW, NULL, NULL, NULL, &displen))
         {
+            DWORD value, type;
+            WCHAR *command;
+
+            if (!RegQueryValueExW(hkeyApp, WindowsInstallerW, NULL, &type, NULL, &value) && type == REG_DWORD && value == 1)
+            {
+                static const WCHAR fmtW[] = {'m','s','i','e','x','e','c',' ','/','x','%','s',0};
+                command = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(fmtW) + lstrlenW(subKeyName)) * sizeof(WCHAR));
+                wsprintfW(command, fmtW, subKeyName);
+            }
+            else if (!RegQueryValueExW(hkeyApp, UninstallCommandlineW, NULL, NULL, NULL, &uninstlen))
+            {
+                command = HeapAlloc(GetProcessHeap(), 0, uninstlen);
+                RegQueryValueExW(hkeyApp, UninstallCommandlineW, 0, 0, (LPBYTE)command, &uninstlen);
+            }
+            else continue;
+
             numentries++;
             entries = HeapReAlloc(GetProcessHeap(), 0, entries, numentries*sizeof(uninst_entry));
             entries[numentries-1].root = root;
@@ -202,9 +218,8 @@ static int FetchFromRootKey(HKEY root)
             lstrcpyW(entries[numentries-1].key, subKeyName);
             entries[numentries-1].descr = HeapAlloc(GetProcessHeap(), 0, displen);
             RegQueryValueExW(hkeyApp, DisplayNameW, 0, 0, (LPBYTE)entries[numentries-1].descr, &displen);
-            entries[numentries-1].command = HeapAlloc(GetProcessHeap(), 0, uninstlen);
+            entries[numentries-1].command = command;
             entries[numentries-1].active = 0;
-            RegQueryValueExW(hkeyApp, UninstallCommandlineW, 0, 0, (LPBYTE)entries[numentries-1].command, &uninstlen);
             WINE_TRACE("allocated entry #%d: %s (%s), %s\n",
             numentries, wine_dbgstr_w(entries[numentries-1].key), wine_dbgstr_w(entries[numentries-1].descr), wine_dbgstr_w(entries[numentries-1].command));
             if(sFilter != NULL && StrStrIW(entries[numentries-1].descr,sFilter)==NULL)




More information about the wine-cvs mailing list