Created
March 17, 2015 16:27
-
-
Save wldevries/0acad7476b148e31483b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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