From 77293f38ddd7c8ed54922f3d59194064b04a59fa Mon Sep 17 00:00:00 2001 From: dreg_fr33project Date: Sat, 16 Aug 2014 19:34:41 +0200 Subject: [PATCH 01/17] BASIC SET MEMORY PAGE RIGHT GUI --- x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp | 14 ++ x64_dbg_gui/Project/Src/Gui/MemoryMapView.h | 3 + .../Project/Src/Gui/PageMemoryRights.cpp | 14 ++ .../Project/Src/Gui/PageMemoryRights.h | 23 ++ .../Project/Src/Gui/PageMemoryRights.ui | 224 ++++++++++++++++++ x64_dbg_gui/Project/x64_dbg.pro | 9 +- 6 files changed, 284 insertions(+), 3 deletions(-) create mode 100644 x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp create mode 100644 x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h create mode 100644 x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp index 4906a1f5..a0b236d7 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp @@ -34,6 +34,10 @@ void MemoryMapView::setupContextMenu() connect(mFollowDisassembly, SIGNAL(triggered()), this, SLOT(followDisassemblerSlot())); connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followDisassemblerSlot())); + //Set PageMemory Rights + mPageMemoryRights = new QAction("Set Page Memory Rights", this); + connect(mPageMemoryRights, SIGNAL(triggered()), this, SLOT(pageMemoryRights())); + //Switch View mSwitchView = new QAction("&Switch View", this); connect(mSwitchView, SIGNAL(triggered()), this, SLOT(switchView())); @@ -103,6 +107,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos) wMenu->addAction(mFollowDisassembly); wMenu->addAction(mFollowDump); wMenu->addAction(mSwitchView); + wMenu->addAction(mPageMemoryRights); wMenu->addSeparator(); wMenu->addMenu(mBreakpointMenu); QMenu wCopyMenu("&Copy", this); @@ -371,6 +376,15 @@ void MemoryMapView::memoryExecuteSingleshootToggleSlot() memoryExecuteSingleshootSlot(); } +void MemoryMapView::pageMemoryRights() +{ + PageMemoryRights* mPageMemoryRightsDialog = new PageMemoryRights(this); + // mPageMemoryRightsDialog->ShowNormal(); + //mPageMemoryRightsDialog->SetFocus(); + + mPageMemoryRightsDialog->exec(); +} + void MemoryMapView::switchView() { duint setting = 0; diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h index a461673a..e4f282e4 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h @@ -4,6 +4,7 @@ #include #include "StdTable.h" #include "Bridge.h" +#include "PageMemoryRights.h" class MemoryMapView : public StdTable { @@ -31,6 +32,7 @@ public slots: void memoryExecuteSingleshootToggleSlot(); void contextMenuSlot(const QPoint & pos); void switchView(); + void pageMemoryRights(); private: QString getProtectionString(DWORD Protect); @@ -38,6 +40,7 @@ private: QAction* mFollowDump; QAction* mFollowDisassembly; QAction* mSwitchView; + QAction* mPageMemoryRights; QMenu* mBreakpointMenu; QMenu* mMemoryAccessMenu; diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp new file mode 100644 index 00000000..a9d98c62 --- /dev/null +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp @@ -0,0 +1,14 @@ +#include "PageMemoryRights.h" +#include "ui_PageMemoryRights.h" + +PageMemoryRights::PageMemoryRights(QWidget* parent) : + QDialog(parent), + ui(new Ui::PageMemoryRights) +{ + ui->setupUi(this); +} + +PageMemoryRights::~PageMemoryRights() +{ + delete ui; +} diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h new file mode 100644 index 00000000..2e504989 --- /dev/null +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h @@ -0,0 +1,23 @@ +#ifndef PAGEMEMORYRIGHTS_H +#define PAGEMEMORYRIGHTS_H + +#include + +namespace Ui +{ +class PageMemoryRights; +} + +class PageMemoryRights : public QDialog +{ + Q_OBJECT + +public: + explicit PageMemoryRights(QWidget* parent = 0); + ~PageMemoryRights(); + +private: + Ui::PageMemoryRights* ui; +}; + +#endif // PAGEMEMORYRIGHTS_H diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui new file mode 100644 index 00000000..16a88dda --- /dev/null +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui @@ -0,0 +1,224 @@ + + + PageMemoryRights + + + + 0 + 0 + 482 + 299 + + + + + 0 + 0 + + + + Set Page Memory Rights + + + + :/icons/images/memory-map.png:/icons/images/memory-map.png + + + + + 350 + 270 + 121 + 21 + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + 20 + 30 + 311 + 192 + + + + + + + 10 + 10 + 331 + 251 + + + + Pages + + + + + + 350 + 10 + 121 + 201 + + + + + + + Rights + + + + + + NO ACCESS + + + + + + + READ ONLY + + + + + + + READ & WRITE + + + + + + + EXECUTE + + + + + + + EXECUTE & READ + + + + + + + FULL ACCESS + + + + + + + + + + Set Rights + + + + + + + + + 20 + 230 + 230 + 25 + + + + + + + Select ALL + + + + + + + Deselect ALL + + + + + + + + + 10 + 270 + 331 + 20 + + + + true + + + buttonBox + pushButton + groupBox + lineEdit + lineEdit + pushButton_2 + pushButton_3 + pushButton + tableWidget + pushButton_2 + pushButton_3 + groupBox_2 + + + + + + + buttonBox + accepted() + PageMemoryRights + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + PageMemoryRights + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/x64_dbg_gui/Project/x64_dbg.pro b/x64_dbg_gui/Project/x64_dbg.pro index 875e39b7..175a0f18 100644 --- a/x64_dbg_gui/Project/x64_dbg.pro +++ b/x64_dbg_gui/Project/x64_dbg.pro @@ -84,7 +84,8 @@ SOURCES += \ Src/Gui/ShortcutsDialog.cpp \ Src/BasicView/ShortcutEdit.cpp \ Src/Gui/CalculatorDialog.cpp \ - Src/Gui/AttachDialog.cpp + Src/Gui/AttachDialog.cpp \ + Src/Gui/PageMemoryRights.cpp HEADERS += \ @@ -147,7 +148,8 @@ HEADERS += \ Src/Gui/ShortcutsDialog.h \ Src/BasicView/ShortcutEdit.h \ Src/Gui/CalculatorDialog.h \ - Src/Gui/AttachDialog.h + Src/Gui/AttachDialog.h \ + Src/Gui/PageMemoryRights.h INCLUDEPATH += \ @@ -180,7 +182,8 @@ FORMS += \ Src/Gui/PatchDialogGroupSelector.ui \ Src/Gui/ShortcutsDialog.ui \ Src/Gui/CalculatorDialog.ui \ - Src/Gui/AttachDialog.ui + Src/Gui/AttachDialog.ui \ + Src/Gui/PageMemoryRights.ui INCLUDEPATH += $$PWD/Src/Bridge From 3f86be63bc88156f29a88e0472c9f1690f10e01f Mon Sep 17 00:00:00 2001 From: dreg_fr33project Date: Sun, 17 Aug 2014 06:38:00 +0200 Subject: [PATCH 02/17] a lot of news in the MEMORY SET RIGHTS STUFF, ALL GUI 80% FINISHED --- x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp | 28 +++++++- .../Project/Src/Gui/PageMemoryRights.cpp | 64 +++++++++++++++++ .../Project/Src/Gui/PageMemoryRights.h | 11 +++ .../Project/Src/Gui/PageMemoryRights.ui | 70 ++++++++++--------- 4 files changed, 138 insertions(+), 35 deletions(-) diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp index a0b236d7..7b454849 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp @@ -107,6 +107,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos) wMenu->addAction(mFollowDisassembly); wMenu->addAction(mFollowDump); wMenu->addAction(mSwitchView); + wMenu->addSeparator(); wMenu->addAction(mPageMemoryRights); wMenu->addSeparator(); wMenu->addMenu(mBreakpointMenu); @@ -379,10 +380,31 @@ void MemoryMapView::memoryExecuteSingleshootToggleSlot() void MemoryMapView::pageMemoryRights() { PageMemoryRights* mPageMemoryRightsDialog = new PageMemoryRights(this); - // mPageMemoryRightsDialog->ShowNormal(); - //mPageMemoryRightsDialog->SetFocus(); - mPageMemoryRightsDialog->exec(); + if(getCellContent(getInitialSelection(), 3) != "IMG") + { + QMessageBox msg(QMessageBox::Warning, "ERROR TYPE", "ONLY SUPPORTED IMG TYPE YET"); + msg.setWindowIcon(QIcon(":/icons/images/compile-warning.png")); + msg.setParent(this, Qt::Dialog); + msg.setWindowFlags(msg.windowFlags() & (~Qt::WindowContextHelpButtonHint)); + msg.exec(); + + return; + } + +#ifdef _WIN64 + uint_t addr = getCellContent(getInitialSelection(), 0).toULongLong(0, 16); +#else //x86 + uint_t addr = getCellContent(getInitialSelection(), 0).toULong(0, 16); +#endif //_WIN64 + +#ifdef _WIN64 + uint_t size = getCellContent(getInitialSelection(), 1).toULongLong(0, 16); +#else //x86 + uint_t size = getCellContent(getInitialSelection(), 1).toULong(0, 16); +#endif //_WIN64 + + mPageMemoryRightsDialog->RunAddrSize(addr, size); } void MemoryMapView::switchView() diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp index a9d98c62..89ed25a4 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp @@ -1,14 +1,78 @@ #include "PageMemoryRights.h" #include "ui_PageMemoryRights.h" +#include PageMemoryRights::PageMemoryRights(QWidget* parent) : QDialog(parent), ui(new Ui::PageMemoryRights) { ui->setupUi(this); + //set window flags + setModal(true); + setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint); } PageMemoryRights::~PageMemoryRights() { delete ui; } + +void PageMemoryRights::RunAddrSize(uint_t addrin, uint_t sizein) +{ + addr = addrin; + size = sizein; + + int charwidth = QFontMetrics(this->font()).width(QChar(' ')); + + //addColumnAt(8 + charwidth * 2 * sizeof(uint_t), "ADDR", false, "Address"); //addr + QTableWidget* tableWidget = ui->pagetableWidget; + tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + + uint_t nr_pages = size / 1000; + tableWidget->setColumnCount(2); + tableWidget->setRowCount(nr_pages); + + tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString("ADDR"))); + tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString("RIGHTS"))); + + for(uint_t i = 0; i < nr_pages; i++) + { + tableWidget->setItem(i, 0, new QTableWidgetItem(QString("%1").arg(addr + (i * 1000), sizeof(uint_t) * 2, 16, QChar('0')).toUpper())); + + + } + + + QModelIndex idx = (ui->pagetableWidget->model()->index(0, 0)); + ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select); + idx = (ui->pagetableWidget->model()->index(0, 1)); + ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select); + + ui->radioFullaccess->setChecked(true); + exec(); + +} + + + +void PageMemoryRights::on_btnSelectall_clicked() +{ + for(int i = 0; i < ui->pagetableWidget->rowCount(); i++) + { + for(int j = 0; j < ui->pagetableWidget->columnCount(); j++) + { + QModelIndex idx = (ui->pagetableWidget->model()->index(i, j)); + ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select); + } + } +} + +void PageMemoryRights::on_btnDeselectall_clicked() +{ + QModelIndexList indexList = ui->pagetableWidget->selectionModel()->selectedIndexes(); + foreach(QModelIndex index, indexList) + { + ui->pagetableWidget->selectionModel()->select(index, QItemSelectionModel::Deselect); + + } +} diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h index 2e504989..cc8e4761 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h @@ -2,6 +2,9 @@ #define PAGEMEMORYRIGHTS_H #include +#include "StdTable.h" +#include "Bridge.h" + namespace Ui { @@ -14,10 +17,18 @@ class PageMemoryRights : public QDialog public: explicit PageMemoryRights(QWidget* parent = 0); + void RunAddrSize(uint_t, uint_t); ~PageMemoryRights(); +private slots: + void on_btnSelectall_clicked(); + + void on_btnDeselectall_clicked(); + private: Ui::PageMemoryRights* ui; + uint_t addr; + uint_t size; }; #endif // PAGEMEMORYRIGHTS_H diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui index 16a88dda..db7cc30b 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui @@ -6,12 +6,12 @@ 0 0 - 482 + 509 299 - + 0 0 @@ -39,35 +39,34 @@ QDialogButtonBox::Close - + + + true + 20 - 30 + 11 311 - 192 + 211 - - - - - 10 - 10 - 331 - 251 - + + true - - Pages + + QAbstractItemView::NoEditTriggers + + false + - + 350 10 - 121 + 122 201 @@ -114,7 +113,7 @@ - + FULL ACCESS @@ -132,7 +131,7 @@ - + 20 @@ -143,14 +142,14 @@ - + Select ALL - + Deselect ALL @@ -171,18 +170,25 @@ true + + + + 260 + 240 + 241 + 20 + + + + Press CTRL or SHIFT key to select multiple pages + + + layoutWidget + layoutWidget buttonBox - pushButton - groupBox lineEdit - lineEdit - pushButton_2 - pushButton_3 - pushButton - tableWidget - pushButton_2 - pushButton_3 - groupBox_2 + pagetableWidget + label From a85c7e5b45e165f02595949b58567778caf449d4 Mon Sep 17 00:00:00 2001 From: dreg_fr33project Date: Mon, 18 Aug 2014 08:41:24 +0200 Subject: [PATCH 03/17] Memory Rights finish --- x64_dbg_dbg/_dbgfunctions.cpp | 18 +++ x64_dbg_dbg/_dbgfunctions.h | 6 + x64_dbg_dbg/debugger.cpp | 114 ++++++++++++++++++ x64_dbg_dbg/debugger.h | 6 + x64_dbg_dbg/debugger_commands.cpp | 50 ++++++++ x64_dbg_dbg/debugger_commands.h | 2 + x64_dbg_dbg/x64_dbg.cpp | 2 + x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp | 53 ++------ .../Project/Src/Gui/PageMemoryRights.cpp | 76 ++++++++++-- .../Project/Src/Gui/PageMemoryRights.h | 6 +- .../Project/Src/Gui/PageMemoryRights.ui | 89 +++++++++----- 11 files changed, 337 insertions(+), 85 deletions(-) diff --git a/x64_dbg_dbg/_dbgfunctions.cpp b/x64_dbg_dbg/_dbgfunctions.cpp index 8caa2ec3..cc156eb2 100644 --- a/x64_dbg_dbg/_dbgfunctions.cpp +++ b/x64_dbg_dbg/_dbgfunctions.cpp @@ -112,6 +112,21 @@ static bool _getjitauto(bool* jit_auto) return dbggetjitauto(jit_auto, notfound, NULL, NULL); } +static bool _getpagerights(uint* addr, char* rights) +{ + return dbggetpagerights(addr, rights); +} + +static bool _pagerightstostring(DWORD protect, char* rights) +{ + return dbgpagerightstostring(protect, rights); +} + +static bool _setpagerights(uint* addr, char* rights) +{ + return dbgsetpagerights(addr, rights); +} + static bool _getjit(char* jit, bool jit64) { arch dummy; @@ -180,4 +195,7 @@ void dbgfunctionsinit() _dbgfunctions.GetJitAuto = _getjitauto; _dbgfunctions.GetDefJit = dbggetdefjit; _dbgfunctions.GetProcessList = _getprocesslist; + _dbgfunctions.GetPageRights = _getpagerights; + _dbgfunctions.SetPageRights = _setpagerights; + _dbgfunctions.PageRightsToString = _pagerightstostring; } diff --git a/x64_dbg_dbg/_dbgfunctions.h b/x64_dbg_dbg/_dbgfunctions.h index 47219fe6..a4fdcffe 100644 --- a/x64_dbg_dbg/_dbgfunctions.h +++ b/x64_dbg_dbg/_dbgfunctions.h @@ -57,6 +57,9 @@ typedef bool (*GETJIT)(char* jit, bool x64); typedef bool (*GETJITAUTO)(bool*); typedef bool (*GETDEFJIT)(char*); typedef bool (*GETPROCESSLIST)(DBGPROCESSINFO** entries, int* count); +typedef bool (*GETPAGERIGHTS)(duint*, char*); +typedef bool (*SETPAGERIGHTS)(duint*, char*); +typedef bool (*PAGERIGHTSTOSTRING)(DWORD, char*); typedef struct DBGFUNCTIONS_ { @@ -84,6 +87,9 @@ typedef struct DBGFUNCTIONS_ GETJIT GetJit; GETDEFJIT GetDefJit; GETPROCESSLIST GetProcessList; + GETPAGERIGHTS GetPageRights; + SETPAGERIGHTS SetPageRights; + PAGERIGHTSTOSTRING PageRightsToString; } DBGFUNCTIONS; #ifdef BUILD_DBG diff --git a/x64_dbg_dbg/debugger.cpp b/x64_dbg_dbg/debugger.cpp index ed34a7f2..41828f23 100644 --- a/x64_dbg_dbg/debugger.cpp +++ b/x64_dbg_dbg/debugger.cpp @@ -1562,6 +1562,120 @@ bool _readwritejitkey(char* jit_key_value, DWORD* jit_key_vale_size, char* key, return true; } +bool dbgpagerightstostring(DWORD protect, char* rights) +{ + memset(rights, 0, RIGHTS_STRING); + + switch(protect & 0xFF) + { + case PAGE_EXECUTE: + strcpy(rights, "E---"); + break; + case PAGE_EXECUTE_READ: + strcpy(rights, "ER--"); + break; + case PAGE_EXECUTE_READWRITE: + strcpy(rights, "ERW-"); + break; + case PAGE_EXECUTE_WRITECOPY: + strcpy(rights, "ERWC"); + break; + case PAGE_NOACCESS: + strcpy(rights, "----"); + break; + case PAGE_READONLY: + strcpy(rights, "-R--"); + break; + case PAGE_READWRITE: + strcpy(rights, "-RW-"); + break; + case PAGE_WRITECOPY: + strcpy(rights, "-RWC"); + break; + } + + if(protect & PAGE_GUARD) + strcat(rights, "G"); + else + strcat(rights, "-"); + + return true; +} + +void dbggetpageligned(uint* addr) +{ +#ifdef _WIN64 + * addr &= 0xFFFFFFFFFFFFF000; +#else // _WIN32 + * addr &= 0xFFFFF000; +#endif // _WIN64 +} + + +bool dbgpagerightsfromstring(DWORD* protect, char* rights_string) +{ + if(strlen(rights_string) < 2) + return false; + + * protect = 0; + if(rights_string[0] == 'G' || rights_string[0] == 'g') + { + * protect |= PAGE_GUARD; + rights_string++; + } + + if(_strcmpi(rights_string, "Execute") == 0) + * protect |= PAGE_EXECUTE; + else if(_strcmpi(rights_string, "ExecuteRead") == 0) + * protect |= PAGE_EXECUTE_READ; + else if(_strcmpi(rights_string, "ExecuteReadWrite") == 0) + * protect |= PAGE_EXECUTE_READWRITE; + else if(_strcmpi(rights_string, "ExecuteWriteCopy") == 0) + * protect |= PAGE_EXECUTE_WRITECOPY; + else if(_strcmpi(rights_string, "NoAccess") == 0) + * protect |= PAGE_NOACCESS; + else if(_strcmpi(rights_string, "ReadOnly") == 0) + * protect |= PAGE_READONLY; + else if(_strcmpi(rights_string, "ReadWrite") == 0) + * protect |= PAGE_READWRITE; + else if(_strcmpi(rights_string, "WriteCopy") == 0) + * protect |= PAGE_WRITECOPY; + + if(* protect == 0) + return false; + + return true; +} + +bool dbgsetpagerights(uint* addr, char* rights_string) +{ + DWORD protect; + DWORD old_protect; + + dbggetpageligned(addr); + + if(!dbgpagerightsfromstring(& protect, rights_string)) + return false; + + if(VirtualProtectEx(fdProcessInfo->hProcess, (void*)*addr, PAGE_SIZE, protect, & old_protect) == 0) + return false; + + // ADD ME: CALL TO UPDATE MEMORY VIEW HERE :-) + + return true; +} + +bool dbggetpagerights(uint* addr, char* rights) +{ + dbggetpageligned(addr); + + MEMORY_BASIC_INFORMATION mbi; + if(VirtualQueryEx(fdProcessInfo->hProcess, (const void*)*addr, &mbi, sizeof(mbi)) == 0) + return false; + + return dbgpagerightstostring(mbi.Protect, rights); +} + bool dbggetjitauto(bool* auto_on, arch arch_in, arch* arch_out, readwritejitkey_error_t* rw_error_out) { char jit_entry[4]; diff --git a/x64_dbg_dbg/debugger.h b/x64_dbg_dbg/debugger.h index 23c0c13d..76a17d73 100644 --- a/x64_dbg_dbg/debugger.h +++ b/x64_dbg_dbg/debugger.h @@ -10,6 +10,7 @@ #define JIT_ENTRY_DEF_SIZE (MAX_PATH + sizeof(ATTACH_CMD_LINE) + 2) #define JIT_ENTRY_MAX_SIZE 512 #define JIT_REG_KEY TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug") +#define RIGHTS_STRING (sizeof("ERWCG") + 1) typedef enum { @@ -62,6 +63,11 @@ bool dbgisignoredexception(unsigned int exception); bool dbgcmdnew(const char* name, CBCOMMAND cbCommand, bool debugonly); bool dbgcmddel(const char* name); bool dbggetjit(char jit_entry[JIT_ENTRY_MAX_SIZE], arch arch_in, arch* arch_out, readwritejitkey_error_t*); +bool dbggetpagerights(uint*, char*); +bool dbgpagerightstostring(DWORD, char*); +void dbggetpageligned(uint*); +bool dbgpagerightsfromstring(DWORD*, char*); +bool dbgsetpagerights(uint*, char*); bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out, readwritejitkey_error_t*); bool dbggetdefjit(char* jit_entry); bool _readwritejitkey(char*, DWORD*, char*, arch, arch*, readwritejitkey_error_t*, bool); diff --git a/x64_dbg_dbg/debugger_commands.cpp b/x64_dbg_dbg/debugger_commands.cpp index ad2271ab..8bfe7b79 100644 --- a/x64_dbg_dbg/debugger_commands.cpp +++ b/x64_dbg_dbg/debugger_commands.cpp @@ -1686,5 +1686,55 @@ CMDRESULT cbDebugGetJIT(int argc, char* argv[]) dprintf("JIT %s: %s\n", (actual_arch == x64) ? "x64" : "x32", get_entry); + return STATUS_CONTINUE; +} + +CMDRESULT cbDebugGetPageRights(int argc, char* argv[]) +{ + uint addr = 0; + char rights[RIGHTS_STRING]; + + if(argc != 2 || !valfromstring(argv[1], &addr)) + { + dprintf("Error: using an address as arg1\n"); + return STATUS_ERROR; + } + + if(!dbggetpagerights(&addr, rights)) + { + dprintf("Error getting rights of page: %s\n", argv[1]); + return STATUS_ERROR; + } + + dprintf("Page: "fhex", Rights: %s\n", addr, rights); + + return STATUS_CONTINUE; +} + +CMDRESULT cbDebugSetPageRights(int argc, char* argv[]) +{ + uint addr = 0; + char rights[RIGHTS_STRING]; + + if(argc != 3 || !valfromstring(argv[1], &addr)) + { + dprintf("Error: using an address as arg1 and as arg2: Execute, ExecuteRead, ExecuteReadWrite, ExecuteWriteCopy, NoAccess, ReadOnly, ReadWrite, WriteCopy. You can add a G at first for add PAGE GUARD, example: GReadOnly\n"); + return STATUS_ERROR; + } + + if(!dbgsetpagerights(&addr, argv[2])) + { + dprintf("Error: Set rights of "fhex" with Rights: %s\n", addr, argv[2]); + return STATUS_ERROR; + } + + if(!dbggetpagerights(&addr, rights)) + { + dprintf("Error getting rights of page: %s\n", argv[1]); + return STATUS_ERROR; + } + + dprintf("New rights of "fhex": %s\n", addr, rights); + return STATUS_CONTINUE; } \ No newline at end of file diff --git a/x64_dbg_dbg/debugger_commands.h b/x64_dbg_dbg/debugger_commands.h index e5a6aac4..efecde7e 100644 --- a/x64_dbg_dbg/debugger_commands.h +++ b/x64_dbg_dbg/debugger_commands.h @@ -55,5 +55,7 @@ CMDRESULT cbDebugDisableHardwareBreakpoint(int argc, char* argv[]); CMDRESULT cbDebugEnableMemoryBreakpoint(int argc, char* argv[]); CMDRESULT cbDebugDisableMemoryBreakpoint(int argc, char* argv[]); CMDRESULT cbDebugDownloadSymbol(int argc, char* argv[]); +CMDRESULT cbDebugGetPageRights(int argc, char* argv[]); +CMDRESULT cbDebugSetPageRights(int argc, char* argv[]); #endif //_DEBUGGER_COMMANDS_H \ No newline at end of file diff --git a/x64_dbg_dbg/x64_dbg.cpp b/x64_dbg_dbg/x64_dbg.cpp index 63852d80..e024a8ce 100644 --- a/x64_dbg_dbg/x64_dbg.cpp +++ b/x64_dbg_dbg/x64_dbg.cpp @@ -162,6 +162,8 @@ static void registercommands() dbgcmdnew("alloc", cbDebugAlloc, true); //allocate memory dbgcmdnew("free", cbDebugFree, true); //free memory dbgcmdnew("Fill\1memset", cbDebugMemset, true); //memset + dbgcmdnew("getpagerights\1getrightspage", cbDebugGetPageRights, true); + dbgcmdnew("setpagerights\1setrightspage", cbDebugSetPageRights, true); //plugins dbgcmdnew("StartScylla\1scylla\1imprec", cbDebugStartScylla, false); //start scylla diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp index 7b454849..463531d3 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp @@ -145,39 +145,13 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos) QString MemoryMapView::getProtectionString(DWORD Protect) { - QString wS; - switch(Protect & 0xFF) - { - case PAGE_EXECUTE: - wS = QString("E---"); - break; - case PAGE_EXECUTE_READ: - wS = QString("ER--"); - break; - case PAGE_EXECUTE_READWRITE: - wS = QString("ERW-"); - break; - case PAGE_EXECUTE_WRITECOPY: - wS = QString("ERWC"); - break; - case PAGE_NOACCESS: - wS = QString("----"); - break; - case PAGE_READONLY: - wS = QString("-R--"); - break; - case PAGE_READWRITE: - wS = QString("-RW-"); - break; - case PAGE_WRITECOPY: - wS = QString("-RWC"); - break; - } - if(Protect & PAGE_GUARD) - wS += QString("G"); - else - wS += QString("-"); - return wS; +#define RIGHTS_STRING (sizeof("ERWCG") + 1) + char rights[RIGHTS_STRING]; + + if(!DbgFunctions()->PageRightsToString(Protect, rights)) + return "bad"; + + return QString(rights); } QString MemoryMapView::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h) @@ -381,17 +355,6 @@ void MemoryMapView::pageMemoryRights() { PageMemoryRights* mPageMemoryRightsDialog = new PageMemoryRights(this); - if(getCellContent(getInitialSelection(), 3) != "IMG") - { - QMessageBox msg(QMessageBox::Warning, "ERROR TYPE", "ONLY SUPPORTED IMG TYPE YET"); - msg.setWindowIcon(QIcon(":/icons/images/compile-warning.png")); - msg.setParent(this, Qt::Dialog); - msg.setWindowFlags(msg.windowFlags() & (~Qt::WindowContextHelpButtonHint)); - msg.exec(); - - return; - } - #ifdef _WIN64 uint_t addr = getCellContent(getInitialSelection(), 0).toULongLong(0, 16); #else //x86 @@ -404,7 +367,7 @@ void MemoryMapView::pageMemoryRights() uint_t size = getCellContent(getInitialSelection(), 1).toULong(0, 16); #endif //_WIN64 - mPageMemoryRightsDialog->RunAddrSize(addr, size); + mPageMemoryRightsDialog->RunAddrSize(addr, size, getCellContent(getInitialSelection(), 3)); } void MemoryMapView::switchView() diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp index 89ed25a4..79e1bb91 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp @@ -17,29 +17,31 @@ PageMemoryRights::~PageMemoryRights() delete ui; } -void PageMemoryRights::RunAddrSize(uint_t addrin, uint_t sizein) +void PageMemoryRights::RunAddrSize(uint_t addrin, uint_t sizein, QString pagetypein) { addr = addrin; size = sizein; + pagetype = pagetypein; - int charwidth = QFontMetrics(this->font()).width(QChar(' ')); - - //addColumnAt(8 + charwidth * 2 * sizeof(uint_t), "ADDR", false, "Address"); //addr QTableWidget* tableWidget = ui->pagetableWidget; tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - uint_t nr_pages = size / 1000; + uint_t nr_pages = size / PAGE_SIZE; tableWidget->setColumnCount(2); tableWidget->setRowCount(nr_pages); - tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString("ADDR"))); - tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString("RIGHTS"))); + tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString("Address"))); + tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString("Rights"))); +#define RIGHTS_STRING (sizeof("ERWCG") + 1) + duint actual_addr; + char rights[RIGHTS_STRING]; for(uint_t i = 0; i < nr_pages; i++) { - tableWidget->setItem(i, 0, new QTableWidgetItem(QString("%1").arg(addr + (i * 1000), sizeof(uint_t) * 2, 16, QChar('0')).toUpper())); - - + actual_addr = addr + (i * PAGE_SIZE); + tableWidget->setItem(i, 0, new QTableWidgetItem(QString("%1").arg(actual_addr, sizeof(uint_t) * 2, 16, QChar('0')).toUpper())); + if(DbgFunctions()->GetPageRights(& actual_addr, rights)) + tableWidget->setItem(i, 1, new QTableWidgetItem(QString(rights))); } @@ -49,6 +51,7 @@ void PageMemoryRights::RunAddrSize(uint_t addrin, uint_t sizein) ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select); ui->radioFullaccess->setChecked(true); + ui->chkPageguard->setCheckable(true); exec(); } @@ -76,3 +79,56 @@ void PageMemoryRights::on_btnDeselectall_clicked() } } + +void PageMemoryRights::on_btnSetrights_clicked() +{ + duint actual_addr; + QString rights; + char newrights[RIGHTS_STRING]; + bool one_right_changed = false; + + if(ui->radioExecute->isChecked()) + rights = "Execute"; + else if(ui->radioExecuteread->isChecked()) + rights = "ExecuteRead"; + else if(ui->radioNoaccess->isChecked()) + rights = "NoAccess"; + else if(ui->radioFullaccess ->isChecked()) + rights = "ExecuteReadWrite"; + else if(ui->radioReadonly->isChecked()) + rights = "ReadOnly"; + else if(ui->radioReadwrite->isChecked()) + rights = "ReadWrite"; + else if(ui->radioWritecopy->isChecked()) + rights = "WriteCopy"; + else if(ui->radioExecutewritecopy->isChecked()) + rights = "ExecuteWriteCopy"; + else + return; + + if(ui->chkPageguard->isChecked()) + rights = "G" + rights; + + QModelIndexList indexList = ui->pagetableWidget->selectionModel()->selectedIndexes(); + foreach(QModelIndex index, indexList) + { +#ifdef _WIN64 + actual_addr = ui->pagetableWidget->item(index.row(), 0)->text().toULongLong(0, 16); +#else //x86 + actual_addr = ui->pagetableWidget->item(index.row(), 0)->text().toULong(0, 16); +#endif //_WIN64 + + if(DbgFunctions()->SetPageRights(& actual_addr, (char*) rights.toStdString().c_str())) + { + one_right_changed = true; + if(DbgFunctions()->GetPageRights(& actual_addr, newrights)) + ui->pagetableWidget->setItem(index.row(), 1, new QTableWidgetItem(QString(newrights))); + } + + } + + if(one_right_changed) + ui->LnEdStatus->setText("Pages Rights Changed to: " + rights); + else + ui->LnEdStatus->setText("Error setting rights, read the MSDN to learn the valid rights of: " + pagetype); +} diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h index cc8e4761..63ced701 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h @@ -5,6 +5,7 @@ #include "StdTable.h" #include "Bridge.h" +#define PAGE_SIZE 0x1000 namespace Ui { @@ -17,7 +18,7 @@ class PageMemoryRights : public QDialog public: explicit PageMemoryRights(QWidget* parent = 0); - void RunAddrSize(uint_t, uint_t); + void RunAddrSize(uint_t, uint_t, QString); ~PageMemoryRights(); private slots: @@ -25,10 +26,13 @@ private slots: void on_btnDeselectall_clicked(); + void on_btnSetrights_clicked(); + private: Ui::PageMemoryRights* ui; uint_t addr; uint_t size; + QString pagetype; }; #endif // PAGEMEMORYRIGHTS_H diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui index db7cc30b..c0d19303 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.ui @@ -6,8 +6,8 @@ 0 0 - 509 - 299 + 510 + 346 @@ -27,7 +27,7 @@ 350 - 270 + 310 121 21 @@ -47,8 +47,8 @@ 20 11 - 311 - 211 + 291 + 241 @@ -64,10 +64,10 @@ - 350 + 330 10 - 122 - 201 + 161 + 242 @@ -76,54 +76,71 @@ Rights - - - + + + QFormLayout::AllNonFixedFieldsGrow + + + NO ACCESS - - + + READ ONLY - - + + - READ & WRITE + READ WRITE - - + + EXECUTE - - + + - EXECUTE & READ + EXECUTE READ - + FULL ACCESS + + + + WRITE COPY + + + + + + + EXECUTE WRITE COPY + + + - + Set Rights @@ -135,7 +152,7 @@ 20 - 230 + 260 230 25 @@ -157,12 +174,12 @@ - + 10 - 270 - 331 + 310 + 371 20 @@ -174,7 +191,7 @@ 260 - 240 + 280 241 20 @@ -183,12 +200,26 @@ Press CTRL or SHIFT key to select multiple pages + + + + 400 + 260 + 91 + 16 + + + + PAGE GUARD + + layoutWidget layoutWidget buttonBox - lineEdit + LnEdStatus pagetableWidget label + chkPageguard From 7560ee9aeceaf4f4b177669ee855cb157e269cf2 Mon Sep 17 00:00:00 2001 From: dreg_fr33project Date: Mon, 18 Aug 2014 09:43:32 +0200 Subject: [PATCH 04/17] JIT fixes and more improvements (admin check etc.) --- x64_dbg_dbg/_dbgfunctions.cpp | 6 +++++ x64_dbg_dbg/_dbgfunctions.h | 2 ++ x64_dbg_dbg/debugger.cpp | 25 ++++++++++++++++++- x64_dbg_dbg/debugger.h | 4 ++- x64_dbg_dbg/debugger_commands.cpp | 12 ++++++++- .../Project/Src/Gui/SettingsDialog.cpp | 7 ++++++ x64_dbg_gui/Project/Src/Gui/SettingsDialog.ui | 13 ++++++++++ 7 files changed, 66 insertions(+), 3 deletions(-) diff --git a/x64_dbg_dbg/_dbgfunctions.cpp b/x64_dbg_dbg/_dbgfunctions.cpp index cc156eb2..12257788 100644 --- a/x64_dbg_dbg/_dbgfunctions.cpp +++ b/x64_dbg_dbg/_dbgfunctions.cpp @@ -112,6 +112,11 @@ static bool _getjitauto(bool* jit_auto) return dbggetjitauto(jit_auto, notfound, NULL, NULL); } +static bool _isprocesselevated(void) +{ + return IsProcessElevated(); +} + static bool _getpagerights(uint* addr, char* rights) { return dbggetpagerights(addr, rights); @@ -198,4 +203,5 @@ void dbgfunctionsinit() _dbgfunctions.GetPageRights = _getpagerights; _dbgfunctions.SetPageRights = _setpagerights; _dbgfunctions.PageRightsToString = _pagerightstostring; + _dbgfunctions.IsProcessElevated = _isprocesselevated; } diff --git a/x64_dbg_dbg/_dbgfunctions.h b/x64_dbg_dbg/_dbgfunctions.h index a4fdcffe..f86e4ee6 100644 --- a/x64_dbg_dbg/_dbgfunctions.h +++ b/x64_dbg_dbg/_dbgfunctions.h @@ -60,6 +60,7 @@ typedef bool (*GETPROCESSLIST)(DBGPROCESSINFO** entries, int* count); typedef bool (*GETPAGERIGHTS)(duint*, char*); typedef bool (*SETPAGERIGHTS)(duint*, char*); typedef bool (*PAGERIGHTSTOSTRING)(DWORD, char*); +typedef bool (*ISPROCESSELEVATED)(void); typedef struct DBGFUNCTIONS_ { @@ -90,6 +91,7 @@ typedef struct DBGFUNCTIONS_ GETPAGERIGHTS GetPageRights; SETPAGERIGHTS SetPageRights; PAGERIGHTSTOSTRING PageRightsToString; + ISPROCESSELEVATED IsProcessElevated; } DBGFUNCTIONS; #ifdef BUILD_DBG diff --git a/x64_dbg_dbg/debugger.cpp b/x64_dbg_dbg/debugger.cpp index 41828f23..d3defae2 100644 --- a/x64_dbg_dbg/debugger.cpp +++ b/x64_dbg_dbg/debugger.cpp @@ -1480,6 +1480,21 @@ void cbDetach() return; } + +bool IsProcessElevated() +{ + + HANDLE hToken; + DWORD tkInfoLen; + TOKEN_ELEVATION tkElevation; + + OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken); + + GetTokenInformation(hToken, TokenElevation, &tkElevation, sizeof(tkElevation), &tkInfoLen); + + return (tkElevation.TokenIsElevated != 0); +} + bool _readwritejitkey(char* jit_key_value, DWORD* jit_key_vale_size, char* key, arch arch_in, arch* arch_out, readwritejitkey_error_t* error, bool write) { DWORD key_flags; @@ -1491,7 +1506,15 @@ bool _readwritejitkey(char* jit_key_value, DWORD* jit_key_vale_size, char* key, * error = ERROR_RW; if(write) + { + if(!IsProcessElevated()) + { + if(error != NULL) + * error = ERROR_RW_NOTADMIN; + return false; + } key_flags = KEY_WRITE; + } else key_flags = KEY_READ; @@ -1512,7 +1535,7 @@ bool _readwritejitkey(char* jit_key_value, DWORD* jit_key_vale_size, char* key, if(arch_in == x64) { -#ifdef _WIN32 +#ifndef _WIN64 if(!IsWow64()) { if(error != NULL) diff --git a/x64_dbg_dbg/debugger.h b/x64_dbg_dbg/debugger.h index 76a17d73..1471de8d 100644 --- a/x64_dbg_dbg/debugger.h +++ b/x64_dbg_dbg/debugger.h @@ -16,7 +16,8 @@ typedef enum { ERROR_RW = 0, ERROR_RW_FILE_NOT_FOUND, - ERROR_RW_NOTWOW64 + ERROR_RW_NOTWOW64, + ERROR_RW_NOTADMIN } readwritejitkey_error_t; //structures @@ -74,6 +75,7 @@ bool _readwritejitkey(char*, DWORD*, char*, arch, arch*, readwritejitkey_error_t bool dbggetjitauto(bool*, arch, arch*, readwritejitkey_error_t*); bool dbgsetjitauto(bool, arch, arch*, readwritejitkey_error_t*); bool dbglistprocesses(std::vector* list); +bool IsProcessElevated(); void cbStep(); void cbRtrStep(); diff --git a/x64_dbg_dbg/debugger_commands.cpp b/x64_dbg_dbg/debugger_commands.cpp index 8bfe7b79..d2f1ad89 100644 --- a/x64_dbg_dbg/debugger_commands.cpp +++ b/x64_dbg_dbg/debugger_commands.cpp @@ -1437,6 +1437,11 @@ CMDRESULT cbDebugSetJITAuto(int argc, char* argv[]) { arch actual_arch; bool set_jit_auto; + if(!IsProcessElevated()) + { + dprintf("Error run the debugger as Admin to setjitauto\n"); + return STATUS_ERROR; + } if(argc < 2) { dprintf("Error setting JIT Auto. Use ON:1 or OFF:0 arg or x64/x32, ON:1 or OFF:0.\n"); @@ -1512,6 +1517,11 @@ CMDRESULT cbDebugSetJIT(int argc, char* argv[]) arch actual_arch; char* jit_debugger_cmd; char oldjit[MAX_SETTING_SIZE] = ""; + if(!IsProcessElevated()) + { + dprintf("Error run the debugger as Admin to setjit\n"); + return STATUS_ERROR; + } if(argc < 2) { char path[JIT_ENTRY_DEF_SIZE]; @@ -1619,7 +1629,7 @@ CMDRESULT cbDebugSetJIT(int argc, char* argv[]) if(rw_error == ERROR_RW_NOTWOW64) dprintf("Error using x64 arg. The debugger is not a WOW64 process\n"); else - dprintf("Error getting JIT %s\n", (actual_arch == x64) ? "x64" : "x32"); + dprintf("Error setting JIT %s\n", (actual_arch == x64) ? "x64" : "x32"); return STATUS_ERROR; } } diff --git a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp index 437dd82c..d4c75d30 100644 --- a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp @@ -191,6 +191,13 @@ void SettingsDialog::LoadSettings() ui->chkConfirmBeforeAtt->setCheckState(bool2check(settings.miscSetJITAuto)); } + + if(!DbgFunctions()->IsProcessElevated()) + { + ui->chkSetJIT->setDisabled(true); + ui->chkConfirmBeforeAtt->setDisabled(true); + ui->lbladminwarning->setText(QString("Warning: Run the debugger as Admin to enable JIT.")); + } } } bJitOld = settings.miscSetJIT; diff --git a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.ui b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.ui index 75af5e0c..beddfe09 100644 --- a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.ui +++ b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.ui @@ -516,6 +516,19 @@ Confirm before attaching + + + + 10 + 80 + 271 + 31 + + + + + + From 9dcef6ac33516c342fb1edad6803f39d6b6f0640 Mon Sep 17 00:00:00 2001 From: dreg_fr33project Date: Mon, 18 Aug 2014 09:57:18 +0200 Subject: [PATCH 05/17] new elevated method --- x64_dbg_dbg/debugger.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/x64_dbg_dbg/debugger.cpp b/x64_dbg_dbg/debugger.cpp index d3defae2..b72fb1ad 100644 --- a/x64_dbg_dbg/debugger.cpp +++ b/x64_dbg_dbg/debugger.cpp @@ -1483,16 +1483,17 @@ void cbDetach() bool IsProcessElevated() { + SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY; + PSID SecurityIdentifier; + if(!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &SecurityIdentifier)) + return 0; - HANDLE hToken; - DWORD tkInfoLen; - TOKEN_ELEVATION tkElevation; + BOOL IsAdminMember; + if(!CheckTokenMembership(NULL, SecurityIdentifier, &IsAdminMember)) + IsAdminMember = FALSE; - OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken); - - GetTokenInformation(hToken, TokenElevation, &tkElevation, sizeof(tkElevation), &tkInfoLen); - - return (tkElevation.TokenIsElevated != 0); + FreeSid(SecurityIdentifier); + return IsAdminMember ? true : false; } bool _readwritejitkey(char* jit_key_value, DWORD* jit_key_vale_size, char* key, arch arch_in, arch* arch_out, readwritejitkey_error_t* error, bool write) From c2ebac0ecfc3431a052a97af6bb68a2db9a9426f Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Mon, 18 Aug 2014 12:25:41 +0200 Subject: [PATCH 06/17] GUI: refresh memory map + removed std::string from the GUI (QString.toUtf8().constData() works fine) --- x64_dbg_dbg/debugger.cpp | 2 - x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp | 169 +++++++++--------- x64_dbg_gui/Project/Src/Gui/MemoryMapView.h | 1 + .../Project/Src/Gui/PageMemoryRights.cpp | 18 +- .../Project/Src/Gui/PageMemoryRights.h | 5 +- 5 files changed, 90 insertions(+), 105 deletions(-) diff --git a/x64_dbg_dbg/debugger.cpp b/x64_dbg_dbg/debugger.cpp index b72fb1ad..fb6dd399 100644 --- a/x64_dbg_dbg/debugger.cpp +++ b/x64_dbg_dbg/debugger.cpp @@ -1684,8 +1684,6 @@ bool dbgsetpagerights(uint* addr, char* rights_string) if(VirtualProtectEx(fdProcessInfo->hProcess, (void*)*addr, PAGE_SIZE, protect, & old_protect) == 0) return false; - // ADD ME: CALL TO UPDATE MEMORY VIEW HERE :-) - return true; } diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp index 463531d3..f4031ec8 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp @@ -201,84 +201,87 @@ QString MemoryMapView::paintContent(QPainter* painter, int_t rowBase, int rowOff return StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h); } +void MemoryMapView::refreshMap() +{ + MEMMAP wMemMapStruct; + int wI; + + memset(&wMemMapStruct, 0, sizeof(MEMMAP)); + + DbgMemMap(&wMemMapStruct); + + setRowCount(wMemMapStruct.count); + + for(wI = 0; wI < wMemMapStruct.count; wI++) + { + QString wS; + MEMORY_BASIC_INFORMATION wMbi = (wMemMapStruct.page)[wI].mbi; + + // Base address + wS = QString("%1").arg((uint_t)wMbi.BaseAddress, sizeof(uint_t) * 2, 16, QChar('0')).toUpper(); + setCellContent(wI, 0, wS); + + // Size + wS = QString("%1").arg((uint_t)wMbi.RegionSize, sizeof(uint_t) * 2, 16, QChar('0')).toUpper(); + setCellContent(wI, 1, wS); + + // Information + wS = QString((wMemMapStruct.page)[wI].info); + setCellContent(wI, 2, wS); + + // State + switch(wMbi.State) + { + case MEM_FREE: + wS = QString("FREE"); + break; + case MEM_COMMIT: + wS = QString("COMM"); + break; + case MEM_RESERVE: + wS = QString("RESV"); + break; + default: + wS = QString("????"); + } + setCellContent(wI, 3, wS); + + // Type + switch(wMbi.Type) + { + case MEM_IMAGE: + wS = QString("IMG"); + break; + case MEM_MAPPED: + wS = QString("MAP"); + break; + case MEM_PRIVATE: + wS = QString("PRV"); + break; + default: + wS = QString("N/A"); + break; + } + setCellContent(wI, 3, wS); + + // current access protection + wS = getProtectionString(wMbi.Protect); + setCellContent(wI, 4, wS); + + // allocation protection + wS = getProtectionString(wMbi.AllocationProtect); + setCellContent(wI, 5, wS); + + } + if(wMemMapStruct.page != 0) + BridgeFree(wMemMapStruct.page); + reloadData(); //refresh memory map +} + void MemoryMapView::stateChangedSlot(DBGSTATE state) { if(state == paused) - { - MEMMAP wMemMapStruct; - int wI; - - memset(&wMemMapStruct, 0, sizeof(MEMMAP)); - - DbgMemMap(&wMemMapStruct); - - setRowCount(wMemMapStruct.count); - - for(wI = 0; wI < wMemMapStruct.count; wI++) - { - QString wS; - MEMORY_BASIC_INFORMATION wMbi = (wMemMapStruct.page)[wI].mbi; - - // Base address - wS = QString("%1").arg((uint_t)wMbi.BaseAddress, sizeof(uint_t) * 2, 16, QChar('0')).toUpper(); - setCellContent(wI, 0, wS); - - // Size - wS = QString("%1").arg((uint_t)wMbi.RegionSize, sizeof(uint_t) * 2, 16, QChar('0')).toUpper(); - setCellContent(wI, 1, wS); - - // Information - wS = QString((wMemMapStruct.page)[wI].info); - setCellContent(wI, 2, wS); - - // State - switch(wMbi.State) - { - case MEM_FREE: - wS = QString("FREE"); - break; - case MEM_COMMIT: - wS = QString("COMM"); - break; - case MEM_RESERVE: - wS = QString("RESV"); - break; - default: - wS = QString("????"); - } - setCellContent(wI, 3, wS); - - // Type - switch(wMbi.Type) - { - case MEM_IMAGE: - wS = QString("IMG"); - break; - case MEM_MAPPED: - wS = QString("MAP"); - break; - case MEM_PRIVATE: - wS = QString("PRV"); - break; - default: - wS = QString("N/A"); - break; - } - setCellContent(wI, 3, wS); - - // current access protection - wS = getProtectionString(wMbi.Protect); - setCellContent(wI, 4, wS); - - // allocation protection - wS = getProtectionString(wMbi.AllocationProtect); - setCellContent(wI, 5, wS); - - } - if(wMemMapStruct.page != 0) - BridgeFree(wMemMapStruct.page); - reloadData(); //refresh memory map - } + refreshMap(); } void MemoryMapView::followDumpSlot() @@ -353,21 +356,11 @@ void MemoryMapView::memoryExecuteSingleshootToggleSlot() void MemoryMapView::pageMemoryRights() { - PageMemoryRights* mPageMemoryRightsDialog = new PageMemoryRights(this); - -#ifdef _WIN64 + PageMemoryRights PageMemoryRightsDialog(this); + connect(&PageMemoryRightsDialog, SIGNAL(refreshMemoryMap()), this, SLOT(refreshMap())); uint_t addr = getCellContent(getInitialSelection(), 0).toULongLong(0, 16); -#else //x86 - uint_t addr = getCellContent(getInitialSelection(), 0).toULong(0, 16); -#endif //_WIN64 - -#ifdef _WIN64 uint_t size = getCellContent(getInitialSelection(), 1).toULongLong(0, 16); -#else //x86 - uint_t size = getCellContent(getInitialSelection(), 1).toULong(0, 16); -#endif //_WIN64 - - mPageMemoryRightsDialog->RunAddrSize(addr, size, getCellContent(getInitialSelection(), 3)); + PageMemoryRightsDialog.RunAddrSize(addr, size, getCellContent(getInitialSelection(), 3)); } void MemoryMapView::switchView() diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h index e4f282e4..f0eecb1e 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h @@ -33,6 +33,7 @@ public slots: void contextMenuSlot(const QPoint & pos); void switchView(); void pageMemoryRights(); + void refreshMap(); private: QString getProtectionString(DWORD Protect); diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp index 79e1bb91..60fd4d23 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.cpp @@ -1,10 +1,7 @@ #include "PageMemoryRights.h" #include "ui_PageMemoryRights.h" -#include -PageMemoryRights::PageMemoryRights(QWidget* parent) : - QDialog(parent), - ui(new Ui::PageMemoryRights) +PageMemoryRights::PageMemoryRights(QWidget* parent) : QDialog(parent), ui(new Ui::PageMemoryRights) { ui->setupUi(this); //set window flags @@ -25,11 +22,9 @@ void PageMemoryRights::RunAddrSize(uint_t addrin, uint_t sizein, QString pagetyp QTableWidget* tableWidget = ui->pagetableWidget; tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - uint_t nr_pages = size / PAGE_SIZE; tableWidget->setColumnCount(2); tableWidget->setRowCount(nr_pages); - tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString("Address"))); tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString("Rights"))); @@ -44,7 +39,6 @@ void PageMemoryRights::RunAddrSize(uint_t addrin, uint_t sizein, QString pagetyp tableWidget->setItem(i, 1, new QTableWidgetItem(QString(rights))); } - QModelIndex idx = (ui->pagetableWidget->model()->index(0, 0)); ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select); idx = (ui->pagetableWidget->model()->index(0, 1)); @@ -53,11 +47,8 @@ void PageMemoryRights::RunAddrSize(uint_t addrin, uint_t sizein, QString pagetyp ui->radioFullaccess->setChecked(true); ui->chkPageguard->setCheckable(true); exec(); - } - - void PageMemoryRights::on_btnSelectall_clicked() { for(int i = 0; i < ui->pagetableWidget->rowCount(); i++) @@ -117,16 +108,17 @@ void PageMemoryRights::on_btnSetrights_clicked() #else //x86 actual_addr = ui->pagetableWidget->item(index.row(), 0)->text().toULong(0, 16); #endif //_WIN64 - - if(DbgFunctions()->SetPageRights(& actual_addr, (char*) rights.toStdString().c_str())) + if(DbgFunctions()->SetPageRights(& actual_addr, (char*) rights.toUtf8().constData())) { one_right_changed = true; if(DbgFunctions()->GetPageRights(& actual_addr, newrights)) ui->pagetableWidget->setItem(index.row(), 1, new QTableWidgetItem(QString(newrights))); } - } + DbgFunctions()->MemUpdateMap(); + emit refreshMemoryMap(); + if(one_right_changed) ui->LnEdStatus->setText("Pages Rights Changed to: " + rights); else diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h index 63ced701..fdaaf8e6 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h @@ -23,11 +23,12 @@ public: private slots: void on_btnSelectall_clicked(); - void on_btnDeselectall_clicked(); - void on_btnSetrights_clicked(); +signals: + void refreshMemoryMap(); + private: Ui::PageMemoryRights* ui; uint_t addr; From 0f8e1998dacecd836fb1616b1c2d0c86f920e517 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Mon, 18 Aug 2014 12:57:16 +0200 Subject: [PATCH 07/17] GUI: first step of refactoring --- .../Src/BasicView/AbstractTableView.cpp | 1 - .../Project/Src/BasicView/AbstractTableView.h | 9 - .../Project/Src/BasicView/Disassembly.cpp | 1 - .../Project/Src/BasicView/Disassembly.h | 10 - x64_dbg_gui/Project/Src/BasicView/HexDump.cpp | 1 - x64_dbg_gui/Project/Src/BasicView/HexDump.h | 10 - .../Project/Src/BasicView/HistoryLineEdit.cpp | 1 - .../Project/Src/BasicView/HistoryLineEdit.h | 3 - .../Project/Src/BasicView/ReferenceView.cpp | 1 - .../Project/Src/BasicView/ReferenceView.h | 6 - .../Project/Src/BasicView/SearchListView.h | 5 - .../Src/BasicView/SearchListViewTable.cpp | 1 - .../Src/BasicView/SearchListViewTable.h | 2 - .../Project/Src/BasicView/ShortcutEdit.cpp | 1 - .../Project/Src/BasicView/ShortcutEdit.h | 2 - .../Project/Src/BasicView/StdTable.cpp | 1 - x64_dbg_gui/Project/Src/BasicView/StdTable.h | 5 - x64_dbg_gui/Project/Src/Bridge/Bridge.h | 12 - .../Project/Src/Disassembler/BeaTokenizer.cpp | 1 - .../Project/Src/Disassembler/BeaTokenizer.h | 9 - .../Project/Src/Disassembler/QBeaEngine.cpp | 7 - .../Project/Src/Disassembler/QBeaEngine.h | 13 -- x64_dbg_gui/Project/Src/Global/NewTypes.h | 2 - .../Project/Src/Gui/AppearanceDialog.cpp | 3 - .../Project/Src/Gui/AppearanceDialog.h | 5 - x64_dbg_gui/Project/Src/Gui/AttachDialog.h | 2 - .../Project/Src/Gui/BreakpointsView.cpp | 1 - x64_dbg_gui/Project/Src/Gui/BreakpointsView.h | 8 - .../Project/Src/Gui/CPUDisassembly.cpp | 2 - x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h | 13 -- x64_dbg_gui/Project/Src/Gui/CPUDump.cpp | 2 - x64_dbg_gui/Project/Src/Gui/CPUDump.h | 11 - x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h | 5 - x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp | 2 - x64_dbg_gui/Project/Src/Gui/CPUSideBar.h | 7 - x64_dbg_gui/Project/Src/Gui/CPUStack.cpp | 3 - x64_dbg_gui/Project/Src/Gui/CPUStack.h | 9 - x64_dbg_gui/Project/Src/Gui/CPUWidget.h | 10 - .../Project/Src/Gui/CalculatorDialog.cpp | 1 - .../Project/Src/Gui/CalculatorDialog.h | 4 - x64_dbg_gui/Project/Src/Gui/CallStackView.cpp | 1 - x64_dbg_gui/Project/Src/Gui/CallStackView.h | 2 - x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp | 1 - x64_dbg_gui/Project/Src/Gui/CloseDialog.h | 2 - .../Project/Src/Gui/CommandHelpView.cpp | 5 +- x64_dbg_gui/Project/Src/Gui/CommandHelpView.h | 8 - x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h | 4 - .../Project/Src/Gui/ExceptionRangeDialog.h | 2 - x64_dbg_gui/Project/Src/Gui/GotoDialog.h | 5 - x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp | 2 - x64_dbg_gui/Project/Src/Gui/HexEditDialog.h | 3 - .../Project/Src/Gui/LineEditDialog.cpp | 1 - x64_dbg_gui/Project/Src/Gui/LineEditDialog.h | 2 - x64_dbg_gui/Project/Src/Gui/LogView.cpp | 1 - x64_dbg_gui/Project/Src/Gui/LogView.h | 4 - x64_dbg_gui/Project/Src/Gui/MainWindow.h | 27 --- x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp | 1 - x64_dbg_gui/Project/Src/Gui/MemoryMapView.h | 5 - .../Project/Src/Gui/PageMemoryRights.h | 4 - x64_dbg_gui/Project/Src/Gui/PatchDialog.h | 4 - .../Src/Gui/PatchDialogGroupSelector.h | 3 - x64_dbg_gui/Project/Src/Gui/RegistersView.cpp | 1 - x64_dbg_gui/Project/Src/Gui/RegistersView.h | 9 - x64_dbg_gui/Project/Src/Gui/ScriptView.cpp | 1 - x64_dbg_gui/Project/Src/Gui/ScriptView.h | 9 - .../Project/Src/Gui/SettingsDialog.cpp | 1 - x64_dbg_gui/Project/Src/Gui/SettingsDialog.h | 5 - x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h | 5 - x64_dbg_gui/Project/Src/Gui/StatusLabel.h | 4 - x64_dbg_gui/Project/Src/Gui/SymbolView.cpp | 1 - x64_dbg_gui/Project/Src/Gui/SymbolView.h | 8 - x64_dbg_gui/Project/Src/Gui/ThreadView.cpp | 3 - x64_dbg_gui/Project/Src/Gui/ThreadView.h | 3 - x64_dbg_gui/Project/Src/Gui/WordEditDialog.h | 6 - .../Project/Src/Memory/MapViewOfMem.cpp | 1 - x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h | 7 - x64_dbg_gui/Project/Src/Memory/MemoryPage.h | 7 - .../Project/Src/Memory/ProcessMemoryMap.cpp | 217 ------------------ .../Project/Src/Memory/ProcessMemoryMap.h | 34 --- x64_dbg_gui/Project/Src/Utils/Breakpoints.h | 3 - .../Project/Src/Utils/Configuration.cpp | 2 - x64_dbg_gui/Project/Src/Utils/Configuration.h | 8 - .../Project/Src/Utils/RichTextPainter.h | 3 - .../Project/Src/Utils/UpdateChecker.cpp | 2 - x64_dbg_gui/Project/Src/Utils/UpdateChecker.h | 3 - x64_dbg_gui/Project/Src/main.cpp | 5 - x64_dbg_gui/Project/x64_dbg.pro | 2 - 87 files changed, 1 insertion(+), 628 deletions(-) delete mode 100644 x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.cpp delete mode 100644 x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.h diff --git a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp index be1a4bd5..05962ab8 100644 --- a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp @@ -1,5 +1,4 @@ #include "AbstractTableView.h" -#include "Configuration.h" AbstractTableView::AbstractTableView(QWidget* parent) : QAbstractScrollArea(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h index 0aac9b9d..ac24ba75 100644 --- a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h +++ b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h @@ -1,15 +1,6 @@ #ifndef ABSTRACTTABLEVIEW_H #define ABSTRACTTABLEVIEW_H -#include -#include -#include -#include -#include -#include -#include -#include - //Hacky class that fixes a really annoying cursor problem class AbstractTableScrollBar : public QScrollBar { diff --git a/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp b/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp index beff3f4b..579f47ae 100644 --- a/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp @@ -1,5 +1,4 @@ #include "Disassembly.h" -#include "Configuration.h" Disassembly::Disassembly(QWidget* parent) : AbstractTableView(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/Disassembly.h b/x64_dbg_gui/Project/Src/BasicView/Disassembly.h index a66594a0..9ded75c6 100644 --- a/x64_dbg_gui/Project/Src/BasicView/Disassembly.h +++ b/x64_dbg_gui/Project/Src/BasicView/Disassembly.h @@ -1,16 +1,6 @@ #ifndef DISASSEMBLY_H #define DISASSEMBLY_H -#include -#include -#include "NewTypes.h" -#include "Bridge.h" -#include "AbstractTableView.h" -#include "QBeaEngine.h" -#include "RichTextPainter.h" -#include "BeaTokenizer.h" -#include "MemoryPage.h" - class Disassembly : public AbstractTableView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp b/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp index 8de942b5..7cf226a5 100644 --- a/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp @@ -1,5 +1,4 @@ #include "HexDump.h" -#include "Configuration.h" HexDump::HexDump(QWidget* parent) : AbstractTableView(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/HexDump.h b/x64_dbg_gui/Project/Src/BasicView/HexDump.h index 894956e4..2299bc9c 100644 --- a/x64_dbg_gui/Project/Src/BasicView/HexDump.h +++ b/x64_dbg_gui/Project/Src/BasicView/HexDump.h @@ -1,16 +1,6 @@ #ifndef _HEXDUMP_H #define _HEXDUMP_H -#include -#include -#include "NewTypes.h" -#include "AbstractTableView.h" -#include "MemoryPage.h" -#include "QBeaEngine.h" -#include "Bridge.h" -#include -#include "RichTextPainter.h" - class HexDump : public AbstractTableView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.cpp b/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.cpp index ce9bf6a0..c91151c6 100644 --- a/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.cpp @@ -1,5 +1,4 @@ #include "HistoryLineEdit.h" -#include "Bridge.h" HistoryLineEdit::HistoryLineEdit(QWidget* parent) : QLineEdit(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h b/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h index 383c9753..4885e09a 100644 --- a/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h +++ b/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h @@ -1,9 +1,6 @@ #ifndef HISTORYLINEEDIT_H #define HISTORYLINEEDIT_H -#include -#include - class HistoryLineEdit : public QLineEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp index 486d0c73..3db545c1 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp @@ -1,5 +1,4 @@ #include "ReferenceView.h" -#include "Configuration.h" ReferenceView::ReferenceView() { diff --git a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h index fe399b4d..e3d76870 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h +++ b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h @@ -1,12 +1,6 @@ #ifndef REFERENCEVIEW_H #define REFERENCEVIEW_H -#include -#include -#include -#include "SearchListView.h" -#include "Bridge.h" - class ReferenceView : public SearchListView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/SearchListView.h b/x64_dbg_gui/Project/Src/BasicView/SearchListView.h index a422da51..a642dc1a 100644 --- a/x64_dbg_gui/Project/Src/BasicView/SearchListView.h +++ b/x64_dbg_gui/Project/Src/BasicView/SearchListView.h @@ -1,11 +1,6 @@ #ifndef SEARCHLISTVIEW_H #define SEARCHLISTVIEW_H -#include -#include -#include -#include "SearchListViewTable.h" - namespace Ui { class SearchListView; diff --git a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp index 5d717657..902216a9 100644 --- a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp @@ -1,5 +1,4 @@ #include "SearchListViewTable.h" -#include "Configuration.h" SearchListViewTable::SearchListViewTable(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h index 3200c195..37ded7ad 100644 --- a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h +++ b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h @@ -1,8 +1,6 @@ #ifndef SEARCHLISTVIEWTABLE_H #define SEARCHLISTVIEWTABLE_H -#include "StdTable.h" - class SearchListViewTable : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp index 547b72bc..d39a6113 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp @@ -1,5 +1,4 @@ #include "ShortcutEdit.h" -#include ShortcutEdit::ShortcutEdit(QWidget* parent) : QLineEdit(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h index 4e15b335..0dad8d73 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h +++ b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h @@ -1,8 +1,6 @@ #ifndef SHORTCUTEDIT_H #define SHORTCUTEDIT_H -#include - class ShortcutEdit : public QLineEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp b/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp index 042d0458..e0120fed 100644 --- a/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp @@ -1,5 +1,4 @@ #include "StdTable.h" -#include "Bridge.h" StdTable::StdTable(QWidget* parent) : AbstractTableView(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/StdTable.h b/x64_dbg_gui/Project/Src/BasicView/StdTable.h index 780e95f5..6436ceaf 100644 --- a/x64_dbg_gui/Project/Src/BasicView/StdTable.h +++ b/x64_dbg_gui/Project/Src/BasicView/StdTable.h @@ -1,11 +1,6 @@ #ifndef STDTABLE_H #define STDTABLE_H -#include -#include -#include "NewTypes.h" -#include "AbstractTableView.h" - class StdTable : public AbstractTableView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Bridge/Bridge.h b/x64_dbg_gui/Project/Src/Bridge/Bridge.h index 1f671422..ccea323d 100644 --- a/x64_dbg_gui/Project/Src/Bridge/Bridge.h +++ b/x64_dbg_gui/Project/Src/Bridge/Bridge.h @@ -1,18 +1,6 @@ #ifndef BRIDGE_H #define BRIDGE_H -#include -#include -#include "NewTypes.h" -#include "ReferenceView.h" -#include "BeaTokenizer.h" -#include "QBeaEngine.h" - -#include "main.h" - -#include "Exports.h" -#include "Imports.h" - class Bridge : public QObject { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp index 4983710f..e2f7613b 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp +++ b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp @@ -1,5 +1,4 @@ #include "BeaTokenizer.h" -#include "Configuration.h" //variables QMap BeaTokenizer::colorNamesMap; diff --git a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h index 145fe834..8eea8115 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h +++ b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h @@ -1,15 +1,6 @@ #ifndef BEATOKENIZER_H #define BEATOKENIZER_H -#include -#include -#include -#include -#include -#include "BeaEngine.h" -#include "NewTypes.h" -#include "RichTextPainter.h" - class BeaTokenizer : RichTextPainter { public: diff --git a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp index 7d1c5305..ead76d66 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp +++ b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp @@ -1,6 +1,5 @@ #include "QBeaEngine.h" - QBeaEngine::QBeaEngine() { // Reset the Disasm structure @@ -8,7 +7,6 @@ QBeaEngine::QBeaEngine() BeaTokenizer::Init(); } - /** * @brief Return the address of the nth instruction before the instruction pointed by ip. @n * This function has been grabbed from OllyDbg ("Disassembleback" in asmserv.c) @@ -88,7 +86,6 @@ ulong QBeaEngine::DisassembleBack(byte_t* data, uint_t base, uint_t size, uint_t return abuf[(i - n + max_instructions) % max_instructions]; } - /** * @brief Return the address of the nth instruction after the instruction pointed by ip. @n * This function has been grabbed from OllyDbg ("Disassembleforward" in asmserv.c) @@ -144,7 +141,6 @@ ulong QBeaEngine::DisassembleNext(byte_t* data, uint_t base, uint_t size, uint_t return ip; } - /** * @brief Disassemble the instruction at the given ip RVA. * @@ -190,6 +186,3 @@ Instruction_t QBeaEngine::DisassembleAt(byte_t* data, uint_t size, uint_t instIn return wInst; } - - - diff --git a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h index e2f15734..1fee29a5 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h +++ b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h @@ -1,12 +1,6 @@ #ifndef QBEAENGINE_H #define QBEAENGINE_H -#include - -#include "BeaEngine.h" -#include "NewTypes.h" -#include "BeaTokenizer.h" - typedef struct _Instruction_t { QString instStr; @@ -19,21 +13,14 @@ typedef struct _Instruction_t class QBeaEngine { - public: explicit QBeaEngine(); - ulong DisassembleBack(byte_t* data, uint_t base, uint_t size, uint_t ip, int n); ulong DisassembleNext(byte_t* data, uint_t base, uint_t size, uint_t ip, int n); Instruction_t DisassembleAt(byte_t* data, uint_t size, uint_t instIndex, uint_t origBase, uint_t origInstRVA); -signals: - -public slots: - private: DISASM mDisasmStruct; - }; #endif // QBEAENGINE_H diff --git a/x64_dbg_gui/Project/Src/Global/NewTypes.h b/x64_dbg_gui/Project/Src/Global/NewTypes.h index e707dcef..a31427b7 100644 --- a/x64_dbg_gui/Project/Src/Global/NewTypes.h +++ b/x64_dbg_gui/Project/Src/Global/NewTypes.h @@ -1,8 +1,6 @@ #ifndef NEWTYPES_H #define NEWTYPES_H -#include "Imports.h" - typedef short int16; typedef unsigned short uint16; diff --git a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp index e6b4ba1c..17cf1f94 100644 --- a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp @@ -1,8 +1,5 @@ #include "AppearanceDialog.h" #include "ui_AppearanceDialog.h" -#include "Bridge.h" -#include "Configuration.h" -#include AppearanceDialog::AppearanceDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AppearanceDialog) { diff --git a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h index 84875872..b80d3e26 100644 --- a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h @@ -1,11 +1,6 @@ #ifndef APPEARANCEDIALOG_H #define APPEARANCEDIALOG_H -#include -#include -#include -#include - namespace Ui { class AppearanceDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/AttachDialog.h b/x64_dbg_gui/Project/Src/Gui/AttachDialog.h index e5dbe68d..7e5144f7 100644 --- a/x64_dbg_gui/Project/Src/Gui/AttachDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/AttachDialog.h @@ -1,8 +1,6 @@ #ifndef ATTACHDIALOG_H #define ATTACHDIALOG_H -#include - namespace Ui { class AttachDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp index 2bfee39a..498c5437 100644 --- a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp @@ -1,5 +1,4 @@ #include "BreakpointsView.h" -#include "Configuration.h" BreakpointsView::BreakpointsView(QWidget* parent) : QWidget(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h index 78634598..968ba6a2 100644 --- a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h +++ b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h @@ -1,14 +1,6 @@ #ifndef BREAKPOINTSVIEW_H #define BREAKPOINTSVIEW_H -#include -#include "StdTable.h" -#include "Bridge.h" -#include "Breakpoints.h" -#include -#include -#include - class BreakpointsView : public QWidget { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp index 7065ba1c..bf5ca500 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp @@ -1,6 +1,4 @@ #include "CPUDisassembly.h" -#include "Configuration.h" -#include "HexEditDialog.h" CPUDisassembly::CPUDisassembly(QWidget* parent) : Disassembly(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h index 370c8dc1..280472cd 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h @@ -1,19 +1,6 @@ #ifndef CPUDISASSEMBLY_H #define CPUDISASSEMBLY_H -#include -#include -#include "NewTypes.h" -#include "Disassembly.h" -#include "Bridge.h" -#include "LineEditDialog.h" -#include "QBeaEngine.h" -#include "GotoDialog.h" -#include -#include -#include -#include "WordEditDialog.h" - class CPUDisassembly : public Disassembly { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp b/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp index d1627a9b..4b16c66a 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp @@ -1,6 +1,4 @@ #include "CPUDump.h" -#include "Configuration.h" -#include "HexEditDialog.h" CPUDump::CPUDump(QWidget* parent) : HexDump(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDump.h b/x64_dbg_gui/Project/Src/Gui/CPUDump.h index fe8c6bb0..9749b703 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDump.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUDump.h @@ -1,17 +1,6 @@ #ifndef CPUDUMP_H #define CPUDUMP_H -#include -#include -#include -#include -#include -#include "NewTypes.h" -#include "LineEditDialog.h" -#include "HexDump.h" -#include "Bridge.h" -#include "GotoDialog.h" - class CPUDump : public HexDump { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h index 3d336a37..9147c42a 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h @@ -1,11 +1,6 @@ #ifndef INFOBOX_H #define INFOBOX_H -#include -#include "StdTable.h" -#include "Bridge.h" -#include "CPUDisassembly.h" - class CPUInfoBox : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp index 3de6cd4e..4958f1b7 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp @@ -1,6 +1,4 @@ #include "CPUSideBar.h" -#include "Configuration.h" -#include "Breakpoints.h" CPUSideBar::CPUSideBar(CPUDisassembly* Ptr, QWidget* parent) : QAbstractScrollArea(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h index 9d983092..37f0ede7 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h @@ -1,12 +1,6 @@ #ifndef CPUSIDEBAR_H #define CPUSIDEBAR_H -#include "NewTypes.h" -#include "Bridge.h" -#include "CPUDisassembly.h" -#include - - class CPUSideBar : public QAbstractScrollArea { Q_OBJECT @@ -32,7 +26,6 @@ protected: bool isJump(int i) const; void drawJump(QPainter* painter, int startLine, int endLine, int jumpoffset, bool conditional, bool isexecute, bool isactive); - private: int_t topVA; int_t selectedVA; diff --git a/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp b/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp index bf3e4e97..6f97aec9 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp @@ -1,7 +1,4 @@ #include "CPUStack.h" -#include "Configuration.h" -#include "HexEditDialog.h" -#include "WordEditDialog.h" CPUStack::CPUStack(QWidget* parent) : HexDump(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUStack.h b/x64_dbg_gui/Project/Src/Gui/CPUStack.h index fca7de28..c67562a3 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUStack.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUStack.h @@ -1,15 +1,6 @@ #ifndef CPUSTACK_H #define CPUSTACK_H -#include -#include -#include -#include -#include "NewTypes.h" -#include "HexDump.h" -#include "Bridge.h" -#include "GotoDialog.h" - class CPUStack : public HexDump { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUWidget.h b/x64_dbg_gui/Project/Src/Gui/CPUWidget.h index c3d5d3be..f42c9b22 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUWidget.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUWidget.h @@ -1,16 +1,6 @@ #ifndef CPUWIDGET_H #define CPUWIDGET_H -#include -#include -#include -#include "CPUDisassembly.h" -#include "CPUDump.h" -#include "CPUStack.h" -#include "RegistersView.h" -#include "CPUInfoBox.h" -#include "CPUSideBar.h" - namespace Ui { class CPUWidget; diff --git a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp index bd2e3275..c36358cb 100644 --- a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp @@ -1,6 +1,5 @@ #include "CalculatorDialog.h" #include "ui_CalculatorDialog.h" -#include CalculatorDialog::CalculatorDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CalculatorDialog) { diff --git a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h index 27de0c5f..aec8d035 100644 --- a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h @@ -1,10 +1,6 @@ #ifndef CALCULATORDIALOG_H #define CALCULATORDIALOG_H -#include -#include -#include "Bridge.h" - namespace Ui { class CalculatorDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp b/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp index cc1fb535..0deaa3e2 100644 --- a/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp @@ -1,5 +1,4 @@ #include "CallStackView.h" -#include "Bridge.h" CallStackView::CallStackView(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CallStackView.h b/x64_dbg_gui/Project/Src/Gui/CallStackView.h index 8fe070ba..1b413b5a 100644 --- a/x64_dbg_gui/Project/Src/Gui/CallStackView.h +++ b/x64_dbg_gui/Project/Src/Gui/CallStackView.h @@ -1,8 +1,6 @@ #ifndef CALLSTACKVIEW_H #define CALLSTACKVIEW_H -#include "StdTable.h" - class CallStackView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp b/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp index 4481dc47..18a588d6 100644 --- a/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp @@ -1,5 +1,4 @@ #include "CloseDialog.h" -#include "ui_CloseDialog.h" CloseDialog::CloseDialog(QWidget* parent) : QDialog(parent), diff --git a/x64_dbg_gui/Project/Src/Gui/CloseDialog.h b/x64_dbg_gui/Project/Src/Gui/CloseDialog.h index 00cbf6da..9af82d51 100644 --- a/x64_dbg_gui/Project/Src/Gui/CloseDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/CloseDialog.h @@ -1,8 +1,6 @@ #ifndef CLOSEDIALOG_H #define CLOSEDIALOG_H -#include - namespace Ui { class CloseDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp index 8ea97d3d..61b775cf 100644 --- a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp @@ -1,9 +1,6 @@ #include "CommandHelpView.h" -#include "ui_CommandHelpView.h" -CommandHelpView::CommandHelpView(QWidget* parent) : - QWidget(parent), - ui(new Ui::CommandHelpView) +CommandHelpView::CommandHelpView(QWidget* parent) : QWidget(parent), ui(new Ui::CommandHelpView) { ui->setupUi(this); diff --git a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h index c64c4268..442052f7 100644 --- a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h +++ b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h @@ -1,14 +1,6 @@ #ifndef COMMANDHELPVIEW_H #define COMMANDHELPVIEW_H -#include -#include -#include -#include -#include "StdTable.h" -#include "Bridge.h" -#include "SearchListView.h" - namespace Ui { class CommandHelpView; diff --git a/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h b/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h index 0ac255a5..44d8c459 100644 --- a/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h +++ b/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h @@ -1,10 +1,6 @@ #ifndef COMMANDLINEEDIT_H #define COMMANDLINEEDIT_H -#include "HistoryLineEdit.h" -#include "Bridge.h" -#include - class CommandLineEdit : public HistoryLineEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h b/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h index 58c7c182..eda4d051 100644 --- a/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h @@ -1,8 +1,6 @@ #ifndef EXCEPTIONRANGEDIALOG_H #define EXCEPTIONRANGEDIALOG_H -#include - namespace Ui { class ExceptionRangeDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/GotoDialog.h b/x64_dbg_gui/Project/Src/Gui/GotoDialog.h index 5a642061..09b6df75 100644 --- a/x64_dbg_gui/Project/Src/Gui/GotoDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/GotoDialog.h @@ -1,11 +1,6 @@ #ifndef GOTODIALOG_H #define GOTODIALOG_H -#include -#include -#include -#include "Bridge.h" - namespace Ui { class GotoDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp index 3ff72624..6e0877e4 100644 --- a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp @@ -1,7 +1,5 @@ #include "HexEditDialog.h" #include "ui_HexEditDialog.h" -#include "QHexEdit/QHexEdit.h" -#include "Configuration.h" HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), diff --git a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h index 752ae6e6..02f84594 100644 --- a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h @@ -1,9 +1,6 @@ #ifndef HEXEDITDIALOG_H #define HEXEDITDIALOG_H -#include -#include "QHexEdit/QHexEdit.h" - namespace Ui { class HexEditDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/LineEditDialog.cpp b/x64_dbg_gui/Project/Src/Gui/LineEditDialog.cpp index e93db80d..bc085c3f 100644 --- a/x64_dbg_gui/Project/Src/Gui/LineEditDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/LineEditDialog.cpp @@ -1,6 +1,5 @@ #include "LineEditDialog.h" #include "ui_LineEditDialog.h" -#include "Bridge.h" LineEditDialog::LineEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::LineEditDialog) { diff --git a/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h b/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h index 14fe9273..455d3125 100644 --- a/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h @@ -1,8 +1,6 @@ #ifndef LINEEDITDIALOG_H #define LINEEDITDIALOG_H -#include - namespace Ui { class LineEditDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/LogView.cpp b/x64_dbg_gui/Project/Src/Gui/LogView.cpp index 8e0bc2c5..b3e109eb 100644 --- a/x64_dbg_gui/Project/Src/Gui/LogView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/LogView.cpp @@ -1,5 +1,4 @@ #include "LogView.h" -#include "Configuration.h" LogView::LogView(QWidget* parent) : QTextEdit(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/LogView.h b/x64_dbg_gui/Project/Src/Gui/LogView.h index e416313c..3559f0a3 100644 --- a/x64_dbg_gui/Project/Src/Gui/LogView.h +++ b/x64_dbg_gui/Project/Src/Gui/LogView.h @@ -1,10 +1,6 @@ #ifndef LOGVIEW_H #define LOGVIEW_H -#include -#include -#include "Bridge.h" - class LogView : public QTextEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/MainWindow.h b/x64_dbg_gui/Project/Src/Gui/MainWindow.h index a7777767..702ba0fa 100644 --- a/x64_dbg_gui/Project/Src/Gui/MainWindow.h +++ b/x64_dbg_gui/Project/Src/Gui/MainWindow.h @@ -1,33 +1,6 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include -#include -#include -#include -#include -#include "CPUWidget.h" -#include "CommandLineEdit.h" -#include "MemoryMapView.h" -#include "LogView.h" -#include "StatusLabel.h" -#include "BreakpointsView.h" -#include "ScriptView.h" -#include "SymbolView.h" -#include "ReferenceView.h" -#include "ThreadView.h" -#include "SettingsDialog.h" -#include "tabwidget.h" -#include "Configuration.h" -#include "AppearanceDialog.h" -#include "ShortcutsDialog.h" -#include "CloseDialog.h" -#include "PatchDialog.h" -#include "UpdateChecker.h" -#include "CallStackView.h" -#include "CalculatorDialog.h" -#include "AttachDialog.h" - namespace Ui { class MainWindow; diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp index f4031ec8..25e4b533 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp @@ -1,5 +1,4 @@ #include "MemoryMapView.h" -#include "Configuration.h" MemoryMapView::MemoryMapView(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h index f0eecb1e..12e6ac19 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h @@ -1,11 +1,6 @@ #ifndef MEMORYMAPVIEW_H #define MEMORYMAPVIEW_H -#include -#include "StdTable.h" -#include "Bridge.h" -#include "PageMemoryRights.h" - class MemoryMapView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h index fdaaf8e6..9b805ac7 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h @@ -1,10 +1,6 @@ #ifndef PAGEMEMORYRIGHTS_H #define PAGEMEMORYRIGHTS_H -#include -#include "StdTable.h" -#include "Bridge.h" - #define PAGE_SIZE 0x1000 namespace Ui diff --git a/x64_dbg_gui/Project/Src/Gui/PatchDialog.h b/x64_dbg_gui/Project/Src/Gui/PatchDialog.h index 75b1d08e..5040ecaf 100644 --- a/x64_dbg_gui/Project/Src/Gui/PatchDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/PatchDialog.h @@ -1,10 +1,6 @@ #ifndef PATCHDIALOG_H #define PATCHDIALOG_H -#include -#include "Bridge.h" -#include "PatchDialogGroupSelector.h" - namespace Ui { class PatchDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h b/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h index 369e77d4..2e4615bc 100644 --- a/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h +++ b/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h @@ -1,9 +1,6 @@ #ifndef PATCHDIALOGGROUPSELECTOR_H #define PATCHDIALOGGROUPSELECTOR_H -#include -#include - namespace Ui { class PatchDialogGroupSelector; diff --git a/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp b/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp index e7b848c3..a8706096 100644 --- a/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp @@ -1,5 +1,4 @@ #include "RegistersView.h" -#include "Configuration.h" RegistersView::RegistersView(QWidget* parent) : QAbstractScrollArea(parent), mVScrollOffset(0) { diff --git a/x64_dbg_gui/Project/Src/Gui/RegistersView.h b/x64_dbg_gui/Project/Src/Gui/RegistersView.h index 6c609505..1fefaba1 100644 --- a/x64_dbg_gui/Project/Src/Gui/RegistersView.h +++ b/x64_dbg_gui/Project/Src/Gui/RegistersView.h @@ -1,15 +1,6 @@ #ifndef REGISTERSVIEW_H #define REGISTERSVIEW_H -#include -#include -#include -#include -#include "Bridge.h" -#include "WordEditDialog.h" -#include "LineEditDialog.h" -#include - #define IsCharacterRegister(x) ((x>=CAX && x -#include -#include -#include -#include -#include "StdTable.h" -#include "Bridge.h" -#include "LineEditDialog.h" - class ScriptView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp index d4c75d30..08539cbf 100644 --- a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp @@ -1,6 +1,5 @@ #include "SettingsDialog.h" #include "ui_SettingsDialog.h" -#include "Configuration.h" SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent), diff --git a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h index 60811054..203963a7 100644 --- a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h @@ -1,11 +1,6 @@ #ifndef SETTINGSDIALOG_H #define SETTINGSDIALOG_H -#include -#include -#include "Bridge.h" -#include "ExceptionRangeDialog.h" - namespace Ui { class SettingsDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h b/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h index 4d171748..78037eef 100644 --- a/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h @@ -1,11 +1,6 @@ #ifndef SHORTCUTSDIALOG_H #define SHORTCUTSDIALOG_H -#include -#include -#include "ShortcutEdit.h" -#include "Configuration.h" - namespace Ui { class ShortcutsDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/StatusLabel.h b/x64_dbg_gui/Project/Src/Gui/StatusLabel.h index 812bbaa8..a452262d 100644 --- a/x64_dbg_gui/Project/Src/Gui/StatusLabel.h +++ b/x64_dbg_gui/Project/Src/Gui/StatusLabel.h @@ -1,10 +1,6 @@ #ifndef LABELCLASS_H #define LABELCLASS_H -#include -#include -#include "Bridge.h" - class StatusLabel : public QLabel { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp b/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp index 245e6fc1..93bd7f6b 100644 --- a/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp @@ -1,6 +1,5 @@ #include "SymbolView.h" #include "ui_SymbolView.h" -#include "Configuration.h" SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView) { diff --git a/x64_dbg_gui/Project/Src/Gui/SymbolView.h b/x64_dbg_gui/Project/Src/Gui/SymbolView.h index a71bd3ab..034b2e85 100644 --- a/x64_dbg_gui/Project/Src/Gui/SymbolView.h +++ b/x64_dbg_gui/Project/Src/Gui/SymbolView.h @@ -1,14 +1,6 @@ #ifndef SYMBOLVIEW_H #define SYMBOLVIEW_H -#include -#include -#include -#include -#include "StdTable.h" -#include "Bridge.h" -#include "SearchListView.h" - namespace Ui { class SymbolView; diff --git a/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp b/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp index 7af62856..30f7c238 100644 --- a/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp @@ -1,7 +1,4 @@ #include "ThreadView.h" -#include "Configuration.h" - -// Dreg code x86_64dbg GPLv3 void ThreadView::contextMenuSlot(const QPoint & pos) { diff --git a/x64_dbg_gui/Project/Src/Gui/ThreadView.h b/x64_dbg_gui/Project/Src/Gui/ThreadView.h index ca51a228..b2d94983 100644 --- a/x64_dbg_gui/Project/Src/Gui/ThreadView.h +++ b/x64_dbg_gui/Project/Src/Gui/ThreadView.h @@ -1,9 +1,6 @@ #ifndef THREADVIEW_H #define THREADVIEW_H -#include "StdTable.h" -#include "Bridge.h" - class ThreadView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h b/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h index 7d47ab32..eafe9740 100644 --- a/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h @@ -1,12 +1,6 @@ #ifndef WORDEDITDIALOG_H #define WORDEDITDIALOG_H -#include -#include -#include -#include -#include "Bridge.h" - namespace Ui { class WordEditDialog; diff --git a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp b/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp index e3727bd3..62052d2f 100644 --- a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp +++ b/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp @@ -1,6 +1,5 @@ #include "MapViewOfMem.h" - MapViewOfMem::MapViewOfMem() { mSelectedData.fromIndex = -1; diff --git a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h b/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h index 0bcccb4d..8765b661 100644 --- a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h +++ b/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h @@ -1,10 +1,6 @@ #ifndef MAPVIEWOFMEM_H #define MAPVIEWOFMEM_H -#include -#include "NewTypes.h" - - typedef struct _Selection_t { int firstSelectedIndex; @@ -12,11 +8,8 @@ typedef struct _Selection_t int toIndex; } Selection_t; - - class MapViewOfMem { - public: MapViewOfMem(); explicit MapViewOfMem(QString file); diff --git a/x64_dbg_gui/Project/Src/Memory/MemoryPage.h b/x64_dbg_gui/Project/Src/Memory/MemoryPage.h index a6405784..f717669e 100644 --- a/x64_dbg_gui/Project/Src/Memory/MemoryPage.h +++ b/x64_dbg_gui/Project/Src/Memory/MemoryPage.h @@ -1,13 +1,6 @@ #ifndef MEMORYPAGE_H #define MEMORYPAGE_H -#include -#include -#include "NewTypes.h" -#include "windows.h" -#include "main.h" -#include "Bridge.h" - class MemoryPage : public QObject { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.cpp b/x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.cpp deleted file mode 100644 index 7931b2a4..00000000 --- a/x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include "ProcessMemoryMap.h" - - -ProcessMemoryMap::ProcessMemoryMap(QString fileName, QObject* parent) : QObject(parent) -{ - Q_UNUSED(fileName); - STARTUPINFO si; - memset(&si, 0, sizeof(STARTUPINFO)); - si.cb = sizeof(si); - - PROCESS_INFORMATION pi; - memset(&pi, 0, sizeof(PROCESS_INFORMATION)); - - LPCTSTR target = TEXT("UnPackMe.exe"); - - if(!CreateProcess((LPCTSTR)target, 0, NULL, NULL, 0, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) - { - //qDebug() << "CreateProcess failed (" << GetLastError() << ").\n"; - } - else - { - mhProcess = pi.hProcess; - - QWidget* widget = new QWidget(); - widget->show(); - - Sleep(800); - - printVirtualMemoryMap(BruteForceProcessMemory()); - } - - -} - - - - -QList ProcessMemoryMap::BruteForceProcessMemory() -{ - QList wMemoryRegionsList; - MEMORY_BASIC_INFORMATION wMemInfo; - uint_t wVirtualAddress = 0; - uint_t wUpperLimit = 0x80000000;//0x000007FFFFFFFFFF; // x64 User Space Limit - SIZE_T wErr; - - // For each page in memory - while(wVirtualAddress <= wUpperLimit) - { - // Query the page - wErr = VirtualQueryEx(mhProcess, (LPCVOID)wVirtualAddress, &wMemInfo, sizeof(wMemInfo)); - - // If VirtualQueryEx failed, try the next region - - if(wErr == 0) - { - wVirtualAddress += 0x1000; - } - else - { - wMemoryRegionsList.append(wMemInfo); - wVirtualAddress += wMemInfo.RegionSize; - } - } - - return wMemoryRegionsList; -} - - - - -void ProcessMemoryMap::printVirtualMemoryMap(QList parList) -{ - int wI; - QString wStr = ""; - QString wTmpStr = ""; - MEMORY_BASIC_INFORMATION wMemInfo; - - // Header - wTmpStr = "Address"; - wStr += wTmpStr + QString(" ").repeated(20 - wTmpStr.length()); - wStr += " | "; - - wTmpStr = "Size"; - wStr += wTmpStr + QString(" ").repeated(20 - wTmpStr.length()); - wStr += " | "; - - wTmpStr = "State"; - wStr += wTmpStr + QString(" ").repeated(10 - wTmpStr.length()); - wStr += " | "; - - wTmpStr = "Access"; - wStr += wTmpStr + QString(" ").repeated(30 - wTmpStr.length()); - wStr += " | "; - - wTmpStr = "Type"; - wStr += wTmpStr + QString(" ").repeated(10 - wTmpStr.length()); - - //qDebug() << wStr; - - wStr = "-------------------------------------------------------------------------------------------------"; - //qDebug() << wStr; - - - for(wI = 0; wI < parList.size(); wI++) - { - wStr = ""; - wMemInfo = parList.at(wI); - - // Base address - wTmpStr = "0x" + QString("%1").arg((uint_t)wMemInfo.BaseAddress, 16, 16, QChar('0')).toUpper(); - wStr += wTmpStr + QString(" ").repeated(20 - wTmpStr.length()); - wStr += " | "; - - // Size - wTmpStr = "0x" + QString("%1").arg((uint_t)wMemInfo.RegionSize, 16, 16, QChar('0')).toUpper(); - wStr += wTmpStr + QString(" ").repeated(20 - wTmpStr.length()); - wStr += " | "; - - // State - switch(wMemInfo.State) - { - case MEM_FREE: - wTmpStr = QString("Free"); - break; - case MEM_COMMIT: - wTmpStr = QString("Commited"); - break; - case MEM_RESERVE: - wTmpStr = QString("Reserved"); - break; - default: - wTmpStr = QString("N/A"); - } - wStr += wTmpStr + QString(" ").repeated(10 - wTmpStr.length()); - wStr += " | "; - - // Access - if(wMemInfo.State != MEM_COMMIT) - { - wTmpStr = QString("N/A"); - wStr += wTmpStr + QString(" ").repeated(30 - wTmpStr.length()); - wStr += " | "; - } - else - { - switch(wMemInfo.Protect & 0xFF) - { - case PAGE_EXECUTE: - wTmpStr = QString("Execute"); - break; - case PAGE_EXECUTE_READ: - wTmpStr = QString("Execute/Read"); - break; - case PAGE_EXECUTE_READWRITE: - wTmpStr = QString("Execute/Read/Write"); - break; - case PAGE_NOACCESS: - wTmpStr = QString("No Access"); - break; - case PAGE_READONLY: - wTmpStr = QString("Read"); - break; - case PAGE_READWRITE: - wTmpStr = QString("Read/Write"); - break; - case PAGE_WRITECOPY: - wTmpStr = QString("Copy on Write"); - break; - case PAGE_EXECUTE_WRITECOPY: - wTmpStr = QString("Execute/Copy on Write"); - break; - } - - switch(wMemInfo.Protect & 0xFF00) - { - case PAGE_GUARD: - wTmpStr += QString(" + Guard"); - } - - wStr += wTmpStr + QString(" ").repeated(30 - wTmpStr.length()); - wStr += " | "; - } - - // Type - switch(wMemInfo.Type) - { - case MEM_IMAGE: - wTmpStr = QString("Image"); - break; - case MEM_MAPPED: - wTmpStr = QString("Mapped"); - break; - case MEM_PRIVATE: - wTmpStr = QString("Private"); - break; - default: - wTmpStr = QString("N/A"); - break; - } - wStr += wTmpStr + QString(" ").repeated(10 - wTmpStr.length()); - - - //qDebug() << wStr; - } -} - - - - - - - - - - - - diff --git a/x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.h b/x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.h deleted file mode 100644 index 3efc31d9..00000000 --- a/x64_dbg_gui/Project/Src/Memory/ProcessMemoryMap.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef MEMORYMAP_H -#define MEMORYMAP_H - -#include -#include -#include -#include "NewTypes.h" -#include "windows.h" - -class ProcessMemoryMap : public QObject -{ - Q_OBJECT -public: - - explicit ProcessMemoryMap(QString fileName, QObject* parent = 0); - QList BruteForceProcessMemory(); - void printVirtualMemoryMap(QList parList); - - -signals: - -public slots: - -private: - HANDLE mhProcess; - - QByteArray mData; - - QList mMemoryRegionsDataList; - QList mMemoryRegionsList; - -}; - -#endif // MEMORYMAP_H diff --git a/x64_dbg_gui/Project/Src/Utils/Breakpoints.h b/x64_dbg_gui/Project/Src/Utils/Breakpoints.h index f11f97fb..85442ae6 100644 --- a/x64_dbg_gui/Project/Src/Utils/Breakpoints.h +++ b/x64_dbg_gui/Project/Src/Utils/Breakpoints.h @@ -1,9 +1,6 @@ #ifndef BREAKPOINTS_H #define BREAKPOINTS_H -#include -#include "Bridge.h" - enum BPXSTATE { bp_enabled = 0, diff --git a/x64_dbg_gui/Project/Src/Utils/Configuration.cpp b/x64_dbg_gui/Project/Src/Utils/Configuration.cpp index 1af61274..e5eda584 100644 --- a/x64_dbg_gui/Project/Src/Utils/Configuration.cpp +++ b/x64_dbg_gui/Project/Src/Utils/Configuration.cpp @@ -1,6 +1,4 @@ #include "Configuration.h" -#include "Bridge.h" -#include Configuration* Configuration::mPtr = NULL; diff --git a/x64_dbg_gui/Project/Src/Utils/Configuration.h b/x64_dbg_gui/Project/Src/Utils/Configuration.h index 764d8ad2..61967861 100644 --- a/x64_dbg_gui/Project/Src/Utils/Configuration.h +++ b/x64_dbg_gui/Project/Src/Utils/Configuration.h @@ -1,14 +1,6 @@ #ifndef CONFIGURATION_H #define CONFIGURATION_H -#include -#include -#include -#include -#include -#include -#include "Bridge.h" - #define Config() (Configuration::instance()) #define ConfigColor(x) (Config()->getColor(x)) #define ConfigBool(x,y) (Config()->getBool(x,y)) diff --git a/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h b/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h index f240fd94..60034cf4 100644 --- a/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h +++ b/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h @@ -1,9 +1,6 @@ #ifndef RICHTEXTPAINTER_H #define RICHTEXTPAINTER_H -#include -#include - class RichTextPainter { public: diff --git a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp index 7ab91e2c..51ded92c 100644 --- a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp +++ b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp @@ -1,6 +1,4 @@ #include "UpdateChecker.h" -#include -#include "Bridge.h" UpdateChecker::UpdateChecker(QWidget* parent) { diff --git a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h index 58f6ce35..bd2b8761 100644 --- a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h +++ b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h @@ -1,9 +1,6 @@ #ifndef UPDATECHECKER_H #define UPDATECHECKER_H -#include -#include - class UpdateChecker : public QNetworkAccessManager { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/main.cpp b/x64_dbg_gui/Project/Src/main.cpp index bf48f800..fb5bfe6c 100644 --- a/x64_dbg_gui/Project/Src/main.cpp +++ b/x64_dbg_gui/Project/Src/main.cpp @@ -1,9 +1,4 @@ -#include -#include "MainWindow.h" -#include "NewTypes.h" -#include "Bridge.h" #include "main.h" -#include MyApplication::MyApplication(int & argc, char** argv) : QApplication(argc, argv) { diff --git a/x64_dbg_gui/Project/x64_dbg.pro b/x64_dbg_gui/Project/x64_dbg.pro index 175a0f18..923db27e 100644 --- a/x64_dbg_gui/Project/x64_dbg.pro +++ b/x64_dbg_gui/Project/x64_dbg.pro @@ -36,7 +36,6 @@ SOURCES += \ Src/BasicView/HexDump.cpp \ Src/BasicView/AbstractTableView.cpp \ Src/Disassembler/QBeaEngine.cpp \ - Src/Memory/ProcessMemoryMap.cpp \ Src/Memory/MemoryPage.cpp \ Src/Memory/MapViewOfMem.cpp \ Src/Bridge/Bridge.cpp \ @@ -97,7 +96,6 @@ HEADERS += \ Src/BasicView/HexDump.h \ Src/BasicView/AbstractTableView.h \ Src/Disassembler/QBeaEngine.h \ - Src/Memory/ProcessMemoryMap.h \ Src/Memory/MemoryPage.h \ Src/Memory/MapViewOfMem.h \ Src/Bridge/Bridge.h \ From 8f7f34a317462b6842868250a7c5010da41eadd3 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Mon, 18 Aug 2014 14:30:12 +0200 Subject: [PATCH 08/17] GUI: refactor finished --- .../Src/BasicView/AbstractTableView.cpp | 2 + .../Project/Src/BasicView/AbstractTableView.h | 8 ++ .../Project/Src/BasicView/Disassembly.cpp | 2 + .../Project/Src/BasicView/Disassembly.h | 4 + x64_dbg_gui/Project/Src/BasicView/HexDump.cpp | 3 + x64_dbg_gui/Project/Src/BasicView/HexDump.h | 4 + .../Project/Src/BasicView/HistoryLineEdit.h | 3 + .../Project/Src/BasicView/ReferenceView.cpp | 3 + .../Project/Src/BasicView/ReferenceView.h | 3 + .../Project/Src/BasicView/SearchListView.h | 6 + .../Src/BasicView/SearchListViewTable.cpp | 2 + .../Src/BasicView/SearchListViewTable.h | 2 + .../Project/Src/BasicView/ShortcutEdit.cpp | 2 +- .../Project/Src/BasicView/ShortcutEdit.h | 4 + .../Project/Src/BasicView/StdTable.cpp | 1 + x64_dbg_gui/Project/Src/BasicView/StdTable.h | 2 + x64_dbg_gui/Project/Src/Bridge/Bridge.cpp | 4 + x64_dbg_gui/Project/Src/Bridge/Bridge.h | 6 + .../Project/Src/Disassembler/BeaTokenizer.cpp | 1 + .../Project/Src/Disassembler/BeaTokenizer.h | 6 + .../Project/Src/Disassembler/QBeaEngine.h | 4 + x64_dbg_gui/Project/Src/Global/NewTypes.h | 2 + .../Project/Src/Gui/AppearanceDialog.cpp | 4 + .../Project/Src/Gui/AppearanceDialog.h | 3 + x64_dbg_gui/Project/Src/Gui/AttachDialog.cpp | 1 + x64_dbg_gui/Project/Src/Gui/AttachDialog.h | 2 + .../Project/Src/Gui/BreakpointsView.cpp | 3 + x64_dbg_gui/Project/Src/Gui/BreakpointsView.h | 5 + .../Project/Src/Gui/CPUDisassembly.cpp | 7 + x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h | 3 + x64_dbg_gui/Project/Src/Gui/CPUDump.cpp | 6 + x64_dbg_gui/Project/Src/Gui/CPUDump.h | 3 + x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp | 1 + x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h | 2 + x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp | 2 + x64_dbg_gui/Project/Src/Gui/CPUSideBar.h | 3 + x64_dbg_gui/Project/Src/Gui/CPUStack.cpp | 5 + x64_dbg_gui/Project/Src/Gui/CPUStack.h | 3 + x64_dbg_gui/Project/Src/Gui/CPUWidget.h | 9 ++ .../Project/Src/Gui/CalculatorDialog.cpp | 2 +- .../Project/Src/Gui/CalculatorDialog.h | 4 + x64_dbg_gui/Project/Src/Gui/CallStackView.cpp | 1 + x64_dbg_gui/Project/Src/Gui/CallStackView.h | 2 + x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp | 5 +- x64_dbg_gui/Project/Src/Gui/CloseDialog.h | 2 + .../Project/Src/Gui/CommandHelpView.cpp | 1 + x64_dbg_gui/Project/Src/Gui/CommandHelpView.h | 4 + .../Project/Src/Gui/CommandLineEdit.cpp | 2 + x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h | 3 + .../Project/Src/Gui/ExceptionRangeDialog.h | 2 + x64_dbg_gui/Project/Src/Gui/GotoDialog.h | 4 + x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp | 10 +- x64_dbg_gui/Project/Src/Gui/HexEditDialog.h | 3 + x64_dbg_gui/Project/Src/Gui/LineEditDialog.h | 2 + x64_dbg_gui/Project/Src/Gui/LogView.cpp | 2 + x64_dbg_gui/Project/Src/Gui/LogView.h | 2 + x64_dbg_gui/Project/Src/Gui/MainWindow.cpp | 12 ++ x64_dbg_gui/Project/Src/Gui/MainWindow.h | 20 ++- x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp | 3 + x64_dbg_gui/Project/Src/Gui/MemoryMapView.h | 2 + .../Project/Src/Gui/PageMemoryRights.h | 3 + x64_dbg_gui/Project/Src/Gui/PatchDialog.cpp | 5 + x64_dbg_gui/Project/Src/Gui/PatchDialog.h | 5 + .../Src/Gui/PatchDialogGroupSelector.h | 3 + x64_dbg_gui/Project/Src/Gui/RegistersView.cpp | 3 + x64_dbg_gui/Project/Src/Gui/RegistersView.h | 5 + x64_dbg_gui/Project/Src/Gui/ScriptView.cpp | 6 + x64_dbg_gui/Project/Src/Gui/ScriptView.h | 2 + .../Project/Src/Gui/SettingsDialog.cpp | 4 + x64_dbg_gui/Project/Src/Gui/SettingsDialog.h | 2 + x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h | 4 + x64_dbg_gui/Project/Src/Gui/StatusLabel.h | 4 + x64_dbg_gui/Project/Src/Gui/SymbolView.cpp | 3 + x64_dbg_gui/Project/Src/Gui/SymbolView.h | 3 + x64_dbg_gui/Project/Src/Gui/ThreadView.cpp | 2 + x64_dbg_gui/Project/Src/Gui/ThreadView.h | 3 + x64_dbg_gui/Project/Src/Gui/WordEditDialog.h | 5 + .../Project/Src/Memory/MapViewOfMem.cpp | 129 ------------------ x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h | 51 ------- x64_dbg_gui/Project/Src/Memory/MemoryPage.h | 3 + x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.cpp | 4 +- x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.h | 3 +- .../Project/Src/QHexEdit/QHexEditPrivate.cpp | 9 +- .../Project/Src/QHexEdit/QHexEditPrivate.h | 5 +- x64_dbg_gui/Project/Src/Utils/Breakpoints.cpp | 4 - x64_dbg_gui/Project/Src/Utils/Breakpoints.h | 15 +- .../Project/Src/Utils/Configuration.cpp | 4 + x64_dbg_gui/Project/Src/Utils/Configuration.h | 7 + .../Project/Src/Utils/RichTextPainter.h | 4 + .../Project/Src/Utils/UpdateChecker.cpp | 6 + x64_dbg_gui/Project/Src/Utils/UpdateChecker.h | 2 + x64_dbg_gui/Project/Src/main.cpp | 5 + x64_dbg_gui/Project/x64_dbg.pro | 2 - 93 files changed, 322 insertions(+), 217 deletions(-) delete mode 100644 x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp delete mode 100644 x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h diff --git a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp index 05962ab8..04bef7ff 100644 --- a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.cpp @@ -1,4 +1,6 @@ #include "AbstractTableView.h" +#include +#include "Configuration.h" AbstractTableView::AbstractTableView(QWidget* parent) : QAbstractScrollArea(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h index ac24ba75..09a49fc9 100644 --- a/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h +++ b/x64_dbg_gui/Project/Src/BasicView/AbstractTableView.h @@ -1,6 +1,14 @@ #ifndef ABSTRACTTABLEVIEW_H #define ABSTRACTTABLEVIEW_H +#include +#include +#include +#include +#include +#include +#include "NewTypes.h" + //Hacky class that fixes a really annoying cursor problem class AbstractTableScrollBar : public QScrollBar { diff --git a/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp b/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp index 579f47ae..93a98062 100644 --- a/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp @@ -1,4 +1,6 @@ #include "Disassembly.h" +#include "Configuration.h" +#include "Bridge.h" Disassembly::Disassembly(QWidget* parent) : AbstractTableView(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/Disassembly.h b/x64_dbg_gui/Project/Src/BasicView/Disassembly.h index 9ded75c6..fbf6e98e 100644 --- a/x64_dbg_gui/Project/Src/BasicView/Disassembly.h +++ b/x64_dbg_gui/Project/Src/BasicView/Disassembly.h @@ -1,6 +1,10 @@ #ifndef DISASSEMBLY_H #define DISASSEMBLY_H +#include "AbstractTableView.h" +#include "QBeaEngine.h" +#include "MemoryPage.h" + class Disassembly : public AbstractTableView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp b/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp index 7cf226a5..2c719cc4 100644 --- a/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/HexDump.cpp @@ -1,4 +1,7 @@ #include "HexDump.h" +#include +#include "Configuration.h" +#include "Bridge.h" HexDump::HexDump(QWidget* parent) : AbstractTableView(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/HexDump.h b/x64_dbg_gui/Project/Src/BasicView/HexDump.h index 2299bc9c..3dd4c1c7 100644 --- a/x64_dbg_gui/Project/Src/BasicView/HexDump.h +++ b/x64_dbg_gui/Project/Src/BasicView/HexDump.h @@ -1,6 +1,10 @@ #ifndef _HEXDUMP_H #define _HEXDUMP_H +#include "AbstractTableView.h" +#include "RichTextPainter.h" +#include "MemoryPage.h" + class HexDump : public AbstractTableView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h b/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h index 4885e09a..c4ee8ad8 100644 --- a/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h +++ b/x64_dbg_gui/Project/Src/BasicView/HistoryLineEdit.h @@ -1,6 +1,9 @@ #ifndef HISTORYLINEEDIT_H #define HISTORYLINEEDIT_H +#include +#include + class HistoryLineEdit : public QLineEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp index 3db545c1..f5bc0bb6 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.cpp @@ -1,4 +1,7 @@ #include "ReferenceView.h" +#include +#include "Configuration.h" +#include "Bridge.h" ReferenceView::ReferenceView() { diff --git a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h index e3d76870..cf032522 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h +++ b/x64_dbg_gui/Project/Src/BasicView/ReferenceView.h @@ -1,6 +1,9 @@ #ifndef REFERENCEVIEW_H #define REFERENCEVIEW_H +#include +#include "SearchListView.h" + class ReferenceView : public SearchListView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/SearchListView.h b/x64_dbg_gui/Project/Src/BasicView/SearchListView.h index a642dc1a..819c77c6 100644 --- a/x64_dbg_gui/Project/Src/BasicView/SearchListView.h +++ b/x64_dbg_gui/Project/Src/BasicView/SearchListView.h @@ -1,6 +1,12 @@ #ifndef SEARCHLISTVIEW_H #define SEARCHLISTVIEW_H +#include +#include +#include +#include +#include "SearchListViewTable.h" + namespace Ui { class SearchListView; diff --git a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp index 902216a9..7ef7830e 100644 --- a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.cpp @@ -1,4 +1,6 @@ #include "SearchListViewTable.h" +#include "Configuration.h" +#include "RichTextPainter.h" SearchListViewTable::SearchListViewTable(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h index 37ded7ad..3200c195 100644 --- a/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h +++ b/x64_dbg_gui/Project/Src/BasicView/SearchListViewTable.h @@ -1,6 +1,8 @@ #ifndef SEARCHLISTVIEWTABLE_H #define SEARCHLISTVIEWTABLE_H +#include "StdTable.h" + class SearchListViewTable : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp index d39a6113..ad4f76c6 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.cpp @@ -56,7 +56,7 @@ void ShortcutEdit::keyPressEvent(QKeyEvent* event) QString KeyText = QKeySequence(keyInt).toString(QKeySequence::NativeText) ; for(int i = 0; i < KeyText.length(); i++) { - if(KeyText[i].toAscii() == 0) + if(KeyText[i].toLatin1() == 0) { setText(""); keyInt = -1; diff --git a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h index 0dad8d73..b437c6a4 100644 --- a/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h +++ b/x64_dbg_gui/Project/Src/BasicView/ShortcutEdit.h @@ -1,6 +1,10 @@ #ifndef SHORTCUTEDIT_H #define SHORTCUTEDIT_H +#include +#include +#include + class ShortcutEdit : public QLineEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp b/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp index e0120fed..042d0458 100644 --- a/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/StdTable.cpp @@ -1,4 +1,5 @@ #include "StdTable.h" +#include "Bridge.h" StdTable::StdTable(QWidget* parent) : AbstractTableView(parent) { diff --git a/x64_dbg_gui/Project/Src/BasicView/StdTable.h b/x64_dbg_gui/Project/Src/BasicView/StdTable.h index 6436ceaf..502900a5 100644 --- a/x64_dbg_gui/Project/Src/BasicView/StdTable.h +++ b/x64_dbg_gui/Project/Src/BasicView/StdTable.h @@ -1,6 +1,8 @@ #ifndef STDTABLE_H #define STDTABLE_H +#include "AbstractTableView.h" + class StdTable : public AbstractTableView { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Bridge/Bridge.cpp b/x64_dbg_gui/Project/Src/Bridge/Bridge.cpp index 4c3a3cd2..d2b3c039 100644 --- a/x64_dbg_gui/Project/Src/Bridge/Bridge.cpp +++ b/x64_dbg_gui/Project/Src/Bridge/Bridge.cpp @@ -1,4 +1,8 @@ #include "Bridge.h" +#include +#include "QBeaEngine.h" +#include "main.h" +#include "Exports.h" /************************************************************************************ Global Variables diff --git a/x64_dbg_gui/Project/Src/Bridge/Bridge.h b/x64_dbg_gui/Project/Src/Bridge/Bridge.h index ccea323d..41a78696 100644 --- a/x64_dbg_gui/Project/Src/Bridge/Bridge.h +++ b/x64_dbg_gui/Project/Src/Bridge/Bridge.h @@ -1,6 +1,12 @@ #ifndef BRIDGE_H #define BRIDGE_H +#include +#include +#include "Imports.h" +#include "NewTypes.h" +#include "SearchListView.h" + class Bridge : public QObject { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp index e2f7613b..4983710f 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp +++ b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.cpp @@ -1,4 +1,5 @@ #include "BeaTokenizer.h" +#include "Configuration.h" //variables QMap BeaTokenizer::colorNamesMap; diff --git a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h index 8eea8115..0bf33707 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h +++ b/x64_dbg_gui/Project/Src/Disassembler/BeaTokenizer.h @@ -1,6 +1,12 @@ #ifndef BEATOKENIZER_H #define BEATOKENIZER_H +#include +#include +#include "RichTextPainter.h" +#include "BeaEngine.h" +#include "NewTypes.h" + class BeaTokenizer : RichTextPainter { public: diff --git a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h index 1fee29a5..f5a84b94 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h +++ b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.h @@ -1,6 +1,10 @@ #ifndef QBEAENGINE_H #define QBEAENGINE_H +#include +#include "NewTypes.h" +#include "BeaTokenizer.h" + typedef struct _Instruction_t { QString instStr; diff --git a/x64_dbg_gui/Project/Src/Global/NewTypes.h b/x64_dbg_gui/Project/Src/Global/NewTypes.h index a31427b7..e707dcef 100644 --- a/x64_dbg_gui/Project/Src/Global/NewTypes.h +++ b/x64_dbg_gui/Project/Src/Global/NewTypes.h @@ -1,6 +1,8 @@ #ifndef NEWTYPES_H #define NEWTYPES_H +#include "Imports.h" + typedef short int16; typedef unsigned short uint16; diff --git a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp index 17cf1f94..708372f8 100644 --- a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.cpp @@ -1,5 +1,9 @@ #include "AppearanceDialog.h" #include "ui_AppearanceDialog.h" +#include +#include +#include +#include "Configuration.h" AppearanceDialog::AppearanceDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AppearanceDialog) { diff --git a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h index b80d3e26..3ba6b37a 100644 --- a/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/AppearanceDialog.h @@ -1,6 +1,9 @@ #ifndef APPEARANCEDIALOG_H #define APPEARANCEDIALOG_H +#include +#include + namespace Ui { class AppearanceDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/AttachDialog.cpp b/x64_dbg_gui/Project/Src/Gui/AttachDialog.cpp index 99c7a265..68ab67e6 100644 --- a/x64_dbg_gui/Project/Src/Gui/AttachDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/AttachDialog.cpp @@ -1,5 +1,6 @@ #include "AttachDialog.h" #include "ui_AttachDialog.h" +#include AttachDialog::AttachDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AttachDialog) { diff --git a/x64_dbg_gui/Project/Src/Gui/AttachDialog.h b/x64_dbg_gui/Project/Src/Gui/AttachDialog.h index 7e5144f7..e5dbe68d 100644 --- a/x64_dbg_gui/Project/Src/Gui/AttachDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/AttachDialog.h @@ -1,6 +1,8 @@ #ifndef ATTACHDIALOG_H #define ATTACHDIALOG_H +#include + namespace Ui { class AttachDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp index 498c5437..72da5ee1 100644 --- a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.cpp @@ -1,4 +1,7 @@ #include "BreakpointsView.h" +#include "Configuration.h" +#include "Bridge.h" +#include "Breakpoints.h" BreakpointsView::BreakpointsView(QWidget* parent) : QWidget(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h index 968ba6a2..1e87764b 100644 --- a/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h +++ b/x64_dbg_gui/Project/Src/Gui/BreakpointsView.h @@ -1,6 +1,11 @@ #ifndef BREAKPOINTSVIEW_H #define BREAKPOINTSVIEW_H +#include +#include +#include +#include "StdTable.h" + class BreakpointsView : public QWidget { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp index bf5ca500..bf197319 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp @@ -1,4 +1,11 @@ #include "CPUDisassembly.h" +#include +#include +#include "Configuration.h" +#include "Bridge.h" +#include "LineEditDialog.h" +#include "WordEditDialog.h" +#include "HexEditDialog.h" CPUDisassembly::CPUDisassembly(QWidget* parent) : Disassembly(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h index 280472cd..88cfe5e2 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h @@ -1,6 +1,9 @@ #ifndef CPUDISASSEMBLY_H #define CPUDISASSEMBLY_H +#include "Disassembly.h" +#include "GotoDialog.h" + class CPUDisassembly : public Disassembly { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp b/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp index 4b16c66a..dbaadba9 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp @@ -1,4 +1,10 @@ #include "CPUDump.h" +#include +#include +#include "Configuration.h" +#include "Bridge.h" +#include "LineEditDialog.h" +#include "HexEditDialog.h" CPUDump::CPUDump(QWidget* parent) : HexDump(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDump.h b/x64_dbg_gui/Project/Src/Gui/CPUDump.h index 9749b703..6397e67a 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDump.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUDump.h @@ -1,6 +1,9 @@ #ifndef CPUDUMP_H #define CPUDUMP_H +#include "HexDump.h" +#include "GotoDialog.h" + class CPUDump : public HexDump { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp index 22cb6ab1..924e56c8 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp @@ -1,4 +1,5 @@ #include "CPUInfoBox.h" +#include "Bridge.h" CPUInfoBox::CPUInfoBox(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h index 9147c42a..cd47e486 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.h @@ -1,6 +1,8 @@ #ifndef INFOBOX_H #define INFOBOX_H +#include "StdTable.h" + class CPUInfoBox : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp index 4958f1b7..3de6cd4e 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.cpp @@ -1,4 +1,6 @@ #include "CPUSideBar.h" +#include "Configuration.h" +#include "Breakpoints.h" CPUSideBar::CPUSideBar(CPUDisassembly* Ptr, QWidget* parent) : QAbstractScrollArea(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h index 37f0ede7..cfd58a03 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUSideBar.h @@ -1,6 +1,9 @@ #ifndef CPUSIDEBAR_H #define CPUSIDEBAR_H +#include +#include "CPUDisassembly.h" + class CPUSideBar : public QAbstractScrollArea { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp b/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp index 6f97aec9..2994200d 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUStack.cpp @@ -1,4 +1,9 @@ #include "CPUStack.h" +#include +#include "Configuration.h" +#include "Bridge.h" +#include "HexEditDialog.h" +#include "WordEditDialog.h" CPUStack::CPUStack(QWidget* parent) : HexDump(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CPUStack.h b/x64_dbg_gui/Project/Src/Gui/CPUStack.h index c67562a3..dd030d21 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUStack.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUStack.h @@ -1,6 +1,9 @@ #ifndef CPUSTACK_H #define CPUSTACK_H +#include "HexDump.h" +#include "GotoDialog.h" + class CPUStack : public HexDump { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CPUWidget.h b/x64_dbg_gui/Project/Src/Gui/CPUWidget.h index f42c9b22..0fe082f8 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUWidget.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUWidget.h @@ -1,6 +1,15 @@ #ifndef CPUWIDGET_H #define CPUWIDGET_H +#include +#include +#include "CPUSideBar.h" +#include "CPUDisassembly.h" +#include "CPUDump.h" +#include "CPUStack.h" +#include "RegistersView.h" +#include "CPUInfoBox.h" + namespace Ui { class CPUWidget; diff --git a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp index c36358cb..bcbf46b5 100644 --- a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.cpp @@ -221,7 +221,7 @@ void CalculatorDialog::on_txtAscii_textEdited(const QString & arg1) return; } ui->txtAscii->setStyleSheet(""); - ui->txtExpression->setText(QString().sprintf("%X", text[0].toAscii())); + ui->txtExpression->setText(QString().sprintf("%X", text[0].toLatin1())); ui->txtAscii->setCursorPosition(1); } diff --git a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h index aec8d035..24f73e25 100644 --- a/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/CalculatorDialog.h @@ -1,6 +1,10 @@ #ifndef CALCULATORDIALOG_H #define CALCULATORDIALOG_H +#include +#include +#include "NewTypes.h" + namespace Ui { class CalculatorDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp b/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp index 0deaa3e2..cc1fb535 100644 --- a/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CallStackView.cpp @@ -1,4 +1,5 @@ #include "CallStackView.h" +#include "Bridge.h" CallStackView::CallStackView(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CallStackView.h b/x64_dbg_gui/Project/Src/Gui/CallStackView.h index 1b413b5a..8fe070ba 100644 --- a/x64_dbg_gui/Project/Src/Gui/CallStackView.h +++ b/x64_dbg_gui/Project/Src/Gui/CallStackView.h @@ -1,6 +1,8 @@ #ifndef CALLSTACKVIEW_H #define CALLSTACKVIEW_H +#include "StdTable.h" + class CallStackView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp b/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp index 18a588d6..fece9145 100644 --- a/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CloseDialog.cpp @@ -1,8 +1,7 @@ #include "CloseDialog.h" +#include "ui_CloseDialog.h" -CloseDialog::CloseDialog(QWidget* parent) : - QDialog(parent), - ui(new Ui::CloseDialog) +CloseDialog::CloseDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CloseDialog) { ui->setupUi(this); setModal(true); diff --git a/x64_dbg_gui/Project/Src/Gui/CloseDialog.h b/x64_dbg_gui/Project/Src/Gui/CloseDialog.h index 9af82d51..00cbf6da 100644 --- a/x64_dbg_gui/Project/Src/Gui/CloseDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/CloseDialog.h @@ -1,6 +1,8 @@ #ifndef CLOSEDIALOG_H #define CLOSEDIALOG_H +#include + namespace Ui { class CloseDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp index 61b775cf..cd1b9b52 100644 --- a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.cpp @@ -1,4 +1,5 @@ #include "CommandHelpView.h" +#include "ui_CommandHelpView.h" CommandHelpView::CommandHelpView(QWidget* parent) : QWidget(parent), ui(new Ui::CommandHelpView) { diff --git a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h index 442052f7..61e053eb 100644 --- a/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h +++ b/x64_dbg_gui/Project/Src/Gui/CommandHelpView.h @@ -1,6 +1,10 @@ #ifndef COMMANDHELPVIEW_H #define COMMANDHELPVIEW_H +#include +#include +#include "SearchListView.h" + namespace Ui { class CommandHelpView; diff --git a/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.cpp b/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.cpp index 1bbaae79..5a92a1ab 100644 --- a/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.cpp @@ -1,4 +1,6 @@ #include "CommandLineEdit.h" +#include +#include "Bridge.h" CommandLineEdit::CommandLineEdit(QWidget* parent) : HistoryLineEdit(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h b/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h index 44d8c459..41ce53ad 100644 --- a/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h +++ b/x64_dbg_gui/Project/Src/Gui/CommandLineEdit.h @@ -1,6 +1,9 @@ #ifndef COMMANDLINEEDIT_H #define COMMANDLINEEDIT_H +#include "HistoryLineEdit.h" +#include + class CommandLineEdit : public HistoryLineEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h b/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h index eda4d051..58c7c182 100644 --- a/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/ExceptionRangeDialog.h @@ -1,6 +1,8 @@ #ifndef EXCEPTIONRANGEDIALOG_H #define EXCEPTIONRANGEDIALOG_H +#include + namespace Ui { class ExceptionRangeDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/GotoDialog.h b/x64_dbg_gui/Project/Src/Gui/GotoDialog.h index 09b6df75..83974c91 100644 --- a/x64_dbg_gui/Project/Src/Gui/GotoDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/GotoDialog.h @@ -1,6 +1,10 @@ #ifndef GOTODIALOG_H #define GOTODIALOG_H +#include +#include +#include "NewTypes.h" + namespace Ui { class GotoDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp index 6e0877e4..938f26a7 100644 --- a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.cpp @@ -1,9 +1,9 @@ #include "HexEditDialog.h" #include "ui_HexEditDialog.h" +#include "Configuration.h" +#include "Bridge.h" -HexEditDialog::HexEditDialog(QWidget* parent) : - QDialog(parent), - ui(new Ui::HexEditDialog) +HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexEditDialog) { ui->setupUi(this); @@ -66,7 +66,7 @@ void HexEditDialog::on_btnAscii2Hex_clicked() QString text = ui->lineEditAscii->text(); QByteArray data; for(int i = 0; i < text.length(); i++) - data.append(text[i].toAscii()); + data.append(text[i].toLatin1()); if(ui->chkKeepSize->isChecked()) //keep size { int dataSize = mHexEdit->data().size(); @@ -105,7 +105,7 @@ void HexEditDialog::dataChangedSlot() { QChar ch(data.constData()[i]); if(ch.isPrint()) - ascii += ch.toAscii(); + ascii += ch.toLatin1(); else ascii += '.'; } diff --git a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h index 02f84594..752ae6e6 100644 --- a/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/HexEditDialog.h @@ -1,6 +1,9 @@ #ifndef HEXEDITDIALOG_H #define HEXEDITDIALOG_H +#include +#include "QHexEdit/QHexEdit.h" + namespace Ui { class HexEditDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h b/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h index 455d3125..14fe9273 100644 --- a/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/LineEditDialog.h @@ -1,6 +1,8 @@ #ifndef LINEEDITDIALOG_H #define LINEEDITDIALOG_H +#include + namespace Ui { class LineEditDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/LogView.cpp b/x64_dbg_gui/Project/Src/Gui/LogView.cpp index b3e109eb..afa6ddd9 100644 --- a/x64_dbg_gui/Project/Src/Gui/LogView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/LogView.cpp @@ -1,4 +1,6 @@ #include "LogView.h" +#include "Configuration.h" +#include "Bridge.h" LogView::LogView(QWidget* parent) : QTextEdit(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/LogView.h b/x64_dbg_gui/Project/Src/Gui/LogView.h index 3559f0a3..6ab08c34 100644 --- a/x64_dbg_gui/Project/Src/Gui/LogView.h +++ b/x64_dbg_gui/Project/Src/Gui/LogView.h @@ -1,6 +1,8 @@ #ifndef LOGVIEW_H #define LOGVIEW_H +#include + class LogView : public QTextEdit { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/MainWindow.cpp b/x64_dbg_gui/Project/Src/Gui/MainWindow.cpp index 8d96a243..70a40260 100644 --- a/x64_dbg_gui/Project/Src/Gui/MainWindow.cpp +++ b/x64_dbg_gui/Project/Src/Gui/MainWindow.cpp @@ -1,5 +1,17 @@ #include "MainWindow.h" #include "ui_MainWindow.h" +#include +#include +#include +#include +#include +#include +#include "Configuration.h" +#include "SettingsDialog.h" +#include "AppearanceDialog.h" +#include "ShortcutsDialog.h" +#include "AttachDialog.h" +#include "LineEditDialog.h" MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow) { diff --git a/x64_dbg_gui/Project/Src/Gui/MainWindow.h b/x64_dbg_gui/Project/Src/Gui/MainWindow.h index 702ba0fa..3d2b5196 100644 --- a/x64_dbg_gui/Project/Src/Gui/MainWindow.h +++ b/x64_dbg_gui/Project/Src/Gui/MainWindow.h @@ -1,6 +1,25 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H +#include +#include +#include "CloseDialog.h" +#include "CommandLineEdit.h" +#include "TabWidget.h" +#include "CPUWidget.h" +#include "MemoryMapView.h" +#include "CallStackView.h" +#include "LogView.h" +#include "SymbolView.h" +#include "BreakpointsView.h" +#include "ScriptView.h" +#include "ReferenceView.h" +#include "ThreadView.h" +#include "PatchDialog.h" +#include "CalculatorDialog.h" +#include "StatusLabel.h" +#include "UpdateChecker.h" + namespace Ui { class MainWindow; @@ -74,7 +93,6 @@ public slots: private: Ui::MainWindow* ui; CloseDialog* mCloseDialog; - CommandLineEdit* mCmdLineEdit; MHTabWidget* mTabWidget; CPUWidget* mCpuWidget; diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp index 25e4b533..758dbb0c 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.cpp @@ -1,4 +1,7 @@ #include "MemoryMapView.h" +#include "Configuration.h" +#include "Bridge.h" +#include "PageMemoryRights.h" MemoryMapView::MemoryMapView(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h index 12e6ac19..1d7e4e37 100644 --- a/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h +++ b/x64_dbg_gui/Project/Src/Gui/MemoryMapView.h @@ -1,6 +1,8 @@ #ifndef MEMORYMAPVIEW_H #define MEMORYMAPVIEW_H +#include "StdTable.h" + class MemoryMapView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h index 9b805ac7..b66c6551 100644 --- a/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h +++ b/x64_dbg_gui/Project/Src/Gui/PageMemoryRights.h @@ -1,6 +1,9 @@ #ifndef PAGEMEMORYRIGHTS_H #define PAGEMEMORYRIGHTS_H +#include +#include "NewTypes.h" + #define PAGE_SIZE 0x1000 namespace Ui diff --git a/x64_dbg_gui/Project/Src/Gui/PatchDialog.cpp b/x64_dbg_gui/Project/Src/Gui/PatchDialog.cpp index 09a532d9..3c49df8b 100644 --- a/x64_dbg_gui/Project/Src/Gui/PatchDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/PatchDialog.cpp @@ -1,5 +1,10 @@ #include "PatchDialog.h" #include "ui_PatchDialog.h" +#include +#include +#include +#include +#include PatchDialog::PatchDialog(QWidget* parent) : QDialog(parent), diff --git a/x64_dbg_gui/Project/Src/Gui/PatchDialog.h b/x64_dbg_gui/Project/Src/Gui/PatchDialog.h index 5040ecaf..e5d8c73d 100644 --- a/x64_dbg_gui/Project/Src/Gui/PatchDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/PatchDialog.h @@ -1,6 +1,11 @@ #ifndef PATCHDIALOG_H #define PATCHDIALOG_H +#include +#include +#include "PatchDialogGroupSelector.h" +#include "Bridge.h" + namespace Ui { class PatchDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h b/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h index 2e4615bc..369e77d4 100644 --- a/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h +++ b/x64_dbg_gui/Project/Src/Gui/PatchDialogGroupSelector.h @@ -1,6 +1,9 @@ #ifndef PATCHDIALOGGROUPSELECTOR_H #define PATCHDIALOGGROUPSELECTOR_H +#include +#include + namespace Ui { class PatchDialogGroupSelector; diff --git a/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp b/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp index a8706096..2fb421c5 100644 --- a/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/RegistersView.cpp @@ -1,4 +1,7 @@ #include "RegistersView.h" +#include +#include "Configuration.h" +#include "WordEditDialog.h" RegistersView::RegistersView(QWidget* parent) : QAbstractScrollArea(parent), mVScrollOffset(0) { diff --git a/x64_dbg_gui/Project/Src/Gui/RegistersView.h b/x64_dbg_gui/Project/Src/Gui/RegistersView.h index 1fefaba1..67819267 100644 --- a/x64_dbg_gui/Project/Src/Gui/RegistersView.h +++ b/x64_dbg_gui/Project/Src/Gui/RegistersView.h @@ -1,6 +1,11 @@ #ifndef REGISTERSVIEW_H #define REGISTERSVIEW_H +#include +#include +#include +#include "Bridge.h" + #define IsCharacterRegister(x) ((x>=CAX && x +#include +#include "Configuration.h" +#include "Bridge.h" +#include "RichTextPainter.h" +#include "LineEditDialog.h" ScriptView::ScriptView(StdTable* parent) : StdTable(parent) { diff --git a/x64_dbg_gui/Project/Src/Gui/ScriptView.h b/x64_dbg_gui/Project/Src/Gui/ScriptView.h index b59c7acd..6615dfa3 100644 --- a/x64_dbg_gui/Project/Src/Gui/ScriptView.h +++ b/x64_dbg_gui/Project/Src/Gui/ScriptView.h @@ -1,6 +1,8 @@ #ifndef SCRIPTVIEW_H #define SCRIPTVIEW_H +#include "StdTable.h" + class ScriptView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp index 08539cbf..9c6bb4fa 100644 --- a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp +++ b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.cpp @@ -1,5 +1,9 @@ #include "SettingsDialog.h" #include "ui_SettingsDialog.h" +#include +#include "Configuration.h" +#include "Bridge.h" +#include "ExceptionRangeDialog.h" SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent), diff --git a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h index 203963a7..bfb437e7 100644 --- a/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/SettingsDialog.h @@ -1,6 +1,8 @@ #ifndef SETTINGSDIALOG_H #define SETTINGSDIALOG_H +#include + namespace Ui { class SettingsDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h b/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h index 78037eef..74555ea9 100644 --- a/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/ShortcutsDialog.h @@ -1,6 +1,10 @@ #ifndef SHORTCUTSDIALOG_H #define SHORTCUTSDIALOG_H +#include +#include +#include "Configuration.h" + namespace Ui { class ShortcutsDialog; diff --git a/x64_dbg_gui/Project/Src/Gui/StatusLabel.h b/x64_dbg_gui/Project/Src/Gui/StatusLabel.h index a452262d..812bbaa8 100644 --- a/x64_dbg_gui/Project/Src/Gui/StatusLabel.h +++ b/x64_dbg_gui/Project/Src/Gui/StatusLabel.h @@ -1,6 +1,10 @@ #ifndef LABELCLASS_H #define LABELCLASS_H +#include +#include +#include "Bridge.h" + class StatusLabel : public QLabel { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp b/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp index 93bd7f6b..d279ca7c 100644 --- a/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/SymbolView.cpp @@ -1,5 +1,8 @@ #include "SymbolView.h" #include "ui_SymbolView.h" +#include +#include "Configuration.h" +#include "Bridge.h" SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView) { diff --git a/x64_dbg_gui/Project/Src/Gui/SymbolView.h b/x64_dbg_gui/Project/Src/Gui/SymbolView.h index 034b2e85..af1134e0 100644 --- a/x64_dbg_gui/Project/Src/Gui/SymbolView.h +++ b/x64_dbg_gui/Project/Src/Gui/SymbolView.h @@ -1,6 +1,9 @@ #ifndef SYMBOLVIEW_H #define SYMBOLVIEW_H +#include +#include "Bridge.h" + namespace Ui { class SymbolView; diff --git a/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp b/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp index 30f7c238..11d324c7 100644 --- a/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp +++ b/x64_dbg_gui/Project/Src/Gui/ThreadView.cpp @@ -1,4 +1,6 @@ #include "ThreadView.h" +#include "Configuration.h" +#include "Bridge.h" void ThreadView::contextMenuSlot(const QPoint & pos) { diff --git a/x64_dbg_gui/Project/Src/Gui/ThreadView.h b/x64_dbg_gui/Project/Src/Gui/ThreadView.h index b2d94983..3adcb511 100644 --- a/x64_dbg_gui/Project/Src/Gui/ThreadView.h +++ b/x64_dbg_gui/Project/Src/Gui/ThreadView.h @@ -1,6 +1,9 @@ #ifndef THREADVIEW_H #define THREADVIEW_H +#include "StdTable.h" +#include + class ThreadView : public StdTable { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h b/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h index eafe9740..cf7e84d5 100644 --- a/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h +++ b/x64_dbg_gui/Project/Src/Gui/WordEditDialog.h @@ -1,6 +1,11 @@ #ifndef WORDEDITDIALOG_H #define WORDEDITDIALOG_H +#include +#include +#include +#include "NewTypes.h" + namespace Ui { class WordEditDialog; diff --git a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp b/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp deleted file mode 100644 index 62052d2f..00000000 --- a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "MapViewOfMem.h" - -MapViewOfMem::MapViewOfMem() -{ - mSelectedData.fromIndex = -1; - mSelectedData.toIndex = -1; -} - -MapViewOfMem::MapViewOfMem(QString file) -{ - MemDataCacheStruct_t data; - memset(&data, 0, sizeof(MemDataCacheStruct_t)); - data.memDataCachePtr = new QVector(0); - mGuiMemDataCache = data; - - mSelectedData.fromIndex = -1; - mSelectedData.toIndex = -1; - - //qDebug() << "MapViewOfMem() Load data from file."; - - QFile wFile(file); - - if(wFile.open(QIODevice::ReadOnly) == false) - //qDebug() << "File has not been opened."; - - mData = wFile.readAll(); - //qDebug() << "Size: " << mData.size(); - - if(mData.size() == 0) - { - //qDebug() << "No Data"; - } - - mSize = mData.size(); - mBase = 0x00401000; -} - - -MapViewOfMem::MapViewOfMem(uint_t startAddress , uint_t size) -{ - mStartAddress = startAddress; - mEndAddress = startAddress + size - 1; - mSize = size; -} - -MapViewOfMem::~MapViewOfMem() -{ - -} - -byte_t MapViewOfMem::readByte(uint_t rva) -{ - return mData.data()[rva]; -} - -uint_t MapViewOfMem::size() -{ - return mSize; -} - -unsigned char* MapViewOfMem::data() -{ - return (unsigned char*)(mData.data()); -} - - -Selection_t MapViewOfMem::getSelection() -{ - return mSelectedData; -} - -void MapViewOfMem::setSelection(Selection_t sel) -{ - mSelectedData = sel; -} - -uint_t MapViewOfMem::getBase() -{ - return mBase; -} - - -byte_t* MapViewOfMem::getDataPtrForGui(uint_t rva, uint_t maxNbrOfBytesToRead, uint_t newCacheSize) -{ - byte_t* wBytePtr = 0; - - if(maxNbrOfBytesToRead > 0) - { - // Bound maxNbrOfBytesToRead to the max value it can take - if(maxNbrOfBytesToRead > (this->size() - rva)) - maxNbrOfBytesToRead = this->size() - rva; - - if((mGuiMemDataCache.isInit == true) && (rva >= mGuiMemDataCache.rva) && ((rva + (uint_t)maxNbrOfBytesToRead) <= (mGuiMemDataCache.rva + (uint_t)mGuiMemDataCache.memDataCacheSize))) - { - // Cache Success - wBytePtr = mGuiMemDataCache.memDataCachePtr->data() + (rva - mGuiMemDataCache.rva); - } - else - { - // Cache Miss - mGuiMemDataCache.memDataCacheSize = newCacheSize; - mGuiMemDataCache.memDataCachePtr->resize(newCacheSize); - mGuiMemDataCache.rva = rva; - wBytePtr = mGuiMemDataCache.memDataCachePtr->data(); - // TODO: Fill cache - for(uint_t wI = 0; wI < newCacheSize; wI++) - { - wBytePtr[wI] = readByte(rva + (uint_t)wI); - } - mGuiMemDataCache.isInit = true; - } - } - - return wBytePtr; -} - - - - - - - - - - - - - - diff --git a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h b/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h deleted file mode 100644 index 8765b661..00000000 --- a/x64_dbg_gui/Project/Src/Memory/MapViewOfMem.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef MAPVIEWOFMEM_H -#define MAPVIEWOFMEM_H - -typedef struct _Selection_t -{ - int firstSelectedIndex; - int fromIndex; - int toIndex; -} Selection_t; - -class MapViewOfMem -{ -public: - MapViewOfMem(); - explicit MapViewOfMem(QString file); - explicit MapViewOfMem(uint_t startAddress , uint_t size); - ~MapViewOfMem(); - byte_t readByte(uint_t rva); - uint_t size(); - unsigned char* data(); - - Selection_t getSelection(); - void setSelection(Selection_t sel); - - uint_t getBase(); - byte_t* getDataPtrForGui(uint_t rva, uint_t maxNbrOfBytesToRead, uint_t newCacheSize); - -private: - typedef struct _MemDataCacheStruct_t - { - QVector* memDataCachePtr; - uint_t memDataCacheSize; - uint_t rva; - bool isInit; - } MemDataCacheStruct_t; - - - uint_t mBase; - unsigned long mStartAddress; - unsigned long mEndAddress; - unsigned long mSize; - - QByteArray mData; - - Selection_t mSelectedData; - - MemDataCacheStruct_t mGuiMemDataCache; -}; - -#endif // MAPVIEWOFMEM_H - diff --git a/x64_dbg_gui/Project/Src/Memory/MemoryPage.h b/x64_dbg_gui/Project/Src/Memory/MemoryPage.h index f717669e..40232a62 100644 --- a/x64_dbg_gui/Project/Src/Memory/MemoryPage.h +++ b/x64_dbg_gui/Project/Src/Memory/MemoryPage.h @@ -1,6 +1,9 @@ #ifndef MEMORYPAGE_H #define MEMORYPAGE_H +#include +#include "NewTypes.h" + class MemoryPage : public QObject { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.cpp b/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.cpp index 6825adf6..db47e07f 100644 --- a/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.cpp +++ b/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.cpp @@ -63,7 +63,7 @@ void QHexEdit::fill(int index, const QString & pattern) } else { - data[i] = convert[i].toAscii(); + data[i] = convert[i].toLatin1(); mask[i] = '0'; } } @@ -124,7 +124,7 @@ void QHexEdit::setData(const QString & pattern) } else { - data[i] = convert[i].toAscii(); + data[i] = convert[i].toLatin1(); mask[i] = '0'; } } diff --git a/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.h b/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.h index 12b0f575..ed7b9414 100644 --- a/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.h +++ b/x64_dbg_gui/Project/Src/QHexEdit/QHexEdit.h @@ -1,7 +1,8 @@ #ifndef QHEXEDIT_H #define QHEXEDIT_H -#include +#include +#include #include "QHexEditPrivate.h" class QHexEdit : public QScrollArea diff --git a/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.cpp b/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.cpp index ba554ee9..35de9149 100644 --- a/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.cpp +++ b/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.cpp @@ -1,6 +1,7 @@ -#include - #include "QHexEditPrivate.h" +#include +#include +#include #include "ArrayCommand.h" const int HEXCHARS_IN_LINE = 47; @@ -422,7 +423,7 @@ void QHexEditPrivate::keyPressEvent(QKeyEvent* event) /* Edit Commands */ /*****************************************************************************/ /* Hex input */ - int key = int(event->text().toLower()[0].toAscii()); + int key = int(event->text().toLower()[0].toLatin1()); if((key >= '0' && key <= '9') || (key >= 'a' && key <= 'f') || (_wildcardEnabled && key == '?')) { if(getSelectionBegin() != getSelectionEnd()) @@ -528,7 +529,7 @@ void QHexEditPrivate::keyPressEvent(QKeyEvent* event) } else { - data[i] = convert[i].toAscii(); + data[i] = convert[i].toLatin1(); mask[i] = '0'; } } diff --git a/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.h b/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.h index 9ea34777..e2738c73 100644 --- a/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.h +++ b/x64_dbg_gui/Project/Src/QHexEdit/QHexEditPrivate.h @@ -1,7 +1,10 @@ #ifndef QHEXEDITPRIVATE_H #define QHEXEDITPRIVATE_H -#include +#include +#include +#include +#include #include "XByteArray.h" class QHexEditPrivate : public QWidget diff --git a/x64_dbg_gui/Project/Src/Utils/Breakpoints.cpp b/x64_dbg_gui/Project/Src/Utils/Breakpoints.cpp index 7dfa5dbe..d3e064c9 100644 --- a/x64_dbg_gui/Project/Src/Utils/Breakpoints.cpp +++ b/x64_dbg_gui/Project/Src/Utils/Breakpoints.cpp @@ -47,7 +47,6 @@ void Breakpoints::setBP(BPXTYPE type, uint_t va) DbgCmdExec(wCmd.toUtf8().constData()); } - /** * @brief Enable breakpoint according to the given breakpoint descriptor. * @@ -378,7 +377,4 @@ void Breakpoints::toggleBPByRemoving(BPXTYPE type, uint_t va) { setBP(bp_hardware, va); } - - - } diff --git a/x64_dbg_gui/Project/Src/Utils/Breakpoints.h b/x64_dbg_gui/Project/Src/Utils/Breakpoints.h index 85442ae6..a9ef02de 100644 --- a/x64_dbg_gui/Project/Src/Utils/Breakpoints.h +++ b/x64_dbg_gui/Project/Src/Utils/Breakpoints.h @@ -1,6 +1,9 @@ #ifndef BREAKPOINTS_H #define BREAKPOINTS_H +#include +#include "Bridge.h" + enum BPXSTATE { bp_enabled = 0, @@ -13,29 +16,17 @@ class Breakpoints : public QObject Q_OBJECT public: explicit Breakpoints(QObject* parent = 0); - static void setBP(BPXTYPE type, uint_t va); - static void enableBP(BRIDGEBP bp); static void enableBP(BPXTYPE type, uint_t va); - static void disableBP(BRIDGEBP bp); static void disableBP(BPXTYPE type, uint_t va); - static void removeBP(BRIDGEBP bp); static void removeBP(BPXTYPE type, uint_t va); - static void toggleBPByDisabling(BRIDGEBP bp); static void toggleBPByDisabling(BPXTYPE type, uint_t va); - static void toggleBPByRemoving(BPXTYPE type, uint_t va); - static BPXSTATE BPState(BPXTYPE type, uint_t va); -signals: - -public slots: - -private: }; diff --git a/x64_dbg_gui/Project/Src/Utils/Configuration.cpp b/x64_dbg_gui/Project/Src/Utils/Configuration.cpp index e5eda584..8e4d02a2 100644 --- a/x64_dbg_gui/Project/Src/Utils/Configuration.cpp +++ b/x64_dbg_gui/Project/Src/Utils/Configuration.cpp @@ -1,4 +1,8 @@ #include "Configuration.h" +#include +#include +#include +#include Configuration* Configuration::mPtr = NULL; diff --git a/x64_dbg_gui/Project/Src/Utils/Configuration.h b/x64_dbg_gui/Project/Src/Utils/Configuration.h index 61967861..b4fe8142 100644 --- a/x64_dbg_gui/Project/Src/Utils/Configuration.h +++ b/x64_dbg_gui/Project/Src/Utils/Configuration.h @@ -1,6 +1,13 @@ #ifndef CONFIGURATION_H #define CONFIGURATION_H +#include +#include +#include +#include +#include +#include "NewTypes.h" + #define Config() (Configuration::instance()) #define ConfigColor(x) (Config()->getColor(x)) #define ConfigBool(x,y) (Config()->getBool(x,y)) diff --git a/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h b/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h index 60034cf4..fc106aaf 100644 --- a/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h +++ b/x64_dbg_gui/Project/Src/Utils/RichTextPainter.h @@ -1,6 +1,10 @@ #ifndef RICHTEXTPAINTER_H #define RICHTEXTPAINTER_H +#include +#include +#include + class RichTextPainter { public: diff --git a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp index 51ded92c..c9cd865a 100644 --- a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp +++ b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.cpp @@ -1,4 +1,10 @@ #include "UpdateChecker.h" +#include +#include +#include +#include +#include +#include "Bridge.h" UpdateChecker::UpdateChecker(QWidget* parent) { diff --git a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h index bd2b8761..5cfd8a0f 100644 --- a/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h +++ b/x64_dbg_gui/Project/Src/Utils/UpdateChecker.h @@ -1,6 +1,8 @@ #ifndef UPDATECHECKER_H #define UPDATECHECKER_H +#include + class UpdateChecker : public QNetworkAccessManager { Q_OBJECT diff --git a/x64_dbg_gui/Project/Src/main.cpp b/x64_dbg_gui/Project/Src/main.cpp index fb5bfe6c..f22a670a 100644 --- a/x64_dbg_gui/Project/Src/main.cpp +++ b/x64_dbg_gui/Project/Src/main.cpp @@ -1,4 +1,9 @@ #include "main.h" +#include +#include +#include "Bridge.h" +#include "Configuration.h" +#include "MainWindow.h" MyApplication::MyApplication(int & argc, char** argv) : QApplication(argc, argv) { diff --git a/x64_dbg_gui/Project/x64_dbg.pro b/x64_dbg_gui/Project/x64_dbg.pro index 923db27e..9eae84fe 100644 --- a/x64_dbg_gui/Project/x64_dbg.pro +++ b/x64_dbg_gui/Project/x64_dbg.pro @@ -37,7 +37,6 @@ SOURCES += \ Src/BasicView/AbstractTableView.cpp \ Src/Disassembler/QBeaEngine.cpp \ Src/Memory/MemoryPage.cpp \ - Src/Memory/MapViewOfMem.cpp \ Src/Bridge/Bridge.cpp \ Src/BasicView/StdTable.cpp \ Src/Gui/MemoryMapView.cpp \ @@ -97,7 +96,6 @@ HEADERS += \ Src/BasicView/AbstractTableView.h \ Src/Disassembler/QBeaEngine.h \ Src/Memory/MemoryPage.h \ - Src/Memory/MapViewOfMem.h \ Src/Bridge/Bridge.h \ Src/Global/NewTypes.h \ Src/Exports.h \ From 56bfe4a78a91cc59f4635e1397712d62b02ca9c9 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Mon, 25 Aug 2014 01:24:09 +0200 Subject: [PATCH 09/17] GUI: forgot to add 'search for -> command' before, not it's fixed. --- x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp index bf197319..b13e67dc 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp @@ -482,6 +482,7 @@ void CPUDisassembly::setupRightClickContextMenu() mSearchCommand->setShortcutContext(Qt::WidgetShortcut); this->addAction(mSearchCommand); connect(mSearchCommand, SIGNAL(triggered()), this, SLOT(findCommand())); + mSearchMenu->addAction(mSearchCommand); // Constant mSearchConstant = new QAction("&Constant", this); From 8edc750348802e8599c02d12bfef6d0e5be77421 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Tue, 26 Aug 2014 17:24:13 +0200 Subject: [PATCH 10/17] GUI: fixed initialization of structures --- x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp index 924e56c8..4e377848 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUInfoBox.cpp @@ -1,4 +1,5 @@ #include "CPUInfoBox.h" +#include "Configuration.h" #include "Bridge.h" CPUInfoBox::CPUInfoBox(StdTable* parent) : StdTable(parent) @@ -82,7 +83,7 @@ QString CPUInfoBox::getSymbolicName(int_t addr) } return finalText; } -#include "Configuration.h" + void CPUInfoBox::disasmSelectionChanged(int_t parVA) { curAddr = parVA; @@ -91,8 +92,10 @@ void CPUInfoBox::disasmSelectionChanged(int_t parVA) clear(); DISASM_INSTR instr; + memset(&instr, 0, sizeof(instr)); DbgDisasmAt(parVA, &instr); BASIC_INSTRUCTION_INFO basicinfo; + memset(&basicinfo, 0, sizeof(basicinfo)); DbgDisasmFastAt(parVA, &basicinfo); int start = 0; From 9060ab2e1ba215c289aa58e479324c5e9b642fc4 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Tue, 26 Aug 2014 20:58:35 +0200 Subject: [PATCH 11/17] DBG: added some comments in the loop functions --- x64_dbg_dbg/addrinfo.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x64_dbg_dbg/addrinfo.cpp b/x64_dbg_dbg/addrinfo.cpp index 320031ef..0d2d2448 100644 --- a/x64_dbg_dbg/addrinfo.cpp +++ b/x64_dbg_dbg/addrinfo.cpp @@ -1019,6 +1019,7 @@ bool loopadd(uint start, uint end, bool manual) return true; } +//get the start/end of a loop at a certain depth and addr bool loopget(int depth, uint addr, uint* start, uint* end) { if(!DbgIsDebugging()) @@ -1070,6 +1071,7 @@ bool loopoverlaps(int depth, uint start, uint end, int* finaldepth) return false; } +//this should delete a loop and all sub-loops that matches a certain addr bool loopdel(int depth, uint addr) { return false; From a4a3eaa61491cdf0bfb666efd18fb56192ec2dc4 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Wed, 27 Aug 2014 01:21:23 +0200 Subject: [PATCH 12/17] DBG: resolved issue #180 (stupid I didn't implement it this way in the first place lol) --- x64_dbg_dbg/simplescript.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/x64_dbg_dbg/simplescript.cpp b/x64_dbg_dbg/simplescript.cpp index 6e535dd9..e71067fa 100644 --- a/x64_dbg_dbg/simplescript.cpp +++ b/x64_dbg_dbg/simplescript.cpp @@ -352,11 +352,8 @@ static CMDRESULT scriptinternalcmdexec(const char* cmd) return STATUS_CONTINUE; } CMDRESULT res = cmddirectexec(dbggetcommandlist(), command); - if(DbgIsDebugging()) - { - while(!waitislocked(WAITID_RUN)) //while not locked (NOTE: possible deadlock) - Sleep(10); - } + while(DbgIsDebugging() && !waitislocked(WAITID_RUN)) //while not locked (NOTE: possible deadlock) + Sleep(10); return res; } From 01151640b520ddb465c5dd130340a32ff425a368 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Wed, 27 Aug 2014 15:18:22 +0200 Subject: [PATCH 13/17] DBG: added modentryfromaddr function --- x64_dbg_dbg/addrinfo.cpp | 10 ++++++++++ x64_dbg_dbg/addrinfo.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/x64_dbg_dbg/addrinfo.cpp b/x64_dbg_dbg/addrinfo.cpp index 0d2d2448..1e9b508c 100644 --- a/x64_dbg_dbg/addrinfo.cpp +++ b/x64_dbg_dbg/addrinfo.cpp @@ -99,6 +99,7 @@ bool modload(uint base, uint size, const char* fullpath) while(name[len] != '.' and len) len--; MODINFO info; + memset(&info, 0, sizeof(MODINFO)); info.sections.clear(); info.hash = modhashfromname(name); if(len) @@ -117,6 +118,7 @@ bool modload(uint base, uint size, const char* fullpath) ULONG_PTR FileMapVA; if(StaticFileLoad((char*)fullpath, UE_ACCESS_READ, false, &FileHandle, &LoadedSize, &FileMap, &FileMapVA)) { + info.entry = GetPE32DataFromMappedFile(FileMapVA, 0, UE_OEP) + info.base; //get entry point int SectionCount = (int)GetPE32DataFromMappedFile(FileMapVA, 0, UE_SECTIONNUMBER); if(SectionCount > 0) { @@ -268,6 +270,14 @@ bool modsectionsfromaddr(uint addr, std::vector* sections) return true; } +uint modentryfromaddr(uint addr) +{ + const ModulesInfo::iterator found = modinfo.find(Range(addr, addr)); + if(found == modinfo.end()) //not found + return 0; + return found->second.entry; +} + ///api functions bool apienumexports(uint base, EXPORTENUMCALLBACK cbEnum) { diff --git a/x64_dbg_dbg/addrinfo.h b/x64_dbg_dbg/addrinfo.h index b8236133..89dbdd0f 100644 --- a/x64_dbg_dbg/addrinfo.h +++ b/x64_dbg_dbg/addrinfo.h @@ -65,6 +65,7 @@ struct MODINFO uint base; //module base uint size; //module size uint hash; //full module name hash + uint entry; //entry point char name[MAX_MODULE_SIZE]; //module name (without extension) char extension[MAX_MODULE_SIZE]; //file extension std::vector sections; @@ -134,6 +135,7 @@ uint modhashfromname(const char* mod); uint modbasefromname(const char* modname); uint modsizefromaddr(uint addr); bool modsectionsfromaddr(uint addr, std::vector* sections); +uint modentryfromaddr(uint addr); bool apienumexports(uint base, EXPORTENUMCALLBACK cbEnum); From 3cb5805d5c4d5bdaaf9bdd782461b809d6320be1 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Wed, 27 Aug 2014 15:20:53 +0200 Subject: [PATCH 14/17] DBG (ANALYSIS): formatting --- x64_dbg_dbg/Analysis/AnalysisRunner.cpp | 8 +- x64_dbg_dbg/Analysis/ClientApiResolver.cpp | 47 +++-- x64_dbg_dbg/Analysis/ClientFunctionFinder.cpp | 13 +- x64_dbg_dbg/Analysis/FlowGraph.cpp | 198 +++++++++--------- x64_dbg_dbg/Analysis/FlowGraph.h | 6 +- x64_dbg_dbg/Analysis/Meta.h | 164 +++++++-------- x64_dbg_dbg/Analysis/Node_t.cpp | 4 +- x64_dbg_dbg/Analysis/Node_t.h | 2 +- 8 files changed, 224 insertions(+), 218 deletions(-) diff --git a/x64_dbg_dbg/Analysis/AnalysisRunner.cpp b/x64_dbg_dbg/Analysis/AnalysisRunner.cpp index 828c9f2c..51e765b3 100644 --- a/x64_dbg_dbg/Analysis/AnalysisRunner.cpp +++ b/x64_dbg_dbg/Analysis/AnalysisRunner.cpp @@ -62,7 +62,7 @@ void AnalysisRunner::start() return; dputs("[StaticAnalysis] analysis started ..."); buildGraph(); - Grph->fillNodes(); + Grph->fillNodes(); emulateInstructions(); dputs("[StaticAnalysis] analysis finished ..."); } @@ -111,8 +111,8 @@ bool AnalysisRunner::disasmChilds(const duint subTreeStartAddress, const duint p { // disassemble instruction const int instrLength = Disasm(&disasm); - DISASM *disasm2 = new DISASM; - *disasm2 = disasm; + DISASM* disasm2 = new DISASM; + *disasm2 = disasm; // everything ok? if(instrLength != UNKNOWN_OPCODE) { @@ -304,7 +304,7 @@ void AnalysisRunner::emulateInstructions() Register->emulate(&(it->second.BeaStruct)); //for(std::vector::iterator itt = interfaces.begin();itt!=interfaces.end();itt++) - a->see(it->second,Register,Stack); + a->see(it->second, Register, Stack); b->see(it->second, Register, Stack); // next instruction it++; diff --git a/x64_dbg_dbg/Analysis/ClientApiResolver.cpp b/x64_dbg_dbg/Analysis/ClientApiResolver.cpp index 2dd6a3b4..5cf06a54 100644 --- a/x64_dbg_dbg/Analysis/ClientApiResolver.cpp +++ b/x64_dbg_dbg/Analysis/ClientApiResolver.cpp @@ -21,32 +21,33 @@ void ClientApiResolver::see(const Instruction_t Instr, const RegisterEmulator* r - Node_t* n; - if(Analysis->graph()->find((duint)Instr.BeaStruct.VirtualAddr, n)) - { - n = Analysis->graph()->node((duint)Instr.BeaStruct.VirtualAddr); + Node_t* n; + if(Analysis->graph()->find((duint)Instr.BeaStruct.VirtualAddr, n)) + { + n = Analysis->graph()->node((duint)Instr.BeaStruct.VirtualAddr); - // is there an edge going out? - if(n->outEdge != NULL) - { - if(n->outEdge->type == fa::CALL) - { - ttDebug("api: found call at "fhex" to "fhex" \n", (duint)Instr.BeaStruct.VirtualAddr,n->outEdge->end->vaddr); - // test if the end has an edge, too - ttDebug("api: opcode is %x \n",(((n->outEdge->end))->instruction.BeaStruct.Instruction.Opcode)&0xFF); - ttDebug("api: opcode is %x \n",Analysis->graph()->node(n->outEdge->end->vaddr)->instruction.BeaStruct.Instruction.Opcode); + // is there an edge going out? + if(n->outEdge != NULL) + { + if(n->outEdge->type == fa::CALL) + { + ttDebug("api: found call at "fhex" to "fhex" \n", (duint)Instr.BeaStruct.VirtualAddr, n->outEdge->end->vaddr); + // test if the end has an edge, too + ttDebug("api: opcode is %x \n", (((n->outEdge->end))->instruction.BeaStruct.Instruction.Opcode) & 0xFF); + ttDebug("api: opcode is %x \n", Analysis->graph()->node(n->outEdge->end->vaddr)->instruction.BeaStruct.Instruction.Opcode); - if(((n->outEdge->end))->instruction.BeaStruct.Instruction.Opcode == 0xFF){ - tDebug("api: --> is API CALL\n", (duint)n->outEdge->end->instruction.BeaStruct.VirtualAddr); - // there is an api call - //DbgSetAutoCommentAt((duint)Instr.BeaStruct.VirtualAddr, "hi"); - - } - return; - } - } + if(((n->outEdge->end))->instruction.BeaStruct.Instruction.Opcode == 0xFF) + { + tDebug("api: --> is API CALL\n", (duint)n->outEdge->end->instruction.BeaStruct.VirtualAddr); + // there is an api call + //DbgSetAutoCommentAt((duint)Instr.BeaStruct.VirtualAddr, "hi"); - } + } + return; + } + } + + } // test if node exists // Node_t n; // if(Analysis->graph()->find((duint)Instr.BeaStruct.VirtualAddr,n)){ diff --git a/x64_dbg_dbg/Analysis/ClientFunctionFinder.cpp b/x64_dbg_dbg/Analysis/ClientFunctionFinder.cpp index c53ebf8e..5925a931 100644 --- a/x64_dbg_dbg/Analysis/ClientFunctionFinder.cpp +++ b/x64_dbg_dbg/Analysis/ClientFunctionFinder.cpp @@ -45,12 +45,13 @@ void ClientFunctionFinder::see(const Instruction_t Instr, const RegisterEmulator // there is a branching! if(n->outEdge->type == fa::RET) { - if((duint) n->outEdge->end->instruction.BeaStruct.Instruction.AddrValue != Analysis->oep()){ - // internal call - DbgSetAutoFunctionAt((duint)n->outEdge->end->instruction.BeaStruct.Instruction.AddrValue, (duint)Instr.BeaStruct.VirtualAddr); - tDebug("add function from "fhex" to "fhex"\n",(duint) n->outEdge->end->instruction.BeaStruct.Instruction.AddrValue, (duint)Instr.BeaStruct.VirtualAddr); - } - + if((duint) n->outEdge->end->instruction.BeaStruct.Instruction.AddrValue != Analysis->oep()) + { + // internal call + DbgSetAutoFunctionAt((duint)n->outEdge->end->instruction.BeaStruct.Instruction.AddrValue, (duint)Instr.BeaStruct.VirtualAddr); + tDebug("add function from "fhex" to "fhex"\n", (duint) n->outEdge->end->instruction.BeaStruct.Instruction.AddrValue, (duint)Instr.BeaStruct.VirtualAddr); + } + } } diff --git a/x64_dbg_dbg/Analysis/FlowGraph.cpp b/x64_dbg_dbg/Analysis/FlowGraph.cpp index 45c0a860..339ac06d 100644 --- a/x64_dbg_dbg/Analysis/FlowGraph.cpp +++ b/x64_dbg_dbg/Analysis/FlowGraph.cpp @@ -6,126 +6,130 @@ namespace fa { - FlowGraph::FlowGraph(AnalysisRunner * ana) : analysis(ana) - { +FlowGraph::FlowGraph(AnalysisRunner* ana) : analysis(ana) +{ - } - FlowGraph::~FlowGraph(void) - { +} +FlowGraph::~FlowGraph(void) +{ - } +} - bool FlowGraph::insertNode(Node_t* node) - { -// if (!contains(nodes,(duint)node->vaddr)) -// { -// return (nodes.insert(std::make_pair(node->vaddr,node))).second; -// } - return true; +bool FlowGraph::insertNode(Node_t* node) +{ + // if (!contains(nodes,(duint)node->vaddr)) + // { + // return (nodes.insert(std::make_pair(node->vaddr,node))).second; + // } + return true; - } - bool FlowGraph::insertEdge(Node_t* startNode, Node_t* endNode, EdgeType currentEdgeType) - { - Node_t *workStart; - Node_t *workEnd; - if(!contains(nodes,startNode->vaddr)){ - nodes.insert(std::pair(startNode->vaddr, startNode)); - } - if(!contains(nodes,endNode->vaddr)){ - nodes.insert(std::pair(endNode->vaddr, endNode)); - } +} +bool FlowGraph::insertEdge(Node_t* startNode, Node_t* endNode, EdgeType currentEdgeType) +{ + Node_t* workStart; + Node_t* workEnd; + if(!contains(nodes, startNode->vaddr)) + { + nodes.insert(std::pair(startNode->vaddr, startNode)); + } + if(!contains(nodes, endNode->vaddr)) + { + nodes.insert(std::pair(endNode->vaddr, endNode)); + } - workStart = &*(nodes.find(startNode->vaddr)->second); - workEnd = &*(nodes.find(endNode->vaddr)->second); + workStart = &*(nodes.find(startNode->vaddr)->second); + workEnd = &*(nodes.find(endNode->vaddr)->second); - if (startNode->hasInstr && !((nodes.find(startNode->vaddr)->second))->hasInstr){ - ttDebug("updating old startnode"); - workStart->instruction = startNode->instruction; - } + if(startNode->hasInstr && !((nodes.find(startNode->vaddr)->second))->hasInstr) + { + ttDebug("updating old startnode"); + workStart->instruction = startNode->instruction; + } - // now workStart and workEnd are most up-to-date information + // now workStart and workEnd are most up-to-date information - Edge_t* edge = new Edge_t(workStart, workEnd, currentEdgeType); + Edge_t* edge = new Edge_t(workStart, workEnd, currentEdgeType); - edges.insert(std::pair(workStart->vaddr,edge)); - std::map::iterator ansiter = edges.find(workStart->vaddr); - edge = &*(ansiter->second); - edge->start = workStart; - edge->end = workEnd; - workStart->outEdge = edge; - workEnd->inEdges.insert(edge); + edges.insert(std::pair(workStart->vaddr, edge)); + std::map::iterator ansiter = edges.find(workStart->vaddr); + edge = &*(ansiter->second); + edge->start = workStart; + edge->end = workEnd; + workStart->outEdge = edge; + workEnd->inEdges.insert(edge); - return true; - } + return true; +} - void FlowGraph::clean() - { - // first delete all edges whoses aks for it - std::map::iterator e = edges.begin(); - while(e != edges.end()) - { - std::map::iterator current = e++; - if((*current->second).askForRemove) - { - delete current->second; - edges.erase(current); - } - } +void FlowGraph::clean() +{ + // first delete all edges whoses aks for it + std::map::iterator e = edges.begin(); + while(e != edges.end()) + { + std::map::iterator current = e++; + if((*current->second).askForRemove) + { + delete current->second; + edges.erase(current); + } + } - // find and delete isolated nodes, i.e. nodes without incoming and outgoing edges - std::map::iterator n = nodes.begin(); - while(n != nodes.end()) - { - std::map::iterator current = n++; - if((!(*current->second).outEdge) && ((*current->second).inEdges.size() == 0)) - { - delete current->second; - nodes.erase(current); - } - } - } - bool FlowGraph::find(const duint va , Node_t* node) - { - if(contains(nodes, va)) - { - std::map::iterator iter = nodes.find(va); - node = (iter->second); + // find and delete isolated nodes, i.e. nodes without incoming and outgoing edges + std::map::iterator n = nodes.begin(); + while(n != nodes.end()) + { + std::map::iterator current = n++; + if((!(*current->second).outEdge) && ((*current->second).inEdges.size() == 0)) + { + delete current->second; + nodes.erase(current); + } + } +} +bool FlowGraph::find(const duint va , Node_t* node) +{ + if(contains(nodes, va)) + { + std::map::iterator iter = nodes.find(va); + node = (iter->second); - tDebug("-> found node at "fhex" \n", node->vaddr); - tDebug("Node_t address is "fhex" \n", node); + tDebug("-> found node at "fhex" \n", node->vaddr); + tDebug("Node_t address is "fhex" \n", node); - return true; - } - return false; + return true; + } + return false; - } - Node_t* FlowGraph::node(const duint va) - { - if(contains(nodes, va)) - { - std::map::iterator iter = nodes.find(va); - Node_t* node = (iter->second); - return node; - } - return NULL; +} +Node_t* FlowGraph::node(const duint va) +{ + if(contains(nodes, va)) + { + std::map::iterator iter = nodes.find(va); + Node_t* node = (iter->second); + return node; + } + return NULL; - } +} - void FlowGraph::fillNodes() - { - for(std::map::iterator i=nodes.begin();i!=nodes.end();i++){ - i->second->hasInstr=true; - i->second->instruction.BeaStruct = analysis->instruction_t(i->first).BeaStruct; - if(i->second->instruction.BeaStruct.Instruction.Opcode == 0xFF) - ttDebug("ext jump at %x",i->first); - } - } +void FlowGraph::fillNodes() +{ + for(std::map::iterator i = nodes.begin(); i != nodes.end(); i++) + { + i->second->hasInstr = true; + i->second->instruction.BeaStruct = analysis->instruction_t(i->first).BeaStruct; + if(i->second->instruction.BeaStruct.Instruction.Opcode == 0xFF) + ttDebug("ext jump at %x", i->first); + } +} diff --git a/x64_dbg_dbg/Analysis/FlowGraph.h b/x64_dbg_dbg/Analysis/FlowGraph.h index 4436e5b7..782fcc20 100644 --- a/x64_dbg_dbg/Analysis/FlowGraph.h +++ b/x64_dbg_dbg/Analysis/FlowGraph.h @@ -18,9 +18,9 @@ class FlowGraph // all existing nodes std::map nodes; - AnalysisRunner *analysis; + AnalysisRunner* analysis; public: - FlowGraph(AnalysisRunner *ana); + FlowGraph(AnalysisRunner* ana); ~FlowGraph(void); void clean(); // insert a new node an returns the existing node if there was already the node @@ -28,7 +28,7 @@ public: bool insertNode(Node_t* node); // insert a new edge an returns the existing edge if there was already the edge bool insertEdge(Node_t* start, Node_t* end, EdgeType btype); - void fillNodes(); + void fillNodes(); bool find(const duint va, Node_t* node); Node_t* FlowGraph::node(const duint va); diff --git a/x64_dbg_dbg/Analysis/Meta.h b/x64_dbg_dbg/Analysis/Meta.h index a39de989..4fb35ddc 100644 --- a/x64_dbg_dbg/Analysis/Meta.h +++ b/x64_dbg_dbg/Analysis/Meta.h @@ -28,92 +28,92 @@ namespace fa { - enum EdgeType{RET,CALL,EXTERNCALL,CONDJMP,UNCONDJMP,EXTERNJMP,INF,UNKOWN}; - - - - // every edge in the application flow graph is an instruction that active modifies the EIP - - typedef struct Instruction_t - { - DISASM BeaStruct; - unsigned int Length; - - Instruction_t(DISASM* dis, unsigned int len) - { - BeaStruct = *dis; - Length = len; - } - - Instruction_t() - { - BeaStruct = DISASM(); - Length = UNKNOWN_OPCODE; - } - } Instruction_t; - - struct ArgumentInfo_t - { - std::string Type; - std::string Name; - - ArgumentInfo_t(std::string t, std::string n) - { - Type = t; - Name = n; - } - - ArgumentInfo_t() {} - }; - - struct FunctionInfo_t - { - std::string DLLName; - std::string ReturnType; - std::string Name; - std::vector Arguments; - bool invalid; - - FunctionInfo_t() - { - invalid = false; - } - - FunctionInfo_t(std::string dll, std::string ret, std::string name, std::vector args) - { - DLLName = dll; - ReturnType = ret; - Name = name; - Arguments = args; - invalid = false; - } - // !! suppresses the warning (ugly solution) - bool operator==(const FunctionInfo_t & rhs) const - { - return static_cast(!!(_strcmpi(Name.c_str(), rhs.Name.c_str()) < 0)); - } - // !! suppresses the warning (ugly solution) - bool operator<(const FunctionInfo_t & rhs) const - { - return static_cast(!!_strcmpi(Name.c_str(), rhs.Name.c_str())); - } - - ArgumentInfo_t arg(int i) - { - return Arguments.at(i); - } +enum EdgeType {RET, CALL, EXTERNCALL, CONDJMP, UNCONDJMP, EXTERNJMP, INF, UNKOWN}; - }; - template - bool contains(std::map s, T key) - { - std::map::iterator it = s.find(key); - return (it != s.end()); - } +// every edge in the application flow graph is an instruction that active modifies the EIP - typedef std::map::const_iterator instrIter; +typedef struct Instruction_t +{ + DISASM BeaStruct; + unsigned int Length; + + Instruction_t(DISASM* dis, unsigned int len) + { + BeaStruct = *dis; + Length = len; + } + + Instruction_t() + { + BeaStruct = DISASM(); + Length = UNKNOWN_OPCODE; + } +} Instruction_t; + +struct ArgumentInfo_t +{ + std::string Type; + std::string Name; + + ArgumentInfo_t(std::string t, std::string n) + { + Type = t; + Name = n; + } + + ArgumentInfo_t() {} +}; + +struct FunctionInfo_t +{ + std::string DLLName; + std::string ReturnType; + std::string Name; + std::vector Arguments; + bool invalid; + + FunctionInfo_t() + { + invalid = false; + } + + FunctionInfo_t(std::string dll, std::string ret, std::string name, std::vector args) + { + DLLName = dll; + ReturnType = ret; + Name = name; + Arguments = args; + invalid = false; + } + // !! suppresses the warning (ugly solution) + bool operator==(const FunctionInfo_t & rhs) const + { + return static_cast(!!(_strcmpi(Name.c_str(), rhs.Name.c_str()) < 0)); + } + // !! suppresses the warning (ugly solution) + bool operator<(const FunctionInfo_t & rhs) const + { + return static_cast(!!_strcmpi(Name.c_str(), rhs.Name.c_str())); + } + + ArgumentInfo_t arg(int i) + { + return Arguments.at(i); + } + + +}; + +template +bool contains(std::map s, T key) +{ + std::map::iterator it = s.find(key); + return (it != s.end()); +} + +typedef std::map::const_iterator instrIter; diff --git a/x64_dbg_dbg/Analysis/Node_t.cpp b/x64_dbg_dbg/Analysis/Node_t.cpp index 87d983d1..a8407fb9 100644 --- a/x64_dbg_dbg/Analysis/Node_t.cpp +++ b/x64_dbg_dbg/Analysis/Node_t.cpp @@ -11,7 +11,7 @@ Node_t::Node_t(Instruction_t t) outEdge = NULL; instruction = t; vaddr = (duint)t.BeaStruct.VirtualAddr; - hasInstr=true; + hasInstr = true; } Node_t::Node_t(duint va) @@ -19,7 +19,7 @@ Node_t::Node_t(duint va) outEdge = NULL; instruction = Instruction_t(); vaddr = va; - hasInstr = false; + hasInstr = false; } Node_t::~Node_t() diff --git a/x64_dbg_dbg/Analysis/Node_t.h b/x64_dbg_dbg/Analysis/Node_t.h index 84ad4281..addc00bd 100644 --- a/x64_dbg_dbg/Analysis/Node_t.h +++ b/x64_dbg_dbg/Analysis/Node_t.h @@ -14,7 +14,7 @@ public: std::set inEdges; // all incoming edges Instruction_t instruction; duint vaddr; - bool hasInstr; + bool hasInstr; Node_t(Instruction_t t); Node_t(duint t); From 6af576e3937d29da9641ed617c97d9a64cc51449 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Wed, 27 Aug 2014 15:53:06 +0200 Subject: [PATCH 15/17] DBG: get OEP in analyse command using modentryfromaddr --- x64_dbg_dbg/debugger_commands.cpp | 5 ++++- x64_dbg_dbg/debugger_commands.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/x64_dbg_dbg/debugger_commands.cpp b/x64_dbg_dbg/debugger_commands.cpp index 682d3b60..1a71a8f0 100644 --- a/x64_dbg_dbg/debugger_commands.cpp +++ b/x64_dbg_dbg/debugger_commands.cpp @@ -1001,6 +1001,9 @@ CMDRESULT cbDebugAnalyse(int argc, char* argv[]) { dputs("init analysis"); uint cipAddr = GetContextData(UE_CIP); + uint oep = modentryfromaddr(cipAddr); + if(!oep) + oep = cipAddr; uint size; uint base = memfindbaseaddr(cipAddr, &size); @@ -1010,7 +1013,7 @@ CMDRESULT cbDebugAnalyse(int argc, char* argv[]) return STATUS_ERROR; } - dprintf("start analysis, assuming oep="fhex", baseaddr="fhex", size="fhex"!\n", cipAddr, base, size); + dprintf("start analysis, assuming oep="fhex", baseaddr="fhex", size="fhex"!\n", oep, base, size); // tr4ce::ApiDB* db = new tr4ce::ApiDB(); diff --git a/x64_dbg_dbg/debugger_commands.h b/x64_dbg_dbg/debugger_commands.h index c5e94306..6060c398 100644 --- a/x64_dbg_dbg/debugger_commands.h +++ b/x64_dbg_dbg/debugger_commands.h @@ -56,6 +56,7 @@ CMDRESULT cbDebugEnableMemoryBreakpoint(int argc, char* argv[]); CMDRESULT cbDebugDisableMemoryBreakpoint(int argc, char* argv[]); CMDRESULT cbDebugDownloadSymbol(int argc, char* argv[]); CMDRESULT cbDebugAnalyse(int argc, char* argv[]); +CMDRESULT cbDebugGetPageRights(int argc, char* argv[]); CMDRESULT cbDebugSetPageRights(int argc, char* argv[]); #endif //_DEBUGGER_COMMANDS_H \ No newline at end of file From 2ce17ecd2c94fc27da6f9b1ab6418b9172ffa6fd Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Wed, 27 Aug 2014 15:57:27 +0200 Subject: [PATCH 16/17] DBG: Analysis files in a new Filter Directory 'Analysis' --- x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters | 108 ++++++++++++------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters b/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters index 25844088..bc8e99cb 100644 --- a/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters +++ b/x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters @@ -34,11 +34,11 @@ {6a8d58f0-1417-4bff-aecd-0f9f5e0641f9} - - {68e04c31-9f66-4c9a-ae1d-54b2f6cf2d1c} + + {4e0317ac-ab94-4f10-9c11-e685d7a9842b} - - {70e48ca5-7813-4da6-95c8-3717ace25093} + + {336c8da2-0baf-4af3-a0d6-71cc5bce296e} @@ -135,35 +135,35 @@ Source Files - - Header Files\fa - - - Header Files\fa + + Source Files\Analysis - Header Files\fa - - - Header Files\fa - - - Header Files\fa - - - Header Files\fa + Source Files\Analysis - Header Files\fa - - - Header Files\fa - - - Header Files\fa + Source Files\Analysis - Header Files\fa + Source Files\Analysis + + + Source Files\Analysis + + + Source Files\Analysis + + + Source Files\Analysis + + + Source Files\Analysis + + + Source Files\Analysis + + + Source Files\Analysis @@ -312,37 +312,37 @@ Header Files - Header Files\fa - - - Header Files\fa - - - Header Files\fa - - - Header Files\fa - - - Header Files\fa - - - Header Files\fa - - - Header Files\fa + Header Files\Analysis - Header Files\fa - - - Header Files\fa - - - Header Files\fa + Header Files\Analysis - Header Files\fa + Header Files\Analysis + + + Header Files\Analysis + + + Header Files\Analysis + + + Header Files\Analysis + + + Header Files\Analysis + + + Header Files\Analysis + + + Header Files\Analysis + + + Header Files\Analysis + + + Header Files\Analysis \ No newline at end of file From 9fc99e1c424caf7d063979b1e9d35df90394ab8e Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Wed, 27 Aug 2014 16:00:05 +0200 Subject: [PATCH 17/17] PROJECT: updated clean & release scripts --- clean.bat | 2 +- release.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clean.bat b/clean.bat index f09eef8b..7a24b93c 100644 --- a/clean.bat +++ b/clean.bat @@ -52,7 +52,7 @@ del /Q *.exp del /Q *.a del /Q *.lib del /Q *.def -del /Q launcher.exe +del /Q x96_dbg.exe cd.. echo cleaning bin\x32... cd bin\x32 diff --git a/release.bat b/release.bat index ee571702..1bf2e4f1 100644 --- a/release.bat +++ b/release.bat @@ -46,7 +46,7 @@ mkdir %RELEASEDIR%\release mkdir %RELEASEDIR%\release\x32 mkdir %RELEASEDIR%\release\x64 -copy bin\launcher.exe %RELEASEDIR%\release\launcher.exe +copy bin\x96_dbg.exe %RELEASEDIR%\release\x96_dbg.exe copy bin\x32\x32_bridge.dll %RELEASEDIR%\release\x32\x32_bridge.dll copy bin\x32\x32_dbg.dll %RELEASEDIR%\release\x32\x32_dbg.dll copy bin\x32\x32_dbg.exe %RELEASEDIR%\release\x32\x32_dbg.exe