Windows Installer Properties and Conditions

Heath Stewart

In many languages, some variables can take a value of different types but with the same meaning. Variants in script, for example, can take 0 or false; or they can take any non-zero value and true. The following JScript example prints “Same”.

if (0 == false) WScript.Echo("Same");

The same is not true of Windows Installer however, and conditions must acknowledge this. Setting a property to 0 does not undefine it nor does it mean a simple property test will fail as shown in the following example condition.

ARPSYSTEMCOMPONENT AND KB123456.PatchCode

If a product defined or a user passed in ARPSYSTEMCOMPONENT=0, the condition above will still pass because ARPSYSTEMCOMPONENT is defined as 0. Setting the value to “false” will also satisfy the condition because “false” is just a string – quoted or not.

If a property is defined to support certain values, conditions must check the properties against those values. In the particular case of ARPSYSTEMCOMPONENT, setting this to any value will result in the default provided ARP being ignored but any value other than 1 is considered to cause undefined behavior. The example condition should be rewritten as follows.

ARPSYSTEMCOMPONENT=1 AND KB123456.PatchCode

If a Windows Installer property is set to any value it is defined. There are no booleans, so setting a property to 0 or false will satisfy any condition that merely checks if the property is defined.

0 comments

Discussion is closed.

Feedback usabilla icon