简体   繁体   English

如果我知道MSI GUID,如何在注册表中找到程序位置?

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

I have installed some MSI with GUID (0733556C-37E8-4123-A801-D3E6C5151617). 我已经安装了一些带有GUID的MSI(0733556C-37E8-4123-A801-D3E6C5151617)。 The program registered in the registry: HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ Windows \\ CurrentVersion \\ Uninstall \\ () 在注册表中注册的程序:HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ Windows \\ CurrentVersion \\ Uninstall \\()

Value UninstallString = MsiExec.exe / I (0733556C-37E8-4123-A801-D3E6C5151617) 值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? 我的问题是:实用程序MsiExec.exe如何知道删除程序时要运行的文件的名称和路径? Where in the registry this information can be found? 在注册表中哪里可以找到这些信息?

Windows keeps Windows Installer configuration information hidden and encrypted in the Registry. Windows会在注册表中隐藏和加密Windows Installer配置信息。 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. 要查询/修改/删除此信息,您需要使用MSI功能。
( Installer Function Reference ) 安装程序功能参考

For your particular question, try the function MsiGetProductInfo . 对于您的特定问题,请尝试MsiGetProductInfo函数。

Here's a simple c# program that uses MsiGetProductInfo, as William Leara says, to get the actual location of the cached installer on disk. 这是一个简单的c#程序,使用MsiGetProductInfo,如William Leara所说,用于获取缓存安装程序在磁盘上的实际位置。

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); 
}

您可以从命令行尝试:

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

There is a free utility from Tarma Software Research that I found helpful for this. Tarma Software Research提供了一个免费的实用程序,我发现它对此有帮助。 Get it from their website . 他们的网站获取它。

You don´t need any software. 你不需要任何软件。 This is working in Windows 10 and I think its valid for windows 7 as well. 这适用于Windows 10,我认为它也适用于Windows 7。

If your Product Code is 0733556C-37E8-4123-A801-D3E6C5151617. 如果您的产品代码是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. 尝试找到密钥C65533708E7332148A103D6E5C516171(基本上它是相反的)一旦找到它,浏览InstallProperties子项,如果不存在,尝试找到其他结果。 Once you found InstallProperties, open and find the LocalPackage Key. 找到InstallProperties后,打开并找到LocalPackage密钥。 And then you have the path for the msi packeage that MSI saves as Cache when you installed your application. 然后,您将获得MSI在安装应用程序时保存为Cache的msi包的路径。

The premise of this question is misleading because the UninstallString in the registry is not used when doing the uninstall. 此问题的前提是误导,因为在执行卸载时不使用注册表中的UninstallString。 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. 尽管对注册表中的内容的引用可能很有吸引力,但简短的回答是注册表中的Windows Installer数据是实现细节。 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. 问题基本上是询问MsiConfigureProduct(.... INSTALLSTATE_ABSENT ...)是如何工作的,猜测实现细节以及它在注册表中的位置毫无意义。 It's APIs all the way down. 它的API一路下来。 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. 海报可能已经想要完成一项实际任务,但它被卸载工作的问题掩盖了。

该键映射到HKEY_CLASSES_ROOT\\Installer\\Products\\

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM