Before Windows 7, support for 64-bit Windows was not really a concern for most applications because they were aimed squarely at the 32-bit Windows market. With Windows 7, a large percentage of Windows users will be using the 64-bit version, which means that your setup program has to know what to do when it encounters 64-bit Windows. If your software only works on certain versions of Windows, you should be using launch conditions to prevent users from installing it on unsupported platforms.
I’ve created several launch conditions that you might want to use in your setups. To keep things easy, I have organized the launch conditions using the table format of the LaunchCondition table in the InstallShield Direct Editor.
Example 1: Preventing Installation on 64-Bit Windows
In this example, the application will only work on 32-bit versions of Windows. Therefore, the launch condition could be something like this:
|Not VersionNT64||[ProductName] will only work on 32-bit versions of Windows. Please run the setup on 32-bit Windows. Setup will now exit.|
Example 2: Preventing Installation on 32-Bit Windows
This is the converse of Example 1. That is, the application requires 64-bit Windows and it will not run on 32-bit Windows.
|VersionNT64||[ProductName] will only work on 64-bit versions of Windows. Please run the setup on 64-bit Windows. Setup will now exit.|
Example 3: Handling Multiple Versions of Windows with Different Service Packs
In this example, the application will run on three versions of Windows and each should have certain service packs. The first condition (VersionNT >= “501”) prevents the end user from running the setup on Windows 2000 or Windows NT. The last three conditions apply to only specific versions of Windows. So if the setup runs on Windows Vista (VersionNT = “600), for example, the first, second, and fourth conditions will always return true, and the third condition will only return true if Service Pack 2 or later is installed.
|VersionNT >= “501”||[ProductName] requires Windows XP, Windows Vista, Windows 7, or a later version of Windows. Setup will now exit.|
|(VersionNT = “501” And ServicePackLevel >= “3”) Or VersionNT <> “501”||[ProductName] requires Windows XP Service Pack 3 or later. Setup will now exit.|
|(VersionNT = “600” And ServicePackLevel >= “2”) Or VersionNT <> “600”||[ProductName] requires Windows Vista Service Pack 2 or later. Setup will now exit.|
|(VersionNT = “601” And ServicePackLevel >= “1”) Or VersionNT <> “601”||[ProductName] requires Windows 7 Service Pack 1 or later. Setup will now exit.|
Example 4: Ensuring the Setup Has Sufficient Privileges
Most setups install files to privileged locations such as the Program Files folder or the System folder. And most setups also write to HKEY_LOCAL_MACHINE or HKEY_CLASSES_ROOT in the registry. These locations require administrative privileges. The best way to check for these privileges is to use the Privileged condition:
|Privileged||[ProductName] requires administrative privileges or elevated privileges. Setup will now exit.|
Launch Conditions in Windows Installer (MSI) are a great way to make sure that end users run the setup only on supported platforms. To take this idea further, you can also combine a System Search with a launch condition to check for required software or registry entries. The possibilities are numerous and correct use of launch conditions can really improve a setup.