1
0
Fork 0

DBG+BRIDGE+GUI: fix bugs and add Graph+Memory Map+Symbol Module plugin menus

This commit is contained in:
Duncan Ogilvie 2019-06-22 16:44:45 +02:00
parent fc9f9a52fd
commit 0b7d840b60
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
22 changed files with 183 additions and 112 deletions

View File

@ -1085,7 +1085,7 @@ BRIDGE_IMPEXP duint DbgEval(const char* expression, bool* success)
return value;
}
BRIDGE_IMPEXP void DbgMenuPrepare(int hMenu)
BRIDGE_IMPEXP void DbgMenuPrepare(GUIMENUTYPE hMenu)
{
_dbg_sendmessage(DBG_MENU_PREPARE, (void*)hMenu, nullptr);
}
@ -1411,12 +1411,12 @@ BRIDGE_IMPEXP void GuiMenuRemove(int hEntryMenu)
_gui_sendmessage(GUI_MENU_REMOVE, (void*)(duint)hEntryMenu, 0);
}
BRIDGE_IMPEXP bool GuiSelectionGet(int hWindow, SELECTIONDATA* selection)
BRIDGE_IMPEXP bool GuiSelectionGet(GUISELECTIONTYPE hWindow, SELECTIONDATA* selection)
{
return !!_gui_sendmessage(GUI_SELECTION_GET, (void*)(duint)hWindow, selection);
}
BRIDGE_IMPEXP bool GuiSelectionSet(int hWindow, const SELECTIONDATA* selection)
BRIDGE_IMPEXP bool GuiSelectionSet(GUISELECTIONTYPE hWindow, const SELECTIONDATA* selection)
{
return !!_gui_sendmessage(GUI_SELECTION_SET, (void*)(duint)hWindow, (void*)selection);
}
@ -1728,6 +1728,11 @@ BRIDGE_IMPEXP void GuiExecuteOnGuiThreadEx(GUICALLBACKEX cbGuiThread, void* user
_gui_sendmessage(GUI_EXECUTE_ON_GUI_THREAD, (void*)cbGuiThread, userdata);
}
BRIDGE_IMPEXP void GuiGetCurrentGraph(BridgeCFGraphList* graphList)
{
_gui_sendmessage(GUI_GET_CURRENT_GRAPH, graphList, nullptr);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;

View File

@ -5,6 +5,9 @@
#ifndef __cplusplus
#include <stdbool.h>
#define DEFAULT_PARAM(name, value) name
#else
#define DEFAULT_PARAM(name, value) name = value
#endif
//default structure alignments forced
@ -1033,22 +1036,32 @@ BRIDGE_IMPEXP DWORD DbgGetThreadId();
BRIDGE_IMPEXP duint DbgGetPebAddress(DWORD ProcessId);
BRIDGE_IMPEXP duint DbgGetTebAddress(DWORD ThreadId);
BRIDGE_IMPEXP bool DbgAnalyzeFunction(duint entry, BridgeCFGraphList* graph);
BRIDGE_IMPEXP duint DbgEval(const char* expression, bool* success = 0);
BRIDGE_IMPEXP void DbgMenuPrepare(int hMenu);
BRIDGE_IMPEXP duint DbgEval(const char* expression, bool* DEFAULT_PARAM(success, nullptr));
BRIDGE_IMPEXP void DbgGetSymbolInfo(const SYMBOLPTR* symbolptr, SYMBOLINFO* info);
//Gui defines
#define GUI_PLUGIN_MENU 0
#define GUI_DISASM_MENU 1
#define GUI_DUMP_MENU 2
#define GUI_STACK_MENU 3
typedef enum
{
GUI_PLUGIN_MENU,
GUI_DISASM_MENU,
GUI_DUMP_MENU,
GUI_STACK_MENU,
GUI_GRAPH_MENU,
GUI_MEMMAP_MENU,
GUI_SYMMOD_MENU,
} GUIMENUTYPE;
#define GUI_DISASSEMBLY 0
#define GUI_DUMP 1
#define GUI_STACK 2
#define GUI_GRAPH 3
#define GUI_MEMMAP 4
#define GUI_SYMMOD 5
BRIDGE_IMPEXP void DbgMenuPrepare(GUIMENUTYPE hMenu);
typedef enum
{
GUI_DISASSEMBLY,
GUI_DUMP,
GUI_STACK,
GUI_GRAPH,
GUI_MEMMAP,
GUI_SYMMOD,
} GUISELECTIONTYPE;
#define GUI_MAX_LINE_SIZE 65536
#define GUI_MAX_DISASSEMBLY_SIZE 2048
@ -1099,8 +1112,8 @@ typedef enum
GUI_MENU_ADD_ENTRY, // param1=int hMenu, param2=const char* title
GUI_MENU_ADD_SEPARATOR, // param1=int hMenu, param2=unused
GUI_MENU_CLEAR, // param1=int hMenu, param2=unused
GUI_SELECTION_GET, // param1=int hWindow, param2=SELECTIONDATA* selection
GUI_SELECTION_SET, // param1=int hWindow, param2=const SELECTIONDATA* selection
GUI_SELECTION_GET, // param1=GUISELECTIONTYPE, param2=SELECTIONDATA* selection
GUI_SELECTION_SET, // param1=GUISELECTIONTYPE, param2=const SELECTIONDATA* selection
GUI_GETLINE_WINDOW, // param1=const char* title, param2=char* text
GUI_AUTOCOMPLETE_ADDCMD, // param1=const char* cmd, param2=ununsed
GUI_AUTOCOMPLETE_DELCMD, // param1=const char* cmd, param2=ununsed
@ -1165,6 +1178,7 @@ typedef enum
GUI_OPEN_TRACE_FILE, // param1=const char* file name,param2=unused
GUI_UPDATE_TRACE_BROWSER, // param1=unused, param2=unused
GUI_INVALIDATE_SYMBOL_SOURCE, // param1=duint base, param2=unused
GUI_GET_CURRENT_GRAPH, // param1=BridgeCFGraphList*, param2=unused
} GUIMSG;
//GUI Typedefs
@ -1281,8 +1295,8 @@ BRIDGE_IMPEXP int GuiMenuAddEntry(int hMenu, const char* title);
BRIDGE_IMPEXP void GuiMenuAddSeparator(int hMenu);
BRIDGE_IMPEXP void GuiMenuClear(int hMenu);
BRIDGE_IMPEXP void GuiMenuRemove(int hEntryMenu);
BRIDGE_IMPEXP bool GuiSelectionGet(int hWindow, SELECTIONDATA* selection);
BRIDGE_IMPEXP bool GuiSelectionSet(int hWindow, const SELECTIONDATA* selection);
BRIDGE_IMPEXP bool GuiSelectionGet(GUISELECTIONTYPE hWindow, SELECTIONDATA* selection);
BRIDGE_IMPEXP bool GuiSelectionSet(GUISELECTIONTYPE hWindow, const SELECTIONDATA* selection);
BRIDGE_IMPEXP bool GuiGetLineWindow(const char* title, char* text);
BRIDGE_IMPEXP void GuiAutoCompleteAddCmd(const char* cmd);
BRIDGE_IMPEXP void GuiAutoCompleteDelCmd(const char* cmd);
@ -1344,6 +1358,7 @@ BRIDGE_IMPEXP void GuiUpdateTraceBrowser();
BRIDGE_IMPEXP void GuiOpenTraceFile(const char* fileName);
BRIDGE_IMPEXP void GuiInvalidateSymbolSource(duint base);
BRIDGE_IMPEXP void GuiExecuteOnGuiThreadEx(GUICALLBACKEX cbGuiThread, void* userdata);
BRIDGE_IMPEXP void GuiGetCurrentGraph(BridgeCFGraphList* graphList);
#ifdef __cplusplus
}

