Disables file system redirection for the calling thread. File system redirection is enabled by
default.
Syntax
BOOL WINAPI Wow64DisableWow64FsRedirection(
__out PVOID *OldValue
);
Parameters
- OldValue [out]
-
The WOW64 file system redirection value.
Return Value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is 0 (zero). To get extended error information, call
GetLastError.
Remarks
To restore file system redirection, call the
Wow64RevertWow64FsRedirection
function.
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0501 or later. For more
information, see
Using the Windows Headers.
Disabling file system redirection affects only operations made by the current thread. Some functions, such as
CreateProcessAsUser, do work on another thread
which is not affected by the state of file system redirection in the calling thread.
Examples
The following example uses
Wow64DisableWow64FsRedirection to
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.
#define _WIN32_WINNT 0x0501
#include <Windows.h>
void main()
{
PVOID OldValue;
HANDLE hFile = INVALID_HANDLE_VALUE;
BOOL bRet = Wow64DisableWow64FsRedirection (&OldValue);
if (bRet == TRUE)
{
// Open a file
hFile = CreateFile(TEXT("C:\\Windows\\System32\\Notepad.exe"),
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
// Restore the previous WOW64 file system redirection value.
Wow64RevertWow64FsRedirection (OldValue);
}
if( INVALID_HANDLE_VALUE != hFile )
{
// Use the file handle
}
}
Requirements
| Minimum supported client | Windows Vista, Windows XP Professional x64 Edition |
| Minimum supported server | Windows Server 2008, Windows Server 2003 with SP1 |
| Header | WinBase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
See Also
- File Management Functions
- File System Redirector
- Wow64EnableWow64FsRedirection
- Wow64RevertWow64FsRedirection
Send comments about this topic to Microsoft
Build date: 7/9/2009