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
C++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:
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
- 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 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 |
---|---|
Header | Msiquery.h |
Library | Msi.lib |
DLL | Msi.dll |
Unicode and ANSI names | MsiSetFeatureAttributesW (Unicode) and MsiSetFeatureAttributesA (ANSI) |
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.