MsiGetFeatureStateW 函数 (msiquery.h)

MsiGetFeatureState 函数获取功能的请求状态。

语法

UINT MsiGetFeatureStateW(
  [in]  MSIHANDLE    hInstall,
  [in]  LPCWSTR      szFeature,
  [out] INSTALLSTATE *piInstalled,
  [out] INSTALLSTATE *piAction
);

参数

[in] hInstall

提供给 DLL 自定义操作或通过 MsiOpenPackage、MsiOpenPackageExMsiOpenProduct 获取的安装的句柄。

[in] szFeature

指定产品中的功能名称。

[out] piInstalled

指定返回的当前安装状态。 此参数不能为 null。 此参数的取值可为下列值之一:

含义
INSTALLSTATE_BADCONFIG
配置数据已损坏。
INSTALLSTATE_INCOMPLETE
安装已暂停或正在进行。
INSTALLSTATE_SOURCEABSENT
该功能必须从源运行,并且源不可用。
INSTALLSTATE_MOREDATA
返回缓冲区已满。
INSTALLSTATE_INVALIDARG
向该函数传递了无效参数。
INSTALLSTATE_UNKNOWN
指定了无法识别的产品或功能。
INSTALLSTATE_BROKEN
该功能已中断。
INSTALLSTATE_ADVERTISED
播发的功能。
INSTALLSTATE_ABSENT
该功能已卸载。
INSTALLSTATE_LOCAL
此功能已安装在本地驱动器上。
INSTALLSTATE_SOURCE
该功能必须从源、CD-ROM 或网络运行。
INSTALLSTATE_DEFAULT
该功能安装在默认位置:本地或源。

[out] piAction

接收在安装会话期间执行的操作。 此参数不能为 null。 有关返回值,请参阅 piInstalled

返回值

MsiGetFeatureState 函数返回以下值:

注解

请参阅 从程序调用数据库函数

如果函数失败,可以使用 MsiGetLastErrorRecord 获取扩展错误信息。

注意

msiquery.h 标头将 MsiGetFeatureState 定义为别名,该别名根据 UNICODE 预处理器常量的定义自动选择此函数的 ANSI 或 Unicode 版本。 将非特定编码别名的使用与非非特定编码的代码混合使用可能会导致不匹配,从而导致编译或运行时错误。 有关详细信息,请参阅 函数原型的约定

要求

要求
最低受支持的客户端 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 Installer
目标平台 Windows
标头 msiquery.h
Library Msi.lib
DLL Msi.dll

另请参阅

安装程序选择函数

将 Null 作为 Windows Installer 函数的参数传递