4

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.

nathan
  • 4,612
  • 6
  • 32
  • 33
  • 1
    You cannot call that function from a 32-bit process. You must compile your program to target x64. – Hans Passant Dec 30 '11 at 21:51
  • @HansPassant Is there a rational behind restricting it to x64? – nathan Dec 30 '11 at 22:19
  • Yes. That's a much more interesting question then this one. Don't hesitate to start a new question. – Hans Passant Dec 30 '11 at 22:30
  • @HansPassant I created a new question! http://stackoverflow.com/questions/8685183/why-is-the-setupdicallclassinstaller-function-restricted-to-64-bit-programs – nathan Dec 30 '11 at 23:55

1 Answers1

2

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.