MsiEnumPatchesA function (msi.h)

The MsiEnumPatches function enumerates all of the patches that have been applied to a product. The function returns the patch code GUID for each patch that has been applied to the product and returns a list of transforms from each patch that apply to the product. Note that patches may have many transforms only some of which are applicable to a particular product. The list of transforms are returned in the same format as the value of the TRANSFORMS property.

Note  pcchTransformsBuf is not set to the number of characters copied to lpTransformsBuf upon a successful return of MsiEnumPatches.


UINT MsiEnumPatchesA(
  [in]      LPCSTR  szProduct,
  [in]      DWORD   iPatchIndex,
  [out]     LPSTR   lpPatchBuf,
  [out]     LPSTR   lpTransformsBuf,
  [in, out] LPDWORD pcchTransformsBuf


[in] szProduct

Specifies the product code of the product for which patches are to be enumerated.

[in] iPatchIndex

Specifies the index of the patch to retrieve. This parameter should be zero for the first call to the MsiEnumPatches function and then incremented for subsequent calls.

[out] lpPatchBuf

Pointer to a buffer that receives the patch's GUID. This argument is required.

[out] lpTransformsBuf

Pointer to a buffer that receives the list of transforms in the patch that are applicable to the product. This argument is required and cannot be Null.

[in, out] pcchTransformsBuf

Set to the number of characters copied to lpTransformsBuf upon an unsuccessful return of the function. Not set for a successful return. 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.

Return value

Value Meaning
The configuration data is corrupt.
An invalid parameter was passed to the function.
There are no patches to return.
A value was enumerated.
A buffer is too small to hold the requested data.


To enumerate patches, an application should initially call the MsiEnumPatches function with the iPatchIndex parameter set to zero. The application should then increment the iPatchIndex parameter and call MsiEnumPatches until there are no more products (until the function returns ERROR_NO_MORE_ITEMS).

If the buffer is too small to hold the requested data, MsiEnumPatches returns ERROR_MORE_DATA and pcchTransformsBuf contains the number of characters copied to lpTransformsBuf, without counting the Null character.


The msi.h header defines MsiEnumPatches 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.


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