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.
UINT MsiGetProductInfoEx( _In_ LPCTSTR szProductCode, _In_ LPCTSTR szUserSid, _In_ MSIINSTALLCONTEXT dwContext, _In_ LPCTSTR szProperty, _Out_opt_ LPTSTR lpValue, _Inout_opt_ LPDWORD pcchValue );
- 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.
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.
- 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.
The state of the product returned in string form as "1" for advertised and "5" for installed.
The support link. For more information, see the ARPHELPLINK property.
The 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.
The installed product name. For more information, see the ProductName property.
The installation location. For more information, see the ARPINSTALLLOCATION property.
The installation source. For more information, see the SourceDir property.
The local cached package.
The publisher. For more information, see the Manufacturer property.
URL information. For more information, see the ARPURLINFOABOUT property.
The URL update information. For more information, see the ARPURLUPDATEINFO property.
The minor product version that is derived from the ProductVersion property.
The major product version that is derived from the ProductVersion property.
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.
Value Description ProductID The product identifier. For more information, see the ProductID property. RegCompany The company that is registered to use the product. RegOwner The 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.
Value Description InstanceType A 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.
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 one (1) if the product is advertised or installed per-computer for all users.
INSTALLPROPERTY_PACKAGECODE Identifier of the package that a product is installed from. For more information, see the Package Codes property. 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.
- 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.
The MsiGetProductInfoEx function returns the following values.
The calling process must have administrative privileges to get information for a product installed for a user other than the current user.
The configuration data is corrupt.
An invalid parameter is 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.
An unexpected internal failure.
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.
|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.|
Unicode and ANSI names
|MsiGetProductInfoExW (Unicode) and MsiGetProductInfoExA (ANSI)|
- Package Codes
- Required Properties
- System Status Functions
- Not Supported in Windows Installer 2.0 and earlier