Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content

MsiExtractPatchXMLData function

The MsiExtractPatchXMLData function extracts information from a patch that can be used to determine if the patch applies to a target system. The function returns an XML string that can be provided to MsiDeterminePatchSequence and MsiDetermineApplicablePatches instead of the full patch file. The returned information can be used to determine whether the patch is applicable.


UINT MsiExtractPatchXMLData(
  _In_        LPCTSTR szPatchPath,
  _In_        DWORD   dwReserved,
  _Out_opt_   LPTSTR  szXMLData,
  _Inout_opt_ DWORD   *pcchXMLData


szPatchPath [in]

The full path to the patch that is being queried. Pass in as a null-terminated string. This parameter cannot be NULL.

dwReserved [in]

A reserved argument that must be 0 (zero).

szXMLData [out, optional]

A pointer to a buffer to hold the XML string that contains the extracted patch information. This buffer should be large enough to contain the received information. If the buffer is too small, the function returns ERROR_MORE_DATA and sets *pcchXMLData to the number of TCHAR in the value, not including the terminating NULL character.

If szXMLData is set to NULL and pcchXMLData is set to a valid pointer, the function returns ERROR_SUCCESS and sets *pcchXMLData to the number of TCHAR in the value, not including the terminating NULL character. The function can then be called again to retrieve the value, with szXMLData buffer large enough to contain *pcchXMLData + 1 characters.

pcchXMLData [in, out, optional]

A pointer to a variable that specifies the number of TCHAR in the szXMLData buffer. When the function returns, this parameter is set to the size of the requested value whether or not the function copies the value into the specified buffer. The size is returned as the number of TCHAR in the requested value, not including the terminating null character.

If this parameter is set to NULL, the function returns ERROR_INVALID_PARAMETER.

Return value

The MsiExtractPatchXMLData function can return the following values.

Return codeDescription

The function failed in a way that is not identified by any of the return values in this table.


An invalid parameter was passed to the function.


The value does not fit in the provided buffer.


The patch file could not be opened.


The function was successful.


The patch file could not be opened.


This error can be returned if MSXML 3.0 is not installed.



The ExtractPatchXMLData method of the Installer object uses the MsiExtractPatchXMLData function.



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 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.







Unicode and ANSI names

MsiExtractPatchXMLDataW (Unicode) and MsiExtractPatchXMLDataA (ANSI)

See also

Not Supported in Windows Installer 2.0 and earlier



Community Additions

© 2015 Microsoft