Wow64EnableWow64FsRedirection function
Enables or disables file system redirection for the calling thread.
This function may not work reliably when there are nested calls. Therefore, this function has been replaced by the Wow64DisableWow64FsRedirection and Wow64RevertWow64FsRedirection functions.
Syntax
BOOLEAN WINAPI Wow64EnableWow64FsRedirection( _In_ BOOLEAN Wow64FsEnableRedirection );
Parameters
- Wow64FsEnableRedirection [in]
-
Indicates the type of request for WOW64 system folder redirection. If TRUE, requests redirection be enabled; if FALSE, requests redirection be disabled.
Return value
Boolean value indicating whether the function succeeded. If TRUE, the function succeeded; if FALSE, the function failed.
Remarks
This function is useful for 32-bit applications that want to gain access to the native system32 directory. By default, WOW64 file system redirection is enabled.
Wow64EnableWow64FsRedirection(TRUE).File redirection is enabled or disabled only for the thread calling this function. This 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.
| Technology | Supported |
|---|---|
|
Server Message Block (SMB) 3.0 protocol |
No |
|
SMB 3.0 Transparent Failover (TFO) |
No |
|
SMB 3.0 with Scale-out File Shares (SO) |
No |
|
Cluster Shared Volume File System (CsvFS) |
Yes |
|
Resilient File System (ReFS) |
No |
Examples
#ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif #define _WIN32_WINNT 0x0501 #ifdef NTDDI_VERSION #undef NTDDI_VERSION #endif #define NTDDI_VERSION 0x05010000 #include <Windows.h> void main() { HANDLE hFile = INVALID_HANDLE_VALUE; // Disable redirection immediately prior to the native API // function call. if( Wow64EnableWow64FsRedirection(FALSE) ) { // 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"), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); // Immediately re-enable redirection. Note that any resources // associated with OldValue are cleaned up by this call. if ( FALSE == Wow64EnableWow64FsRedirection(TRUE) ) { // Failure to re-enable redirection should be considered // a criticial failure and execution aborted. return; } } // The handle, if valid, can be used as usual without // leaving redirection disabled. if( INVALID_HANDLE_VALUE != hFile ) { // Use the file handle } }
Requirements
|
Minimum supported client |
Windows Vista [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- File Management Functions
- File System Redirector
- GetSystemWow64Directory
- Wow64DisableWow64FsRedirection
- Wow64RevertWow64FsRedirection