Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

MsiGetProductInfoEx function

The MsiGetProductInfoEx function returns product information for advertised and installed products. This function can retrieve information about an instance of a product that is installed under a user account other than the current user.

The calling process must have administrative privileges for a user who is different from the current user. The MsiGetProductInfoEx function cannot query an instance of a product that is advertised under a per-user-unmanaged context for a user account other than the current user.

This function is an extension of the MsiGetProductInfo function.

Syntax


UINT MsiGetProductInfoEx(
  _In_         LPCTSTR szProductCode,
  _In_         LPCTSTR szUserSid,
  _In_         MSIINSTALLCONTEXT dwContext,
  _In_         LPCTSTR szProperty,
  _Out_opt_    LPTSTR lpValue,
  _Inout_opt_  LPDWORD pcchValue
);

Parameters

szProductCode [in]

The ProductCode GUID of the product instance that is being queried.

szUserSid [in]

The security identifier (SID) of the account under which the instance of the product that is being queried exists. A NULL specifies the current user SID.

SIDMeaning
NULL

The currently logged-on user.

User SID

The enumeration for a specific user in the system. An example of user SID is "S-1-3-64-2415071341-1358098788-3127455600-2561".

 

Note  The special SID string s-1-5-18 (system) cannot be used to enumerate products installed as per-machine. If dwContext is MSIINSTALLCONTEXT_MACHINE, szUserSid must be NULL.

dwContext [in]

The installation context of the product instance that is being queried.

NameMeaning
MSIINSTALLCONTEXT_USERMANAGED

Retrieves the product property for the per–user–managed instance of the product.

MSIINSTALLCONTEXT_USERUNMANAGED

Retrieves the product property for the per–user–unmanaged instance of the product.

MSIINSTALLCONTEXT_MACHINE

Retrieves the product property for the per-machine instance of the product.

 

szProperty [in]

Property being queried.

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

PropertyMeaning
INSTALLPROPERTY_PRODUCTSTATE

The state of the product returned in string form as "1" for advertised and "5" for installed.

INSTALLPROPERTY_HELPLINK

The support link. For more information, see the ARPHELPLINK property.

INSTALLPROPERTY_HELPTELEPHONE

The 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

The installed product name. For more information, see the ProductName property.

INSTALLPROPERTY_INSTALLLOCATION

The installation location. For more information, see the ARPINSTALLLOCATION property.

INSTALLPROPERTY_INSTALLSOURCE

The installation source. For more information, see the SourceDir property.

INSTALLPROPERTY_LOCALPACKAGE

The local cached package.

INSTALLPROPERTY_PUBLISHER

The publisher. For more information, see the Manufacturer property.

INSTALLPROPERTY_URLINFOABOUT

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

INSTALLPROPERTY_URLUPDATEINFO

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

INSTALLPROPERTY_VERSIONMINOR

The minor product version that is derived from the ProductVersion property.

INSTALLPROPERTY_VERSIONMAJOR

The major product version that is derived from the ProductVersion property.

INSTALLPROPERTY_VERSIONSTRING

The 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 more information, see the ProductID property.
RegCompanyThe company that is registered to use the product.
RegOwnerThe owner who is registered to use the 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 one (1) indicates a product installed using a multiple instance transform and the MSINEWINSTANCE property. Available with the Windows Installer running Windows Server 2003 or Windows XP with SP1. For more information, see Installing Multiple Instances of Products and Patches.

 

The properties in the following table can be retrieved from applications that are advertised or installed. These properties cannot be retrieved for product instances that are installed under a per-user-unmanaged context for user accounts other than current user account.

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 one (1) if the product is advertised or installed per-computer for all users.

INSTALLPROPERTY_PACKAGECODEIdentifier of the package that a product is installed from. For more information, see the Package Codes property.
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.

 

lpValue [out, optional]

A pointer to a buffer that receives the property value. This buffer should be large enough to contain the information. If the buffer is too small, the function returns ERROR_MORE_DATA and sets *pcchValue to the number of TCHAR in the value, not including the terminating NULL character.

If lpValue is set to NULL and pcchValue is set to a valid pointer, the function returns ERROR_SUCCESS and sets *pcchValue 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 lpValue buffer large enough to contain *pcchValue + 1 characters.

If lpValue and pcchValue are both set to NULL, the function returns ERROR_SUCCESS if the value exists, without retrieving the value.

pcchValue [in, out, optional]

A pointer to a variable that specifies the number of TCHAR in the lpValue 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.

This parameter can be set to NULL only if lpValue is also NULL. Otherwise, the function returns ERROR_INVALID_PARAMETER.

Return value

The MsiGetProductInfoEx function returns the following values.

Return codeDescription
ERROR_ACCESS_DENIED

The calling process must have administrative privileges to get information for a product installed for a user other than the current user.

ERROR_BAD_CONFIGURATION

The configuration data is corrupt.

ERROR_INVALID_PARAMETER

An invalid parameter is 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.

ERROR_FUNCTION_FAILED

An unexpected internal failure.

 

Remarks

When the MsiGetProductInfoEx function returns, the pcchValue parameter contains the length of the string that is stored in the buffer. The count returned does not include the terminating null character. If the buffer is not big enough, MsiGetProductInfoEx returns ERROR_MORE_DATA, and the pcchValue parameter contains the size of the string, in TCHAR, without counting the null character.

The MsiGetProductInfoEx function (INSTALLPROPERTY_LOCALPACKAGE) returns a path to the cached package. The cached package is for internal use only. Maintenance mode installations must be invoked through the MsiConfigureFeature, MsiConfigureProduct, or MsiConfigureProductEx functions.

The MsiGetProductInfo function returns ERROR_UNKNOWN_PROPERTY if the application being queried is advertised and not installed. For example, if the application is advertised and not installed, a query for INSTALLPROPERTY_INSTALLLOCATION 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 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.

Header

Msi.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiGetProductInfoExW (Unicode) and MsiGetProductInfoExA (ANSI)

See also

ARPHELPLINK
ARPHELPTELEPHONE
ARPINSTALLLOCATION
ARPPRODUCTICON
ARPURLINFOABOUT
ARPURLUPDATEINFO
Manufacturer
Package Codes
ProductID
ProductName
ProductVersion
Properties
Required Properties
SourceDir
System Status Functions
MsiConfigureFeature
MsiConfigureProduct
MsiConfigureProductEx
ProductCode
Not Supported in Windows Installer 2.0 and earlier

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.