10

I have an application setup build in NSIS. The set requires a key to be created at the following location for my application to start:- HKEY_LOCAL_MACHINE\Software\\\" "VersionNo" 0 HKEY_LOCAL_MACHINE\Software\Wow6432Node\\" "VersionNo" "11"

In the script, i have used:-

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

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

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

This results in my application not starting after installation.

--Can someone please suggest command/script for NSIS to compulsorily create the key(s) under HKEY_LOCAL_MACHINE\Software\ for a 64-bit system instead of it getting created under HKEY_LOCAL_MACHINE\Software\Wow6432Node?

Eagerly waiting for a solution....

Bomzinho
  • 161
  • 1
  • 7
  • 14

1 Answers1

36

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

SetRegView 64
WriteRegDWORD HKLM "SOFTWARE\<Key1>\<Key2>" "VersionNo" 0
SetRegView 32
WriteRegStr HKLM "SOFTWARE\<Key1>\<Key2>" "VersionNo" "11"
Austin Adams
  • 6,535
  • 3
  • 23
  • 27
Sergey Podobry
  • 7,101
  • 1
  • 41
  • 51