[This is preliminary documentation and subject to change.]
The MsiProvideComponent function returns the full component path, performing any necessary installation. This function prompts for source if necessary and increments the usage count for the feature.
UINT MsiProvideComponent(
LPCTSTR szProduct, // product code in case install required
LPCTSTR szFeature, // feature ID in case install required
LPCTSTR szComponent, // component ID
DWORD dwInstallMode, // the install mode
LPTSTR lpPathBuf, // returned path to component key file
DWORD *pcchPathBuf // in/out buffer character count
);
Value | Meaning |
---|---|
INSTALLMODE_DEFAULT | Provide the component, performing any installation, if necessary. |
INSTALLMODE_EXISTING | Provide the component only if the feature exists, else return ERROR_FILE_NOT_FOUND. |
combination of the REINSTALLMODE flags | Call MsiReinstallFeature to reinstall feature using this parameter for the dwReinstallMode parameter, and then provide the component. |
If lpPathBuf is NULL, pcchBuf can be NULL.
Upon success of the MsiProvideComponent function, the pcchPathBuf parameter contains the length of the string in lpPathBuf.
The MsiProvideComponent function combines the functionality of MsiUseFeature, MsiConfigureFeature, and MsiGetComponentPath. You can use the MsiProvideComponent function to simplify the calling sequence. However, because this function increments the usage count, use it with caution to prevent inaccurate usage counts. The MsiProvideComponent function also provides less flexibility than the series of individual calls.
If the application is recovering from an unexpected situation, the application has probably already called MsiUseFeature and incremented the usage count. In this case, the application should call MsiConfigureFeature instead of MsiProvideComponent to avoid incrementing the count again.
The INSTALLMODE_EXISTING option cannot be used in combination with the REINSTALLMODE flag
Windows NT: Requires version 4.0 or later. Available as a redistributable for Windows NT 4.0.
Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in msi.h.
Import Library: Use msi.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.