1
0
Fork 0

Merge remote-tracking branch 'BitBucket/master' into utf8_support

Conflicts:
	x64_dbg_dbg/x64_dbg_dbg.vcxproj.filters
	x64_dbg_gui/Project/Src/main.cpp
This commit is contained in:
Mr. eXoDia 2014-09-23 18:24:20 +02:00
commit 6eab29e9f1
33 changed files with 223 additions and 79 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ debug/
#global filetypes to ignore
*.depend
*.layout
*.patch
*.cscope_file_list
*.bmarks
*.chw

13
x64_dbg_dbg/log.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "log.h"
#include "_global.h"
log::log(void)
{
}
log::~log(void)
{
GuiAddLogMessage(message.str().c_str());
}

23
x64_dbg_dbg/log.h Normal file
View File

@ -0,0 +1,23 @@
#pragma once
#include <sstream>
// a Qt's QDebug like message logging
// usage: "log() << "hi" << "there";
class log
{
public:
log();
~log();
public:
template<class T>
inline log & operator<<(const T & x)
{
// accumulate messages
message << x;
return *this;
}
private:
std::ostringstream message;
};

View File

@ -22,6 +22,7 @@
<ClCompile Include="disasm_fast.cpp" />
<ClCompile Include="disasm_helper.cpp" />
<ClCompile Include="instruction.cpp" />
<ClCompile Include="log.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="math.cpp" />
<ClCompile Include="memory.cpp" />
@ -69,6 +70,7 @@
<ClInclude Include="instruction.h" />
<ClInclude Include="jansson\jansson.h" />
<ClInclude Include="jansson\jansson_config.h" />
<ClInclude Include="log.h" />
<ClInclude Include="lz4\lz4.h" />
<ClInclude Include="lz4\lz4file.h" />
<ClInclude Include="lz4\lz4hc.h" />

View File

@ -159,6 +159,9 @@
<ClCompile Include="debugger.cpp">
<Filter>Source Files\Debugger Core</Filter>
</ClCompile>
<ClCompile Include="log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="_exports.h">
@ -305,6 +308,9 @@
<ClInclude Include="dynamicmem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="UString\Exception.h">
<Filter>Header Files\UString</Filter>
</ClInclude>

View File

@ -192,6 +192,7 @@ void ReferenceView::toggleBreakpoint()
}
DbgCmdExec(wCmd.toUtf8().constData());
this->mSearchList->selectNext();
}
void ReferenceView::toggleBookmark()

View File

