Notes on Using the Software Update Wizard on 64 Bit Windows

Installation

The Software Update Wizard and the supplied installers are all 32 bit applications throughout.

Developer Install

The developer install will install the developer components to the folder "C:\Program Files (x86)\SoftwareUpdateWizard".

Redistributable Installer (wuwinstaller.exe)

The wuwinstaller.exe redistributable installer is a 32 bit application and therefore will install the Software Update Wizard components into the 32 bit virtualised folders under Windows 64 bit operating systems.  If your application is also compiled for 32 bit targets then wuwinstaller.exe will work correctly for you under Windows 64 bit without requiring any adjustments whatever.

However, the installation folder locations will be different, compared to a 32 bit environment.

The Software Update Wizard service (WebUpdateSvc4.exe), the UI component (WuWUI.exe) and the wuw4.dll dynamic link library will install to the folder "C:\Windows\SysWOW64".

The Software Update Wizard log file will also be created and updated in "C:\Windows\SysWOW64".

The WebUpdateSvc4.ini file will be created and updated in "C:\Windows" as normal.

The Software Update Wizard registry entries will be created under the node "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\WUW".

Special information for .Net developers

The default behaviour of a .Net application is to run as a 32 bit application under 32 bit Windows platforms and as a 64 bit application under Windows 64 bit platforms.  This means that a .Net application, built with the IDE default settings, will successfully reference wuw4.dll on 32 bit platforms but will raise an exception under 64 bit platforms.  This is because a 64 bit application cannot load a 32 bit Windows dll - a Windows limitation.

However, there are two alternative solutions which will allow your .Net application to call the Software Update Wizard on all platforms:

  1. Change the .Net 'Target platform' setting from 'Any cpu' to 32 bit cpus.
  2. Do not use wuw4.dll directly.  Instead, call the wuwstub.exe utility using ShellExecute() or similar, as shown below.  Wuwstub.exe is a simple 32 bit application which is, itself, linked to wuw4.dll.  Your app passes the url of the update script on the command line which launches wuwstub.exe and wuwstub.exe initiates the update check via wuw4.dll.  (Tip: launch wuwstub.exe with the SW_HIDE flag to avoid the temporary display of a command window.)

Supporting your 32 bit Application Using  the Software Update Wizard in 64 bit Windows

A 32 bit application will function under Windows 64 exactly as if it is running on a Windows 32 bit operating system.  It runs inside the dedicated Windows on Windows' (WOW64) subsystem which is part of all 64-bit Windows operating systems.

There are therefore system folders which it may not be able to see - i.e. the non-virtualised folders used by the 64 bit operating system.  However, a 32 bit application should generally not need to be able to see these folders.  To all intents and purposes, therefore, your 32 bit application can use the Software Update Wizard under Windows 64 bit without any adjustment to either your code, the way the Software Update Wizard is deployed, or the way your application calls the Software Update Wizard.

Your 64 bit Application Using the Software Update Wizard in 64 bit Windows

An application compiled for 64 bit Windows cannot load wuw4.dll because it is a 32 bit DLL.  However, your application can launch the supplied wuwstub.exe (32 bit) utility as a process instead of calling wuw4.dll directly.  Wuwstub.exe receives the URL of your update script in its command line and then uses the WebUpdate() function from wuw4.dll to instigate the update check.

In C#, you would therefore use:

Process.Start("wuwstub.exe", "http://www.mycompany.com/updatecheck.txt");

 

You should install Wuwstub.exe into the same folder as your (64 bit) application, so that the Software Update Wizard can locate your application folder:

Folder constant expansions

Because the Software Update Wizard is 32 bit throughout, all folder constants are expanded using the Windows on Windows' (WOW64) subsystem.  Therefore the folder names as seen by the Software Update Wizard and your 64 bit application will be different.

For example, say you use the <SYSDIR> constant in conjunction with the TargetFolder keyword in order to update a DLL in the System folder.  To a 32 bit application running in Windows 64 bit, such as the Software Update Wizard, the folder constant <SYSDIR> expands to "C:\Windows\System32" in WOW64, but in fact the real (physical) folder (as seen by a 64 bit application) in which the file will be placed is actually "C:\Windows\SysWOW64".

The following table shows how the various Software Update Wizard folder constants expand on a 64 bit operating system.  "<SYSDIR>" is the only problematic item, where it is not possible to break out of the WOW64 virtualisation.

Constant 32 bit expansion Physical location on 64 bit Windows
<WINDIR> C:\Windows Same as 32 bit
<SYSDIR> C:\Windows\System32 C:\Windows\SysWOW64

Tip: The Software Update Wizard is a 32 bit application and therefore will always redirect 'c:\Windows\System32' to 'c:\Windows\SysWOW64'.  If you want the Software Update Wizard to access the real (64 bit) System32 folder you should use:

c:\Windows\Sysnative

<PROGRAMFILES> C:\Program Files (x86) C:\Program Files (x86)
<CLIENTFOLDER> The correct client folder, even if it resides in C:\Program Files. The correct client folder, even if it resides in C:\Program Files.
<APPDATA> C:\Users\<username>\AppData\Roaming C:\Users\<username>\AppData\Roaming
<COMMONAPPDATA> C:\ProgramData Same as 32 bit
<COMMONDOCUMENTS> C:\Users\Public\Documents Same as 32 bit
<LOCALAPPDATA> C:\Users\<username>\AppData\Local Same as 32 bit

 

Tip:
Although <PROGRAMFILES> expands to C:\Program Files (x86) you can use the following variation of <CLIENTFOLDER> to get to another folder within C:\Program Files (the Program Files parent folder used by your 64 bit application):
 
TargetFolder=<CLIENTFOLDER>\..\AnotherApp

 

The ellipsis causes Windows to go up a folder level and then to folder 'AnotherApp', which is at the same folder level as your application resides, underneath Program Files.

Note that the example assumes that Wuwstub.exe is installed into an application folder one level below (i.e. an immediate child folder of) C:\Program Files.