为什么SetupDiCallClassInstaller函数仅限于64位程序?

发布于 2024-12-23 13:39:26 字数 97 浏览 4 评论 0原文

尝试从以 32 位模式编译的程序调用 SetupDiCallClassInstaller 在 64 位 Windows 上失败。

显然这是设计使然,但我想知道原因。

Attempting to call SetupDiCallClassInstaller from a program compiled in 32 bit mode fails on 64 bit Windows.

Apparently this is by design, but I'd like to know the reason.

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

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

发布评论

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

评论(2

痴者 2024-12-30 13:39:26

根据 MSDN:

64 位系统上的设备安装 :

32 位版本的应用程序必须检查 UpdateDriverForPlugAndPlayDevices 返回的值。如果返回值为 ERROR_IN_WOW64,则 32 位应用程序正在 64 位平台上执行,并且无法更新收件箱驱动程序。相反,它必须调用 CreateProcess(在 Windows SDK 文档中进行了描述)来启动 64 位版本的应用程序。然后,64 位版本可以调用 UpdateDriverForPlugAndPlayDevices,指定一个 FullInfPath 参数来标识所有文件的 64 位版本的位置。

因此,看起来任何旨在报告ERROR_IN_WOW64的API都专门不适用于WOW64,32位进程必须调用64位进程才能调用该API。

According to MSDN:

Device Installations on 64-Bit Systems:

The 32-bit version of the application must check the value returned by UpdateDriverForPlugAndPlayDevices. If the return value is ERROR_IN_WOW64, the 32-bit application is executing on a 64-bit platform and cannot update inbox drivers. Instead, it must call CreateProcess (described in the Windows SDK documentation) to start the 64-bit version of the application. The 64-bit version can then call UpdateDriverForPlugAndPlayDevices, specifying a FullInfPath parameter that identifies the location of the 64-bit versions of all files.

So it looks like any API that is designed to report ERROR_IN_WOW64 is specifically intended NOT to work in WOW64, a 32bit process has to invoke a 64bit process to call the API.

桃扇骨 2024-12-30 13:39:26

如果您从 64 位操作系统上的 32 位进程进行该调用,则会失败,因为它必须修改注册表的 64 位部分中的某些注册表项。如果您要从 64 位操作系统上的 64 位进程进行该调用,那么在 32 位操作系统上使用 32 位进程同样会成功。

If you are making that call from a 32bit process on a 64bit OS, it fails because it has to modify some registry keys in the 64bit portion of the registry. Where else if you were to make that call from a 64bit process on a 64bit OS, it would succeed likewise with 32bit process on a 32bit OS.

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