How to find program location in registry, if I know MSI GUID?

混江龙づ霸主 提交于 2019-12-12 10:34:51

问题


I have installed some MSI with GUID (0733556C-37E8-4123-A801-D3E6C5151617). The program registered in the registry: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ ()

Value UninstallString = MsiExec.exe / I (0733556C-37E8-4123-A801-D3E6C5151617)

My question is: how utility MsiExec.exe knows the name and path to the file you want to run when you remove programs? Where in the registry this information can be found?


回答1:


Windows keeps Windows Installer configuration information hidden and encrypted in the Registry. It is not browseable with the human eye as other parts of the Registry are.

To query/modify/delete this information, you'll need to use MSI functions.
(Installer Function Reference)

For your particular question, try the function MsiGetProductInfo.




回答2:


Here's a simple c# program that uses MsiGetProductInfo, as William Leara says, to get the actual location of the cached installer on disk.

class Program
{
    static void Main(string[] args)
    {
        Int32 len = 512;
        System.Text.StringBuilder builder = new System.Text.StringBuilder(len);
        MsiGetProductInfo("{89C098E5-C108-49F9-9B1D-10503C6D8A05}", "LocalPackage", builder, ref len);
        Console.WriteLine(builder.ToString());
        Console.ReadLine();
    }

    [DllImport("msi.dll", CharSet = CharSet.Unicode)]
    static extern Int32 MsiGetProductInfo(string product, string property, [Out] StringBuilder valueBuf, ref Int32 len); 
}



回答3:


You could try, from the command line:

wmic product where "Name like '%your software here%'" get Name, Version, PackageCode



回答4:


There is a free utility from Tarma Software Research that I found helpful for this. Get it from their website.




回答5:


You don´t need any software. This is working in Windows 10 and I think its valid for windows 7 as well.

If your Product Code is 0733556C-37E8-4123-A801-D3E6C5151617. Try to find the key C65533708E7332148A103D6E5C516171 (basically it's reversed) once you found it, browse for InstallProperties subkey, if doesn´t exists, try to find other result. Once you found InstallProperties, open and find the LocalPackage Key. And then you have the path for the msi packeage that MSI saves as Cache when you installed your application.




回答6:


The premise of this question is misleading because the UninstallString in the registry is not used when doing the uninstall. Go ahead and change the string to test this - it won't use your altered string.

Although references to stuff in the registry might be appealing, the short answer is that Windows Installer data in the registry is implementation detail. The question is basically asking how MsiConfigureProduct(....INSTALLSTATE_ABSENT...) works, and it's pointless to guess at the implementation details and where it might be in the registry. It's APIs all the way down. There might have been an actual task the poster may have wanted to accomplish, but it is masked by a question of how uninstalls work.




回答7:


That key maps to HKEY_CLASSES_ROOT\Installer\Products\.



来源:https://stackoverflow.com/questions/3475793/how-to-find-program-location-in-registry-if-i-know-msi-guid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!