1
0
Fork 0

GUI+BRIDGE: added api for argument visualisation http://i.imgur.com/RGqrudU.png

This commit is contained in:
mrexodia 2016-02-14 21:30:27 +01:00
parent 93f7196fe4
commit a9c711906d
3 changed files with 41 additions and 3 deletions

View File

@ -826,6 +826,11 @@ BRIDGE_IMPEXP duint DbgGetTimeWastedCounter()
return _dbg_sendmessage(DBG_GET_TIME_WASTED_COUNTER, nullptr, nullptr);
}
BRIDGE_IMPEXP ARGTYPE DbgGetArgTypeAt(duint addr)
{
return ARG_NONE;
}
BRIDGE_IMPEXP void GuiDisasmAt(duint addr, duint cip)
{
_gui_sendmessage(GUI_DISASSEMBLE_AT, (void*)addr, (void*)cip);

View File

@ -127,6 +127,14 @@ typedef enum
LOOP_END
} LOOPTYPE;
typedef enum
{
ARG_NONE,
ARG_BEGIN,
ARG_MIDDLE,
ARG_END
} ARGTYPE;
typedef enum
{
DBG_SCRIPT_LOAD, // param1=const char* filename, param2=unused
@ -700,6 +708,7 @@ BRIDGE_IMPEXP bool DbgWinEvent(MSG* message, long* result);
BRIDGE_IMPEXP bool DbgWinEventGlobal(MSG* message);
BRIDGE_IMPEXP bool DbgIsRunning();
BRIDGE_IMPEXP duint DbgGetTimeWastedCounter();
BRIDGE_IMPEXP ARGTYPE DbgGetArgTypeAt(duint addr);
//Gui defines
#define GUI_PLUGIN_MENU 0

View File

@ -432,8 +432,32 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
case 3: //draw comments
{
int argsize = 0;
duint cur_addr = rvaToVa(mInstBuffer.at(rowOffset).rva);
ARGTYPE argType = DbgGetArgTypeAt(cur_addr);
if(argType != ARG_NONE)
{
Function_t funcType;
switch(argType)
{
case ARG_BEGIN:
funcType = Function_start;
break;
case ARG_MIDDLE:
funcType = Function_middle;
break;
case ARG_END:
funcType = Function_end;
break;
default:
break;
}
argsize += paintFunctionGraphic(painter, x, y, funcType, true);
}
char comment[MAX_COMMENT_SIZE] = "";
if(DbgGetCommentAt(rvaToVa(mInstBuffer.at(rowOffset).rva), comment))
if(DbgGetCommentAt(cur_addr, comment))
{
QString commentText;
QColor backgroundColor;
@ -454,8 +478,8 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
if(width > w)
width = w;
if(width)
painter->fillRect(QRect(x + 2, y, width, h), QBrush(backgroundColor)); //fill comment color
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, commentText);
painter->fillRect(QRect(x + argsize + 2, y, width, h), QBrush(backgroundColor)); //fill comment color
painter->drawText(QRect(x + argsize + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, commentText);
}
}
break;