问题
Calling SetupDiCallClassInstaller on a 64 bit machine when compiled for 32 bit returns false.
GetLastError() == ERROR_IN_WOW64
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.
回答1:
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.
来源:https://stackoverflow.com/questions/8684061/setupdicallclassinstaller-throws-error-in-wow64-when-compiled-for-32-bit-on-a-64