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

发布于 2024-09-14 04:49:06 字数 308 浏览 3 评论 0原文

我已经安装了一些带有 GUID (0733556C-37E8-4123-A801-D3E6C5151617) 的 MSI。 该程序在注册表中注册: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\()

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

我的问题是:实用程序 MsiExec.exe 如何知道删除程序时要运行的文件的名称和路径?在注册表中的哪里可以找到此信息?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

满天都是小星星 2024-09-21 04:49:06

Windows 将 Windows Installer 配置信息隐藏并加密在注册表中。它不像注册表的其他部分那样可以用肉眼浏览。

要查询/修改/删除此信息,您需要使用 MSI 函数。
安装程序功能参考

对于您的特定问题,尝试使用函数 MsiGetProductInfo

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.

悲喜皆因你 2024-09-21 04:49:06

正如 William Leara 所说,这是一个简单的 C# 程序,它使用 MsiGetProductInfo 来获取磁盘上缓存的安装程序的实际位置。

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

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); 
}
安静 2024-09-21 04:49:06

您可以从命令行尝试:

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

You could try, from the command line:

wmic product where "Name like '%your software here%'" get Name, Version, PackageCode
温柔一刀 2024-09-21 04:49:06

您不需要任何软件。这适用于 Windows 10,我认为它也适用于 Windows 7。

如果您的产品代码是 0733556C-37E8-4123-A801-D3E6C5151617。
尝试找到密钥 C65533708E7332148A103D6E5C516171 (基本上是相反的)一旦找到它,浏览 InstallProperties 子项,如果不存在,请尝试查找其他结果。找到 InstallProperties 后,打开并找到 LocalPackage Key。然后您就有了安装应用程序时 MSI 保存为缓存的 msi 包的路径。

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.

素年丶 2024-09-21 04:49:06

该键映射到 HKEY_CLASSES_ROOT\Installer\Products\

That key maps to HKEY_CLASSES_ROOT\Installer\Products\.

长亭外,古道边 2024-09-21 04:49:06

我发现 Tarma Software Research 有一个免费实用程序对此很有帮助。从他们的网站获取它。

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

难如初 2024-09-21 04:49:06

这个问题的前提是误导性的,因为卸载时并没有使用注册表中的UninstallString。继续更改字符串来测试它 - 它不会使用您更改的字符串。

尽管引用注册表中的内容可能很有吸引力,但简短的答案是注册表中的 Windows Installer 数据是实现细节。问题基本上是询问 MsiConfigureProduct(....INSTALLSTATE_ABSENT...) 是如何工作的,猜测实现细节以及它可能在注册表中的位置是毫无意义的。从头到尾都是 API。发布者可能想要完成一项实际任务,但它被卸载如何工作的问题所掩盖。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文