EN
此内容没有您的语言版本,但有英语版本。

MsiGetProductCode function

The MsiGetProductCode function returns the product code of an application by using the component code of an installed or advertised component of the application. During initialization, an application must determine under which product code it has been installed or advertised.

Syntax


UINT MsiGetProductCode(
  _In_   LPCTSTR szComponent,
  _Out_  LPTSTR lpProductBuf
);

Parameters

szComponent [in]

This parameter specifies the component code of a component that has been installed by the application. This will be typically the component code of the component containing the executable file of the application.

lpProductBuf [out]

Pointer to a buffer that receives the product code. 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

ValueMeaning
ERROR_BAD_CONFIGURATION

The configuration data is corrupt.

ERROR_INSTALL_FAILURE

The product code could not be determined.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function.

ERROR_SUCCESS

The function completed successfully.

ERROR_UNKNOWN_COMPONENT

The specified component is unknown.

 

Remarks

During initialization, an application must determine the product code under which it was installed. An application can be part of different products in different installations. For example, an application can be part of a suite of applications, or it can be installed by itself.

Requirements

Version

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.

Header

Msi.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiGetProductCodeW (Unicode) and MsiGetProductCodeA (ANSI)

See also

Application-Only Functions

 

 

社区附加资源

添加
显示:
© 2014 Microsoft