MsiApplyPatchA function (msi.h)
For each product listed by the patch package as eligible to receive the patch, the MsiApplyPatch function invokes an installation and sets the PATCH property to the path of the patch package.
Syntax
UINT MsiApplyPatchA(
[in] LPCSTR szPatchPackage,
[in] LPCSTR szInstallPackage,
[in] INSTALLTYPE eInstallType,
[in] LPCSTR szCommandLine
);
Parameters
[in] szPatchPackage
A null-terminated string specifying the full path to the patch package.
[in] szInstallPackage
If eInstallType is set to INSTALLTYPE_NETWORK_IMAGE, this parameter is a null-terminated string that specifies a path to the product that is to be patched. The installer applies the patch to every eligible product listed in the patch package if szInstallPackage is set to null and eInstallType is set to INSTALLTYPE_DEFAULT.
If eInstallType is INSTALLTYPE_SINGLE_INSTANCE, the installer applies the patch to the product specified by szInstallPackage. In this case, other eligible products listed in the patch package are ignored and the szInstallPackage parameter contains the null-terminated string representing the product code of the instance to patch. This type of installation requires the installer running Windows Server 2003 or Windows XP.
[in] eInstallType
This parameter specifies the type of installation to patch.
Type of installation | Meaning |
---|---|
|
Specifies an administrative installation. In this case, szInstallPackage must be set to a package path. A value of 1 for INSTALLTYPE_NETWORK_IMAGE sets this for an administrative installation. |
|
Searches system for products to patch. In this case, szInstallPackage must be 0. |
|
Patch the product specified by szInstallPackage. szInstallPackage is the product code of the instance to patch. This type of installation requires the installer running Windows Server 2003 or Windows XP with SP1. For more information see, Installing Multiple Instances of Products and Patches. |
[in] szCommandLine
A null-terminated string that specifies command line property settings. See About Properties and Setting Public Property Values on the Command Line. See the Remarks section.
Return value
Value | Meaning |
---|---|
|
The function completed successfully. |
|
Patch package could not be opened. |
|
The patch package is invalid. |
|
The patch package is unsupported. |
|
See Error Codes. |
An initialization error occurred. |
Remarks
Because the list delimiter for transforms, sources, and patches is a semicolon, this character should not be used for file names or paths.
You must set the REINSTALL property on the command line when applying a small update or minor upgrade patch. Without this property, the patch is registered on the system but cannot update files. For patches that do not use a Custom Action Type 51 to automatically set the REINSTALL and REINSTALLMODE properties, the REINSTALL property must be explicitly set with the szCommandLine parameter. Set the REINSTALL property to list the features affected by the patch, or use a practical default setting of "REINSTALL=ALL". The default value of the REINSTALLMODE property is "omus". Beginning with Windows Installer version 3.0, the REINSTALL property is configured by the installer and does not need to be set on the command line.
Note
The msi.h header defines MsiApplyPatch as an alias which 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 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 |