MsiProvideAssemblyW function (msi.h)
The MsiProvideAssembly function returns the full path to a Windows Installer component that contains an assembly. The function prompts for a source and performs any necessary installation. MsiProvideAssembly increments the usage count for the feature.
Syntax
UINT MsiProvideAssemblyW(
[in] LPCWSTR szAssemblyName,
[in] LPCWSTR szAppContext,
[in] DWORD dwInstallMode,
[in] DWORD dwAssemblyInfo,
[out] LPWSTR lpPathBuf,
[in, out] LPDWORD pcchPathBuf
);
Parameters
[in] szAssemblyName
The assembly name as a string.
[in] szAppContext
Set to null for global assemblies. For private assemblies, set szAppContext to the full path of the application configuration file or to the full path of the executable file of the application to which the assembly has been made private.
[in] dwInstallMode
Defines the installation mode. This parameter can be one of the following values.
Value | Meaning |
---|---|
|
Provide the component and perform any installation necessary to provide the component. If the key file of a component in the requested feature, or a feature parent, is missing, reinstall the feature using MsiReinstallFeature with the following flag bits set: REINSTALLMODE_FILEMISSING, REINSTALLMODE_FILEOLDERVERSION, REINSTALLMODE_FILEVERIFY, REINSTALLMODE_MACHINEDATA, REINSTALLMODE_USERDATA and REINSTALLMODE_SHORTCUT. |
|
Provide the component only if the feature exists. Otherwise return ERROR_FILE_NOT_FOUND.
This mode verifies that the key file of the component exists. |
|
Provide the component only if the feature exists. Otherwise return ERROR_FILE_NOT_FOUND.
This mode only checks that the component is registered and does not verify that the key file of the component exists. |
|
Provide the component only if the feature's installation state is INSTALLSTATE_LOCAL. If the feature installation state is INSTALLSTATE_SOURCE, return ERROR_INSTALL_SOURCE_ABSENT. Otherwise return ERROR_FILE_NOT_FOUND. This mode only checks that the component is registered and does not verify that the key file exists. |
|
Provide the component if a feature exists from any installed product. Otherwise return ERROR_FILE_NOT_FOUND. This mode only checks that the component is registered and does not verify that the key file of the component exists. This flag is similar to the INSTALLMODE_NODETECTION flag except that with this flag we check for any product that has installed the assembly as opposed to the last product as is the case with the INSTALLMODE_NODETECTION flag. This flag can only be used with MsiProvideAssembly. |
|
Call MsiReinstallFeature to reinstall feature using this parameter for the dwReinstallMode parameter, and then provide the component. |
[in] dwAssemblyInfo
Assembly information and assembly type. Set to one of the following values.
Value | Meaning |
---|---|
|
.NET Assembly |
|
Win32 Assembly |
[out] lpPathBuf
Pointer to a variable that receives the path to the component. This parameter can be null.
[in, out] pcchPathBuf
Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpPathBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. If the buffer passed in is too small, the count returned does not include the terminating null character.
If lpPathBuf is null, pcchPathBuf can be null.
Return value
Value | Meaning |
---|---|
|
The configuration data is corrupt. |
|
The feature is absent or broken. This error is returned for dwInstallMode = INSTALLMODE_EXISTING. |
|
The installation failed. |
|
The component being requested is disabled on the computer. |
|
An invalid parameter was passed to the function. |
|
The function completed successfully. |
|
The feature ID does not identify a known feature. |
|
The component ID does not specify a known component. |
|
The product code does not identify a known product. |
|
An unrecognized product or a feature name was passed to the function. |
|
The buffer overflow is returned. |
|
The system does not have enough memory to complete the operation. Available with Windows Server 2003. |
|
Unable to detect a source. |
For more information, see Displayed Error Messages.
Remarks
When the MsiProvideAssembly function succeeds, the pcchPathBuf parameter contains the length of the string in lpPathBuf.
The INSTALLMODE_EXISTING option cannot be used in combination with the REINSTALLMODE flag.
Features with components that contain a corrupted file or the wrong version of a file must be explicitly reinstalled by the user, or by having the application call MsiReinstallFeature.
Note
The msi.h header defines MsiProvideAssembly 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. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version. |
Target Platform | Windows |
Header | msi.h |
Library | Msi.lib |
DLL | Msi.dll |