private static void Start() { MainJitHook hook = new MainJitHook(typeof(InjectionTest).Assembly, IntPtr.Size == 8); hook.OnCompileMethod += CompileMethod; hook.Hook(); }
public static void Main(string[] args) { Assembly asm = Assembly.LoadFrom(@"Amelia_dotnet4_x86_mod.exe"); MainJitHook hook = new MainJitHook(asm, IntPtr.Size == 8); hook.OnCompileMethod += ChangeExample; hook.Hook(); asm.EntryPoint.Invoke(null, new object[] {}); hook.Unhook(); Console.WriteLine("DONE"); Console.ReadKey(); }
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(); }