To restore file system redirection, call the
function. Every successful call to the
must have a matching call to the
function. This will ensure redirection is re-enabled and frees associated system resources.
Note The Wow64DisableWow64FsRedirection
function affects all file operations performed by the current thread, which can have unintended consequences if
file system redirection is disabled for any length of time. For example, DLL loading depends on file system
redirection, so disabling file system redirection will cause DLL loading to fail. Also, many feature
implementations use delayed loading and will fail while redirection is disabled. The failure state of the initial
delay-load operation is persisted, so any subsequent use of the delay-load function will fail even after file
system redirection is re-enabled. To avoid these problems, disable file system redirection immediately before
calls to specific file I/O functions (such as CreateFile)
that must not be redirected, and re-enable file system redirection immediately afterward using
Disabling file system redirection affects only operations made by the current thread. Some functions, such as
CreateProcessAsUser, do their work on another
thread, which is not affected by the state of file system redirection in the calling thread.
In Windows 8 and Windows Server 2012, this function is supported by the following technologies.
Server Message Block (SMB) 3.0 protocol
SMB 3.0 Transparent Failover (TFO)
SMB 3.0 with Scale-out File Shares (SO)
Cluster Shared Volume File System (CsvFS)
Resilient File System (ReFS)
The following example uses
disable file system redirection so that a 32-bit application that is running under WOW64 can open the 64-bit
version of Notepad.exe in %SystemRoot%\System32 instead of being redirected
to the 32-bit version in %SystemRoot%\SysWOW64.
// Disable redirection immediately prior to the native API
// function call.
if( Wow64DisableWow64FsRedirection(&OldValue) )
// Any function calls in this block of code should be as concise
// and as simple as possible to avoid unintended results.
hFile = CreateFile(TEXT("C:\\Windows\\System32\\Notepad.exe"),
// Immediately re-enable redirection. Note that any resources
// associated with OldValue are cleaned up by this call.
if ( FALSE == Wow64RevertWow64FsRedirection(OldValue) )
// Failure to re-enable redirection should be considered
// a criticial failure and execution aborted.
// The handle, if valid, now can be used as usual, and without
// leaving redirection disabled.
if( INVALID_HANDLE_VALUE != hFile )
// Use the file handle
Minimum supported client
Windows Vista, Windows XP Professional x64 Edition [desktop apps only]
Minimum supported server
Windows Server 2008, Windows Server 2003 with SP1 [desktop apps only]