On 6/1/07, Tom Spear speeddymon@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.
On 6/1/07, James Hawkins truiken@gmail.com wrote:
On 6/1/07, Tom Spear speeddymon@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 = .....;
On Fri, Jun 01, 2007 at 01:28:36PM -0500, Tom Spear wrote:
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 = .....;
please excuse my bold mail on top of plain ignorance of the windows api - but i would consider finding a key in either the user or the global branch of the registry a task that many developers had to face (even in wine) and i bet there is an API function for that? would it be a Good Thing to add such a thing if not?
On 6/1/07, Christoph Frick frick@sc-networks.de wrote:
please excuse my bold mail on top of plain ignorance of the windows api
- but i would consider finding a key in either the user or the global
branch of the registry a task that many developers had to face (even in wine) and i bet there is an API function for that? would it be a Good Thing to add such a thing if not?
I looked, but was unable to find any.