View File

@ -0,0 +1 @@
#include "bridgemain.h"

View File

@ -20,6 +20,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="bridgemain.cpp" />
<ClCompile Include="bridgemain_checker.c" />
<ClCompile Include="_global.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -17,6 +17,9 @@
<ClCompile Include="bridgemain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bridgemain_checker.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="_global.h">

View File

@ -1473,7 +1473,7 @@ extern "C" DLL_EXPORT duint _dbg_sendmessage(DBGMSG type, void* param1, void* pa
case DBG_MENU_PREPARE:
{
PLUG_CB_MENUPREPARE info;
info.hMenu = int(param1);
info.hMenu = GUIMENUTYPE(duint(param1));
plugincbcall(CB_MENUPREPARE, &info);
}
break;

View File

@ -47,6 +47,9 @@ typedef struct
int hMenuDisasm; //plugin disasm menu handle
int hMenuDump; //plugin dump menu handle
int hMenuStack; //plugin stack menu handle
int hMenuGraph; //plugin graph menu handle
int hMenuMemmap; //plugin memory map menu handle
int hMenuSymmod; //plugin symbol module menu handle
} PLUG_SETUPSTRUCT;
typedef struct
@ -225,7 +228,7 @@ typedef struct
typedef struct
{
int hMenu;
GUIMENUTYPE hMenu;
} PLUG_CB_MENUPREPARE;
//enums

