Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
653 views
in Technique[技术] by (71.8m points)

winapi - SetupDiCallClassInstaller throws ERROR_IN_WOW64 when compiled for 32 bit on a 64 bit machine.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...