[1/2] uninstaller: add ability to scan HKCU for uninstall entries (Try 2)

James Hawkins truiken at gmail.com
Fri Jun 1 12:28:32 CDT 2007


On 6/1/07, Tom Spear <speeddymon at gmail.com> wrote:
> Here is a 2nd attempt at the last one I sent.  This time the root
> field is initialized, and this part of the patch is written against
> current git, not against changes to my own tree.  Oh and its onl;y a
> 2-parter
>
> This will make wine's programs/uninstaller look thru not only
> HKEY_LOCAL_MACHINE for uninstall entries, but also HKEY_CURRENT_USER.
>

+    /* Loop thru HKCU first, then thru HKLM  */
+    for (iRootKey=0; iRootKey<sizeof(rootKeys) / sizeof(rootKeys[0]);
++iRootKey)
+    {
+    /* If there is no uninstall info in a specific root key,
+     * finish this run and go to the next */
+    if (RegOpenKeyExW(rootKeys[iRootKey], PathUninstallW, 0,
+                      KEY_READ, &hkeyUninst) != ERROR_SUCCESS)
+        continue;

This whole patch would be a lot simpler if you just used one root variable:

if (RegOpenKeyExW(HKCU....) == ERROR_SUCCESS) root = HKCU;
else if (RegOpenKeyExW(HKLM....) == ERROR_SUCCESS) root = HKLM;
else bail out

Now just use root everywhere instead of having an array of just two
constants, and you get rid of the index.

-- 
James Hawkins



More information about the wine-devel mailing list