BRIDGE: moved _dbg_dbginit to a new export (to call when the GUI is ready)
DBG: changed some stuff in the plugin loader GUI: call DbgInit when ready loading the GUI
This commit is contained in:
parent
44934f139e
commit
acc1196461
|
@ -138,9 +138,6 @@ BRIDGE_IMPEXP const char* BridgeStart()
|
|||
{
|
||||
if(!_dbg_dbginit || !_gui_guiinit)
|
||||
return "\"_dbg_dbginit\" || \"_gui_guiinit\" was not loaded yet, call BridgeInit!";
|
||||
const char* errormsg=_dbg_dbginit();
|
||||
if(errormsg)
|
||||
return errormsg;
|
||||
_gui_guiinit(0, 0); //remove arguments
|
||||
_dbg_dbgexitsignal(); //send exit signal to debugger
|
||||
return 0;
|
||||
|
@ -344,6 +341,11 @@ BRIDGE_IMPEXP bool DbgSetBookmarkAt(duint addr, bool isbookmark)
|
|||
return _dbg_addrinfoset(addr, &info);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP const char* DbgInit()
|
||||
{
|
||||
return _dbg_dbginit();
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP BPXTYPE DbgGetBpxTypeAt(duint addr)
|
||||
{
|
||||
return _dbg_bpgettypeat(addr);
|
||||
|
|
|
@ -170,6 +170,7 @@ struct REGDUMP
|
|||
};
|
||||
|
||||
//Debugger functions
|
||||
BRIDGE_IMPEXP const char* DbgInit();
|
||||
BRIDGE_IMPEXP void DbgMemRead(duint va, unsigned char* dest, duint size);
|
||||
BRIDGE_IMPEXP duint DbgMemGetPageSize(duint base);
|
||||
BRIDGE_IMPEXP duint DbgMemFindBaseAddr(duint addr, duint* size);
|
||||
|
|
|
@ -28,7 +28,6 @@ void pluginload(const char* pluginDir)
|
|||
return;
|
||||
}
|
||||
PLUG_DATA pluginData;
|
||||
char errorMsg[deflen]="";
|
||||
do
|
||||
{
|
||||
memset(&pluginData, 0, sizeof(PLUG_DATA));
|
||||
|
@ -36,34 +35,26 @@ void pluginload(const char* pluginDir)
|
|||
pluginData.hPlugin=LoadLibraryA(foundData.cFileName); //load the plugin library
|
||||
if(!pluginData.hPlugin)
|
||||
{
|
||||
sprintf(errorMsg, "Failed to load plugin: %s", foundData.cFileName);
|
||||
MessageBoxA(0, errorMsg, "Plugin Error!", MB_ICONERROR|MB_SYSTEMMODAL);
|
||||
dprintf("[PLUGIN] Failed to load plugin: %s\n", foundData.cFileName);
|
||||
continue;
|
||||
}
|
||||
pluginData.pluginit=(PLUGINIT)GetProcAddress(pluginData.hPlugin, "pluginit");
|
||||
if(!pluginData.pluginit)
|
||||
{
|
||||
sprintf(errorMsg, "Export \"pluginit\" not found in plugin: %s", foundData.cFileName);
|
||||
MessageBoxA(0, errorMsg, "Plugin Error!", MB_ICONERROR|MB_SYSTEMMODAL);
|
||||
dprintf("[PLUGIN] Export \"pluginit\" not found in plugin: %s\n", foundData.cFileName);
|
||||
FreeLibrary(pluginData.hPlugin);
|
||||
continue;
|
||||
}
|
||||
pluginData.plugstop=(PLUGSTOP)GetProcAddress(pluginData.hPlugin, "plugstop");
|
||||
if(!pluginData.plugstop)
|
||||
{
|
||||
sprintf(errorMsg, "Export \"plugstop\" not found in plugin: %s", foundData.cFileName);
|
||||
MessageBoxA(0, errorMsg, "Plugin Error!", MB_ICONERROR|MB_SYSTEMMODAL);
|
||||
FreeLibrary(pluginData.hPlugin);
|
||||
continue;
|
||||
}
|
||||
//TODO: handle exceptions
|
||||
if(!pluginData.pluginit(&pluginData.initStruct))
|
||||
{
|
||||
sprintf(errorMsg, "pluginit failed for plugin: %s", foundData.cFileName);
|
||||
MessageBoxA(0, errorMsg, "Plugin Error!", MB_ICONERROR|MB_SYSTEMMODAL);
|
||||
dprintf("[PLUGIN] pluginit failed for plugin: %s\n", foundData.cFileName);
|
||||
FreeLibrary(pluginData.hPlugin);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
dprintf("[PLUGIN] %s v%d Loaded!\n", pluginData.initStruct.pluginName, pluginData.initStruct.pluginVersion);
|
||||
pluginList.push_back(pluginData);
|
||||
curPluginHandle++;
|
||||
}
|
||||
|
@ -76,7 +67,9 @@ void pluginunload()
|
|||
int pluginCount=pluginList.size();
|
||||
for(int i=0; i<pluginCount; i++)
|
||||
{
|
||||
pluginList.at(i).plugstop();
|
||||
PLUGSTOP stop=pluginList.at(i).plugstop;
|
||||
if(stop)
|
||||
stop();
|
||||
FreeLibrary(pluginList.at(i).hPlugin);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
connect(ui->actionPause,SIGNAL(triggered()),this,SLOT(execPause()));
|
||||
connect(ui->actionScylla,SIGNAL(triggered()),this,SLOT(startScylla()));
|
||||
connect(ui->actionRestart,SIGNAL(triggered()),this,SLOT(restartDebugging()));
|
||||
|
||||
const char* errormsg=DbgInit();
|
||||
if(errormsg)
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, "DbgInit Error!", QString(errormsg));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.exec();
|
||||
ExitProcess(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue