File System Redirector and Sysnative - how to call 64 bit program from 32 bit application

The %windir%/System32 directory is reserved for 64-bit applications. Most DLL file names were not changed when 64-bit versions of the DLLs were created, so 32-bit versions of the DLLs are stored in a different directory. WOW64 hides this difference using a file system redirector.

In most cases, whenever a 32-bit application attempts to access %windir%/System32, the access is redirected to %windir%/SysWOW64. Access to %windir%/lastgood/system32 is redirected to %windir%/lastgood/SysWOW64. Access to %windir%/regedit.exe is redirected to %windir%/SysWOW64/regedit.exe.

If the access causes the system to display the UAC prompt, redirection does not occur. Instead, the 64-bit version of the requested file is launched. To prevent this problem, either specify the SysWOW64 directory to avoid redirection and ensure access to the 32-bit version of the file, or run the 32-bit application with administrator privileges so the UAC prompt is not displayed.

Windows Server 2003 and Windows XP/2000:   UAC is not supported.

Certain subdirectories are exempt from redirection. Access to these subdirectories is not redirected to %windir%/SysWOW64:

%windir%/system32/catroot
%windir%/system32/catroot2
%windir%/system32/driverstore
%windir%/system32/drivers/etc
%windir%/system32/logfiles
%windir%/system32/spool
Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP:  %windir%/system32/driverstore is redirected.

To retrieve the name of the 32-bit system directory, 64-bit applications should use the GetSystemWow64Directory function.

Applications should use the SHGetSpecialFolderPath function to determine the %ProgramFiles% directory name.

Applications can control the WOW64 file system redirector using the Wow64DisableWow64FsRedirection, Wow64EnableWow64FsRedirection, and Wow64RevertWow64FsRedirection functions. Disabling file system redirection affects all file operations performed by the calling thread, so it should be disabled only when necessary for a single CreateFile call and re-enabled again immediately after the function returns. Disabling file system redirection for longer periods can prevent 32-bit applications from loading system DLLs, causing the applications to fail.

32-bit applications can access the native system directory by substituting %windir%/Sysnative for %windir%/System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. This mechanism is flexible and easy to use, therefore, it is the recommended mechanism to bypass file system redirection. Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one.

Windows Server 2003 and Windows XP:  The Sysnative alias was added starting with Windows Vista.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值