[wpkg-users] Checks in wpkg.js
Rainer Meier
r.meier at wpkg.org
Mon Sep 15 10:14:24 CEST 2008
Hi Vladimir,
Vladimir Psenicka wrote:
> Hi,
>
> I have problem with checking conditions in registry on Vista 64bit with
> WPKG service.
>
>
> Example: SP1 install on Vista
>
>> <package
>> id="vistasp1"
>> name="Windows Vista Service Pack 1 All Language Standalone (KB936330) 32bit/64bit"
>> revision="1"
>> reboot="true"
>> priority="2000">
>>
>> <check type="logical" condition="and">
>> <check type="registry" condition="equals" path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" value="Windows Vista (TM) Business" />
>> <check type="registry" condition="equals" path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion" value="Service Pack 1" />
>> </check>
>>
>> <install cmd='%COMSPEC% /C IF %PROCESSOR_ARCHITECTURE% == x86 "%SOFTWARE%\sp-nt\WinVista\32bit\Windows6.0-KB936330-X86-wave1.exe" /quiet'>
>> <exit code="3010" />
>> </install>
>>
>> <install cmd='%COMSPEC% /C IF %PROCESSOR_ARCHITECTURE% == AMD64 "%SOFTWARE%\sp-nt\WinVista\64bit\Windows6.0-KB936330-X64-wave1.exe" /quiet'>
>> <exit code="3010" />
>> </install>
>>
>> </package>
>
>
> I have Vista with SP1 integrated, but instalation runs on it because
> conditions are not met. Wpkg.js is returning different value that is
> really in key and subkeys, In app log on Vista wpkg.js says that in
> registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
> NT\CurrentVersion\ProductName" has this value "Windows (TM) Vista
> Business". But if I run regedit on Vista I see in this value "Windows
> Vista (TM) Business" in the same key.
>
> "Windows (TM) Vista Business" != "Windows Vista (TM) Business"
>
> I think this issue is only on 64bit system...
> I attach screenshot from Vista64
>
> Do you have better idea how check if system is Windows Vista with
> service pack 1 than in registry?
Looks like you have been trapped by Microsoft Registry redirection.
Windows x64 redirects registry read attempts of 32-bit applications to
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\...
So a 32-bit application reading
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProductName" actually reads from
"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows
NT\CurrentVersion\ProductName"
while a 64-bit application reads from
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProductName"
NOTE: The 64-bit key is not available to 32-bit applications.
The CSDVersion entry is NOT available within the virtualized 32-bit
registry tree. I don't know why Microsoft decided to hide this
information from 32-bit applications.
If you want to access the _real_ (64-bit) ProductName and CSDVersion
keys you need to execute WPKG with 64-bit version of cscript.exe (which
will be able then to access the keys).
To do so please use the latest version of WPKG client (1.3.5 at the time
of writing) in its 64-bit version. This will launch 64-bit cscript.exe.
Alternatively you might change your client configuration and run
wrapper.js instead of wpkg.js on your 64-bit workstations. The
wrapper.js script will run 64-bit cmd.exe (which you have to put on the
share as well) and therefore execute 64-bit cscript.exe when invoking
wpkg.js. This was done to "escape" the 32-bit-only environment in order
to allow WPKG to access all (including 64-bit) files and registry paths.
Please open wrapper.js with a text editor to get some more instructions
how to use it.
Well, it might be easier to use the (yet unreleased) 64-bit version of
WPKG client.
Ah yes, by the way - there might be an easier version to check for SP1.
Use the 'ver' command to get the Windows version printed on the shell.
So you might use this output to detect the windows version. A simple
script wrapped around packed into a cmd file could return 0 or 1 to WPKG
(execute-type check) to detect if SP1 is installed or not.
br,
Rainer
More information about the wpkg-users
mailing list