MsiEvaluateCondition

[This is preliminary documentation and subject to change.]

The MsiEvaluateCondition function evaluates a conditional expression containing property names and values.

MSICONDITION MsiEvaluateCondition(
  MSIHANDLE hInstall,    // installer handle
  LPCTSTR szCondition    // conditional expression
);
 

Parameters

hInstall
Handle to the installation.
szCondition
Specifies the conditional expression.

Return Values

MSICONDITION_ERROR
An invalid handle was passed to the function, or the conditional expression has a syntax error.
MSICONDITION_FALSE
An expression that evaluates to FALSE was passed to the function.
MSICONDITION_NONE
No expression was passed to the function.
MSICONDITION_TRUE
An expression that evaluates to TRUE was passed to the function.

Remarks

The MsiEvaluateCondition function uses the following conditional statement syntax.

value ::= symbol | literal | integer

comparison-operator ::= < | > | <= | >= | = | <>

term ::= value | value comparison-operator value | ( expression )|

Boolean-factor ::= term | NOT term

Boolean-term ::= Boolean-factor | Boolean-factor AND term

expression ::= Boolean-term | Boolean-term OR expression

symbol ::= property | %environment-variable | $component-action | ?component-state | &feature-action | !feature-state

All symbol names and values are case-sensitive, except environment variable names, which are not case-sensitive.

Operators are not case-sensitive.

Literal text must be enclosed in double quotes.

Floating point numeric values are not supported.

Operators and precedence: same as BASIC and SQL languages.

Arithmetic operators are not supported.

Supported operators: OR AND NOT Xor Eqv Imp < <= = <> >= > ().

Non-existent property values are treated as empty strings.

Comparison of an integer with a string or property value that cannot be converted to an integer is always iecFalse, except for the comparison operator '<>', which returns iecTrue.

Parentheses can be used to override operator precedence.

For string comparisons, a tilde '~' prefixed to the operator performs a comparison that is not case-sensitive.

The following table shows the prefixes to use to access various system and installer information for use in conditional expressions.

Symbol type Prefix Value
Installer property (none) Value of property (Property table).
Environment variable % Value of environment variable.
Component table key $ Action state of the component.
Component table key ? Installed state of the component.
Feature table key & Action state of the feature.
Feature table key ! Installed state of the feature.

The following table shows the logical operators used by the MsiEvaluateCondition function, in high to low order.

Operator Meaning
Not - Prefix unary operator; inverts state of following term.
And - TRUE if both terms are TRUE.
Or - TRUE if either or both terms are TRUE.
Xor - TRUE if either but not both terms are TRUE.
Eqv - TRUE if both terms are TRUE or both terms are FALSE.
Imp - TRUE if left term is FALSE or right term is TRUE.

The following table shows the comparison operators used by the MsiEvaluateCondition function. These comparison operators can only occur between two values.

Operator Meaning
= - TRUE if left value is equal to right value.
<> - TRUE if left value is not equal to right value.
> - TRUE if left value is greater than right value.
>= - TRUE if left value is greater than or equal to right value.
< - TRUE if left value is less than right value.
<= - TRUE if left value is less than or equal to right value.

The following table shows the substring operators used by the MsiEvaluateCondition function. These substring operators can occur between two string values.

Operator Meaning
>< - TRUE if left string contains the right string.
<< - TRUE if left string starts with the right string.
>> - TRUE if left string ends with the right string.

The following table shows the bitwise numeric operators used by the MsiEvaluateCondition function. These operators can occur between two integer values.

Operator Meaning
>< - Bitwise AND, TRUE if the left and right integers have any bits in common.
<< - True if the high 16-bits of the left integer are equal to the right integer.
>> - True if the low 16-bits of the left integer are equal to the right integer.

The following table shows the feature and component state values used by the MsiEvaluateCondition function.

Value Meaning
INSTALLSTATE_ABSENT - Feature or component not present.
INSTALLSTATE_LOCAL - Feature or component on local computer.
INSTALLSTATE_SOURCE - Feature or component run from source.
(NULL value) - No action to be taken on feature or component.

Note  These states are not set until MsiSetInstallLevel is called, either directly or by the CostFinalize action. Therefore, state checking is generally only useful for conditional expressions in an action sequence table.

QuickInfo

  Windows NT: Requires version 4.0 or later. Available as a redistributable for Windows NT 4.0.
  Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in msiquery.h.
  Import Library: Use msi.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Database Access Reference, Installer Action Functions