@ -18,7 +18,7 @@ QString SearchListViewTable::paintContent(QPainter* painter, int_t rowBase, int
const char* addrText = text.toUtf8().constData();
ULONGLONG val = 0;
uint_t wVA;
if(sscanf(addrText, "%llX", &val) != 1)
if(sscanf_s(addrText, "%llX", &val) != 1)
isaddr = false;
else
wVA = val;

View File

@ -16,9 +16,9 @@ const QKeySequence ShortcutEdit::getKeysequence() const
void ShortcutEdit::setErrorState(bool error)
{
if(error)
setStyleSheet("color: #FF0000");
setStyleSheet("color: #DD0000");
else
setStyleSheet("color: #000000");
setStyleSheet("color: #222222");
}
void ShortcutEdit::keyPressEvent(QKeyEvent* event)

View File

@ -293,7 +293,7 @@ void BeaTokenizer::Argument(BeaInstructionToken* instr, const DISASM* disasm, co
value.size = arg->ArgSize / 8;
//nice little hack
LONGLONG val;
sscanf(arg->ArgMnemonic, "%llX", &val);
sscanf_s(arg->ArgMnemonic, "%llX", &val);
value.value = val;
/*
switch(value.size)
@ -531,7 +531,7 @@ void BeaTokenizer::TokenizeInstruction(BeaInstructionToken* instr, const DISASM*
{
unsigned int segment = 0;
unsigned int address = 0;
sscanf(disasm->Argument1.ArgMnemonic, "%X : %X", &segment, &address);
sscanf_s(disasm->Argument1.ArgMnemonic, "%X : %X", &segment, &address);
AddToken(instr, TokenSpace, QString(" "), 0);
BeaTokenValue val;
val.size = 2;

View File

@ -10,7 +10,9 @@ AppearanceDialog::AppearanceDialog(QWidget* parent) : QDialog(parent), ui(new Ui
ui->setupUi(this);
//set window flags
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
//Colors
colorMap = &Config()->Colors;

View File

@ -673,7 +673,7 @@
<string>HexEdit:</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget1">
<property name="geometry">
<rect>
<x>10</x>
@ -718,7 +718,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget2">
<property name="geometry">
<rect>
<x>130</x>
@ -846,7 +846,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget3">
<property name="geometry">
<rect>
<x>130</x>
@ -974,7 +974,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget4">
<property name="geometry">
<rect>
<x>130</x>
@ -1102,7 +1102,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget5">
<property name="geometry">
<rect>
<x>130</x>
@ -1230,7 +1230,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget6">
<property name="geometry">
<rect>
<x>130</x>
@ -1358,7 +1358,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget7">
<property name="geometry">
<rect>
<x>130</x>
@ -1486,13 +1486,13 @@
</item>
</layout>
</widget>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget1</zorder>
<zorder>layoutWidget2</zorder>
<zorder>layoutWidget3</zorder>
<zorder>layoutWidget4</zorder>
<zorder>layoutWidget5</zorder>
<zorder>layoutWidget6</zorder>
<zorder>layoutWidget7</zorder>
<zorder>labelFontAbstractTables</zorder>
<zorder>labelFontDisassembly</zorder>
<zorder>labelFontHexDump</zorder>

View File

@ -5,7 +5,9 @@
AttachDialog::AttachDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AttachDialog)
{
ui->setupUi(this);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
//setup actions

View File

@ -4,7 +4,9 @@
CalculatorDialog::CalculatorDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CalculatorDialog)
{
ui->setupUi(this);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
connect(this, SIGNAL(validAddress(bool)), ui->btnGoto, SLOT(setEnabled(bool)));
emit validAddress(false);

View File

@ -5,7 +5,9 @@ CloseDialog::CloseDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CloseDia
{
ui->setupUi(this);
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags((Qt::Tool | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint) & ~Qt::WindowCloseButtonHint);
#endif
setFixedSize(this->size()); //fixed size
//setWindowFlags(((windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowCloseButtonHint));
}

View File

@ -8,7 +8,9 @@ ExceptionRangeDialog::ExceptionRangeDialog(QWidget* parent) :
ui->setupUi(this);
//set window flags
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
ui->editStart->setCursorPosition(0);
ui->editEnd->setCursorPosition(0);

View File

@ -6,7 +6,9 @@ GotoDialog::GotoDialog(QWidget* parent) : QDialog(parent), ui(new Ui::GotoDialog
//setup UI first
ui->setupUi(this);
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
//initialize stuff
if(!DbgIsDebugging()) //not debugging

View File

@ -6,8 +6,9 @@
HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexEditDialog)
{
ui->setupUi(this);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
setModal(true); //modal window

View File

@ -5,7 +5,9 @@ LineEditDialog::LineEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Li
{
ui->setupUi(this);
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
setModal(true); //modal window
ui->checkBox->hide();

View File

@ -834,7 +834,7 @@ void MainWindow::menuEntrySlot()
if(action && action->objectName().startsWith("ENTRY|"))
{
int hEntry = -1;
if(sscanf(action->objectName().mid(6).toUtf8().constData(), "%d", &hEntry) == 1)
if(sscanf_s(action->objectName().mid(6).toUtf8().constData(), "%d", &hEntry) == 1)
DbgMenuEntryClicked(hEntry);
}
}

View File

@ -87,10 +87,11 @@
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionAbout"/>
<addaction name="actionDonate"/>
<addaction name="actionCheckUpdates"/>
<addaction name="actionCalculator"/>
<addaction name="actionCheckUpdates"/>
<addaction name="actionDonate"/>
<addaction name="separator"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuPlugins">
<property name="title">

View File

@ -5,8 +5,10 @@ PageMemoryRights::PageMemoryRights(QWidget* parent) : QDialog(parent), ui(new Ui
{
ui->setupUi(this);
//set window flags
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setModal(true);
addr = 0;
size = 0;
}

View File

@ -61,7 +61,7 @@
<bool>false</bool>
</attribute>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="paddingLayoutWidget">
<property name="geometry">
<rect>
<x>330</x>
@ -70,9 +70,9 @@
<height>242</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayoutGroup">
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="rightsGroup">
<property name="title">
<string>Rights</string>
</property>
@ -157,7 +157,7 @@
<height>25</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="buttonsLayout">
<item>
<widget class="QPushButton" name="btnSelectall">
<property name="text">

View File

@ -11,8 +11,9 @@ PatchDialog::PatchDialog(QWidget* parent) :
ui(new Ui::PatchDialog)
{
ui->setupUi(this);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
setModal(false); //non-modal window
@ -480,7 +481,11 @@ void PatchDialog::on_btnPatchFile_clicked()
void PatchDialog::on_btnImport_clicked()
{
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QString filename = QFileDialog::getOpenFileName(this, tr("Open patch"), QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation), tr("Patch files (*.1337)"));
#else
QString filename = QFileDialog::getOpenFileName(this, tr("Open patch"), QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0], tr("Patch files (*.1337)"));
#endif
if(!filename.length())
return;
filename = QDir::toNativeSeparators(filename); //convert to native path format (with backlashes)
@ -525,7 +530,7 @@ void PatchDialog::on_btnImport_clicked()
if(!modbase)
continue;
curLine = curLine.replace(" ", "");
if(sscanf(curLine.toUtf8().constData(), "%llX:%X->%X", &rva, &oldbyte, &newbyte) != 3)
if(sscanf_s(curLine.toUtf8().constData(), "%llX:%X->%X", &rva, &oldbyte, &newbyte) != 3)
{
QMessageBox msg(QMessageBox::Critical, "Error!", QString("Patch file format is incorrect..."));
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
@ -616,7 +621,11 @@ void PatchDialog::on_btnExport_clicked()
if(!mPatches->size())
return;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QString filename = QFileDialog::getSaveFileName(this, tr("Save patch"), QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation), tr("Patch files (*.1337)"));
#else
QString filename = QFileDialog::getSaveFileName(this, tr("Save patch"), QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0], tr("Patch files (*.1337)"));
#endif
if(!filename.length())
return;
filename = QDir::toNativeSeparators(filename); //convert to native path format (with backlashes)

View File

@ -6,8 +6,9 @@ PatchDialogGroupSelector::PatchDialogGroupSelector(QWidget* parent) :
ui(new Ui::PatchDialogGroupSelector)
{
ui->setupUi(this);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
setModal(false); //non-modal window

View File

@ -27,6 +27,9 @@ RegistersView::RegistersView(QWidget* parent) : QScrollArea(parent), mVScrollOff
wCM_CopyToClipboard = new QAction(tr("Copy Value to Clipboard"), this);
wCM_CopyToClipboard->setShortcutContext(Qt::WidgetShortcut);
this->addAction(wCM_CopyToClipboard);
wCM_CopySymbolToClipboard = new QAction(tr("Copy Symbol Value to Clipboard"), this);
wCM_CopySymbolToClipboard->setShortcutContext(Qt::WidgetShortcut);
this->addAction(wCM_CopySymbolToClipboard);
wCM_FollowInDisassembly = new QAction(tr("Follow in Disassembler"), this);
wCM_FollowInDump = new QAction(tr("Follow in Dump"), this);
wCM_FollowInStack = new QAction("Follow in Stack", this);
@ -229,6 +232,7 @@ RegistersView::RegistersView(QWidget* parent) : QScrollArea(parent), mVScrollOff
connect(wCM_Modify, SIGNAL(triggered()), this, SLOT(onModifyAction()));
connect(wCM_ToggleValue, SIGNAL(triggered()), this, SLOT(onToggleValueAction()));
connect(wCM_CopyToClipboard, SIGNAL(triggered()), this, SLOT(onCopyToClipboardAction()));
connect(wCM_CopySymbolToClipboard, SIGNAL(triggered()), this, SLOT(onCopySymbolToClipboardAction()));
connect(wCM_FollowInDisassembly, SIGNAL(triggered()), this, SLOT(onFollowInDisassembly()));
connect(wCM_FollowInDump, SIGNAL(triggered()), this, SLOT(onFollowInDump()));
connect(wCM_FollowInStack, SIGNAL(triggered()), this, SLOT(onFollowInStack()));
@ -245,6 +249,7 @@ void RegistersView::refreshShortcutsSlot()
wCM_SetToOne->setShortcut(ConfigShortcut("ActionSetOneRegister"));
wCM_ToggleValue->setShortcut(ConfigShortcut("ActionToggleRegisterValue"));
wCM_CopyToClipboard->setShortcut(ConfigShortcut("ActionCopy"));
wCM_CopySymbolToClipboard->setShortcut(ConfigShortcut("ActionCopySymbol"));
}
RegistersView::~RegistersView()
@ -368,6 +373,39 @@ QSize RegistersView::sizeHint() const
return QSize(32 * mCharWidth , this->viewport()->height());
}
QString RegistersView::getRegisterLabel(REGISTER_NAME register_selected)
{
char label_text[MAX_LABEL_SIZE] = "";
char module_text[MAX_MODULE_SIZE] = "";
char string_text[MAX_STRING_SIZE] = "";
QString valueText = QString("%1").arg(registerValue(&wRegDumpStruct, register_selected), mRegisterPlaces[mSelected].valuesize, 16, QChar('0')).toUpper();
duint register_value = registerValue(&wRegDumpStruct, register_selected);
QString newText = QString("");
bool hasString = DbgGetStringAt(register_value, string_text);
bool hasLabel = DbgGetLabelAt(register_value, SEG_DEFAULT, label_text);
bool hasModule = DbgGetModuleAt(register_value, module_text);
if(hasString)
{
newText = string_text;
}
else if(hasLabel && hasModule)
{
newText = "<" + QString(module_text) + "." + QString(label_text) + ">";
}
else if(hasModule)
{
newText = QString(module_text) + "." + valueText;
}
else if(hasLabel)
{
newText = "<" + QString(label_text) + ">";
}
return newText;
}
void RegistersView::drawRegister(QPainter* p, REGISTER_NAME reg, uint_t value)
{
// is the register-id known?
@ -415,35 +453,18 @@ void RegistersView::drawRegister(QPainter* p, REGISTER_NAME reg, uint_t value)
p->drawText(x, y, width, mRowHeight, Qt::AlignVCenter, valueText);
//p->drawText(x + (mRegisterPlaces[reg].labelwidth)*mCharWidth ,mRowHeight*(mRegisterPlaces[reg].line+1),QString("%1").arg(value, mRegisterPlaces[reg].valuesize, 16, QChar('0')).toUpper());
// do we have a label ?
char label_text[MAX_LABEL_SIZE] = "";
char module_text[MAX_MODULE_SIZE] = "";
char string_text[MAX_STRING_SIZE] = "";
bool hasString = DbgGetStringAt(value, string_text);
bool hasLabel = DbgGetLabelAt(value, SEG_DEFAULT, label_text);
bool hasModule = DbgGetModuleAt(value, module_text);
QString newText = getRegisterLabel(reg);
bool isCharacter = false;
x += valueText.length() * mCharWidth;
x += 5 * mCharWidth; //5 spaces
QString newText = "";
if(hasString)
{
newText = string_text;
}
else if(hasLabel && hasModule)
{
newText = "<" + QString(module_text) + "." + QString(label_text) + ">";
}
else if(hasModule)
{
newText = QString(module_text) + "." + valueText;
}
else if(hasLabel)
{
newText = "<" + QString(label_text) + ">";
}
bool has_label;
if(newText != "")
has_label = true;
else
{
has_label = false;
// can we interpret the character as ASCII ??
if(mGPR.contains(reg))
{
@ -468,7 +489,7 @@ void RegistersView::drawRegister(QPainter* p, REGISTER_NAME reg, uint_t value)
}
}
// are there additional informations?
if(hasString || hasLabel || hasModule || isCharacter)
if(has_label || isCharacter)
{
width = newText.length() * mCharWidth;
p->setPen(ConfigColor("RegistersExtraInfoColor"));
@ -546,6 +567,14 @@ void RegistersView::onCopyToClipboardAction()
clipboard->setText(QString("%1").arg((uint_t)registerValue(&wRegDumpStruct, mSelected), sizeof(int_t) * 2, 16, QChar('0')).toUpper());
}
void RegistersView::onCopySymbolToClipboardAction()
{
QClipboard* clipboard = QApplication::clipboard();
QString symbol = getRegisterLabel(mSelected);
if(symbol != "")
clipboard->setText(symbol);
}
void RegistersView::onFollowInDisassembly()
{
if(mGPR.contains(mSelected))
@ -611,6 +640,9 @@ void RegistersView::displayCustomContextMenuSlot(QPoint pos)
}
}
wMenu.addAction(wCM_CopyToClipboard);
QString symbol = getRegisterLabel(mSelected);
if(symbol != "")
wMenu.addAction(wCM_CopySymbolToClipboard);
wMenu.exec(this->mapToGlobal(pos));
}
else

View File

@ -76,7 +76,6 @@ protected:
virtual void mouseDoubleClickEvent(QMouseEvent* event);
virtual void paintEvent(QPaintEvent* event);
virtual void keyPressEvent(QKeyEvent* event);
//virtual void wheelEvent(QWheelEvent* event);
// use-in-class-only methods
void drawRegister(QPainter* p, REGISTER_NAME reg, uint_t value);
@ -95,9 +94,11 @@ protected slots:
void onModifyAction();
void onToggleValueAction();
void onCopyToClipboardAction();
void onCopySymbolToClipboardAction();
void onFollowInDisassembly();
void onFollowInDump();
void onFollowInStack();
QString getRegisterLabel(REGISTER_NAME);
private:
int mVScrollOffset;
@ -130,6 +131,7 @@ private:
QAction* wCM_Modify;
QAction* wCM_ToggleValue;
QAction* wCM_CopyToClipboard;
QAction* wCM_CopySymbolToClipboard;
QAction* wCM_FollowInDisassembly;
QAction* wCM_FollowInDump;
QAction* wCM_FollowInStack;

View File

@ -11,9 +11,11 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
{
ui->setupUi(this);
//set window flags
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
setModal(true);
LoadSettings(); //load settings from file
connect(Bridge::getBridge(), SIGNAL(setLastException(uint)), this, SLOT(setLastException(uint)));
lastException = 0;
@ -142,7 +144,7 @@ void SettingsDialog::LoadSettings()
{
unsigned long start;
unsigned long end;
if(sscanf(ranges.at(i).toUtf8().constData(), "%08X-%08X", &start, &end) == 2 && start <= end)
if(sscanf_s(ranges.at(i).toUtf8().constData(), "%08X-%08X", &start, &end) == 2 && start <= end)
{
RangeStruct newRange;
newRange.start = start;

View File

@ -241,7 +241,7 @@
<string>Default Breakpoint Type:</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutSettingsWidget">
<property name="geometry">
<rect>
<x>20</x>
@ -270,7 +270,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutBreakpoingWidget">
<property name="geometry">
<rect>
<x>20</x>
@ -369,7 +369,7 @@
<string>Ignored Exceptions:</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutExceptionsWidget">
<property name="geometry">
<rect>
<x>170</x>
@ -477,7 +477,7 @@
<string>Set x64_dbg as Just In Time Debugger</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutSettingsPadWidget">
<property name="geometry">
<rect>
<x>10</x>

View File

@ -5,9 +5,11 @@ ShortcutsDialog::ShortcutsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::
{
ui->setupUi(this);
//set window flags
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setFixedSize(this->size()); //fixed size
setModal(true);
// x64 has no model-view-controler pattern
QStringList tblHeader;
@ -22,7 +24,12 @@ ShortcutsDialog::ShortcutsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::
ui->tblShortcuts->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tblShortcuts->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tblShortcuts->setShowGrid(false);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
ui->tblShortcuts->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
#else
ui->tblShortcuts->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
#endif
ui->tblShortcuts->verticalHeader()->setDefaultSectionSize(15);
const unsigned int numShortcuts = Config()->Shortcuts.count();

View File

@ -4,12 +4,12 @@
WordEditDialog::WordEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::WordEditDialog)
{
ui->setupUi(this);
setModal(true);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
#endif
setModal(true);
mValidateThread = new WordEditDialogValidateThread(this);
mWord = 0;
}
@ -100,7 +100,7 @@ void WordEditDialog::on_expressionLineEdit_textChanged(const QString & arg1)
void WordEditDialog::on_signedLineEdit_textEdited(const QString & arg1)
{
LONGLONG value;
if(sscanf(arg1.toUtf8().constData(), "%lld", &value) == 1)
if(sscanf_s(arg1.toUtf8().constData(), "%lld", &value) == 1)
{
ui->signedLineEdit->setStyleSheet("");
ui->buttons->button(QDialogButtonBox::Ok)->setEnabled(true);
@ -116,7 +116,7 @@ void WordEditDialog::on_signedLineEdit_textEdited(const QString & arg1)
void WordEditDialog::on_unsignedLineEdit_textEdited(const QString & arg1)
{
LONGLONG value;
if(sscanf(arg1.toUtf8().constData(), "%llu", &value) == 1)
if(sscanf_s(arg1.toUtf8().constData(), "%llu", &value) == 1)
{
ui->unsignedLineEdit->setStyleSheet("");
ui->buttons->button(QDialogButtonBox::Ok)->setEnabled(true);

View File

@ -250,6 +250,7 @@ Configuration::Configuration() : QObject()
defaultShortcuts.insert("ActionSetOneRegister", Shortcut(tr("Actions -> Set Register to One"), "1"));
defaultShortcuts.insert("ActionToggleRegisterValue", Shortcut(tr("Actions -> Toggle Register Value"), "Space"));
defaultShortcuts.insert("ActionCopy", Shortcut(tr("Actions -> Copy"), "Ctrl+C"));
defaultShortcuts.insert("ActionCopySymbol", Shortcut(tr("Actions -> Copy Symbol"), "Ctrl+S"));
defaultShortcuts.insert("ActionLoadScript", Shortcut(tr("Actions -> Load Script"), "Ctrl+O"));
defaultShortcuts.insert("ActionUnloadScript", Shortcut(tr("Actions -> Unload Script"), "Ctrl+U"));
defaultShortcuts.insert("ActionRunScript", Shortcut(tr("Actions -> Run Script"), "Space"));

View File

@ -1,24 +1,21 @@
#include "main.h"
#include <QAbstractEventDispatcher>
#include <QMessageBox>
#include <QTextCodec>
#include "Bridge.h"
#include "Configuration.h"
#include "MainWindow.h"
MyApplication::MyApplication(int & argc, char** argv) : QApplication(argc, argv)
{
}
bool MyApplication::winEventFilter(MSG* message, long* result)
{
return DbgWinEvent(message, result);
}
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
bool MyApplication::globalEventFilter(void* message)
{
return DbgWinEventGlobal((MSG*)message);
}
#endif
bool MyApplication::winEventFilter(MSG* message, long* result)
{
return DbgWinEvent(message, result);
}
bool MyApplication::notify(QObject* receiver, QEvent* event)
{
@ -49,7 +46,13 @@ static Configuration* mConfiguration;
int main(int argc, char* argv[])
{
MyApplication application(argc, argv);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QAbstractEventDispatcher::instance(application.thread())->setEventFilter(MyApplication::globalEventFilter);
#else
x64GlobalFilter* filter = new x64GlobalFilter();
QAbstractEventDispatcher::instance(application.thread())->installNativeEventFilter(filter);
#endif
// load config file + set config font
mConfiguration = new Configuration;
@ -90,5 +93,8 @@ int main(int argc, char* argv[])
//execute the application
int result = application.exec();
mConfiguration->save(); //save config on exit
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
QAbstractEventDispatcher::instance(application.thread())->removeNativeEventFilter(filter);
#endif
return result;
}

View File

@ -2,6 +2,14 @@
#define MAIN_H
#include <QApplication>
#include <QAbstractEventDispatcher>
#include <QMessageBox>
#include "Bridge.h"
#include "Configuration.h"
#include "MainWindow.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QAbstractNativeEventFilter>
#endif
class MyApplication : public QApplication
{
@ -9,10 +17,22 @@ public:
MyApplication(int & argc, char** argv);
bool notify(QObject* receiver, QEvent* event);
bool winEventFilter(MSG* message, long* result);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
static bool globalEventFilter(void* message);
#endif
};
int main(int argc, char* argv[]);
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
class x64GlobalFilter : public QAbstractNativeEventFilter
{
public:
virtual bool nativeEventFilter(const QByteArray &, void* message, long*) Q_DECL_OVERRIDE
{
return DbgWinEventGlobal((MSG*)message);
}
};
#endif // QT_VERSION
#endif // MAIN_H