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

Installer.OpenPackage method

· 52CE 我爱测

The OpenPackage method of the Installer object opens an installer package for use with functions that access the product database and install engine, returning an Session object.

The OpenPackage method of the Installer object opens an installer package for use with functions that access the product database and install engine, returning an Session object.

Syntax

Installer.OpenPackage(
  packagePath,
  options
)

Parameters

packagePath

Required string containing the path name of the package.

options

An optional integer value that specifies whether or not OpenPackage should ignore the current computer state when creating the Session object. No value or a value of 0 for options defaults to the original behavior. When options is 1, the OpenPackage Method ignores the current computer state when opening the package. A value of 1 prevents changes to the current computer state. For more information, see MsiOpenPackageEx.

Return value

This method does not return a value.

Remarks

The OpenPackage method can accept the database handle directly instead of the string for the package path.

Note that only one Session object can be opened by a single process. OpenPackage cannot be used in a custom action because the active installation is the only session allowed.

A safe Session object ignores the current computer state when opening the package and prevents changes to the current computer state. For more information, see MsiOpenPackageEx.

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_IInstaller is defined as 000C1090-0000-0000-C000-000000000046

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)

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

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