开发者

WOW64 Redirection and LoadLibrary

开发者 https://www.devze.com 2023-02-05 01:27 出处:网络
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:\\Progr

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:

WOW64 Redirection and LoadLibrary


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号