MsiSetFeatureAttributesA 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 MsiSetFeatureAttributesA(
  MSIHANDLE hInstall,
  LPCSTR    szFeature,
  DWORD     dwAttributes
);

Parameters

hInstall

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

szFeature

Specifies the feature name within the product.

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.

Requirements

   
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