大网数据广告活动
安装更新与部署

Session object (Windows Installer)

· 52CE 我爱测

The Session object controls the installation process.

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.

Members

The Session object has these types of members:

Methods

The Session object has these 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 has these properties.

Property Access type Description
ComponentCosts Returns a RecordList object enumerating the disk space per drive required to install a component.
ComponentCurrentState Returns the current installed state of the designated component.
ComponentRequestState Obtains or requests a change in the Action state of a row in the Component table.
Database Returns the database for the current installation session.
FeatureCost 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 Returns the current installed state of the designated feature.
FeatureRequestState Read/write Obtains or requests a change in the Select state of a feature's record and subrecords.
FeatureValidStates Returns an integer representing bit flags with each relevant bit representing a valid installation state for the specified feature.
Installer Returns the active installer object.
Language (Session Object) Represents the numeric language identifier used by the current installation session.
Mode This property is a value representing the designated mode flag for the current installation session.
ProductProperty Represents the string value of a named installer property.
Property (Session Object) Read/write Retrieves product properties from the product database.
SourcePath Provides the full path to the designated folder on the source media or server image.
TargetPath Read/write Provides the full path to the designated folder on the installation target drive.
VerifyDiskSpace Returns true if enough disk space exists, and false if the disk is full.

Requirements

Requirement Value
Version Windows Installer 5.0 on Windows Server 2012, Windows 8, 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 or Windows XP
DLL Msi.dll
IID IID_ISession is defined as 000C109E-0000-0000-C000-000000000046

See also

Windows Installer Scripting Examples

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。