The MsiGetProductInfo function returns product information for published and installed products.
Syntax
C++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.
Property Meaning - INSTALLPROPERTY_HELPLINK
Support link. For more information, see the ARPHELPLINK property.
- INSTALLPROPERTY_HELPTELEPHONE
Support telephone. For more information, see the ARPHELPTELEPHONE property.
- INSTALLPROPERTY_INSTALLDATE
Installation date.
- 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.
Value Description ProductID The product identifier for the product. For more information, see the ProductID property. RegCompany The company registered to use this product. RegOwner The 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.
Value Description InstanceType A 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.
Property Description INSTALLPROPERTY_TRANSFORMS Transforms. INSTALLPROPERTY_LANGUAGE Product language. INSTALLPROPERTY_PRODUCTNAME Human readable product name. For more information, see the ProductName property. INSTALLPROPERTY_ASSIGNMENTTYPE Equals 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_PACKAGECODE Identifier of the package this product was installed from. For more information, see Package Codes. INSTALLPROPERTY_VERSION Product version derived from the ProductVersion property. INSTALLPROPERTY_PRODUCTICON Primary icon for the package. For more information, see the ARPPRODUCTICON property. INSTALLPROPERTY_PACKAGENAME Name of the original installation package. INSTALLPROPERTY_AUTHORIZED_LUA_APP A 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
Value | Meaning |
---|---|
|
The configuration data is corrupt. |
|
An invalid parameter was passed to the function. |
|
A buffer is too small to hold the requested data. |
|
The function completed successfully. |
|
The product is unadvertised or uninstalled. |
|
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 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. |
---|---|
Header | Msi.h |
Library | Msi.lib |
DLL | Msi.dll |
Unicode and ANSI names | MsiGetProductInfoW (Unicode) and MsiGetProductInfoA (ANSI) |
See Also
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.