[1/2] uninstaller: add ability to scan HKCU for uninstall
entries (Try 2)
Tom Spear
speeddymon at gmail.com
Fri Jun 1 13:28:36 CDT 2007
On 6/1/07, James Hawkins <truiken at gmail.com> wrote:
> 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.
root is used in more than just FetchUninstallInformation.... It is
used in UninstallProgram. So unless I declare root as a global
variable, it would not be accessible by UninstallProgram, and would
therefore fail to compile. Also, what if a new root key is added in
later on by MS, that allows Uninstall stuff to be placed in it? This
way, we just add the name of that new root key to the array.
Otherwise, someone has to add another
else if (RegOpenKeyExW(.....) == ERROR_SUCCESS) root = .....;
--
Thanks
Tom
More information about the wine-devel
mailing list