Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing registry value in a 64-bit system

Tags:

nsis

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....

like image 995
Bomzinho Avatar asked Jun 22 '12 04:06

Bomzinho


1 Answers

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"
like image 176
Sergey Podobry Avatar answered Oct 22 '22 12:10

Sergey Podobry