From 441c895cf0171966999b7909e6f8e07471713ada Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Sun, 6 Jul 2014 19:40:36 +0200 Subject: [PATCH] DBG: apply patches on every memory change --- x64_dbg_dbg/assemble.cpp | 5 +++-- x64_dbg_dbg/instruction.cpp | 3 ++- x64_dbg_dbg/value.cpp | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/x64_dbg_dbg/assemble.cpp b/x64_dbg_dbg/assemble.cpp index ee4175de..e9b396ee 100644 --- a/x64_dbg_dbg/assemble.cpp +++ b/x64_dbg_dbg/assemble.cpp @@ -60,9 +60,10 @@ bool assembleat(uint addr, const char* instruction, char* error, bool fillnop) unsigned char nops[16]; memset(nops, 0x90, sizeof(nops)); - bool ret=memwrite(fdProcessInfo->hProcess, (void*)addr, dest, destSize, 0); + bool ret=mempatch(fdProcessInfo->hProcess, (void*)addr, dest, destSize, 0); if(ret && fillnop && nopsize) - if(!memwrite(fdProcessInfo->hProcess, (void*)(addr+destSize), nops, nopsize, 0)) + if(!mempatch(fdProcessInfo->hProcess, (void*)(addr+destSize), nops, nopsize, 0)) ret=false; + GuiUpdatePatches(); return true; } diff --git a/x64_dbg_dbg/instruction.cpp b/x64_dbg_dbg/instruction.cpp index 922341aa..b358f684 100644 --- a/x64_dbg_dbg/instruction.cpp +++ b/x64_dbg_dbg/instruction.cpp @@ -968,7 +968,7 @@ CMDRESULT cbInstrCopystr(int argc, char* argv[]) dprintf("invalid address \"%s\"!\n", argv[1]); return STATUS_ERROR; } - if(!memwrite(fdProcessInfo->hProcess, (void*)addr, string, strlen(string), 0)) + if(!mempatch(fdProcessInfo->hProcess, (void*)addr, string, strlen(string), 0)) { efree(string, "cbInstrCopystr:string"); dputs("memwrite failed!"); @@ -977,6 +977,7 @@ CMDRESULT cbInstrCopystr(int argc, char* argv[]) efree(string, "cbInstrCopystr:string"); dputs("string written!"); GuiUpdateAllViews(); + GuiUpdatePatches(); return STATUS_CONTINUE; } diff --git a/x64_dbg_dbg/value.cpp b/x64_dbg_dbg/value.cpp index 694c1e7b..d4aefcc1 100644 --- a/x64_dbg_dbg/value.cpp +++ b/x64_dbg_dbg/value.cpp @@ -1413,13 +1413,14 @@ bool valtostring(const char* string, uint* value, bool silent) return false; } efree(newstring, "valfromstring::newstring"); - if(!memwrite(fdProcessInfo->hProcess, (void*)temp, value, read_size, 0)) + if(!mempatch(fdProcessInfo->hProcess, (void*)temp, value, read_size, 0)) { if(!silent) dputs("failed to write memory"); return false; } GuiUpdateAllViews(); //repaint gui + GuiUpdatePatches(); //update patch dialog return true; } else if(isregister(string)) //register