[wpkg-users] getArchitecture in wpkg.js

Rainer Meier r.meier at wpkg.org
Tue Jul 1 19:49:29 CEST 2014


Hi Jon,

On 01.07.2014 19:13, Jon Goldberg wrote:
> I run wpkg using the winexe method detailed on the wiki.  Recently I
> found a situation that came down to a winexe bug - it was launching a
> 32-bit command prompt on a 64-bit machine.  This led to
> %PROCESSOR_ARCHITECTURE% being "x86" and not "AMD64", which led to
> getArchitecture() returning the wrong value.
>
> I'm building a new version of winexe from source as we speak - but I
> wonder if we should employ a more robust architecture check?  Maybe
> check the value/existence of %PROCESSOR_ARCHITEW6432%?
>
> I'm willing to submit a patch, but this is admittedly far from my area
> of expertise, and I wanted to poll the community to see if there's a
> reason NOT to do this.  From my testing, it seems that there's no
> problem installing a 64-bit .msi on a 64-bit system using a 32-bit
> command prompt.

No. I actually think it would be a bad idea.

And as usal I am trying to explain further. If WPKG would detect 64-bit system 
even if run on WoW64 on a 64-bit system (ie. running in 32-bit cscript.exe mode 
on 64-bit Windows) then of course it would be possible to detect that the 
underlying OS is 64-bit and still run all the installers. Thought this would not 
help WPKG to read 64-bit native paths like the 64-bit uninstaller entries, 
native %ProgramFiles%, %SystemRoot%\system32 etc.

As a result it would of course properly launch 64-bit installers. But very 
likely package checks for uninstall entries would immediately fail at no clear 
reason to the user since the user would be able to see the uninstall entry; but 
WPKG couldn't.

As a result it's better for WPKG to work in pure 32-bit mode if 32-bit 
WPKG/cscript.exe is launched even on 64-bit OS.

Also WPKG comes with a wrapper.js script which also ensures to run cscript.exe 
in 64-bit mode if available. Also depending on how you launch WPKG you might run 
cscript.exe from %SystemRoot%\sysnative if available to ensure 64-bit 
cscript.exe is run.


br,
Rainer



More information about the wpkg-users mailing list