The TWUFindInstalledInfo function retrieves installation information for the currently installed version of a product. It uses the product's uninstall information for this purpose and will fail if the product has no uninstall information registered on the system.
The function tries the product codes from the pPackage->szProductCode and pPackage->szAltProductCodes fields in sequence. For each product code, the HKEY_CURRENT_USER hive is tried first, followed by HKEY_LOCAL_MACHINE. To be successful, the uninstall registry key for the product must contain at least one of UninstallString or QuietUninstallString. If an uninstall registry key is present but does not contain at least one of these values, the next product code is tried. If no more product codes remain, the function fails.
See TWUInstalledInfo for details about the uninstall information that is returned.
URESULT TWUFindInstalledInfo( TWUPackageData *pPackage, TWUInstalledInfo *pInfo );
function TWUFindInstalledInfo( pPackage: PTWUPackageData; var pInfo: TWUInstalledInfo ): URESULT;
[Input,output] Pointer to the package whose installed information must be retrieved. The pPackage->szProductCode or pPackage->szAltProductCodes fields must be set to the product's uninstall information registration key(s); see TWUPackageData for more information.
If the package is found on the target system, pPackage->szProductCode is set to the product code under which the installed information was found.
- [Output] Pointer to a buffer that will receive the installation information. See TWUInstalledInfo for a description. You must set pInfo->uStructSize to sizeof(TWUInstalledInfo) before calling the function. (In Delphi, this is pInfo^.uStructSize := sizeof(TWUInstalledInfo);)
If the function succeeds, it returns ERROR_SUCCESS (0). If it fails, it returns a nonzero Win32 error code. You can use TWUGetErrorMessage to retrieve the error message that corresponds to the error code.