RegDBQueryKey 无法同时列出 32 位和 64 位密钥的密钥

发布于 2024-12-17 19:59:59 字数 711 浏览 4 评论 0原文

我在 InstallScript 中获取 32 位和 64 位安装的注册表项列表时遇到了问题。

我的机器是Windows Server 2008 64位。我可以在这台机器上安装SQL Server 2008 32位版本或64位版本。

现在,在安装过程中,我需要知道是否安装了任一 SQL Server 版本。

据我了解,

  • 64位机器上的64位应用程序存储在Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall中。
  • 64 位计算机上的 32 位应用程序存储在 Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall 中。

我编写了一个函数,该函数应该使用 RegDBQueryKey 函数在这两个位置搜索 SQL Server 安装。

即使我将 "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall" 传递给 RegDBQueryKey,它也会列出 Software\\Wow6432Node\\ 的键Microsoft\\Windows\\CurrentVersion\\Uninstall

谁能帮我解决这个问题吗?

I have been facing a problem in InstallScript to get the list of registry keys for 32- and 64-bit installations.

My machine is Windows Server 2008 64-bit. I can install the SQL Server 2008 32-bit version or 64-bit version on this machine.

Now during the setup I need to know whether either of the SQL Server versions are installed.

As per my understanding,

  • 64-bit applications on 64-bit machine are stored in Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall.
  • 32-bit applications on 64-bit machine are stored in Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall.

I have written a function which should search both these locations for SQL Server installation using the RegDBQueryKey function.

Even if I pass "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall" to RegDBQueryKey, it lists the keys of Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall.

Can anyone help me with this issue?

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

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

发布评论

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

评论(1

自找没趣 2024-12-24 19:59:59

在调用 RegDBQueryKey 之前设置此标志:

REGDB_OPTIONS = REGDB_OPTION_WOW64_64KEY;

这将禁用默认转发到密钥的 64 位版本,并为您提供 32 位版本。它适用于全局,因此完成后请确保使用以下命令重置标志:

REGDB_OPTIONS = REGDB_OPTION_USE_DEFAULT_OPTIONS;

Set this flag before your call to RegDBQueryKey:

REGDB_OPTIONS = REGDB_OPTION_WOW64_64KEY;

That will disable the default forwarding to the 64-bit version of the key, and give you the 32-bit version. It applies globally, so when you're done make sure to reset the flag using:

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