Expand Minimize

MsiGetProductInfo function

The MsiGetProductInfo function returns product information for published and installed products.

Syntax


UINT MsiGetProductInfo(
  _In_     LPCTSTR szProduct,
  _In_     LPCTSTR szProperty,
  _Out_    LPTSTR lpValueBuf,
  _Inout_  DWORD *pcchValueBuf
);

Parameters

szProduct [in]

Specifies the product code for the product.

szProperty [in]

Specifies the property to be retrieved.

The Required Properties are guaranteed to be available, but other properties are available only if that property is set. For more information, see Properties. The properties in the following list can be retrieved only from applications that are installed.

PropertyMeaning
INSTALLPROPERTY_HELPLINK

Support link. For more information, see the ARPHELPLINK property.

INSTALLPROPERTY_HELPTELEPHONE

Support telephone. For more information, see the ARPHELPTELEPHONE property.

INSTALLPROPERTY_INSTALLDATE

The last time this product received service. The value of this property is replaced each time a patch is applied or removed from the product or the /v Command-Line Option is used to repair the product. If the product has received no repairs or patches this property contains the time this product was installed on this computer.

INSTALLPROPERTY_INSTALLEDLANGUAGE

Installed language.

Windows Installer 4.5 and earlier:  Not supported.

INSTALLPROPERTY_INSTALLEDPRODUCTNAME

Installed product name. For more information, see the ProductName property.

INSTALLPROPERTY_INSTALLLOCATION

Installation location. For more information, see the ARPINSTALLLOCATION property.

INSTALLPROPERTY_INSTALLSOURCE

Installation source. For more information, see the SourceDir property.

INSTALLPROPERTY_LOCALPACKAGE

Local cached package.

INSTALLPROPERTY_PUBLISHER

Publisher. For more information, see the Manufacturer property.

INSTALLPROPERTY_URLINFOABOUT

URL information. For more information, see the ARPURLINFOABOUT property.

INSTALLPROPERTY_URLUPDATEINFO

URL update information. For more information, see the ARPURLUPDATEINFO property.

INSTALLPROPERTY_VERSIONMINOR

Minor product version derived from the ProductVersion property.

INSTALLPROPERTY_VERSIONMAJOR

Major product version derived from the ProductVersion property.

INSTALLPROPERTY_VERSIONSTRING

Product version. For more information, see the ProductVersion property.

 

To retrieve the product ID, registered owner, or registered company from applications that are installed, set szProperty to one of the following text string values.

ValueDescription
ProductIDThe product identifier for the product. For more information, see the ProductID property.
RegCompanyThe company registered to use this product.
RegOwnerThe owner registered to use this product.

 

To retrieve the instance type of the product, set szProperty to the following value. This property is available for advertised or installed products.

ValueDescription
InstanceTypeA missing value or a value of 0 (zero) indicates a normal product installation. A value of 1 (one) indicates a product installed using a multiple instance transform and the MSINEWINSTANCE property. Available with the installer running Windows Server 2003 or Windows XP with SP1. For more information see, Installing Multiple Instances of Products and Patches.

 

The advertised properties in the following list can be retrieved from applications that are advertised or installed.

PropertyDescription
INSTALLPROPERTY_TRANSFORMSTransforms.
INSTALLPROPERTY_LANGUAGEProduct language.
INSTALLPROPERTY_PRODUCTNAMEHuman readable product name. For more information, see the ProductName property.
INSTALLPROPERTY_ASSIGNMENTTYPEEquals 0 (zero) if the product is advertised or installed per-user.

Equals 1 (one) if the product is advertised or installed per-machine for all users.

INSTALLPROPERTY_PACKAGECODEIdentifier of the package this product was installed from. For more information, see Package Codes.
INSTALLPROPERTY_VERSIONProduct version derived from the ProductVersion property.
INSTALLPROPERTY_PRODUCTICONPrimary icon for the package. For more information, see the ARPPRODUCTICON property.
INSTALLPROPERTY_PACKAGENAMEName of the original installation package.
INSTALLPROPERTY_AUTHORIZED_LUA_APPA value of one (1) indicates a product that can be serviced by non-administrators using User Account Control (UAC) Patching. A missing value or a value of 0 (zero) indicates that least-privilege patching is not enabled. Available in Windows Installer 3.0 or later.

 

lpValueBuf [out]

Pointer to a buffer that receives the property value. This parameter can be null.

pcchValueBuf [in, out]

Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpValueBuf parameter. 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.

If lpValueBuf is null, pcchValueBuf can be null. In this case, the function checks that the property is registered correctly with the product.

Return value

ValueMeaning
ERROR_BAD_CONFIGURATION

The configuration data is corrupt.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function.

ERROR_MORE_DATA

A buffer is too small to hold the requested data.

ERROR_SUCCESS

The function completed successfully.

ERROR_UNKNOWN_PRODUCT

The product is unadvertised or uninstalled.

ERROR_UNKNOWN_PROPERTY

The property is unrecognized.

Note  The MsiGetProductInfo function returns ERROR_UNKNOWN_PROPERTY if the application being queried is advertised and not installed.

 

Remarks

When the MsiGetProductInfo function returns, the pcchValueBuf parameter contains the length of the string stored in the buffer. The count returned does not include the terminating null character. If the buffer is not large enough, MsiGetProductInfo returns ERROR_MORE_DATA and pcchValueBuf contains the size of the string, in characters, without counting the null character.

MsiGetProductInfo(INSTALLPROPERTY_LOCALPACKAGE) does not necessarily return a path to the cached package. The cached package is for internal use only. Maintenance mode installations should be invoked through the MsiConfigureFeature, MsiConfigureProduct, or MsiConfigureProductEx functions.

If you attempt to use MsiGetProductInfo to query an advertised product for a property that is only available to installed products, the function returns ERROR_UNKNOWN_PROPERTY. For example, if the application is advertised and not installed, a query for the INSTALLPROPERTY_INSTALLLOCATION property returns an error of ERROR_UNKNOWN_PROPERTY.

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

MsiGetProductInfoW (Unicode) and MsiGetProductInfoA (ANSI)

See also

Determining Installation Context
System Status Functions
Not Supported in Windows Installer 2.0 and earlier

 

 

Community Additions

ADD
Show:
© 2014 Microsoft