Writing Entries Under HKCU for a Per-User Installation
Project:This information applies to the following project types:
Since the current user may not have sufficient privileges for modifying keys under HKEY_LOCAL_MACHINE, you may need to write the entries under HKEY_CURRENT_USER.
When you select HKEY_USER_SELECTABLE in the Registry view, the entries are created under the appropriate registry hive, according to the type of installation and the end user’s access rights. In a per-user installation, which means that the ALLUSERS property is set to 2 or that the installation is being run by someone with user-level access privileges, these entries would be made under HKEY_CURRENT_USER. In a per-machine installation, which means that ALLUSERS is not null and that the end user is an administrator, the entries would be written under HKEY_LOCAL_MACHINE.
Note:Windows does not allow a new key to be created directly under HKEY_LOCAL_MACHINE. For this reason, any information that you create under HKEY_USER_SELECTABLE must be placed under the SOFTWARE subkey, which is the only subkey common to HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER.
For example, creating the key HKEY_USER_SELECTABLE\SOFTWARE\MyCompany is valid, but creating HKEY_USER_SELECTABLE\MyCompany is not.