Ejemplo n.º 1
0
        static DetourHelper()
        {
            if (Type.GetType("Mono.Runtime") != null)
            {
                Runtime = new DetourRuntimeMonoPlatform();
            }
            else
            {
                Runtime = new DetourRuntimeNETPlatform();
            }

            if (PlatformHelper.Is(Platform.ARM))
            {
                Native = new DetourNativeARMPlatform();
            }
            else
            {
                Native = new DetourNativeX86Platform();
            }

            if ((PlatformHelper.Current & Platform.Windows) == Platform.Windows)
            {
                Native = new DetourNativeWindowsPlatform(Native);
            }
            // TODO: Do Linux, macOS and other systems require protection lifting?
        }
Ejemplo n.º 2
0
        static DetourManager()
        {
            if (Type.GetType("Mono.Runtime") != null)
            {
                Runtime = new DetourRuntimeMonoPlatform();
            }
            else
            {
                Runtime = new DetourRuntimeNETPlatform();
            }

            // Detect X86 vs ARM and use the proper platform.
            typeof(object).Module.GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine);
            if (machine == (ImageFileMachine)0x01C4 /* ARM, .NET 4.5 */)
            {
                Native = new DetourNativeARMPlatform();
            }
            else
            {
                Native = new DetourNativeX86Platform();
            }

            if ((PlatformHelper.Current & Platform.Windows) == Platform.Windows)
            {
                Native = new DetourNativeWindowsPlatform(Native);
            }
            // TODO: Do Linux, macOS and other systems require protection lifting?
        }