Session Object

Windows Installer

Session Object

The Session object controls the installation process. It opens the Installer database, which contains the installation tables and data. This object is associated with a standard set of action functions, each performing particular operations on data from one or more tables. Additional custom actions may be added for particular product installations. The basic engine function is a sequencer that fetches sequential records from a designated sequence table, evaluates any specified condition expression, and executes the designated action. Actions not recognized by the engine are deferred to the UI handler object for processing, usually dialog box sequences.

Note that only one Session object can be opened by a single process.

Methods

The Session object defines the following methods.

Method Description

DoAction

Executes the specified action.

EvaluateCondition

Evaluates a logical expression containing symbols and values and returns an integer of the enumeration msiEvaluateConditionErrorEnum.

FeatureInfo

Returns a FeatureInfo object containing descriptive information for the specified feature.

FormatRecord

Returns a formatted string from template and record data.

Message

Performs any enabled logging operations and defers execution to the UI handler object associated with the engine.

Sequence

Opens a query on the specified table, ordering the actions by the numbers in the Sequence column. For each row fetched, the DoAction method is called, provided that any supplied condition expression does not evaluate to False.

SetInstallLevel

Sets the install level for the current installation to a specified value and recalculates the Select and Installed states for all features.

 

Properties

The Session object defines the following properties.

Property Access type Description

ComponentCosts

Read-only

Returns a RecordList object enumerating the disk space per drive required to install a component.

ComponentCurrentState

Read-only

Returns the current installed state of the designated component.

ComponentRequestState

Read-only

Obtains or requests a change in the Action state of a row in the Component table.

Database

Read-only

Returns the database for the current installation session.

FeatureCost

Read-only

Returns the total amount of disk space (in units of 512 bytes) required by the specified feature and its parent features (up to the root of the Feature table).

FeatureCurrentState

Read-only

Returns the current installed state of the designated feature.

FeatureRequestState

Read-only

Obtains or requests a change in the Select state of a feature's record and subrecords.

FeatureValidStates

Read-only

Returns an integer representing bit flags with each relevant bit representing a valid installation state for the specified feature.

Installer

Read-only

Returns the active installer object.

Language (Session Object)

Read-only

Represents the numeric language identifier used by the current installation session.

Mode

Read-only

This property is a value representing the designated mode flag for the current installation session.

ProductProperty

Read-only

Represents the string value of a named installer property.

Property (Session Object)

Read-only

Retrieves product properties from the product database.

SourcePath

Read-only

Provides the full path to the designated folder on the source media or server image.

TargetPath

Read-only

Provides the full path to the designated folder on the installation target drive.

VerifyDiskSpace

Read-only

Returns true if enough disk space exists, and false if the disk is full.

 

Requirements

VersionWindows Installer 5.0 on Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003, Windows XP, and Windows 2000
DLLMsi.dll
IIDIID_ISession is defined as 000C109E-0000-0000-C000-000000000046

See Also

Windows Installer Scripting Examples

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.