1
0
Fork 0

PROJECT: updated clean.bat

PROJECT: updated MSVC projects
BRIDGE: use _gui_sendmessage
BRIDGE: small change of enum value
GUI: cleaned up the bridge (directly use Dbg* exports)
GUI: removed many exports
This commit is contained in:
mr.exodia 2013-12-06 15:10:44 +01:00
parent cecc3dccbd
commit df9c1e9a21
20 changed files with 97 additions and 257 deletions

View File

@ -74,4 +74,5 @@ cd ..
cd ..
echo cleaning help...
cd help
del /Q *.chm
del /Q *.chm
rmdir /S /Q output

View File

@ -6,12 +6,7 @@ HINSTANCE hInstDbg;
//GUI functions
GUIGUIINIT _gui_guiinit;
GUIDISASSEMBLEAT _gui_disassembleat;
GUISETDEBUGSTATE _gui_setdebugstate;
GUIADDLOGMESSAGE _gui_addlogmessage;
GUILOGCLEAR _gui_logclear;
GUIUPDATEREGISTERVIEW _gui_updateregisterview;
GUIUPDATEDISASSEMBLYVIEW _gui_updatedisassemblyview;
GUISENDMESSAGE _gui_sendmessage;
//DBG functions
DBGDBGINIT _dbg_dbginit;

View File

@ -29,21 +29,11 @@ extern HINSTANCE hInstDbg;
//GUI typedefs
typedef int (*GUIGUIINIT)(int, char**);
typedef void (*GUIDISASSEMBLEAT)(duint va, duint cip);
typedef void (*GUISETDEBUGSTATE)(DBGSTATE state);
typedef void (*GUIADDLOGMESSAGE)(const char* msg);
typedef void (*GUILOGCLEAR)();
typedef void (*GUIUPDATEREGISTERVIEW)();
typedef void (*GUIUPDATEDISASSEMBLYVIEW)();
typedef void (*GUISENDMESSAGE)(MSGTYPE type, void* param1, void* param2);
//GUI functions
extern GUIGUIINIT _gui_guiinit;
extern GUIDISASSEMBLEAT _gui_disassembleat;
extern GUISETDEBUGSTATE _gui_setdebugstate;
extern GUIADDLOGMESSAGE _gui_addlogmessage;
extern GUILOGCLEAR _gui_logclear;
extern GUIUPDATEREGISTERVIEW _gui_updateregisterview;
extern GUIUPDATEDISASSEMBLYVIEW _gui_updatedisassemblyview;
extern GUISENDMESSAGE _gui_sendmessage;
//DBG typedefs
typedef const char* (*DBGDBGINIT)();

View File

@ -34,30 +34,10 @@ BRIDGE_IMPEXP const char* BridgeInit()
_gui_guiinit=(GUIGUIINIT)GetProcAddress(hInstGui, "_gui_guiinit");
if(!_gui_guiinit)
return "Export \"_gui_guiinit\" could not be found!";
//_gui_disassembleat
_gui_disassembleat=(GUIDISASSEMBLEAT)GetProcAddress(hInstGui, "_gui_disassembleat");
if(!_gui_disassembleat)
return "Export \"_gui_disassembleat\" could not be found!";
//_gui_setdebugstate
_gui_setdebugstate=(GUISETDEBUGSTATE)GetProcAddress(hInstGui, "_gui_setdebugstate");
if(!_gui_setdebugstate)
return "Export \"_gui_setdebugstate\" could not be found!";
//_gui_addlogmessage
_gui_addlogmessage=(GUIADDLOGMESSAGE)GetProcAddress(hInstGui, "_gui_addlogmessage");
if(!_gui_addlogmessage)
return "Export \"_gui_addlogmessage\" could not be found!";
//_gui_logclear
_gui_logclear=(GUILOGCLEAR)GetProcAddress(hInstGui, "_gui_logclear");
if(!_gui_logclear)
return "Export \"_gui_logclear\" could not be found!";
//_gui_updateregisterview
_gui_updateregisterview=(GUIUPDATEREGISTERVIEW)GetProcAddress(hInstGui, "_gui_updateregisterview");
if(!_gui_updateregisterview)
return "Export \"_gui_updateregisterview\" could not be found!";
//_gui_updatedisassemblyview
_gui_updatedisassemblyview=(GUIUPDATEDISASSEMBLYVIEW)GetProcAddress(hInstGui, "_gui_updatedisassemblyview");
if(!_gui_updatedisassemblyview)
return "Export \"_gui_updatedisassemblyview\" could not be found!";
//_gui_sendmessage;
_gui_sendmessage=(GUISENDMESSAGE)GetProcAddress(hInstGui, "_gui_sendmessage");
if(!_gui_sendmessage)
return "Export \"_gui_sendmessage\" could not be found!";
///DBG Load
hInstDbg=LoadLibraryA(dbg_lib); //Mr. eXoDia
@ -387,22 +367,22 @@ BRIDGE_IMPEXP bool DbgCmdExecDirect(const char* cmd)
//GUI
BRIDGE_IMPEXP void GuiDisasmAt(duint addr, duint cip)
{
_gui_disassembleat(addr, cip);
_gui_sendmessage(GUI_DISASSEMBLE_AT, (void*)addr, (void*)cip);
}
BRIDGE_IMPEXP void GuiSetDebugState(DBGSTATE state)
{
_gui_setdebugstate(state);
_gui_sendmessage(GUI_SET_DEBUG_STATE, (void*)state, 0);
}
BRIDGE_IMPEXP void GuiAddLogMessage(const char* msg)
{
_gui_addlogmessage(msg);
_gui_sendmessage(GUI_ADD_MSG_TO_LOG, (void*)msg, 0);
}
BRIDGE_IMPEXP void GuiLogClear()
{
_gui_logclear();
_gui_sendmessage(GUI_CLEAR_LOG, 0, 0);
}
BRIDGE_IMPEXP void GuiUpdateAllViews()
@ -413,12 +393,12 @@ BRIDGE_IMPEXP void GuiUpdateAllViews()
BRIDGE_IMPEXP void GuiUpdateRegisterView()
{
_gui_updateregisterview();
_gui_sendmessage(GUI_UPDATE_REGISTER_VIEW, 0, 0);
}
BRIDGE_IMPEXP void GuiUpdateDisassemblyView()
{
_gui_updatedisassemblyview();
_gui_sendmessage(GUI_UPDATE_DISASSEMBLY_VIEW, 0, 0);
}
//Main

View File

@ -50,7 +50,7 @@ enum MSGTYPE
GUI_SET_DEBUG_STATE, // param1=(DBGSTATE)state, param2=unused
GUI_ADD_MSG_TO_LOG, // param1=(const char*)msg, param2=unused
GUI_CLEAR_LOG, // param1=unused, param2=unused
GUI_UPDATE_REGISTER, // param1=unused, param2=unused
GUI_UPDATE_REGISTER_VIEW, // param1=unused, param2=unused
GUI_UPDATE_DISASSEMBLY_VIEW // param1=unused, param2=unused
};

View File

@ -53,7 +53,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -68,7 +68,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

View File

@ -93,7 +93,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;BUILD_DBG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;BUILD_DBG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -109,7 +109,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;BUILD_DBG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;BUILD_DBG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

View File

@ -54,7 +54,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -70,7 +70,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

View File

@ -596,7 +596,7 @@ int_t Disassembly::getPreviousInstructionRVA(int_t rva, uint_t count)
wMaxByteCountToRead = wVirtualRVA + 1 + 16;
wBuffer.resize(wMaxByteCountToRead);
Bridge::getBridge()->readProcessMemory(reinterpret_cast<byte_t*>(wBuffer.data()), mBase + wBottomByteRealRVA, wMaxByteCountToRead);
DbgMemRead(mBase + wBottomByteRealRVA, reinterpret_cast<byte_t*>(wBuffer.data()), wMaxByteCountToRead);
int_t addr = mDisasm->DisassembleBack(reinterpret_cast<byte_t*>(wBuffer.data()), 0, wMaxByteCountToRead, wVirtualRVA, count);
@ -628,7 +628,7 @@ int_t Disassembly::getNextInstructionRVA(int_t rva, uint_t count)
wMaxByteCountToRead = wRemainingBytes > wMaxByteCountToRead ? wMaxByteCountToRead : wRemainingBytes;
wBuffer.resize(wMaxByteCountToRead);
Bridge::getBridge()->readProcessMemory(reinterpret_cast<byte_t*>(wBuffer.data()), mBase + rva, wMaxByteCountToRead);
DbgMemRead(mBase + rva, reinterpret_cast<byte_t*>(wBuffer.data()), wMaxByteCountToRead);
wNewRVA = mDisasm->DisassembleNext(reinterpret_cast<byte_t*>(wBuffer.data()), 0, wMaxByteCountToRead, wVirtualRVA, count);
wNewRVA += rva;
@ -680,7 +680,7 @@ Instruction_t Disassembly::DisassembleAt(int_t rva)
int_t wMaxByteCountToRead = 16 * 2;
wBuffer.resize(wMaxByteCountToRead);
Bridge::getBridge()->readProcessMemory(reinterpret_cast<byte_t*>(wBuffer.data()), mBase+rva, wMaxByteCountToRead);
DbgMemRead(mBase+rva, reinterpret_cast<byte_t*>(wBuffer.data()), wMaxByteCountToRead);
return mDisasm->DisassembleAt(reinterpret_cast<byte_t*>(wBuffer.data()), wMaxByteCountToRead, 0, base, rva);
}
@ -835,8 +835,8 @@ uint_t Disassembly::rvaToVa(int_t rva)
void Disassembly::disassambleAt(int_t parVA, int_t parCIP)
{
int_t wBase = Bridge::getBridge()->getBase(parVA);
int_t wSize = Bridge::getBridge()->getSize(wBase);
int_t wBase = DbgMemFindBaseAddr(parVA, 0);
int_t wSize = DbgMemGetPageSize(wBase);
int_t wRVA = parVA - wBase;
int_t wCipRva = parCIP - wBase;

View File

@ -28,8 +28,8 @@ HexDump::HexDump(QWidget *parent) :AbstractTableView(parent)
void HexDump::printDumpAt(int_t parVA)
{
int_t wBase = Bridge::getBridge()->getBase(parVA);
int_t wSize = Bridge::getBridge()->getSize(wBase);
int_t wBase = DbgMemFindBaseAddr(parVA, 0);
int_t wSize = DbgMemGetPageSize(wBase);
int_t wRVA = parVA - wBase;
setRowCount(wSize/mDumpByteWidth);

View File

@ -67,8 +67,7 @@ void MemoryMapView::stateChangedSlot(DBGSTATE state)
memset(&wMemMapStruct, 0, sizeof(MEMMAP));
Bridge::getBridge()->getMemMapFromDbg(&wMemMapStruct);
DbgMemMap(&wMemMapStruct);
//qDebug() << "count " << wMemMapStruct.count;
@ -140,7 +139,7 @@ void MemoryMapView::stateChangedSlot(DBGSTATE state)
if(wMemMapStruct.page != 0)
{
Bridge::getBridge()->Free(wMemMapStruct.page);
BridgeFree(wMemMapStruct.page);
}
}

View File

@ -225,7 +225,7 @@ void RegistersView::updateRegistersSlot()
REGDUMP wRegDumpStruct;
memset(&wRegDumpStruct, 0, sizeof(REGDUMP));
Bridge::getBridge()->getRegDumpFromDbg(&wRegDumpStruct);
DbgGetRegDump(&wRegDumpStruct);
ui->AXRegLabel->setText(QString("%1").arg(wRegDumpStruct.cax, sizeof(uint_t) * 2, 16, QChar('0')).toUpper());
ui->CXRegLabel->setText(QString("%1").arg(wRegDumpStruct.ccx, sizeof(uint_t) * 2, 16, QChar('0')).toUpper());
@ -525,5 +525,5 @@ void RegistersView::setRegister(REGISTER_NAME reg, uint_t value)
else
return;
Bridge::getBridge()->valToString(wRegName.toUtf8().constData(), value);
DbgValToString(wRegName.toUtf8().constData(), value);
}

View File

