为什么 SetupDiCallClassInstaller 函数仅限于 64 位程序? [英] Why is the SetupDiCallClassInstaller function restricted to 64 bit programs?
问题描述
尝试从以 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.
推荐答案
根据 MSDN:
32 位版本的应用程序必须检查 UpdateDriverForPlugAndPlayDevices 返回的值.如果返回值为 ERROR_IN_WOW64,则 32 位应用程序正在 64 位平台上执行,无法更新收件箱驱动程序.相反,它必须调用 CreateProcess(在 Windows SDK 文档中描述)来启动 64 位版本的应用程序.然后 64 位版本可以调用 UpdateDriverForPlugAndPlayDevices,指定一个 FullInfPath 参数来标识所有文件的 64 位版本的位置.
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.
因此看起来任何旨在报告 ERROR_IN_WOW64
的 API 都专门用于不适用于 WOW64,32 位进程必须调用 64 位进程来调用 API.
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.
这篇关于为什么 SetupDiCallClassInstaller 函数仅限于 64 位程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!