MsiSetFeatureAttributesW function (msiquery.h)

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 MsiSetFeatureAttributesW(
  [in] MSIHANDLE hInstall,
  [in] LPCWSTR   szFeature,
  [in] DWORD     dwAttributes
);

Parameters

[in] hInstall

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

[in] szFeature

Specifies the feature name within the product.

[in] dwAttributes

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

Constant Meaning
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

This function returns UINT.

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.

Note

The msiquery.h header defines MsiSetFeatureAttributes as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client 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
Target Platform Windows
Header msiquery.h
Library Msi.lib
DLL Msi.dll