Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 1st February 2007, 12:29   #1
lrobinot
Junior Member
 
Join Date: Feb 2007
Posts: 3
Question 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:

code:

!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 :

code:

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

code:

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.
lrobinot is offline   Reply With Quote
Old 1st February 2007, 12:48   #2
lrobinot
Junior Member
 
Join Date: Feb 2007
Posts: 3
After finding

http://nsis.cvs.sourceforge.net/nsis...?r1=1.4&r2=1.5

I changed my test script to :

code:

!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 ==="
SetOutPath "$SYSDIR"
File /oname=SYSDIR_1.tmp test.nsi
SetOutPath "$INSTDIR"
File /oname=INSTDIR_1.tmp test.nsi
SetOutPath "$PROGRAMFILES"
File /oname=PROGRAMFILES_1.tmp test.nsi

${DisableX64FSRedirection}
DetailPrint "=== After Disable ==="
SetOutPath "$SYSDIR"
File /oname=SYSDIR_2.tmp test.nsi
SetOutPath "$INSTDIR"
File /oname=INSTDIR_2.tmp test.nsi
SetOutPath "$PROGRAMFILES"
File /oname=PROGRAMFILES_2.tmp test.nsi

${EnableX64FSRedirection}
DetailPrint "=== After Enable ==="
SetOutPath "$SYSDIR"
File /oname=SYSDIR_3.tmp test.nsi
SetOutPath "$INSTDIR"
File /oname=INSTDIR_3.tmp test.nsi
SetOutPath "$PROGRAMFILES"
File /oname=PROGRAMFILES_3.tmp test.nsi
SectionEnd



but all the files are created in the same directories...
lrobinot is offline   Reply With Quote
Old 1st February 2007, 13:04   #3
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
$PROGRAMFILES is constant, not variable, and the question is when it is initialized. AFAIK good place to disable redirection and get correct constant value is .onInit. May be you can use %ProgramFiles% later instead of $PROGRAMFILES (not tested).
Takhir is offline   Reply With Quote
Old 1st February 2007, 16:19   #4
lrobinot
Junior Member
 
Join Date: Feb 2007
Posts: 3
Quote:
Originally posted by Takhir
$PROGRAMFILES is constant, not variable, and the question is when it is initialized. AFAIK good place to disable redirection and get correct constant value is .onInit. May be you can use %ProgramFiles% later instead of $PROGRAMFILES (not tested).
Thank you very much, by using dynamic variables, I can install files in the right directories...

Now I have a new problem, accessing the right registry hive!

While reading this forum, I saw a thread about writing system calls to read registry hive in 64-bit and another one about a patch :

http://sourceforge.net/tracker/index...49&atid=373087

Do I have to rewrite all my scripts to use macro for 64-bit registry reading/writing, or can I wait for the inclusion of the pacth ?
lrobinot is offline   Reply With Quote
Old 9th February 2007, 12:08   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
For now, you'd have to use the macro. You could make a macro of your own that'd wrap that macro, so once the patch is applied, you only have to change one line of code.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump