Marek
Marek

Reputation: 496

Get application installdir by product code in c++

I have c++ console application and i want to get the msi installed application INSTALLDIR(the value where is software actually installed). I have applications product code.
What is the correct way to do this?

Upvotes: 1

Views: 549

Answers (2)

PhilDW
PhilDW

Reputation: 20780

MsiGetProductInfo for the location only if your setup has a type 51 custom action that sets ARPINSTALLLOCATION to the actual installation folder. Not all of them do.

Upvotes: 1

Marek
Marek

Reputation: 496

It seems that this code works just fine:

wchar_t installDirPrev[4096];
DWORD isBuffer = 4096;
MsiGetProductInfo(productCode, INSTALLPROPERTY_INSTALLLOCATION, installDirPrev, &isBuffer);

Upvotes: 1

Related Questions