|
|
1.1 ! root 1: using System; ! 2: using System.Runtime.InteropServices; ! 3: ! 4: namespace CleanFlashCommon { ! 5: public class RedirectionManager { ! 6: ! 7: [DllImport("kernel32.dll", SetLastError = true)] ! 8: static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr); ! 9: ! 10: [DllImport("kernel32.dll", SetLastError = true)] ! 11: static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr); ! 12: ! 13: public static IntPtr DisableRedirection() { ! 14: IntPtr redirectionPtr = (IntPtr)(-1); ! 15: ! 16: try { ! 17: Wow64DisableWow64FsRedirection(ref redirectionPtr); ! 18: } catch { ! 19: // No Wow64 redirection possible. ! 20: } ! 21: ! 22: return redirectionPtr; ! 23: } ! 24: ! 25: public static void EnableRedirection(IntPtr redirectionPtr) { ! 26: try { ! 27: Wow64RevertWow64FsRedirection(redirectionPtr); ! 28: } catch { ! 29: // No Wow64 redirection possible. ! 30: } ! 31: } ! 32: } ! 33: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.