MsiGetProductInfoA function (msi.h)
The MsiGetProductInfo function returns product information for published and installed products.
UINT MsiGetProductInfoA( [in] LPCSTR szProduct, [in] LPCSTR szAttribute, [out] LPSTR lpValueBuf, [in, out] LPDWORD pcchValueBuf );
Specifies the product code for the product.
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.
||Support link. For more information, see the ARPHELPLINK property.|
||Support telephone. For more information, see the ARPHELPTELEPHONE property.|
||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.|
Windows Installer 4.5 and earlier: Not supported.
||Installed product name. For more information, see the ProductName property.|
||Installation location. For more information, see the ARPINSTALLLOCATION property.|
||Installation source. For more information, see the SourceDir property.|
||Local cached package.|
||Publisher. For more information, see the Manufacturer property.|
||URL information. For more information, see the ARPURLINFOABOUT property.|
||URL update information. For more information, see the ARPURLUPDATEINFO property.|
||Minor product version derived from the ProductVersion property.|
||Major product version derived from the ProductVersion property.|
||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.
|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.
|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.
|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.|
Pointer to a buffer that receives the property value. This parameter can be null.
[in, out] pcchValueBuf
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.
||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.
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.
The msi.h header defines MsiGetProductInfo as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||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.|