Skip to content

Instantly share code, notes, and snippets.

@wldevries
Created March 17, 2015 16:27
Show Gist options
  • Select an option

  • Save wldevries/0acad7476b148e31483b to your computer and use it in GitHub Desktop.

Select an option

Save wldevries/0acad7476b148e31483b to your computer and use it in GitHub Desktop.
public class Wow64RedirectDisabler : IDisposable
{
IntPtr ptr ;
public Wow64RedirectDisabler()
{
this.ptr = new IntPtr();
bool success = NativeMethods.Wow64DisableWow64FsRedirection(ref ptr);
Console.WriteLine("Disable Wow64 FS redirection success: " + success);
}
public void Dispose()
{
bool success = NativeMethods.Wow64RevertWow64FsRedirection(ptr);
Console.WriteLine("Wow64 FS redirection revert success: " + success);
}
private static class NativeMethods
{
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment