MsiEnumRelatedProducts Function

Windows Installer

MsiEnumRelatedProducts Function

The MsiEnumRelatedProducts function enumerates products with a specified upgrade code. This function lists the currently installed and advertised products that have the specified UpgradeCode property in their Property table.

Syntax

C++UINT MsiEnumRelatedProducts(
  __in   LPCTSTR lpUpgradeCode,
  __in   DWORD dwReserved,
  __in   DWORD iProductIndex,
  __out  LPTSTR lpProductBuf
);

Parameters

lpUpgradeCode [in]

The null-terminated string specifying the upgrade code of related products that the installer is to enumerate.

dwReserved [in]

This parameter is reserved and must be 0.

iProductIndex [in]

The zero-based index into the registered products.

lpProductBuf [out]

A buffer to receive the product code GUID. This buffer must be 39 characters long. The first 38 characters are for the GUID, and the last character is for the terminating null character.

Return Value

Value Meaning
ERROR_BAD_CONFIGURATION

The configuration data is corrupt.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function.

ERROR_NO_MORE_ITEMS

There are no products to return.

ERROR_NOT_ENOUGH_MEMORY

The system does not have enough memory to complete the operation. Available starting with Windows Server 2003.

ERROR_SUCCESS

A value was enumerated.

 

Remarks

See UpgradeCode property.

To enumerate currently installed and advertised products that have a specific upgrade code, an application should initially call the MsiEnumRelatedProducts function with the iProductIndex parameter set to zero. The application should then increment the iProductIndex parameter and call MsiEnumRelatedProducts until the function returns ERROR_NO_MORE_ITEMS, which means there are no more products with the specified upgrade code.

When making multiple calls to MsiEnumRelatedProducts to enumerate all of the related products, each call should be made from the same thread.

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 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 namesMsiEnumRelatedProductsW (Unicode) and MsiEnumRelatedProductsA (ANSI)

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.