MsiRemovePatches Function

Windows Installer

MsiRemovePatches Function

The MsiRemovePatches function removes one or more patches from a single product. To remove a patch from multiple products, MsiRemovePatches must be called for each product.

Syntax

C++UINT MsiRemovePatches(
  __in      LPCTSTR szPatchList,
  __in      LPCTSTR szProductCode,
  __in      INSTALLTYPE eUninstallType,
  __in_opt  LPCTSTR szPropertyList
);

Parameters

szPatchList [in]

A null-terminated string that represents the list of patches to remove. Each patch can be specified by the GUID of the patch or the full path to the patch package. The patches in the list are delimited by semicolons.

szProductCode [in]

A null-terminated string that is the ProductCode (GUID) of the product from which the patches are removed. This parameter cannot be NULL.

eUninstallType [in]

Value that indicates the type of patch removal to perform. This parameter must be INSTALLTYPE_SINGLE_INSTANCE.

Value Meaning
INSTALLTYPE_SINGLE_INSTANCE

The patch is uninstalled for only the product specified by szProduct.

 

szPropertyList [in, optional]

A null-terminated string that specifies command-line property settings. For more information see About Properties and Setting Public Property Values on the Command Line. This parameter can be NULL.

Return Value

The MsiRemovePatches function returns the following values.

Value Meaning
ERROR_INVALID_PARAMETER

An invalid parameter was included.

ERROR_PATCH_PACKAGE_OPEN_FAILED

The patch package could not be opened.

ERROR_SUCCESS

The patch was successfully removed.

ERROR_UNKNOWN_PRODUCT

The product specified by szProductList is not installed either per-machine or per-user for the caller of MsiRemovePatches.

ERROR_PATCH_PACKAGE_OPEN_FAILED

The patch package could not be opened.

ERROR_PATCH_PACKAGE_INVALID

The patch package is invalid.

ERROR_PATCH_PACKAGE_UNSUPPORTED

The patch package cannot be processed by this version of the Windows Installer service.

ERROR_PATCH_REMOVAL_UNSUPPORTED

The patch package is not removable.

ERROR_UNKNOWN_PATCH

The patch has not been applied to this product.

ERROR_PATCH_REMOVAL_DISALLOWED

Patch removal was disallowed by policy.

 

Remarks

Windows Installer 2.0:  Not supported. The MsiRemovePatches function is available beginning with Windows Installer 3.0.

See Uninstalling Patches for an example that demonstrates how an application can remove a patch from all products that are available to the user.

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 and 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 namesMsiRemovePatchesW (Unicode) and MsiRemovePatchesA (ANSI)

See Also

Removing Patches
Uninstalling Patches
About Properties
Setting Public Property Values on the Command Line
MsiApplyPatch
ProductCode
Multiple-Package Installations

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.