title: How to disable WOW64 file system redirection for GetModuleFileNameEx?
body: <p>I'm running the following from a 32-bit process on a 64-bit Windows 10:</p>
  
  <pre><code>#ifndef _DEBUG
      WCHAR buffPath[MAX_PATH] = {0};
      FARPROC pfn = (FARPROC)::GetModuleHandleEx;
      HMODULE hMod = NULL;
      ::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 
          GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
          (LPCTSTR)pfn, &amp;hMod);
  
      PVOID pOldVal = NULL;
      if(::Wow64DisableWow64FsRedirection(&amp;pOldVal))
      {
          ::GetModuleFileNameEx(::GetCurrentProcess(), hMod, buffPath, _countof(buffPath));
          ::Wow64RevertWow64FsRedirection(pOldVal);
  
          wprintf(L"Path=%s\n", buffPath);
      }
  #else
  #error run_in_release_mode
  #endif
  </code></pre>
  
  <p>and I'm expecting to receive the path as <code>c:\windows\syswow64\KERNEL32.DLL</code>, but it gives me:</p>
  
  <pre><code>Path=C:\Windows\System32\KERNEL32.DLL
  </code></pre>
  
  <p>Any idea why?</p>