Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MsiSetFeatureAttributes

MsiSetFeatureAttributes function

The MsiSetFeatureAttributes function can modify the default attributes of a feature at runtime. Note that the default attributes of features are authored in the Attributes column of the Feature table.

Syntax


UINT MsiSetFeatureAttributes(
  _In_ MSIHANDLE hInstall,
  _In_ LPCTSTR   szFeature,
  _In_ DWORD     dwAttributes
);

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.

dwAttributes [in]

Feature attributes specified at run time as a set of bit flags:

ConstantMeaning
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
1

Modifies default feature attributes to msidbFeatureAttributesFavorLocal at run time. See Attributes column of the Feature table for a description.

INSTALLFEATUREATTRIBUTE_FAVORSOURCE
2

Modifies default feature attributes to msidbFeatureAttributesFavorSource at run time. See Attributes column of the Feature table for a description.

INSTALLFEATUREATTRIBUTE_FOLLOWPARENT
4

Modifies default feature attributes to msidbFeatureAttributesFollowParent at run time. Note that this is not a valid attribute to be set for top-level features. See Attributes column of the Feature table for a description.

INSTALLFEATUREATTRIBUTE_FAVORADVERTISE
8

Modifies default feature attributes to msidbFeatureAttributesFavorAdvertise at run time. See Attributes column of the Feature table for a description.

INSTALLFEATUREATTRIBUTE_DISALLOWADVERTISE
16

Modifies default feature attributes to msidbFeatureAttributesDisallowAdvertise at run time. See Attributes column of the Feature table for a description.

INSTALLFEATUREATTRIBUTE_NOUNSUPPORTEDADVERTISE
32

Modifies default feature attributes to msidbFeatureAttributesNoUnsupportedAdvertise at run time. See Attributes column of the Feature table for a description.

 

Return value

ERROR_SUCCESS

The function returned successfully.

ERROR_INVALID_HANDLE

The product handle is invalid.

ERROR_UNKNOWN_FEATURE

The feature is not known.

ERROR_FUNCTION_FAILED

The function was called at an invalid time during the install, before the CostInitialize action or after the CostFinalize action.

Remarks

MsiSetFeatureAttributes must be called after CostInitialize action and before CostFinalize action. The function returns ERROR_FUNCTION_FAILED if called at any other time.

The INSTALLFEATUREATTRIBUTE_FAVORLOCAL, INSTALLFEATUREATTRIBUTE_FAVORSOURCE, and INSTALLFEATUREATTRIBUTE_FOLLOWPARENT flags are mutually exclusive. Only one of these bits can be set for any feature. If more than one of these flags is set, the behavior of that feature is undefined.

See Calling Database Functions From Programs.

Requirements

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

Header

Msiquery.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiSetFeatureAttributesW (Unicode) and MsiSetFeatureAttributesA (ANSI)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft