Skip to content

Commit

Permalink
Merge pull request #2850 from torusrxxx/patch000000d3
Browse files Browse the repository at this point in the history
Remember some window settings, copy old value, UI enhancement
  • Loading branch information
mrexodia committed Mar 24, 2022
2 parents 2219a40 + 10c26e7 commit af07ddf
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[![Telegram](https://img.shields.io/badge/chat-%20on%20Telegram-blue.svg)](https://telegram.me/x64dbg) [![Discord](https://img.shields.io/badge/chat-on%20Discord-green.svg)](https://invite.gg/x64dbg) [![Slack](https://img.shields.io/badge/chat-on%20Slack-red.svg)](https://x64dbg-slack.herokuapp.com) [![Gitter](https://img.shields.io/badge/chat-on%20Gitter-lightseagreen.svg)](https://gitter.im/x64dbg/x64dbg) [![Freenode](https://img.shields.io/badge/chat-%20on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channels=x64dbg) [![Matrix](https://img.shields.io/badge/chat-on%20Matrix-yellowgreen.svg)](https://riot.im/app/#/room/#x64dbg:matrix.org) [![XMPP](https://img.shields.io/badge/chat-%20on%20XMPP-orange.svg)](https://inverse.chat/#converse/room?jid=x64dbg@conference.jwchat.org)

一个开源的Windows二进制调试器,旨在进行恶意软件分析和你没有源代码的可执行文件的逆向工程。有许多可用的功能和一个全面的[插件系统](http://plugins.x64dbg.com) 来添加你自己的功能。你可以在[博客](https://x64dbg.com/blog)!上找到更多信息!
一个开源的Windows二进制调试器,旨在进行恶意软件分析和你没有源代码的可执行文件的逆向工程。有许多可用的功能和一个全面的[插件系统](http://plugins.x64dbg.com) 来添加你自己的功能。你可以在[博客](https://x64dbg.com/blog)上找到更多信息!

## 屏幕截图

Expand All @@ -30,7 +30,7 @@

- 调试器核心由[TitanEngine社区版](https://github.com/x64dbg/TitanEngine)提供技术支持
- 反汇编引擎由 [Zydis](https://zydis.re)提供技术支持
- 组件由 [XEDParse](https://github.com/x64dbg/XEDParse)[asmjit](https://github.com/asmjit)提供技术支持
- 汇编由 [XEDParse](https://github.com/x64dbg/XEDParse)[asmjit](https://github.com/asmjit)提供技术支持
- 导入重建由 [Scylla](https://github.com/NtQuery/Scylla)提供技术支持
- JSON由 [Jansson](https://www.digip.org/jansson)提供技术支持
- 数据库优化由 [lz4](https://bitbucket.org/mrexodia/lz4)提供技术支持
Expand Down
10 changes: 10 additions & 0 deletions src/gui/Src/Gui/CPURegistersView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CPURegistersView::CPURegistersView(CPUWidget* parent) : RegistersView(parent), m
wCM_Modify->setShortcut(QKeySequence(Qt::Key_Enter));
wCM_ToggleValue = setupAction(DIcon("register_toggle.png"), tr("Toggle"));
wCM_Undo = setupAction(DIcon("undo.png"), tr("Undo"));
wCM_CopyPrevious = setupAction(DIcon("undo.png"), "");
wCM_FollowInDisassembly = new QAction(DIcon(QString("processor%1.png").arg(ArchValue("32", "64"))), tr("Follow in Disassembler"), this);
wCM_FollowInDump = new QAction(DIcon("dump.png"), tr("Follow in Dump"), this);
wCM_FollowInStack = new QAction(DIcon("stack.png"), tr("Follow in Stack"), this);
Expand All @@ -37,6 +38,7 @@ CPURegistersView::CPURegistersView(CPUWidget* parent) : RegistersView(parent), m
connect(wCM_Modify, SIGNAL(triggered()), this, SLOT(onModifyAction()));
connect(wCM_ToggleValue, SIGNAL(triggered()), this, SLOT(onToggleValueAction()));
connect(wCM_Undo, SIGNAL(triggered()), this, SLOT(onUndoAction()));
connect(wCM_CopyPrevious, SIGNAL(triggered()), this, SLOT(onCopyPreviousAction()));
connect(wCM_FollowInDisassembly, SIGNAL(triggered()), this, SLOT(onFollowInDisassembly()));
connect(wCM_FollowInDump, SIGNAL(triggered()), this, SLOT(onFollowInDump()));
connect(wCM_FollowInStack, SIGNAL(triggered()), this, SLOT(onFollowInStack()));
Expand Down Expand Up @@ -441,6 +443,11 @@ void CPURegistersView::onUndoAction()
}
}

void CPURegistersView::onCopyPreviousAction()
{
Bridge::CopyToClipboard(wCM_CopyPrevious->data().toString());
}

void CPURegistersView::onHighlightSlot()
{
Disassembly* CPUDisassemblyView = mParent->getDisasmWidget();
Expand Down Expand Up @@ -580,6 +587,9 @@ void CPURegistersView::displayCustomContextMenuSlot(QPoint pos)
if(mUNDODISPLAY.contains(mSelected) && CompareRegisters(mSelected, &wRegDumpStruct, &wCipRegDumpStruct) != 0)
{
wMenu.addAction(wCM_Undo);
wCM_CopyPrevious->setData(GetRegStringValueFromValue(mSelected, registerValue(&wCipRegDumpStruct, mSelected)));
wCM_CopyPrevious->setText(tr("Copy old value: %1").arg(wCM_CopyPrevious->data().toString()));
wMenu.addAction(wCM_CopyPrevious);
}

if(mBOOLDISPLAY.contains(mSelected))
Expand Down
2 changes: 2 additions & 0 deletions src/gui/Src/Gui/CPURegistersView.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected slots:
void onModifyAction();
void onToggleValueAction();
void onUndoAction();
void onCopyPreviousAction();
void onFollowInDisassembly();
void onFollowInDump();
void onFollowInDumpN();
Expand All @@ -43,6 +44,7 @@ protected slots:
QAction* mFollowInDump;
QAction* wCM_Modify;
QAction* wCM_ToggleValue;
QAction* wCM_CopyPrevious;
QAction* wCM_Undo;
QAction* wCM_FollowInDisassembly;
QAction* wCM_FollowInDump;
Expand Down
27 changes: 27 additions & 0 deletions src/gui/Src/Gui/EditBreakpointDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
</property>
<item row="1" column="0">
<widget class="QLabel" name="labelLogText">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This text will be logged whenever the log condition is true.&lt;/p&gt;&lt;p&gt;String formatting can be used to print variables.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Log Text:</string>
</property>
Expand All @@ -52,6 +55,9 @@
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelBreakCondition">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this expression is evaluated to 1 the breakpoint will break.&lt;/p&gt;&lt;p&gt;Set to &lt;span style=&quot; text-decoration: underline;&quot;&gt;0&lt;/span&gt; for a breakpoint that never breaks, but can still do logging and execute command.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Break Condition:</string>
</property>
Expand Down Expand Up @@ -90,6 +96,9 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelLogCondition">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;String logging is enabled whenever this expression is evaluated to 1.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Lo&amp;g Condition:</string>
</property>
Expand All @@ -110,6 +119,9 @@
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelCommandText">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This command will be executed whenever command condition is true.&lt;/p&gt;&lt;p&gt;Currently certain commands, for example, stepping from breakpoint command are not supported.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Command Text:</string>
</property>
Expand Down Expand Up @@ -137,6 +149,9 @@
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelHitCount">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The number of times the breakpoint is hit.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Hit Count:</string>
</property>
Expand All @@ -147,6 +162,9 @@
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelCommandCondition">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this expression is evaluated to 1 the command specified above is executed when the breakpoint is hit.&lt;/p&gt;&lt;p&gt;Set the expression to &lt;span style=&quot; text-decoration: underline;&quot;&gt;1&lt;/span&gt; to always execute the command.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>C&amp;ommand Condition:</string>
</property>
Expand Down Expand Up @@ -181,20 +199,29 @@
</item>
<item>
<widget class="QCheckBox" name="checkBoxSingleshoot">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove the breakpoint once it pauses the debuggee.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Singlesho&amp;ot</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSilent">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Don't print the default breakpoint log.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Silent</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxFastResume">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Don't enable extended conditional breakpoint features and plugins.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Fast Resume</string>
</property>
Expand Down
18 changes: 18 additions & 0 deletions src/gui/Src/Gui/EditFloatRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ EditFloatRegister::EditFloatRegister(int RegisterSize, QWidget* parent) :
ui->hexEdit->setValidator(&hexValidate);
connect(ui->hexEdit_2, SIGNAL(textEdited(QString)), this, SLOT(editingHex2FinishedSlot(QString)));
ui->hexEdit_2->setValidator(&hexValidate);
QRadioButton* checkedRadio;
switch(ConfigUint("Gui", "EditFloatRegisterDefaultMode"))
{
case 0:
default:
checkedRadio = ui->radioHex;
break;
case 1:
checkedRadio = ui->radioSigned;
break;
case 2:
checkedRadio = ui->radioUnsigned;
break;
}
checkedRadio->setChecked(true);
editingModeChangedSlot(false);
connect(ui->radioHex, SIGNAL(toggled(bool)), this, SLOT(editingModeChangedSlot(bool)));
connect(ui->radioSigned, SIGNAL(toggled(bool)), this, SLOT(editingModeChangedSlot(bool)));
Expand Down Expand Up @@ -473,6 +488,7 @@ void EditFloatRegister::editingModeChangedSlot(bool arg)
ui->longLongEdit0_2->setValidator(&hexValidate);
ui->longLongEdit1_2->setValidator(&hexValidate);
}
Config()->setUint("Gui", "EditFloatRegisterDefaultMode", 0);
}
else if(ui->radioSigned->isChecked())
{
Expand Down Expand Up @@ -532,6 +548,7 @@ void EditFloatRegister::editingModeChangedSlot(bool arg)
ui->longLongEdit1->setValidator(&signedLongLongValidator);
ui->longLongEdit0_2->setValidator(&signedLongLongValidator);
ui->longLongEdit1_2->setValidator(&signedLongLongValidator);
Config()->setUint("Gui", "EditFloatRegisterDefaultMode", 1);
}
else
{
Expand Down Expand Up @@ -587,6 +604,7 @@ void EditFloatRegister::editingModeChangedSlot(bool arg)
ui->longLongEdit1->setValidator(&unsignedLongLongValidator);
ui->longLongEdit0_2->setValidator(&unsignedLongLongValidator);
ui->longLongEdit1_2->setValidator(&unsignedLongLongValidator);
Config()->setUint("Gui", "EditFloatRegisterDefaultMode", 2);
}
reloadDataLow();
if(RegSize > 128)
Expand Down
10 changes: 8 additions & 2 deletions src/gui/Src/Gui/HexEditDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexE
//setup text fields
ui->lineEditAscii->setEncoding(QTextCodec::codecForName("System"));
ui->lineEditUnicode->setEncoding(QTextCodec::codecForName("UTF-16"));

ui->chkKeepSize->setChecked(ConfigBool("HexDump", "KeepSize"));
ui->chkEntireBlock->hide();

mDataInitialized = false;
Expand Down Expand Up @@ -86,7 +86,9 @@ HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexE
for(int i = 0; i < DataLast; i++)
ui->listType->addItem(mTypes[i].name);

QModelIndex index = ui->listType->model()->index(DataCByte, 0);
duint lastDataType = ConfigUint("HexDump", "CopyDataType");
lastDataType = std::min(lastDataType, static_cast<duint>(ui->listType->count() - 1));
QModelIndex index = ui->listType->model()->index(lastDataType, 0);
ui->listType->setCurrentIndex(index);

Config()->setupWindowPos(this);
Expand Down Expand Up @@ -162,10 +164,13 @@ void HexEditDialog::updateStyle()

void HexEditDialog::on_chkKeepSize_toggled(bool checked)
{
if(!this->isVisible())
return;
mHexEdit->setKeepSize(checked);
ui->lineEditAscii->setKeepSize(checked);
ui->lineEditUnicode->setKeepSize(checked);
ui->lineEditCodepage->setKeepSize(checked);
Config()->setBool("HexDump", "KeepSize", checked);
}

void HexEditDialog::dataChangedSlot()
Expand Down Expand Up @@ -818,6 +823,7 @@ void HexEditDialog::on_listType_currentRowChanged(int currentRow)
mIndex = currentRow;
ui->spinBox->setValue(mTypes[mIndex].itemsPerLine);
printData(DataType(mIndex));
Config()->setUint("HexDump", "CopyDataType", currentRow);
}

void HexEditDialog::on_buttonCopy_clicked()
Expand Down
3 changes: 3 additions & 0 deletions src/gui/Src/Gui/PatchDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ void PatchDialog::on_btnImport_clicked()
QList<QPair<DBGPATCHINFO, IMPORTSTATUS>> patchList;
DBGPATCHINFO curPatch;

if(!filenamelist.size())
return; // No files are selected, don't show the "No patches to apply in the current process." dialog.

for(const auto & filename1 : filenamelist)
{
if(!filename1.length())
Expand Down
5 changes: 5 additions & 0 deletions src/gui/Src/Utils/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "SourceView", 4);
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "Trace", 7);
guiUint.insert("SIMDRegistersDisplayMode", 0);
guiUint.insert("EditFloatRegisterDefaultMode", 0);
addWindowPosConfig(guiUint, "AssembleDialog");
addWindowPosConfig(guiUint, "AttachDialog");
addWindowPosConfig(guiUint, "GotoDialog");
Expand All @@ -342,7 +343,11 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
//uint settings
QMap<QString, duint> hexdumpUint;
hexdumpUint.insert("DefaultView", 0);
hexdumpUint.insert("CopyDataType", 0);
defaultUints.insert("HexDump", hexdumpUint);
QMap<QString, bool> hexdumpBool;
hexdumpBool.insert("KeepSize", false);
defaultBools.insert("HexDump", hexdumpBool);

QMap<QString, duint> disasmUint;
disasmUint.insert("MaxModuleSize", -1);
Expand Down

0 comments on commit af07ddf

Please sign in to comment.