问题描述
在为32位编译时在64位计算机上调用SetupDiCallClassInstaller返回false。
Calling SetupDiCallClassInstaller on a 64 bit machine when compiled for 32 bit returns false.
GetLastError() == ERROR_IN_WOW64
所有其他函数调用在32bit下都可以正常工作,只是这个给我带来了问题。
All the other function calls work fine under 32bit, just this one is giving me problems.
我想知道是否有人知道我在这里做错了什么。
I'm wondering if anyone knows what I am doing wrong here.
推荐答案
正如汉斯·帕森特(Hans Passant)指出的那样,您不能从64位的32位进程中调用该函数。位Windows平台。无论如何尝试这样做,都会得到ERROR_IN_WOW64。
之所以不能执行此操作,是因为您的32位进程调用了32位版本的API。在64位平台上,此API在WoW64 Windows子系统中运行()。某些方法(如SetupDiCallClassInstaller)在此子系统内不可用。当您尝试调用它们时,会出现ERROR_IN_WOW64。应用程序应直接调用API的64位版本。实现此目的的一种方法是针对64位平台重新编译应用程序。
As Hans Passant pointed as a comment to the question, you cannot call that function from a 32-bit process on a 64-bit Windows platform. When you try to do so anyway, you get an ERROR_IN_WOW64.The reason why you can't do this is that your 32-bit process invokes the 32-bit version of the API. On a 64-bit platform, this API is running in the WoW64 windows subsystem (https://en.wikipedia.org/wiki/WoW64). Some methods like SetupDiCallClassInstaller are not available within this subsystem. When you try to invoke them, an ERROR_IN_WOW64 occurs. The application should invoke the 64-bit version of the API directly instead. One way to achieve this is to recompile your application targetting the 64-bit platform.
这篇关于在64位计算机上为32位编译时,SetupDiCallClassInstaller引发ERROR_IN_WOW64。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!