Installer Function Referenc ...


MsiApplyMultiplePatches Function

The MsiApplyMultiplePatches function applies one or more patches to products eligible to receive the patches. The MsiApplyMultiplePatches function sets the PATCH property with a list of patches delimited by semicolons and invokes the patching of the target products. Other properties can be set using a properties list.

Syntax

C++
UINT MsiApplyMultiplePatches(
  __in      LPCTSTR szPatchPackages,
  __in_opt  LPCTSTR szProductCode,
  __in_opt  LPCTSTR szPropertiesList
);

Parameters

szPatchPackages [in]

A semicolon-delimited list of the paths to patch files as a single string. For example: ""c:\sus\download\cache\Office\sp1.msp; c:\sus\download\cache\Office\QFE1.msp; c:\sus\download\cache\Office\QFEn.msp" "

szProductCode [in, optional]

This parameter is the ProductCode GUID of the product to be patched. The user or application calling MsiApplyMultiplePatches must have privileges to apply patches. When this parameter is null, the patches are applied to all eligible products. When this parameter is non-null, the patches are applied only to the specified product.

szPropertiesList [in, optional]

A null-terminated string that specifies command–line property settings used during the patching of products. If there are no command–line property settings, pass in a NULL pointer. An empty string is an invalid parameter. These properties are shared by all target products. For more information, see About Properties and Setting Public Property Values on the Command Line.

Note  The properties list should not contain the PATCH property. If the PATCH property is set in the command line the value is ignored and is overwritten with the patches being applied.

Return Value

The MsiApplyMultiplePatches function returns the following values.

ValueMeaning
ERROR_INVALID_PARAMETER

Some arguments passed in are incorrect or contradicting.

ERROR_SUCCESS

The function completed and all products are successfully patched. ERROR_SUCCESS is returned only if all the products eligible for the patches are patched successfully. If none of the new patches are applicable, MsiApplyMultiplePatches returns ERROR_SUCCESS and product state remains unchanged.

ERROR_SUCCESS_REBOOT_INITIATED

The restart initiated by the last transaction terminated this call to MsiApplyMultiplePatches. All the target products may not have been patched.

ERROR_SUCCESS_REBOOT_REQUIRED

The restart required by the last transaction terminated this call to MsiApplyMultiplePatches. All target products may not have been patched.

ERROR_PATCH_PACKAGE_OPEN_FAILED

One of the patch packages provide could not be opened.

ERROR_PATCH_PACKAGE_INVALID

One of the patch packages provide is not a valid one.

ERROR_PATCH_PACKAGE_UNSUPPORTED

One of the patch packages is unsupported.

Any error in Winerror.h

Implies possible partial completion or that one or more transactions failed.

 

Requirements

VersionWindows 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 3.0 or later 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.
HeaderMsi.h
LibraryMsi.lib
DLLMsi.dll
Unicode and ANSI namesMsiApplyMultiplePatchesW (Unicode) and MsiApplyMultiplePatchesA (ANSI)

See Also

About Properties
Setting Public Property Values on the Command Line
PATCH
ProductCode
Multiple-Package Installations
Not Supported in Windows Installer 2.0 and earlier

Send comments about this topic to Microsoft

Build date: 11/12/2009

Tags :


Community Content

Robert Flaming - MSFT
Hex Values for Win32 error codes Published as part of Open Protocol Specifications

As a part of the Open Protocol Specifications, the hex values for Win32 error codes can now be found at http://msdn2.microsoft.com/en-us/library/cc231199.aspx.


Heath Stewart
Patches are only applied to products listed in their Template summary property
This API has a caveat where it will not apply patches that do not list the given ProductCode in their Template summary properties even if the patch's transforms do not validate the ProductCode.

For example, an MSP contains one set of MSTs and the primary MST does not set the validation bit MSITRANSFORM_VALIDATE_PRODUCT. Consequently, not all possible target ProductCodes (perhaps not all are known at build time nor needed to build a transform that would otherwise be the same for all products) are listed in the MSP's Template summary property.

As a result, passing this MSP to MsiApplyMultiplePatches() with a specific ProductCode that is not listed in the MSP's Template summary property will not apply that MSP to the product.

Is a workaround, call MsiInstallProduct() with the same ProductCode and the PATCH property set to the full path of the same MSP and patch applicability, sequencing, and supersedence will happen correctly for that product.
Tags : contentbug

dmex
vb.net syntax
<DllImport("msi.dll", CharSet:=CharSet.Unicode)> _
Public Shared Function MsiApplyMultiplePatches(ByVal szPatchPackages As String, ByVal szProductCode As String, ByVal szPropertiesList As String) As UInt32
End Function
Tags : vb.net syntax

dmex
C# syntax
[DllImport("msi.dll", CharSet=CharSet.Unicode)]
public static extern uint MsiApplyMultiplePatches(string szPatchPackages, string szProductCode, string szPropertiesList);
Tags : c# syntax

Page view tracker