Exemple #1
0
        public static void Main(string[] args)
        {
            Assembly    asm  = Assembly.LoadFrom(@"TinyJitHook.Core.TestApp_x64.dll");
            MainJitHook hook = new MainJitHook(asm, IntPtr.Size == 8);

            hook.OnCompileMethod += ChangeExample;

            hook.Hook();

            asm.EntryPoint.Invoke(null, new object[] { new[] { "" } });

            hook.Unhook();

            Console.WriteLine("DONE");
            Console.ReadKey();
        }
Exemple #2
0
        public MainJitHook(Assembly asm, bool is64Bit)
        {
            Is64Bit    = is64Bit;
            EntryCount = 0;

            _instance = this;
            _compileMethodResetEvent = new AutoResetEvent(false);

            if (is64Bit)
            {
                _hookHelper = new HookHelper64(asm, HookedCompileMethod64);
            }
            else
            {
                _hookHelper = new HookHelper32(asm, HookedCompileMethod32);
            }

            _hookHelper.Hook.PrepareOriginalCompileGetter(Is64Bit);
            //Assembly.GetExecutingAssembly().PrepareMethods();

            //AppDomain.CurrentDomain.PrepareAssemblies();

            _scopeMap = AppDomain.CurrentDomain.GetScopeMap();
        }