Patch 对象

Patch 对象表示已注册或应用的补丁的唯一实例。

该对象可使用 Patch 属性实例化为“WindowsInstaller.Installer.Patch(PatchCode, ProductCode, UserSid, Context)”。 对于计算机上下文,UserSid 参数必须为空字符串。 对于仅注册但尚未应用到任何产品的补丁,可以将 ProductCode 设置为空字符串。 仅在读取或更新补丁的源列表信息时,可以将 ProductCode 设置为空字符串。

成员

Patch 对象包含以下类型的成员:

方法

Patch 对象包含以下方法。

方法 说明
SourceListAddMediaDisk 将磁盘添加到已注册的磁盘集中。
SourceListAddSource 将网络或 URL 源添加到源列表。
SourceListClearAll 清除指定类型的源的完整源列表。
SourceListClearMediaDisk 从源列表中的已注册磁盘集中移除磁盘。
SourceListClearSource 从源列表中移除网络或 URL 源。
SourceListForceResolution 从源列表中清除最后使用的源。 这将在下次需要源时强制进行源列表解析。

 

属性

Patch 对象包含以下属性。

属性 说明
上下文
此补丁实例的上下文是 MSIINSTALLCONTEXT 值。
MediaDisks
枚举此补丁实例的所有媒体磁盘。
PatchCode
返回补丁代码。
PatchProperty
获取有关应用于特定产品实例的特定补丁的属性信息。
ProductCode
返回产品代码。
SourceListInfo
获取和设置源信息属性。 这是一个读取或写入属性。

枚举此补丁实例的所有源。
State
补丁的安装状态。
UserSid
在此补丁实例可用的帐户下返回用户 SID。

 

要求

要求
版本
Windows Server 2012、Windows 8、Windows Server 2008 R2 或 Windows 7 上的 Windows Installer 5.0。 Windows Server 2008 或 Windows Vista 上的 Windows Installer 4.0 或 Windows Installer 4.5。 Windows Server 2003、Windows XP 和 Windows 2000 上的 Windows Installer 3.0 或更高版本
DLL
Msi.dll
IID
IID_IPatch 定义为 000C10A1-0000-0000-C000-000000000046

另请参阅

Windows Installer 脚本编写示例