File:  [cleanflash] / cleanflash / CleanFlashCommon / RedirectionManager.cs
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed Oct 13 09:04:22 2021 UTC (4 years, 7 months ago) by root
Branches: UNKNWN, MAIN
CVS tags: v3400192, HEAD
cleanflash 34.0.0.192

using System;
using System.Runtime.InteropServices;

namespace CleanFlashCommon {
    public class RedirectionManager {
        
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);

        public static IntPtr DisableRedirection() {
            IntPtr redirectionPtr = (IntPtr)(-1);

            try {
                Wow64DisableWow64FsRedirection(ref redirectionPtr);
            } catch {
                // No Wow64 redirection possible.
            }

            return redirectionPtr;
        }

        public static void EnableRedirection(IntPtr redirectionPtr) {
            try {
                Wow64RevertWow64FsRedirection(redirectionPtr);
            } catch {
                // No Wow64 redirection possible.
            }
        }
    }
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.