WOW64 Redirection and LoadLibrary
I'm trying to buil开发者_运维技巧d 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?
Easy, call Wow64DisableWow64FsRedirection
just before you call CreateFile
, and then call Wow64RevertWow64FsRedirection
just as soon as it is done.
精彩评论