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>
PVOID OldValue;
HANDLE hFile = INVALID_HANDLE_VALUE;
BOOL bRet = [COLOR="Red"][B]Wow64DisableWow64FsRedirection [/B][/COLOR](&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.
[COLOR="red"][B]Wow64RevertWow64FsRedirection [/B][/COLOR](OldValue);
}
if( INVALID_HANDLE_VALUE != hFile )
{
// Use the file handle
}