WOW64 Redirection and LoadLibrary

为君一笑 提交于 2019-12-11 14:45:03

问题


I'm trying to build a 32-bit program that can run correctly on 64-bit Windows; that is, if it needs to open a text file for the user, the file needs to not be redirected from C:\Program Files to C:\Program Files (x86). However, if I just call Wow64DisableWow64FsRedirection, then my program fails to load at all because some system libraries call LoadLibrary when portions of the GUI are loading, which tries to load a 64-bit version of a system DLL into my program.

How do I solve this problem?


Edit:

See the problem in the screenshot below:


Edit 2:

Here's another question that'll solve the problem: Is there any way to disable WOW64 redirection for an arbitrary thread in your process, or for your process as a whole?


回答1:


Easy, call Wow64DisableWow64FsRedirection just before you call CreateFile, and then call Wow64RevertWow64FsRedirection just as soon as it is done.



来源:https://stackoverflow.com/questions/4721342/wow64-redirection-and-loadlibrary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!