MsiGetFeatureState Function

Windows Installer

MsiGetFeatureState Function

The MsiGetFeatureState function gets the requested state of a feature.

Syntax

C++UINT MsiGetFeatureState(
  __in   MSIHANDLE hInstall,
  __in   LPCTSTR szFeature,
  __out  INSTALLSTATE *piInstalled,
  __out  INSTALLSTATE *piAction
);

Parameters

hInstall [in]

Handle to the installation provided to a DLL custom action or obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.

szFeature [in]

Specifies the feature name within the product.

piInstalled [out]

Specifies the returned current installed state. This parameter must not be null. This parameter can be one of the following values.

Value Meaning
INSTALLSTATE_BADCONFIG

The configuration data is corrupt.

INSTALLSTATE_INCOMPLETE

The installation is suspended or in progress.

INSTALLSTATE_SOURCEABSENT

The feature must run from the source, and the source is unavailable.

INSTALLSTATE_MOREDATA

The return buffer is full.

INSTALLSTATE_INVALIDARG

An invalid parameter was passed to the function.

INSTALLSTATE_UNKNOWN

An unrecognized product or feature was specified.

INSTALLSTATE_BROKEN

The feature is broken.

INSTALLSTATE_ADVERTISED

The advertised feature.

INSTALLSTATE_ABSENT

The feature was uninstalled.

INSTALLSTATE_LOCAL

The feature was installed on the local drive.

INSTALLSTATE_SOURCE

The feature must run from the source, CD-ROM, or network.

INSTALLSTATE_DEFAULT

The feature is installed in the default location: local or source.

 

piAction [out]

Receives the action taken during the installation session. This parameter must not be null. For return values, see piInstalled.

Return Value

The MsiGetFeatureState function returns the following values:

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_SUCCESS

The function succeeded.

ERROR_UNKNOWN_FEATURE

An unknown feature was requested.

Remarks

See Calling Database Functions From Programs.

If the function fails, you can obtain extended error information by using MsiGetLastErrorRecord.

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
HeaderMsiquery.h
LibraryMsi.lib
DLLMsi.dll
Unicode and ANSI namesMsiGetFeatureStateW (Unicode) and MsiGetFeatureStateA (ANSI)

See Also

Installer Selection Functions
Passing Null as the Argument of Windows Installer Functions

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.