diff --git a/x64_dbg_bridge/bridgemain.h b/x64_dbg_bridge/bridgemain.h index aa07b977..0da1e6fb 100644 --- a/x64_dbg_bridge/bridgemain.h +++ b/x64_dbg_bridge/bridgemain.h @@ -469,6 +469,8 @@ struct BASIC_INSTRUCTION_INFO ULONG_PTR addr; //addrvalue (jumps + calls) bool branch; //jumps/calls bool call; //instruction is a call + int size; + char instruction[MAX_MNEMONIC_SIZE*4]; }; struct SCRIPTBRANCH diff --git a/x64_dbg_dbg/_dbgfunctions.cpp b/x64_dbg_dbg/_dbgfunctions.cpp index 20af187b..8bb10ac0 100644 --- a/x64_dbg_dbg/_dbgfunctions.cpp +++ b/x64_dbg_dbg/_dbgfunctions.cpp @@ -5,6 +5,7 @@ #include "addrinfo.h" #include "patches.h" #include "memory.h" +#include "disasm_fast.h" static DBGFUNCTIONS _dbgfunctions; @@ -117,4 +118,5 @@ void dbgfunctionsinit() _dbgfunctions.PatchFile=(PATCHFILE)patchfile; _dbgfunctions.ModPathFromAddr=_modpathfromaddr; _dbgfunctions.ModPathFromName=_modpathfromname; + _dbgfunctions.DisasmFast=disasmfast; } \ No newline at end of file diff --git a/x64_dbg_dbg/_dbgfunctions.h b/x64_dbg_dbg/_dbgfunctions.h index 447f4168..214fe4cc 100644 --- a/x64_dbg_dbg/_dbgfunctions.h +++ b/x64_dbg_dbg/_dbgfunctions.h @@ -25,6 +25,7 @@ typedef bool (*PATCHRESTORE)(duint addr); typedef int (*PATCHFILE)(DBGPATCHINFO* patchlist, int count, const char* szFileName, char* error); typedef int (*MODPATHFROMADDR)(duint addr, char* path, int size); typedef int (*MODPATHFROMNAME)(const char* modname, char* path, int size); +typedef bool (*DISASMFAST)(unsigned char* data, duint addr, BASIC_INSTRUCTION_INFO* basicinfo); struct DBGFUNCTIONS { @@ -44,6 +45,7 @@ struct DBGFUNCTIONS PATCHFILE PatchFile; MODPATHFROMADDR ModPathFromAddr; MODPATHFROMNAME ModPathFromName; + DISASMFAST DisasmFast; }; #ifdef BUILD_DBG diff --git a/x64_dbg_dbg/_exports.cpp b/x64_dbg_dbg/_exports.cpp index 11eca11e..1c6fadf4 100644 --- a/x64_dbg_dbg/_exports.cpp +++ b/x64_dbg_dbg/_exports.cpp @@ -869,8 +869,11 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par #endif // _WIN64 disasm.EIP=(UIntPtr)data; disasm.VirtualAddr=(UInt64)param1; + int len=Disasm(&disasm); uint i=0; - fillbasicinfo(&disasm, (BASIC_INSTRUCTION_INFO*)param2); + BASIC_INSTRUCTION_INFO* basicinfo=(BASIC_INSTRUCTION_INFO*)param2; + basicinfo->size=len; + fillbasicinfo(&disasm, basicinfo); } break; diff --git a/x64_dbg_dbg/disasm_fast.cpp b/x64_dbg_dbg/disasm_fast.cpp index 95f5c2d5..331ba568 100644 --- a/x64_dbg_dbg/disasm_fast.cpp +++ b/x64_dbg_dbg/disasm_fast.cpp @@ -22,6 +22,8 @@ void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo) { //zero basicinfo memset(basicinfo, 0, sizeof(BASIC_INSTRUCTION_INFO)); + //copy instruction text + strcpy(basicinfo->instruction, disasm->CompleteInstr); //find immidiat if(disasm->Instruction.BranchType==0) //no branch { @@ -104,6 +106,7 @@ bool disasmfast(unsigned char* data, uint addr, BASIC_INSTRUCTION_INFO* basicinf int len=Disasm(&disasm); if(len==UNKNOWN_OPCODE) return false; + basicinfo->size=len; fillbasicinfo(&disasm, basicinfo); return true; } diff --git a/x64_dbg_dbg/reference.cpp b/x64_dbg_dbg/reference.cpp index 759974d3..cf6e833c 100644 --- a/x64_dbg_dbg/reference.cpp +++ b/x64_dbg_dbg/reference.cpp @@ -62,6 +62,7 @@ int reffind(uint addr, uint size, CBREF cbRef, void* userinfo, bool silent) int len=Disasm(&disasm); if(len!=UNKNOWN_OPCODE) { + basicinfo.size=len; fillbasicinfo(&disasm, &basicinfo); if(cbRef(&disasm, &basicinfo, &refinfo)) refinfo.refcount++;