user1621767
user1621767

Reputation: 11

How to get the upgrade code using the MsiGetProductInfo and MsiOpenDatabase?

I have read a few posts on StackOverflow itself about getting the UpgradeCode using 2 queries. First, use MsiGetProductInfo to get the database path (how?!) to open the database which will contain the UpgradeCode. Please provide the API call to fetch the database path! Urgent.

Upvotes: 1

Views: 839

Answers (1)

saschabeaumont
saschabeaumont

Reputation: 22416

Call MsiEnumProducts to find the package code if you only know the name, then call MsiGetProductInfo with the product code to get INSTALLPROPERTY_LOCALPACKAGE property (i.e. the "database"/msi file), open the database, find UpgradeCode in the property table, done. That answers your question - but I'm not sure why you would need this in such a manner.

Upvotes: 1

Related Questions