Why is the SetupDiCallClassInstaller function restricted to 64 bit programs?

后端 未结 2 597
不知归路
不知归路 2021-01-12 12:42

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

2条回答
  •  醉酒成梦
    2021-01-12 13:23

    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.

提交回复
热议问题