Old 28th April 2010, 10:35   #1
voyteckst
Junior Member
 
Join Date: Oct 2006
Location: Poland
Posts: 22
One installer for 32bit and 64bit

I'm creating installer which will contain components for 32 and 64 bit systems. There is no problem with copying correct files, but I don't know how to define INSTDIR and InstallDir. Can someone tell me how to set INSTDIR and InstallDir depending on Windows architecture (i.e. in .oninit)?
voyteckst is offline   Reply With Quote
Old 28th April 2010, 13:20   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
You want to use x64.nsh. (This question has been asked dozens of times before. Please search before you ask.)
MSG is offline   Reply With Quote
Old 28th April 2010, 13:55   #3
voyteckst
Junior Member
 
Join Date: Oct 2006
Location: Poland
Posts: 22
Yes, I have searched, but as far as I remember it doesn't worked for InstallDir?
voyteckst is offline   Reply With Quote
Old 28th April 2010, 15:04   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
InstallDir is a compiletime command. If you're setting $INSTDIR in .onInit anyway, using it is pointless.

This is probably all you have to do:

code:
funtion .onInit
${If} ${RunningX64}
StrCpy $INSTDIR "Your x64 default install path"
$[Else}
StrCpy $INSTDIR "Your x86 default install path"
${EndIf}
FunctionEnd

MSG is offline   Reply With Quote
Old 28th April 2010, 20:39   #5
voyteckst
Junior Member
 
Join Date: Oct 2006
Location: Poland
Posts: 22
Thanks. But should it be in .oninit or can be in other function which I have (also it is question for sysdir) - I give 64bit user page where he have choice to install 32bit or either 64bit version. Choice is because it installs some component for browsers and because i.e. firefox officially is not 64bit (and user likes to use ff) he can install 32bit version.
voyteckst is offline   Reply With Quote
Old 28th April 2010, 22:00   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
If it is system32/syswow64 then you don't need to change the actual value of $INSTDIR and just use the DisableX64FSRedirection/EnableX64FSRedirection macros from x64.nsh. For other paths not dependent on x64 file system redirection then you need to change $OUTDIR (SetOutPath) accordingly. And no it doesn't need to be in .onInit - if you do change $INSTDIR it needs to be before the Directory page of course (if you are using it).

Stu
Afrow UK is offline   Reply With Quote
Old 29th April 2010, 09:30   #7
voyteckst
Junior Member
 
Join Date: Oct 2006
Location: Poland
Posts: 22
Thanks it works fine, but I have to manually set DisableX64FSRedirection/EnableX64FSRedirection each time I want to copy something to $SYSDIR. It don't works when set in .oninit.
voyteckst is offline   Reply With Quote
Old 29th April 2010, 14:30   #8
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Should be fine in .onInit unless something else messes with the x64 redirection under your installer process.

just as an aside.. on Vista and above, and XP with a particular by-request hotfix (so I wouldn't depend on it), you can also write to the special SysNative folder, which is the 64bit System folder on 64bit platforms, and simply doesn't exist on 32bit platforms.
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
Animaether is offline   Reply With Quote
Old 30th April 2010, 05:47   #9
voyteckst
Junior Member
 
Join Date: Oct 2006
Location: Poland
Posts: 22
I have strange issue. When user choose whether to install 32 or 64 bit i set variable named arch and based on it I'm copying 32 or 64 bit files. But it works on one test computer and on other two not... What can be wrong? Code for this is below:
code:

SetOutPath $SYSDIR
${If} $arch == 32
File "file.dll"
${ElseIf} $arch == 64
${DisableX64FSRedirection}
File /oname=file.dll "filex64.dll"
${Else}
${EndIf}

voyteckst is offline   Reply With Quote
Old 30th April 2010, 06:40   #10
redxii
Senior Member
 
Join Date: Nov 2005
Posts: 115
What exactly is it doing or not doing (copying wrong file/wrong location/etc)? I would write it like this:

PHP Code:
  SetOutPath "$SYSDIR"
 
  
{If} $arch == 32
    File 
"file.dll"
  
${ElseIf} $arch == 64
    
${DisableX64FSRedirection}
    
File /oname=file.dll "filex64.dll"
    
${EnableX64FSRedirection}
  ${EndIf} 
redxii is offline   Reply With Quote
Old 30th April 2010, 08:26   #11
voyteckst
Junior Member
 
Join Date: Oct 2006
Location: Poland
Posts: 22
It doesn't copy this file. I will try to make different functions for 32 and 64 and call them according to arch variable.

What is the purpose of running at the and ${EnableX64FSRedirection} ?

Edit: Different functions and calling them according to this variable works ok.

Last edited by voyteckst; 30th April 2010 at 09:13.
voyteckst is offline   Reply With Quote
Old 30th April 2010, 08:53   #12
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by voyteckst View Post
What is the purpose of running at the and ${EnableX64FSRedirection} ?
It's to return the installer to standard behavior. In case you forget later on that you changed it. It's good practice to always do this.
MSG is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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