Why is the SetupDiCallClassInstaller function restricted to 64 bit programs?
Asked Answered
W

2

9

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.

Whistling answered 30/12, 2011 at 23:54 Comment(3)
Hi, I face the same issue with "SetupDiCallClassInstaller" in windows 7, 64-bit machine. Can you tell what is the solution for this?Headrest
@Headrest Any luck with getting this one figured out?Underskirt
Microsoft simply didn't implement the 32-bit version of it, the one that could run in the Wow64 emulator in which 32-bit processes run. Whether that is a todo item or a technical restriction isn't clear, I vote for the latter.Inalienable
F
3

According to MSDN:

Device Installations on 64-Bit Systems:

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.

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.

Ferdinana answered 8/8, 2014 at 17:50 Comment(0)
R
-1

If you are making that call from a 32bit process on a 64bit OS, it fails because it has to modify some registry keys in the 64bit portion of the registry. Where else if you were to make that call from a 64bit process on a 64bit OS, it would succeed likewise with 32bit process on a 32bit OS.

Rigby answered 8/8, 2014 at 16:23 Comment(1)
A 32bit process can access the 64bit registry via the KEY_WOW64_64KEY flag when opening/creating a key, so that should not be the limiting factor of why the API does not work in WOW64, unless that is an oversight on Microsoft's part and they simply haven't enabled the API to use that flag yet.Ferdinana

© 2022 - 2024 — McMap. All rights reserved.