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
C++UINT MsiApplyPatch(
__in LPCTSTR szPatchPackage,
__in LPCTSTR szInstallPackage,
__in INSTALLTYPE eInstallType,
__in LPCTSTR szCommandLine
);
Parameters
- szPatchPackage [in]
-
A null-terminated string specifying the full path to the patch package.
- szInstallPackage [in]
-
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.
- eInstallType [in]
-
This parameter specifies the type of installation to patch.
Type of installation Meaning - INSTALLTYPE_NETWORK_IMAGE
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.
- INSTALLTYPE_DEFAULT
Searches system for products to patch. In this case, szInstallPackage must be 0.
- INSTALLTYPE_SINGLE_INSTANCE
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.
- szCommandLine [in]
-
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.
Note
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.
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. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version. |
---|---|
Header | Msi.h |
Library | Msi.lib |
DLL | Msi.dll |
Unicode and ANSI names | MsiApplyPatchW (Unicode) and MsiApplyPatchA (ANSI) |
See Also
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.