Problems with 64-bit
Hello,
I'am trying to create an installer with NSIS (2.23) that will install a software on Windows XP, Windows XP 64-bit, Vista and Vista 64-bit.
I have problems with x64.nsh, here is my tests:
!include "LogicLib.nsh"
!include "x64.nsh"
OutFile "nsis_test.exe"
InstallDir "$PROGRAMFILES\Company\Product"
Section
${If} ${RunningX64}
DetailPrint "Running X64=1"
${Else}
DetailPrint "Running X64=0"
${Endif}
DetailPrint "=== Default ==="
DetailPrint "SYSDIR=$SYSDIR"
DetailPrint "INSTDIR=$INSTDIR"
DetailPrint "PROGRAMFILES=$PROGRAMFILES"
DetailPrint "=== After Disable ==="
${DisableX64FSRedirection}
DetailPrint "SYSDIR=$SYSDIR"
DetailPrint "INSTDIR=$INSTDIR"
DetailPrint "PROGRAMFILES=$PROGRAMFILES"
DetailPrint "=== After Enable ==="
${EnableX64FSRedirection}
DetailPrint "SYSDIR=$SYSDIR"
DetailPrint "INSTDIR=$INSTDIR"
DetailPrint "PROGRAMFILES=$PROGRAMFILES"
SectionEnd
After compiling and running the resulting test_nsis.exe, I obtain this result on 64-bit plateforms :
Running X64=1
=== Default ===
SYSDIR=C:\WINDOWS\system32
INSTDIR=C:\Program Files (x86)\Company\Product
PROGRAMFILES=C:\Program Files (x86)
=== After Disable ===
SYSDIR=C:\WINDOWS\system32
INSTDIR=C:\Program Files (x86)\Company\Product
PROGRAMFILES=C:\Program Files (x86)
=== After Enable ===
SYSDIR=C:\WINDOWS\system32
INSTDIR=C:\Program Files (x86)\Company\Product
PROGRAMFILES=C:\Program Files (x86)
Completed
I would have expected
Running X64=1
=== Default ===
SYSDIR=C:\WINDOWS\SysWOW64
INSTDIR=C:\Program Files (x86)\Company\Product
PROGRAMFILES=C:\Program Files (x86)
=== After Disable ===
SYSDIR=C:\WINDOWS\system32
INSTDIR=C:\Program Files\Company\Product
PROGRAMFILES=C:\Program Files
=== After Enable ===
SYSDIR=C:\WINDOWS\SysWOW64
INSTDIR=C:\Program Files (x86)\Company\Product
PROGRAMFILES=C:\Program Files (x86)
Completed
As test_nsis.exe is a 32-bit executable running on a 64-bit OS.
Am I wrong ?
If I am wrong what is the solution to get PROGRAMFILES with the right path if I need to install 32-bit executables, and the 64-bit executables ??
Thank you very much for any answer.