コード例 #1
0
        private Patch PatchJNZ(ProcessDebugger dbg)
        {
            dbg.Start(SimpleCrackMe);
            RVA mainRVA = dbg.SymbolManager.FromName("SimpleCrackMe.exe", "main").RVA; //new RVA(0x113D0);
            RVA jnzRVA  = new RVA(0x113F2);                                            // mainRVA + 0x22;

            dbg.Wait.NextEvent();
            Breakpoint breakPoint = dbg.Breakpoints.At("SimpleCrackMe.exe", mainRVA);

            dbg.BreakingThread.Continue.UntilBreakpoint(breakPoint);
            var disasm   = dbg.BreakingThread.Continue.UntilInstruction("JNZ");
            var expected = dbg.AddressOfModule("SimpleCrackMe.exe") + jnzRVA;
            var actual   = dbg.BreakingThread.CurrentInstruction;

            Assert.Equal(expected, actual);
            return(dbg.BreakingThread.WriteInstruction("NOP", true));
        }