CPackage::GetProperty

The CPackage::GetProperty function returns a property value for the specified package.

UINT GetProperty(
UINT uPropertyId, // property number
LPTSTR lpValue, // property string value
INT uLength // property string length
);

Parameters

uPropertyId
[in] A numeric identifier which specifies the property value that is being requested.
 
One of the following values may be used:
Value Description
PACKAGE_PROPERTY_COMPANY_NAME The name of the company that has produced the package.
PACKAGE_PROPERTY_COMPANY_EMAIL The e-mail address of the company that has produced the package. It is recommended that this address use the standard Internet address format, although no restrictions are placed on the actual format of the address string.
PACKAGE_PROPERTY_COMPANY_URL The URL for the company that has produced the package.
PACKAGE_PROPERTY_PRODUCT_NAME The name of the product that this package was created for.
PACKAGE_PROPERTY_PRODUCT_VERSION The version of the product that this package was created for. The string is not restricted to numeric values and does not have to correspond to the value returned by the CPackage::GetVersion function.
PACKAGE_PROPERTY_PRODUCT_BUILD The build identifier for the version of the product that this package was created for. The build string is not restricted to numeric values and does not have to correspond to the value return by the CPackage::GetVersion function.
PACKAGE_PROPERTY_PRODUCT_URL The URL for the product that this package was created for.
PACKAGE_PROPERTY_PRODUCT_KEY The registry key under HKEY_LOCAL_MACHINE that is used to store product installation and configuration data.
PACKAGE_PROPERTY_PRODUCT_DESCRIPTION A brief description of the product.
PACKAGE_PROPERTY_PRODUCT_COPYRIGHT The copyright for this product.
PACKAGE_PROPERTY_PRODUCT_TRADEMARK The trademark for this product.
PACKAGE_PROPERTY_PRODUCT_LICENSE Licensing information for this product.
PACKAGE_PROPERTY_PRODUCT_COMMENTS Any additional information about the package.
lpValue
[out] A pointer to a buffer that will contain the requested information when the function returns; this parameter may be NULL, in which case the function will return the length of the requested information, not including the terminating null-byte.
 
uLength
[in] Specifies the maximum number of characters which may be copied into the buffer. If lpBuffer is NULL, this parameter is ignored. If lpBuffer is not NULL, and the information that has been requested is longer than the provided buffer, the function will return a value of 0.

Return Values

If the CPackage::GetProperty function succeeds, it will return the length of the property string, not including the terminating null-byte.

If the function fails, it will return a value of zero. To get extended error information, call GetLastError.

Remarks

Properties are stored as compressed string resources in the package file. The maximum length of a property value is approximately 2 billion characters.

Example

// Get the name of the product that the patch package
// was created for

LPSTR lpszCompanyName = NULL;
UINT nLength;

nLength = GetProperty(hPackage,
                      PACKAGE_PROPERTY_PRODUCT_NAME,
                      NULL, 0);

if (nLength > 0)
{
    lpszCompanyName = (LPSTR)LocalAlloc(LPTR, nLength + 1);
    GetProperty(hPackage,
                PACKAGE_PROPERTY_PRODUCT_NAME,
                lpszCompanyName,
                nLength + 1);
}

Requirements

Windows NT/2000/XP: Requires Windows NT 4.0 SP3 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Include apatch.h.
Library: Use apatch32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

CPackage::GetVersion, CPackage::SetProperty