Archive: Guideline? Use HKLM or HKLU?


Guideline? Use HKLM or HKLU?
Is there a guideline for whether to use HKLU (Local User) or HKLM (Local machine) for applications settings, uninstall information, and installation directory?

The norm seems to be to put the path to the application in HKLM and application settings in HKLU, but this varies a lot from application to application.

The NSIS examples seem to mostly use HKLM. Is this for a particular technical reason, or just convention (and it really doesn't matter).


Application settings should always be kept in HKCU so every user can have his own settings. Other global settings, such as the uninstall information, are usually kept in HKLM. However, it's possible, on Windows 2000 and above (probably NT as well), to put those in HKCU to create a "private installation" for the user.


Thanks ... makes sense.


Or you can use SHCTX and then SetShellVarContext appropriately.


Thanks ..... wasn't aware of SHCTX and SetShellVarContext. But it does seem like the end-user could encounter permission problems.