Permissions Issue on HKEY_LOCAL_MACHINE:
- The key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
is a system-wide registry setting and requires administrative privileges to write to. While your installer is running as an administrator, it may not have the necessary permissions to write to this registry key for all users. - Solution: Ensure that the installer is running with elevated privileges (i.e., Run as Administrator). Even though it’s being executed with admin rights, certain keys may require additional permission handling, especially on 64-bit systems where the registry paths for 32-bit and 64-bit applications are separated. If you are working on a 64-bit system, ensure the installer is writing to the correct registry view:
- For 64-bit systems, use
HKEY_LOCAL_MACHINE\SOFTWARE
for 64-bit applications.- For 32-bit applications, use
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
for the appropriate 32-bit registry hive. - User-Specific Registry Entries in HKCU vs. HKLM:
-
HKEY_CURRENT_USER
(HKCU) is user-specific, whileHKEY_LOCAL_MACHINE
(HKLM) is system-wide. When you set a value underHKCU
, it applies only to the current logged-in user. When you attempt to apply the same setting underHKLM
, it should apply system-wide but requires elevated privileges.- Solution: If your goal is to apply the setting to all users, make sure you are modifying the registry under
HKEY_LOCAL_MACHINE
for all users, but also ensure that you have the necessary administrative rights. - Correct Registry Path and Formatting:
- Ensure the registry path is correct and formatted properly:
- The registry value you are adding should be a string value (
REG_SZ
), and the value data should be the path to the executable with the~RUNASADMIN
flag.- Double-check the key path
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
and verify that there are no typographical errors in the path. - System Reboot:
- Sometimes, changes made to the registry, especially for
HKEY_LOCAL_MACHINE
, may require a system reboot to take effect.
- Sometimes, changes made to the registry, especially for
- Double-check the key path
- 32-bit vs. 64-bit Registry View:
- On 64-bit systems, there are separate registry hives for 32-bit and 64-bit applications. If the application is 32-bit, it might not be reading from the expected
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
(which is typically for 64-bit apps).- Solution: Use the
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
registry path for 32-bit applications on a 64-bit machine.
- Solution: Use the
- Solution: If your goal is to apply the setting to all users, make sure you are modifying the registry under
- For 32-bit applications, use