View File

@ -76,7 +76,7 @@ SCRIPT_EXPORT duint Script::Gui::SymMod::SelectionGetStart()
return SelectionGetStart(SymModWindow);
}
static inline int windowToBridge(Script::Gui::Window window)
static inline GUISELECTIONTYPE windowToBridge(Script::Gui::Window window)
{
switch(window)
{

View File

@ -73,7 +73,7 @@ namespace Exprfunc
return 0;
}
static duint selstart(int hWindow)
static duint selstart(GUISELECTIONTYPE hWindow)
{
SELECTIONDATA selection;
GuiSelectionGet(hWindow, &selection);

View File

@ -209,81 +209,43 @@ bool pluginload(const char* pluginName, bool loadall)
regExport("CBVALTOSTRING", CB_VALTOSTRING);
regExport("CBMENUPREPARE", CB_MENUPREPARE);
SectionLocker<LockPluginMenuList, false> menuLock; //exclusive lock
//add plugin menus
{
SectionLocker<LockPluginMenuList, false> menuLock; //exclusive lock
//add plugin menu
int hNewMenu = GuiMenuAdd(GUI_PLUGIN_MENU, pluginData.initStruct.pluginName);
if(hNewMenu == -1)
{
dprintf(QT_TRANSLATE_NOOP("DBG", "[PLUGIN] GuiMenuAdd(GUI_PLUGIN_MENU) failed for plugin: %s\n"), pluginData.initStruct.pluginName);
pluginData.hMenu = -1;
}
else
{
PLUG_MENU newMenu;
newMenu.hEntryMenu = hNewMenu;
newMenu.hParentMenu = GUI_PLUGIN_MENU;
newMenu.pluginHandle = pluginData.initStruct.pluginHandle;
pluginMenuList.push_back(newMenu);
pluginData.hMenu = newMenu.hEntryMenu;
}
auto addPluginMenu = [](GUIMENUTYPE type)
{
int hNewMenu = GuiMenuAdd(type, pluginData.initStruct.pluginName);
if(hNewMenu == -1)
{
dprintf(QT_TRANSLATE_NOOP("DBG", "[PLUGIN] GuiMenuAdd(%d) failed for plugin: %s\n"), type, pluginData.initStruct.pluginName);
return -1;
}
else
{
PLUG_MENU newMenu;
newMenu.hEntryMenu = hNewMenu;
newMenu.hParentMenu = type;
newMenu.pluginHandle = pluginData.initStruct.pluginHandle;
pluginMenuList.push_back(newMenu);
return newMenu.hEntryMenu;
}
};
//add disasm plugin menu
hNewMenu = GuiMenuAdd(GUI_DISASM_MENU, pluginData.initStruct.pluginName);
if(hNewMenu == -1)
{
dprintf(QT_TRANSLATE_NOOP("DBG", "[PLUGIN] GuiMenuAdd(GUI_DISASM_MENU) failed for plugin: %s\n"), pluginData.initStruct.pluginName);
pluginData.hMenu = -1;
pluginData.hMenu = addPluginMenu(GUI_PLUGIN_MENU);
pluginData.hMenuDisasm = addPluginMenu(GUI_DISASM_MENU);
pluginData.hMenuDump = addPluginMenu(GUI_DUMP_MENU);
pluginData.hMenuStack = addPluginMenu(GUI_STACK_MENU);
pluginData.hMenuGraph = addPluginMenu(GUI_GRAPH_MENU);
pluginData.hMenuMemmap = addPluginMenu(GUI_MEMMAP_MENU);
pluginData.hMenuSymmod = addPluginMenu(GUI_SYMMOD_MENU);
}
else
{
PLUG_MENU newMenu;
newMenu.hEntryMenu = hNewMenu;
newMenu.hParentMenu = GUI_DISASM_MENU;
newMenu.pluginHandle = pluginData.initStruct.pluginHandle;
pluginMenuList.push_back(newMenu);
pluginData.hMenuDisasm = newMenu.hEntryMenu;
}
//add dump plugin menu
hNewMenu = GuiMenuAdd(GUI_DUMP_MENU, pluginData.initStruct.pluginName);
if(hNewMenu == -1)
{
dprintf(QT_TRANSLATE_NOOP("DBG", "[PLUGIN] GuiMenuAdd(GUI_DUMP_MENU) failed for plugin: %s\n"), pluginData.initStruct.pluginName);
pluginData.hMenu = -1;
}
else
{
PLUG_MENU newMenu;
newMenu.hEntryMenu = hNewMenu;
newMenu.hParentMenu = GUI_DUMP_MENU;
newMenu.pluginHandle = pluginData.initStruct.pluginHandle;
pluginMenuList.push_back(newMenu);
pluginData.hMenuDump = newMenu.hEntryMenu;
}
//add stack plugin menu
hNewMenu = GuiMenuAdd(GUI_STACK_MENU, pluginData.initStruct.pluginName);
if(hNewMenu == -1)
{
dprintf(QT_TRANSLATE_NOOP("DBG", "[PLUGIN] GuiMenuAdd(GUI_STACK_MENU) failed for plugin: %s\n"), pluginData.initStruct.pluginName);
pluginData.hMenu = -1;
}
else
{
PLUG_MENU newMenu;
newMenu.hEntryMenu = hNewMenu;
newMenu.hParentMenu = GUI_STACK_MENU;
newMenu.pluginHandle = pluginData.initStruct.pluginHandle;
pluginMenuList.push_back(newMenu);
pluginData.hMenuStack = newMenu.hEntryMenu;
}
menuLock.Unlock();
//add the plugin to the list
SectionLocker<LockPluginList, false> pluginLock; //exclusive lock
pluginList.push_back(pluginData);
pluginLock.Unlock();
{
SectionLocker<LockPluginList, false> pluginLock; //exclusive lock
pluginList.push_back(pluginData);
}
//setup plugin
if(pluginData.plugsetup)
@ -294,6 +256,9 @@ bool pluginload(const char* pluginName, bool loadall)
setupStruct.hMenuDisasm = pluginData.hMenuDisasm;
setupStruct.hMenuDump = pluginData.hMenuDump;
setupStruct.hMenuStack = pluginData.hMenuStack;
setupStruct.hMenuGraph = pluginData.hMenuGraph;
setupStruct.hMenuMemmap = pluginData.hMenuMemmap;
setupStruct.hMenuSymmod = pluginData.hMenuSymmod;
pluginData.plugsetup(&setupStruct);
}
pluginData.isLoaded = true;
@ -337,8 +302,10 @@ bool pluginunload(const char* pluginName, bool unloadall)
auto currentPlugin = *found;
if(currentPlugin.plugstop)
canFreeLibrary = currentPlugin.plugstop();
plugincmdunregisterall(currentPlugin.initStruct.pluginHandle);
pluginexprfuncunregisterall(currentPlugin.initStruct.pluginHandle);
int pluginHandle = currentPlugin.initStruct.pluginHandle;
plugincmdunregisterall(pluginHandle);
pluginexprfuncunregisterall(pluginHandle);
pluginformatfuncunregisterall(pluginHandle);
//remove the callbacks
{
@ -347,7 +314,7 @@ bool pluginunload(const char* pluginName, bool unloadall)
{
for(auto it = cbList.begin(); it != cbList.end();)
{
if(it->pluginHandle == currentPlugin.initStruct.pluginHandle)
if(it->pluginHandle == pluginHandle)
it = cbList.erase(it);
else
++it;
@ -357,6 +324,12 @@ bool pluginunload(const char* pluginName, bool unloadall)
{
EXCLUSIVE_ACQUIRE(LockPluginList);
pluginmenuclear(currentPlugin.hMenu, true);
pluginmenuclear(currentPlugin.hMenuDisasm, true);
pluginmenuclear(currentPlugin.hMenuDump, true);
pluginmenuclear(currentPlugin.hMenuStack, true);
pluginmenuclear(currentPlugin.hMenuGraph, true);
pluginmenuclear(currentPlugin.hMenuMemmap, true);
pluginmenuclear(currentPlugin.hMenuSymmod, true);
if(!unloadall)
{
@ -446,21 +419,44 @@ void plugincmdunregisterall(int pluginHandle)
/**
\brief Unregister all plugin expression functions.
\param pluginHandle Handle of the plugin to remove the commands from.
\param pluginHandle Handle of the plugin to remove the expression functions from.
*/
void pluginexprfuncunregisterall(int pluginHandle)
{
SHARED_ACQUIRE(LockPluginExprfunctionList);
auto commandList = pluginExprfunctionList; //copy for thread-safety reasons
auto exprFuncList = pluginExprfunctionList; //copy for thread-safety reasons
SHARED_RELEASE();
auto i = commandList.begin();
while(i != commandList.end())
auto i = exprFuncList.begin();
while(i != exprFuncList.end())
{
auto currentExprfunction = *i;
if(currentExprfunction.pluginHandle == pluginHandle)
auto currentExprFunc = *i;
if(currentExprFunc.pluginHandle == pluginHandle)
{
i = commandList.erase(i);
ExpressionFunctions::Unregister(currentExprfunction.name);
i = exprFuncList.erase(i);
ExpressionFunctions::Unregister(currentExprFunc.name);
}
else
++i;
}
}
/**
\brief Unregister all plugin format functions.
\param pluginHandle Handle of the plugin to remove the format functions from.
*/
void pluginformatfuncunregisterall(int pluginHandle)
{
SHARED_ACQUIRE(LockPluginFormatfunctionList);
auto formatFuncList = pluginExprfunctionList; //copy for thread-safety reasons
SHARED_RELEASE();
auto i = formatFuncList.begin();
while(i != formatFuncList.end())
{
auto currentFormatFunc = *i;
if(currentFormatFunc.pluginHandle == pluginHandle)
{
i = formatFuncList.erase(i);
FormatFunctions::Unregister(currentFormatFunc.name);
}
else
++i;

View File

@ -35,6 +35,9 @@ struct PLUG_DATA
int hMenuDisasm;
int hMenuDump;
int hMenuStack;
int hMenuGraph;
int hMenuMemmap;
int hMenuSymmod;
PLUG_INITSTRUCT initStruct;
};
@ -70,6 +73,7 @@ void pluginloadall(const char* pluginDir);
void pluginunloadall();
void plugincmdunregisterall(int pluginHandle);
void pluginexprfuncunregisterall(int pluginHandle);
void pluginformatfuncunregisterall(int pluginHandle);
void pluginregistercallback(int pluginHandle, CBTYPE cbType, CBPLUGIN cbPlugin);
bool pluginunregistercallback(int pluginHandle, CBTYPE cbType);
void plugincbcall(CBTYPE cbType, void* callbackInfo);

View File

@ -76,7 +76,7 @@ void Bridge::initBridge()
Helper Functions
************************************************************************************/
void Bridge::emitMenuAddToList(QWidget* parent, QMenu* menu, int hMenu, int hParentMenu)
void Bridge::emitMenuAddToList(QWidget* parent, QMenu* menu, GUIMENUTYPE hMenu, int hParentMenu)
{
BridgeResult result(BridgeResult::MenuAddToList);
emit menuAddMenuToList(parent, menu, hMenu, hParentMenu);
@ -376,7 +376,7 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_SELECTION_GET:
{
int hWindow = (int)param1;
GUISELECTIONTYPE hWindow = GUISELECTIONTYPE(duint(param1));
SELECTIONDATA* selection = (SELECTIONDATA*)param2;
if(!DbgIsDebugging())
return (void*)false;
@ -417,7 +417,7 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_SELECTION_SET:
{
int hWindow = (int)param1;
GUISELECTIONTYPE hWindow = GUISELECTIONTYPE(duint(param1));
const SELECTIONDATA* selection = (const SELECTIONDATA*)param2;
if(!DbgIsDebugging())
return (void*)false;
@ -852,6 +852,14 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_INVALIDATE_SYMBOL_SOURCE:
symbolView->invalidateSymbolSource(duint(param1));
break;
case GUI_GET_CURRENT_GRAPH:
{
BridgeResult result(BridgeResult::GraphCurrent);
emit getCurrentGraph((BridgeCFGraphList*)param1);
result.Wait();
}
break;
}
return nullptr;

View File

@ -36,7 +36,7 @@ public:
void setResult(BridgeResult::Type type, dsint result = 0);
//helper functions
void emitMenuAddToList(QWidget* parent, QMenu* menu, int hMenu, int hParentMenu = -1);
void emitMenuAddToList(QWidget* parent, QMenu* menu, GUIMENUTYPE hMenu, int hParentMenu = -1);
void setDbgStopped();
//Public variables
@ -86,7 +86,7 @@ signals:
void updateMemory();
void addRecentFile(QString file);
void setLastException(unsigned int exceptionCode);
void menuAddMenuToList(QWidget* parent, QMenu* menu, int hMenu, int hParentMenu);
void menuAddMenuToList(QWidget* parent, QMenu* menu, GUIMENUTYPE hMenu, int hParentMenu);
void menuAddMenu(int hMenu, QString title);
void menuAddMenuEntry(int hMenu, QString title);
void menuAddSeparator(int hMenu);
@ -161,6 +161,7 @@ signals:
void openTraceFile(const QString & fileName);
void updateTraceBrowser();
void symbolSelectModule(duint base);
void getCurrentGraph(BridgeCFGraphList* graphList);
private:
CRITICAL_SECTION csBridge;

View File

@ -36,6 +36,7 @@ public:
TypeAddNode,
TypeClear,
MenuSetEntryHotkey,
GraphCurrent,
Last,
};
explicit BridgeResult(Type type);

View File

@ -85,6 +85,7 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget* parent)
connect(Bridge::getBridge(), SIGNAL(selectionGraphGet(SELECTIONDATA*)), this, SLOT(selectionGetSlot(SELECTIONDATA*)));
connect(Bridge::getBridge(), SIGNAL(disassembleAt(dsint, dsint)), this, SLOT(disassembleAtSlot(dsint, dsint)));
connect(Bridge::getBridge(), SIGNAL(focusGraph()), this, SLOT(setFocus()));
connect(Bridge::getBridge(), SIGNAL(getCurrentGraph(BridgeCFGraphList*)), this, SLOT(getCurrentGraphSlot(BridgeCFGraphList*)));
//Connect to config
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot()));
@ -2256,6 +2257,16 @@ void DisassemblerGraphView::setupContextMenu()
mediumLayout->setChecked(true);
mMenuBuilder->addMenu(makeMenu(DIcon("layout.png"), tr("Layout")), layoutMenu);
mPluginMenu = new QMenu(this);
Bridge::getBridge()->emitMenuAddToList(this, mPluginMenu, GUI_GRAPH_MENU);
mMenuBuilder->addSeparator();
mMenuBuilder->addBuilder(new MenuBuilder(this, [this](QMenu * menu)
{
DbgMenuPrepare(GUI_GRAPH_MENU);
menu->addActions(mPluginMenu->actions());
return true;
}));
mMenuBuilder->loadFromConfig();
}
@ -2569,3 +2580,9 @@ void DisassemblerGraphView::zoomToCursorSlot()
this->adjustSize(areaSize.width(), areaSize.height(), pos);
this->viewport()->update();
}
void DisassemblerGraphView::getCurrentGraphSlot(BridgeCFGraphList* graphList)
{
*graphList = currentGraph.ToGraphList();
Bridge::getBridge()->setResult(BridgeResult::GraphCurrent);
}

View File

@ -284,6 +284,7 @@ public slots:
void xrefSlot();
void fitToWindowSlot();
void zoomToCursorSlot();
void getCurrentGraphSlot(BridgeCFGraphList* graphList);
private:
bool graphZoomMode;
@ -324,6 +325,7 @@ private:
std::vector<int> row_edge_y;
CachedFontMetrics* mFontMetrics;
MenuBuilder* mMenuBuilder;
QMenu* mPluginMenu;
bool drawOverview;
bool onlySummary;
bool syncOrigin;

View File

@ -70,7 +70,7 @@ MainWindow::MainWindow(QWidget* parent)
connect(Bridge::getBridge(), SIGNAL(updateWindowTitle(QString)), this, SLOT(updateWindowTitleSlot(QString)));
connect(Bridge::getBridge(), SIGNAL(addRecentFile(QString)), this, SLOT(addRecentFile(QString)));
connect(Bridge::getBridge(), SIGNAL(setLastException(uint)), this, SLOT(setLastException(uint)));
connect(Bridge::getBridge(), SIGNAL(menuAddMenuToList(QWidget*, QMenu*, int, int)), this, SLOT(addMenuToList(QWidget*, QMenu*, int, int)));
connect(Bridge::getBridge(), SIGNAL(menuAddMenuToList(QWidget*, QMenu*, GUIMENUTYPE, int)), this, SLOT(addMenuToList(QWidget*, QMenu*, GUIMENUTYPE, int)));
connect(Bridge::getBridge(), SIGNAL(menuAddMenu(int, QString)), this, SLOT(addMenu(int, QString)));
connect(Bridge::getBridge(), SIGNAL(menuAddMenuEntry(int, QString)), this, SLOT(addMenuEntry(int, QString)));
connect(Bridge::getBridge(), SIGNAL(menuAddSeparator(int)), this, SLOT(addSeparator(int)));
@ -1082,7 +1082,7 @@ const MainWindow::MenuInfo* MainWindow::findMenu(int hMenu)
return nFound == -1 ? 0 : &mMenuList.at(nFound);
}
void MainWindow::addMenuToList(QWidget* parent, QMenu* menu, int hMenu, int hParentMenu)
void MainWindow::addMenuToList(QWidget* parent, QMenu* menu, GUIMENUTYPE hMenu, int hParentMenu)
{
if(!findMenu(hMenu))
mMenuList.push_back(MenuInfo(parent, menu, hMenu, hParentMenu, hMenu == GUI_PLUGIN_MENU));

View File

@ -101,7 +101,7 @@ public slots:
void setLastException(unsigned int exceptionCode);
void findStrings();
void findModularCalls();
void addMenuToList(QWidget* parent, QMenu* menu, int hMenu, int hParentMenu = -1);
void addMenuToList(QWidget* parent, QMenu* menu, GUIMENUTYPE hMenu, int hParentMenu = -1);
void addMenu(int hMenu, QString title);
void addMenuEntry(int hMenu, QString title);
void addSeparator(int hMenu);

View File

@ -172,6 +172,9 @@ void MemoryMapView::setupContextMenu()
connect(mComment, SIGNAL(triggered()), this, SLOT(commentSlot()));
mComment->setShortcutContext(Qt::WidgetShortcut);
mPluginMenu = new QMenu(this);
Bridge::getBridge()->emitMenuAddToList(this, mPluginMenu, GUI_MEMMAP_MENU);
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
}
@ -209,6 +212,9 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
wMenu.addAction(mPageMemoryRights);
wMenu.addSeparator();
wMenu.addMenu(mBreakpointMenu);
wMenu.addSeparator();
DbgMenuPrepare(GUI_MEMMAP_MENU);
wMenu.addActions(mPluginMenu->actions());
QMenu wCopyMenu(tr("&Copy"), this);
wCopyMenu.setIcon(DIcon("copy.png"));
setupCopyMenu(&wCopyMenu);

View File

@ -74,6 +74,7 @@ private:
QAction* mMemoryFree;
QAction* mAddVirtualMod;
QAction* mComment;
QMenu* mPluginMenu;
duint mCipBase;
};

View File

@ -372,6 +372,9 @@ void SymbolView::setupContextMenu()
mModuleList->addAction(mModSetPartyAction);
connect(mModSetPartyAction, SIGNAL(triggered()), this, SLOT(moduleSetParty()));
mPluginMenu = new QMenu(this);
Bridge::getBridge()->emitMenuAddToList(this, mPluginMenu, GUI_SYMMOD_MENU);
//Shortcuts
refreshShortcutsSlot();
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcutsSlot()));
@ -603,6 +606,9 @@ void SymbolView::moduleContextMenu(QMenu* wMenu)
wMenu->addSeparator();
wMenu->addMenu(&wCopyMenu);
}
wMenu->addSeparator();
DbgMenuPrepare(GUI_SYMMOD_MENU);
wMenu->addActions(mPluginMenu->actions());
}
void SymbolView::moduleFollow()

View File

@ -89,6 +89,7 @@ private:
QAction* mFollowInMemMap;
QAction* mLoadLib;
QAction* mFreeLib;
QMenu* mPluginMenu;
static void cbSymbolEnum(SYMBOLINFO* symbol, void* user);
};