So I have a project that installs with an MSI, and I need to be able to get it's install directory later on from somewhere else.
This works:
int a = 512;
StringBuilder sb2 = new StringBuilder(a);
MsiGetProductInfo("{2E2C2AD2-6F72-44D4-925B-4F6130A241D8}", "InstallSource", sb2, ref a);
Console.Write(sb2.ToString());
Console.ReadLine();
and returns the path to the MSI I used to install it. But when I sub in InstallLocation, I just get back nothing as a result. What am I doing wrong?
I found the place in the registry where all this data is coming from: hklm\software\microsoft\windows\currentversion\installer\userdata\s-1-5-18\products\myguid\
The InstallLocation is blank. That doesn't make any sense, because I just installed it and It obviously installed somewhere (The default location)
Or does default location just mean a blank entry for InstallLocation?
Question
Linkinfamous
Hi.
So I have a project that installs with an MSI, and I need to be able to get it's install directory later on from somewhere else.
This works:
int a = 512; StringBuilder sb2 = new StringBuilder(a); MsiGetProductInfo("{2E2C2AD2-6F72-44D4-925B-4F6130A241D8}", "InstallSource", sb2, ref a); Console.Write(sb2.ToString()); Console.ReadLine();and returns the path to the MSI I used to install it. But when I sub in InstallLocation, I just get back nothing as a result. What am I doing wrong?
I found the place in the registry where all this data is coming from: hklm\software\microsoft\windows\currentversion\installer\userdata\s-1-5-18\products\myguid\
The InstallLocation is blank. That doesn't make any sense, because I just installed it and It obviously installed somewhere (The default location)
Or does default location just mean a blank entry for InstallLocation?
Link to comment
https://www.neowin.net/forum/topic/569064-get-install-directory-from-msi-guid/Share on other sites
5 answers to this question
Recommended Posts