Writing a registry value in a 64-bit system

I have an assembly of application settings in NSIS. To install the application, you need to create a key in the following location: - HKEY_LOCAL_MACHINE \ Software \\\ "VersionNo" 0 HKEY_LOCAL_MACHINE \ Software \ Wow6432Node \\ "VersionNo" "11"

In the script, I used: -

WriteRegDWORD HKLM "SOFTWARE\<Key1>\<Key2>\<Key3>" "VersionNo" 0 WriteRegStr HKLM "SOFTWARE\<Key1>\<Key2>" "VersionNo" "11" 

This key was successfully created in the 32-bit system of Windows 7. However, when I install the installation on the 64-bit system of Windows 7, the key is not created in the above location. Instead, it creates a key: -

  HKEY_LOCAL_MACHINE\Software\Wow6432Node\<Key1>\<Key2>\<Key3>" "VersionNo" 0 HKEY_LOCAL_MACHINE\Software\Wow6432Node\<Key1>\<Key2>" "VersionNo" "11" 

As a result, my application does not start after installation.

- Can someone suggest a command / script for NSIS to force a key under HKEY_LOCAL_MACHINE \ Software \ for a 64-bit system instead of being created in HKEY_LOCAL_MACHINE \ Software \ Wow6432Node?

Looking forward to a decision ....

+8
nsis
source share
1 answer

Use SetRegView to switch between 32-bit and 64-bit registry. Your code should look like this:

 SetRegView 64 WriteRegDWORD HKLM "SOFTWARE\<Key1>\<Key2>" "VersionNo" 0 SetRegView 32 WriteRegStr HKLM "SOFTWARE\<Key1>\<Key2>" "VersionNo" "11" 
+27
source share

All Articles