1
0
Fork 0

follow string in dump (#2913)

Improve the string reference view with more context menus.
This commit is contained in:
Torusrxxx 2022-08-05 11:18:46 +00:00 committed by GitHub
parent 2665db453b
commit 61c1808701
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -551,7 +551,10 @@ static bool cbRefStr(Zydis* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO*
GuiReferenceInitialize(refinfo->name);
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
GuiReferenceAddColumn(100, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Disassembly")));
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "String Address")));
GuiReferenceAddColumn(500, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "String")));
GuiReferenceAddCommand(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Follow in Disassembly and Dump")), "disasm $0;dump $2");
GuiReferenceAddCommand(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Follow string in Dump")), "dump $2");
GuiReferenceSetSearchStartCol(2); //only search the strings
GuiReferenceSetRowCount(0);
GuiReferenceReloadData();
@ -561,10 +564,12 @@ static bool cbRefStr(Zydis* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO*
char string[MAX_STRING_SIZE] = "";
if(basicinfo->branch) //branches have no strings (jmp dword [401000])
return false;
auto addRef = [&]()
auto addRef = [&](duint strAddr)
{
char addrText[20] = "";
sprintf_s(addrText, "%p", disasm->Address());
char strAddrText[20] = "";
sprintf_s(strAddrText, "%p", strAddr);
GuiReferenceSetRowCount(refinfo->refcount + 1);
GuiReferenceSetCellContent(refinfo->refcount, 0, addrText);
char disassembly[4096] = "";
@ -572,18 +577,19 @@ static bool cbRefStr(Zydis* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO*
GuiReferenceSetCellContent(refinfo->refcount, 1, disassembly);
else
GuiReferenceSetCellContent(refinfo->refcount, 1, disasm->InstructionText().c_str());
GuiReferenceSetCellContent(refinfo->refcount, 2, string);
GuiReferenceSetCellContent(refinfo->refcount, 2, strAddrText);
GuiReferenceSetCellContent(refinfo->refcount, 3, string);
refinfo->refcount++;
};
if((basicinfo->type & TYPE_VALUE) == TYPE_VALUE)
{
if(DbgGetStringAt(basicinfo->value.value, string))
addRef();
addRef(basicinfo->value.value);
}
if((basicinfo->type & TYPE_MEMORY) == TYPE_MEMORY)
{
if(DbgGetStringAt(basicinfo->memory.value, string))
addRef();
addRef(basicinfo->memory.value);
}
return false;
}