Ron.Stordahl
4th August 2011 19:23 UTC
Windows 7 Uninstall Registry Entries
I am updating an installer for XP to include Vista/Windows 7. Currently, in XP, I set in the registry:
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\BPQ32.exe"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe". As well as similar entries for "DisplayIcon", "Publisher" etc.
Should these be changed to HKCU for Vista/Windows 7 installs. I do need to use HKCU as opposed to HKLM for other non-install related registry entries in Windows 7, such as paths to application data, etc.
The application is 32 bit if that matters.
MSG
4th August 2011 20:04 UTC
If you're elevating your install (that is, requiring admin access), you shouldn't be using HKCU at all, because they'll end up in the admin's reghive, not the user's. (It's true that on Vista/7 this might actually be the same user, but that's not guaranteed.)
If on the other hand you don't elevate, you cannot use HKLM at all because you need admin access to write there.
So, long story short: In almost all cases you shouldn't be writing to both HKLM and HKCU. It's either one or the other: HKLM for admin-level installers, HKCU for user-level installers.
Ron.Stordahl
5th August 2011 00:04 UTC
That is good info. The entries I quoted are as far as I understand needed so that the control panel uninstall program list will include my application. I doubt it is actually necessary as I have the uninstall link in the program list, however good practice is to do as I have suggested.
So I will use HKCU for all and not mix the two.
Thanks for the informative response...I am just learning about W7!