[wpkg-users] Installer for windows 64 bits

Rainer Meier r.meier at wpkg.org
Thu Jun 12 15:17:44 CEST 2008


Hi Vincent,

Vincent MALIEN wrote:
> hello,
> 
> I use wpkg for installing firefox (and other softwares), it works good, 
> but it fails on computers using Windows vista 64 Bits (it should be the 
> same on XP 64 bits):
> I added to the basic installation given on the site, the following line 
> to lock user preferences / Firefox settings for all users (like proxy etc.):
> 
>   <install cmd='xcopy /Y "%SOFTWARE%\firefox\all.js" 
> "%ProgramFiles%\Mozilla Firefox\greprefs\*.*"' />
>   <install cmd='xcopy  /Y "%SOFTWARE%\firefox\mozilla.cfg" 
> "%ProgramFiles%\Mozilla Firefox\*.*"' />
> 
> but "Firefox Setup 2.0.0.14.exe" runs on the folder: Program Files (x86)
> and those lines copy the files to the folder Program Files.
> 
> how do I Deal with this?
> I didn't find any advice about this on the web site.
> Shall I add a check condition in the installer like this:
> 
> <check type="file" condition="exists" path="%SYSTEMROOT%\SysWOW64" />
> 
> or have you got a better solution?

Here's the way I do it usually...

First of all make sure that you're running WPKG using wrapper.js. Read 
within the header of wrapper.js on how to use it. Especially do not 
forget to put 64-bit cmd.exe to the "64-bit/" sub-directory. If you 
don't do this then WPKG is run on 32-bit CSCRIPT version which has no 
possibility to access folders like %SystemRoot%\System32 as it is 
re-directed to %SystemRoot%\SysWOW64.


Well, all this does not solve the problem that %ProgramFiles% accessed 
on a 32-bit command is not the same as %ProgramFiles% accessed within a 
64-bit command.
I usually create a postinstall script to do actions as you do it above. 
This also makes it easier to track.

In your case it could look something like
%SOFTWARE%\firefox\firefox-postinstall.cmd:


@echo off
set PROG_FILES=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set PROG_FILES=%ProgramFiles(x86)%

xcopy /Y "%SOFTWARE%\firefox\all.js" "%PROG_FILES%\Mozilla 
Firefox\greprefs\*.*"
xcopy  /Y "%SOFTWARE%\firefox\mozilla.cfg" "%PROG_FILES%\Mozilla 
Firefox\*.*"

exit 0


I use the fact here that %ProgramFiles(x86)% is defined only on 64-bit 
systems. So I know it is a 64-bit system.
Then embed it to your package:

<install cmd='%SOFTWARE%\firefox\firefox-postinstall.cmd' />


NOTE AGAIN: This does only work properly if you execute wrapper.js which 
calls 64-bit version of cmd.exe. If you call wpkg.js directly from WPKG 
client (which is currently only 32-bit) then it will invoke 32-bit 
cscript.exe and therefore you get re-directed folders. In addition 
package checks for uninstall entries of 64-bit software will only work 
if wrapper.js is used.

As soon as a 64-bit version of WPKG client is available this step can be 
omitted and 64-bit WPKG client can directly call 64-bit cscript and 
launch wpkg.js directly.


br,
Rainer



More information about the wpkg-users mailing list