@ -21,13 +21,11 @@ WordEditDialog::~WordEditDialog()
void WordEditDialog::expressionChanged(QString s)
{
bool wIsValid = Bridge::getBridge()->isValidExpression(s.toUtf8().constData());
if(wIsValid == true)
if(DbgIsValidExpression(s.toUtf8().constData()))
{
ui->expressionLineEdit->setStyleSheet("");
ui->buttons->button(QDialogButtonBox::Ok)->setEnabled(true);
mWord = Bridge::getBridge()->getValFromString(reinterpret_cast<const char*>(s.toUtf8().constData()));
mWord = DbgValFromString(s.toUtf8().constData());
ui->hexLineEdit->setText(QString("%1").arg(mWord, sizeof(uint_t) * 2, 16, QChar('0')).toUpper());
ui->signedLineEdit->setText(QString::number((int_t)mWord));
ui->unsignedLineEdit->setText(QString::number((uint_t)mWord));

View File

@ -3,9 +3,7 @@
/************************************************************************************
Global Variables
************************************************************************************/
Bridge* mBridge;
static Bridge* mBridge;
/************************************************************************************
Class Members
@ -17,9 +15,9 @@ Bridge::Bridge(QObject *parent) : QObject(parent)
QFile wFile("AsmCode.bin");
if(wFile.open(QIODevice::ReadOnly) == false)
//qDebug() << "File has not been opened.";
//qDebug() << "File has not been opened.";
*mData = wFile.readAll();
*mData = wFile.readAll();
//qDebug() << "Size: " << mData->size();
if(mData->size() == 0)
@ -28,17 +26,6 @@ Bridge::Bridge(QObject *parent) : QObject(parent)
}
}
void Bridge::readProcessMemory(byte_t* dest, uint_t va, uint_t size)
{
#ifdef BUILD_LIB
DbgMemRead(va, dest, size);
#else
stubReadProcessMemory(dest, va, size);
#endif
}
void Bridge::emitDisassembleAtSignal(int_t va, int_t eip)
{
#ifdef BUILD_LIB
@ -53,25 +40,6 @@ void Bridge::emitUpdateDisassembly()
#endif
}
uint_t Bridge::getSize(uint_t va)
{
#ifdef BUILD_LIB
return DbgMemGetPageSize(va);
#else
return mData->size();
#endif
}
uint_t Bridge::getBase(uint_t addr)
{
#ifdef BUILD_LIB
return DbgMemFindBaseAddr(addr,0);
#else
return 0x00401000;
#endif
}
void Bridge::emitDbgStateChanged(DBGSTATE state)
{
#ifdef BUILD_LIB
@ -85,7 +53,6 @@ void Bridge::emitAddMsgToLog(QString msg)
emit addMsgToLog(msg);
}
void Bridge::emitClearLog()
{
emit clearLog();
@ -96,44 +63,6 @@ void Bridge::emitUpdateRegisters()
emit updateRegisters();
}
bool Bridge::execCmd(const char* cmd)
{
return DbgCmdExec(cmd);
}
bool Bridge::getMemMapFromDbg(MEMMAP* parMemMap)
{
return DbgMemMap(parMemMap);
}
bool Bridge::isValidExpression(const char* expression)
{
return DbgIsValidExpression(expression);
}
bool Bridge::valToString(const char* name, uint_t value)
{
return DbgValToString(name, value);
}
void Bridge::Free(void* ptr)
{
BridgeFree(ptr);
}
bool Bridge::getRegDumpFromDbg(REGDUMP* parRegDump)
{
return DbgGetRegDump(parRegDump);
}
uint_t Bridge::getValFromString(const char* string)
{
return DbgValFromString(string);
}
/************************************************************************************
Static Functions
************************************************************************************/
@ -158,92 +87,58 @@ void Bridge::initBridge()
#ifdef BUILD_LIB
__declspec(dllexport) int _gui_guiinit(int argc, char *argv[])
__declspec(dllexport) int _gui_guiinit(int argc, char *argv[])
{
return main(argc, argv);
}
__declspec(dllexport) void _gui_sendmessage(MSGTYPE type, void* param1, void* param2)
{
switch(type)
{
return main(argc, argv);
}
__declspec(dllexport) void _gui_disassembleat(duint va, duint eip)
case GUI_DISASSEMBLE_AT:
{
//Bridge::getBridge()->emitDisassembleAtSignal((int_t)va, (int_t)eip);
_gui_sendmessage(GUI_DISASSEMBLE_AT, (void*)va, (void*)eip);
Bridge::getBridge()->emitDisassembleAtSignal((int_t)param1, (int_t)param2);
}
break;
__declspec(dllexport) void _gui_updatedisassemblyview()
case GUI_SET_DEBUG_STATE:
{
//Bridge::getBridge()->emitUpdateDisassembly();
_gui_sendmessage(GUI_UPDATE_DISASSEMBLY_VIEW, (void*)0, (void*)0);
Bridge::getBridge()->emitDbgStateChanged(reinterpret_cast<DBGSTATE&>(param1));
}
break;
__declspec(dllexport) void _gui_setdebugstate(DBGSTATE state)
case GUI_ADD_MSG_TO_LOG:
{
//Bridge::getBridge()->emitDbgStateChanged(state);
_gui_sendmessage(GUI_SET_DEBUG_STATE, (void*)state, (void*)0);
Bridge::getBridge()->emitAddMsgToLog(QString(reinterpret_cast<const char*>(param1)));
}
break;
__declspec(dllexport) void _gui_addlogmessage(const char* msg)
case GUI_CLEAR_LOG:
{
//Bridge::getBridge()->emitAddMsgToLog(QString(msg));
_gui_sendmessage(GUI_ADD_MSG_TO_LOG, (void*)msg, (void*)0);
Bridge::getBridge()->emitClearLog();
}
break;
__declspec(dllexport) void _gui_logclear()
case GUI_UPDATE_REGISTER_VIEW:
{
//Bridge::getBridge()->emitClearLog();
_gui_sendmessage(GUI_CLEAR_LOG, (void*)0, (void*)0);
Bridge::getBridge()->emitUpdateRegisters();
}
break;
__declspec(dllexport) void _gui_updateregisterview()
case GUI_UPDATE_DISASSEMBLY_VIEW:
{
//Bridge::getBridge()->emitUpdateRegisters();
_gui_sendmessage(GUI_UPDATE_REGISTER, (void*)0, (void*)0);
Bridge::getBridge()->emitUpdateDisassembly();
}
break;
__declspec(dllexport) void _gui_sendmessage(MSGTYPE type, void* param1, void* param2)
default:
{
switch(type)
{
case GUI_DISASSEMBLE_AT:
{
Bridge::getBridge()->emitDisassembleAtSignal((int_t)param1, (int_t)param2);
}
break;
case GUI_SET_DEBUG_STATE:
{
Bridge::getBridge()->emitDbgStateChanged(reinterpret_cast<DBGSTATE&>(param1));
}
break;
case GUI_ADD_MSG_TO_LOG:
{
Bridge::getBridge()->emitAddMsgToLog(QString(reinterpret_cast<const char*>(param1)));
}
break;
case GUI_CLEAR_LOG:
{
Bridge::getBridge()->emitClearLog();
}
break;
case GUI_UPDATE_REGISTER:
{
Bridge::getBridge()->emitUpdateRegisters();
}
break;
case GUI_UPDATE_DISASSEMBLY_VIEW:
{
Bridge::getBridge()->emitUpdateDisassembly();
}
break;
default:
{
}
break;
}
}
break;
}
}
#endif
@ -252,15 +147,15 @@ void Bridge::initBridge()
Imported Functions (Stub)
************************************************************************************/
#ifndef BUILD_LIB
void stubReadProcessMemory(byte_t* dest, uint_t va, uint_t size)
{
uint_t wI;
void stubReadProcessMemory(byte_t* dest, uint_t va, uint_t size)
{
uint_t wI;
for(wI = 0; wI < size; wI++)
{
dest[wI] = Bridge::getBridge()->mData->data()[(va - Bridge::getBridge()->getBase(0)) + wI];
}
for(wI = 0; wI < size; wI++)
{
dest[wI] = Bridge::getBridge()->mData->data()[(va - Bridge::getBridge()->getBase(0)) + wI];
}
}
#endif

View File

@ -19,21 +19,11 @@ class Bridge : public QObject
Q_OBJECT
public:
explicit Bridge(QObject *parent = 0);
void readProcessMemory(byte_t* dest, uint_t va, uint_t size);
uint_t getSize(uint_t va);
void emitDisassembleAtSignal(int_t va, int_t eip);
void emitUpdateDisassembly();
void emitDbgStateChanged(DBGSTATE state);
uint_t getBase(uint_t addr);
static Bridge* getBridge();
static void initBridge();
bool execCmd(const char* cmd);
bool getMemMapFromDbg(MEMMAP* parMemMap);
bool isValidExpression(const char* expression);
void Free(void* ptr);
bool getRegDumpFromDbg(REGDUMP* parRegDump);
uint_t getValFromString(const char* string);
bool valToString(const char* name, uint_t value);
void emitAddMsgToLog(QString msg);
void emitClearLog();
void emitUpdateRegisters();

View File

@ -9,14 +9,6 @@
#ifdef BUILD_LIB
extern "C" __declspec(dllexport) int _gui_guiinit(int argc, char *argv[]);
extern "C" __declspec(dllexport) void _gui_disassembleat(duint va, duint cip);
extern "C" __declspec(dllexport) void _gui_setdebugstate(DBGSTATE state);
extern "C" __declspec(dllexport) void _gui_addlogmessage(const char* msg);
extern "C" __declspec(dllexport) void _gui_logclear();
extern "C" __declspec(dllexport) void _gui_updateregisterview();
extern "C" __declspec(dllexport) void _gui_updatedisassemblyview();
extern "C" __declspec(dllexport) void _gui_sendmessage(MSGTYPE type, void* param1, void* param2);
#endif

View File

@ -182,7 +182,7 @@ void CPUDisassembly::setupRightClickContextMenu()
void CPUDisassembly::gotoOrigin()
{
Bridge::getBridge()->execCmd("d cip");
DbgCmdExec("d cip");
}
@ -201,7 +201,7 @@ void CPUDisassembly::toggleInt3BPAction()
wCmd = "bp " + QString("%1").arg(wVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
}
Bridge::getBridge()->execCmd(wCmd.toUtf8().constData());
DbgCmdExec(wCmd.toUtf8().constData());
}
@ -220,7 +220,7 @@ void CPUDisassembly::toggleHwBpActionSlot()
wCmd = "bphws " + QString("%1").arg(wVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
}
Bridge::getBridge()->execCmd(wCmd.toUtf8().constData());
DbgCmdExec(wCmd.toUtf8().constData());
}
@ -274,17 +274,17 @@ void CPUDisassembly::setHwBpAt(uint_t va, int slot)
if(wSlotIndex < 0) // Slot not used
{
wCmd = "bphws " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
Bridge::getBridge()->execCmd(wCmd.toUtf8().constData());
DbgCmdExec(wCmd.toUtf8().constData());
}
else // Slot used
{
wCmd = "bphwc " + QString("%1").arg((uint_t)(wBPList.bp[wSlotIndex].addr), sizeof(uint_t) * 2, 16, QChar('0')).toUpper();
Bridge::getBridge()->execCmd(wCmd.toUtf8().constData());
DbgCmdExec(wCmd.toUtf8().constData());
Sleep(200);
wCmd = "bphws " + QString("%1").arg(va, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
Bridge::getBridge()->execCmd(wCmd.toUtf8().constData());
DbgCmdExec(wCmd.toUtf8().constData());
}
}
@ -292,7 +292,7 @@ void CPUDisassembly::setNewOriginHereActionSlot()
{
uint_t wVA = rvaToVa(getInitialSelection());
QString wCmd = "cip=" + QString("%1").arg(wVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
Bridge::getBridge()->execCmd(wCmd.toUtf8().constData());
DbgCmdExec(wCmd.toUtf8().constData());
}
void CPUDisassembly::setLabel()

View File

@ -32,7 +32,7 @@ void GotoDialog::on_editExpression_textChanged(const QString &arg1)
ui->buttonOk->setEnabled(false);
expressionText.clear();
}
else if(!Bridge::getBridge()->isValidExpression(arg1.toUtf8().constData())) //invalid expression
else if(!DbgIsValidExpression(arg1.toUtf8().constData())) //invalid expression
{
ui->labelError->setText("<font color='red'><b>Invalid expression...</b></color>");
ui->buttonOk->setEnabled(false);

View File

@ -118,7 +118,7 @@ void MainWindow::executeCommand()
{
QString wCmd = mCmdLineEdit->text();
Bridge::getBridge()->execCmd(wCmd.toUtf8().constData());
DbgCmdExec(wCmd.toUtf8().constData());
mCmdLineEdit->addCmdToHistory(wCmd);
mCmdLineEdit->setText("");
@ -127,12 +127,12 @@ void MainWindow::executeCommand()
void MainWindow::execStepOver()
{
Bridge::getBridge()->execCmd("StepOver");
DbgCmdExec("StepOver");
}
void MainWindow::execStepInto()
{
Bridge::getBridge()->execCmd("StepInto");
DbgCmdExec("StepInto");
}
void MainWindow::setFocusToCommandBar()
@ -142,17 +142,17 @@ void MainWindow::setFocusToCommandBar()
void MainWindow::execClose()
{
Bridge::getBridge()->execCmd("stop");
DbgCmdExec("stop");
}
void MainWindow::execRun()
{
Bridge::getBridge()->execCmd("run");
DbgCmdExec("run");
}
void MainWindow::execRtr()
{
Bridge::getBridge()->execCmd("rtr");
DbgCmdExec("rtr");
}
void MainWindow::displayMemMapWidget()
@ -183,7 +183,7 @@ void MainWindow::on_actionGoto_triggered()
if(mGoto.exec()==QDialog::Accepted)
{
QString cmd;
Bridge::getBridge()->execCmd(cmd.sprintf("disasm \"%s\"", mGoto.expressionText.toUtf8().constData()).toUtf8().constData());
DbgCmdExec(cmd.sprintf("disasm \"%s\"", mGoto.expressionText.toUtf8().constData()).toUtf8().constData());
}
}
@ -196,17 +196,17 @@ void MainWindow::openFile()
if(DbgIsDebugging())
DbgCmdExecDirect("stop");
QString cmd;
Bridge::getBridge()->execCmd(cmd.sprintf("init \"%s\"", filename.toUtf8().constData()).toUtf8().constData());
DbgCmdExec(cmd.sprintf("init \"%s\"", filename.toUtf8().constData()).toUtf8().constData());
}
void MainWindow::execPause()
{
Bridge::getBridge()->execCmd("pause");
DbgCmdExec("pause");
}
void MainWindow::startScylla() //this is executed
{
Bridge::getBridge()->execCmd("StartScylla");
DbgCmdExec("StartScylla");
}
void MainWindow::restartDebugging()
@ -216,11 +216,11 @@ void MainWindow::restartDebugging()
return;
if(DbgIsDebugging())
{
Bridge::getBridge()->execCmd("stop"); //close current file (when present)
DbgCmdExec("stop"); //close current file (when present)
Sleep(400);
}
QString cmd;
Bridge::getBridge()->execCmd(cmd.sprintf("init \"%s\"", filename).toUtf8().constData());
DbgCmdExec(cmd.sprintf("init \"%s\"", filename).toUtf8().constData());
}
void MainWindow::displayBreakpointWidget()
@ -247,7 +247,7 @@ void MainWindow::dropEvent(QDropEvent* pEvent)
if(DbgIsDebugging())
DbgCmdExecDirect("stop");
QString cmd;
Bridge::getBridge()->execCmd(cmd.sprintf("init \"%s\"", filename.toUtf8().constData()).toUtf8().constData());
DbgCmdExec(cmd.sprintf("init \"%s\"", filename.toUtf8().constData()).toUtf8().constData());
}
pEvent->acceptProposedAction();
}

View File

@ -9,7 +9,7 @@ MemoryPage::MemoryPage(uint_t parBase, uint_t parSize, QObject *parent) : QObjec
void MemoryPage::readOriginalMemory(byte_t* parDest, uint_t parRVA, uint_t parSize)
{
Bridge::getBridge()->readProcessMemory(parDest, mBase + parRVA, parSize);
DbgMemRead(mBase + parRVA, parDest, parSize);
}