Skip to content

Commit 10c26e7

Browse files
committed
Remember some window settings, copy old value, UI enhancement
1 parent a6313b4 commit 10c26e7

File tree

8 files changed

+75
-4
lines changed

8 files changed

+75
-4
lines changed

README_zh-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![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/[email protected])
88

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

1111
## 屏幕截图
1212

@@ -30,7 +30,7 @@
3030

3131
- 调试器核心由[TitanEngine社区版](https://github.com/x64dbg/TitanEngine)提供技术支持
3232
- 反汇编引擎由 [Zydis](https://zydis.re)提供技术支持
33-
- 组件由 [XEDParse](https://github.com/x64dbg/XEDParse)[asmjit](https://github.com/asmjit)提供技术支持
33+
- 汇编由 [XEDParse](https://github.com/x64dbg/XEDParse)[asmjit](https://github.com/asmjit)提供技术支持
3434
- 导入重建由 [Scylla](https://github.com/NtQuery/Scylla)提供技术支持
3535
- JSON由 [Jansson](https://www.digip.org/jansson)提供技术支持
3636
- 数据库优化由 [lz4](https://bitbucket.org/mrexodia/lz4)提供技术支持

src/gui/Src/Gui/CPURegistersView.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CPURegistersView::CPURegistersView(CPUWidget* parent) : RegistersView(parent), m
1818
wCM_Modify->setShortcut(QKeySequence(Qt::Key_Enter));
1919
wCM_ToggleValue = setupAction(DIcon("register_toggle.png"), tr("Toggle"));
2020
wCM_Undo = setupAction(DIcon("undo.png"), tr("Undo"));
21+
wCM_CopyPrevious = setupAction(DIcon("undo.png"), "");
2122
wCM_FollowInDisassembly = new QAction(DIcon(QString("processor%1.png").arg(ArchValue("32", "64"))), tr("Follow in Disassembler"), this);
2223
wCM_FollowInDump = new QAction(DIcon("dump.png"), tr("Follow in Dump"), this);
2324
wCM_FollowInStack = new QAction(DIcon("stack.png"), tr("Follow in Stack"), this);
@@ -37,6 +38,7 @@ CPURegistersView::CPURegistersView(CPUWidget* parent) : RegistersView(parent), m
3738
connect(wCM_Modify, SIGNAL(triggered()), this, SLOT(onModifyAction()));
3839
connect(wCM_ToggleValue, SIGNAL(triggered()), this, SLOT(onToggleValueAction()));
3940
connect(wCM_Undo, SIGNAL(triggered()), this, SLOT(onUndoAction()));
41+
connect(wCM_CopyPrevious, SIGNAL(triggered()), this, SLOT(onCopyPreviousAction()));
4042
connect(wCM_FollowInDisassembly, SIGNAL(triggered()), this, SLOT(onFollowInDisassembly()));
4143
connect(wCM_FollowInDump, SIGNAL(triggered()), this, SLOT(onFollowInDump()));
4244
connect(wCM_FollowInStack, SIGNAL(triggered()), this, SLOT(onFollowInStack()));
@@ -441,6 +443,11 @@ void CPURegistersView::onUndoAction()
441443
}
442444
}
443445

446+
void CPURegistersView::onCopyPreviousAction()
447+
{
448+
Bridge::CopyToClipboard(wCM_CopyPrevious->data().toString());
449+
}
450+
444451
void CPURegistersView::onHighlightSlot()
445452
{
446453
Disassembly* CPUDisassemblyView = mParent->getDisasmWidget();
@@ -580,6 +587,9 @@ void CPURegistersView::displayCustomContextMenuSlot(QPoint pos)
580587
if(mUNDODISPLAY.contains(mSelected) && CompareRegisters(mSelected, &wRegDumpStruct, &wCipRegDumpStruct) != 0)
581588
{
582589
wMenu.addAction(wCM_Undo);
590+
wCM_CopyPrevious->setData(GetRegStringValueFromValue(mSelected, registerValue(&wCipRegDumpStruct, mSelected)));
591+
wCM_CopyPrevious->setText(tr("Copy old value: %1").arg(wCM_CopyPrevious->data().toString()));
592+
wMenu.addAction(wCM_CopyPrevious);
583593
}
584594

585595
if(mBOOLDISPLAY.contains(mSelected))

src/gui/Src/Gui/CPURegistersView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected slots:
2424
void onModifyAction();
2525
void onToggleValueAction();
2626
void onUndoAction();
27+
void onCopyPreviousAction();
2728
void onFollowInDisassembly();
2829
void onFollowInDump();
2930
void onFollowInDumpN();
@@ -43,6 +44,7 @@ protected slots:
4344
QAction* mFollowInDump;
4445
QAction* wCM_Modify;
4546
QAction* wCM_ToggleValue;
47+
QAction* wCM_CopyPrevious;
4648
QAction* wCM_Undo;
4749
QAction* wCM_FollowInDisassembly;
4850
QAction* wCM_FollowInDump;

src/gui/Src/Gui/EditBreakpointDialog.ui

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
</property>
4343
<item row="1" column="0">
4444
<widget class="QLabel" name="labelLogText">
45+
<property name="toolTip">
46+
<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>
47+
</property>
4548
<property name="text">
4649
<string>&amp;Log Text:</string>
4750
</property>
@@ -52,6 +55,9 @@
5255
</item>
5356
<item row="0" column="0">
5457
<widget class="QLabel" name="labelBreakCondition">
58+
<property name="toolTip">
59+
<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>
60+
</property>
5561
<property name="text">
5662
<string>&amp;Break Condition:</string>
5763
</property>
@@ -90,6 +96,9 @@
9096
</item>
9197
<item row="2" column="0">
9298
<widget class="QLabel" name="labelLogCondition">
99+
<property name="toolTip">
100+
<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>
101+
</property>
93102
<property name="text">
94103
<string>Lo&amp;g Condition:</string>
95104
</property>
@@ -110,6 +119,9 @@
110119
</item>
111120
<item row="3" column="0">
112121
<widget class="QLabel" name="labelCommandText">
122+
<property name="toolTip">
123+
<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>
124+
</property>
113125
<property name="text">
114126
<string>&amp;Command Text:</string>
115127
</property>
@@ -137,6 +149,9 @@
137149
</item>
138150
<item row="6" column="0">
139151
<widget class="QLabel" name="labelHitCount">
152+
<property name="toolTip">
153+
<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>
154+
</property>
140155
<property name="text">
141156
<string>&amp;Hit Count:</string>
142157
</property>
@@ -147,6 +162,9 @@
147162
</item>
148163
<item row="4" column="0">
149164
<widget class="QLabel" name="labelCommandCondition">
165+
<property name="toolTip">
166+
<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>
167+
</property>
150168
<property name="text">
151169
<string>C&amp;ommand Condition:</string>
152170
</property>
@@ -181,20 +199,29 @@
181199
</item>
182200
<item>
183201
<widget class="QCheckBox" name="checkBoxSingleshoot">
202+
<property name="toolTip">
203+
<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>
204+
</property>
184205
<property name="text">
185206
<string>Singlesho&amp;ot</string>
186207
</property>
187208
</widget>
188209
</item>
189210
<item>
190211
<widget class="QCheckBox" name="checkBoxSilent">
212+
<property name="toolTip">
213+
<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>
214+
</property>
191215
<property name="text">
192216
<string>&amp;Silent</string>
193217
</property>
194218
</widget>
195219
</item>
196220
<item>
197221
<widget class="QCheckBox" name="checkBoxFastResume">
222+
<property name="toolTip">
223+
<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>
224+
</property>
198225
<property name="text">
199226
<string>&amp;Fast Resume</string>
200227
</property>

src/gui/Src/Gui/EditFloatRegister.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ EditFloatRegister::EditFloatRegister(int RegisterSize, QWidget* parent) :
5858
ui->hexEdit->setValidator(&hexValidate);
5959
connect(ui->hexEdit_2, SIGNAL(textEdited(QString)), this, SLOT(editingHex2FinishedSlot(QString)));
6060
ui->hexEdit_2->setValidator(&hexValidate);
61+
QRadioButton* checkedRadio;
62+
switch(ConfigUint("Gui", "EditFloatRegisterDefaultMode"))
63+
{
64+
case 0:
65+
default:
66+
checkedRadio = ui->radioHex;
67+
break;
68+
case 1:
69+
checkedRadio = ui->radioSigned;
70+
break;
71+
case 2:
72+
checkedRadio = ui->radioUnsigned;
73+
break;
74+
}
75+
checkedRadio->setChecked(true);
6176
editingModeChangedSlot(false);
6277
connect(ui->radioHex, SIGNAL(toggled(bool)), this, SLOT(editingModeChangedSlot(bool)));
6378
connect(ui->radioSigned, SIGNAL(toggled(bool)), this, SLOT(editingModeChangedSlot(bool)));
@@ -473,6 +488,7 @@ void EditFloatRegister::editingModeChangedSlot(bool arg)
473488
ui->longLongEdit0_2->setValidator(&hexValidate);
474489
ui->longLongEdit1_2->setValidator(&hexValidate);
475490
}
491+
Config()->setUint("Gui", "EditFloatRegisterDefaultMode", 0);
476492
}
477493
else if(ui->radioSigned->isChecked())
478494
{
@@ -532,6 +548,7 @@ void EditFloatRegister::editingModeChangedSlot(bool arg)
532548
ui->longLongEdit1->setValidator(&signedLongLongValidator);
533549
ui->longLongEdit0_2->setValidator(&signedLongLongValidator);
534550
ui->longLongEdit1_2->setValidator(&signedLongLongValidator);
551+
Config()->setUint("Gui", "EditFloatRegisterDefaultMode", 1);
535552
}
536553
else
537554
{
@@ -587,6 +604,7 @@ void EditFloatRegister::editingModeChangedSlot(bool arg)
587604
ui->longLongEdit1->setValidator(&unsignedLongLongValidator);
588605
ui->longLongEdit0_2->setValidator(&unsignedLongLongValidator);
589606
ui->longLongEdit1_2->setValidator(&unsignedLongLongValidator);
607+
Config()->setUint("Gui", "EditFloatRegisterDefaultMode", 2);
590608
}
591609
reloadDataLow();
592610
if(RegSize > 128)

src/gui/Src/Gui/HexEditDialog.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexE
2525
//setup text fields
2626
ui->lineEditAscii->setEncoding(QTextCodec::codecForName("System"));
2727
ui->lineEditUnicode->setEncoding(QTextCodec::codecForName("UTF-16"));
28-
28+
ui->chkKeepSize->setChecked(ConfigBool("HexDump", "KeepSize"));
2929
ui->chkEntireBlock->hide();
3030

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

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

9294
Config()->setupWindowPos(this);
@@ -162,10 +164,13 @@ void HexEditDialog::updateStyle()
162164

163165
void HexEditDialog::on_chkKeepSize_toggled(bool checked)
164166
{
167+
if(!this->isVisible())
168+
return;
165169
mHexEdit->setKeepSize(checked);
166170
ui->lineEditAscii->setKeepSize(checked);
167171
ui->lineEditUnicode->setKeepSize(checked);
168172
ui->lineEditCodepage->setKeepSize(checked);
173+
Config()->setBool("HexDump", "KeepSize", checked);
169174
}
170175

171176
void HexEditDialog::dataChangedSlot()
@@ -818,6 +823,7 @@ void HexEditDialog::on_listType_currentRowChanged(int currentRow)
818823
mIndex = currentRow;
819824
ui->spinBox->setValue(mTypes[mIndex].itemsPerLine);
820825
printData(DataType(mIndex));
826+
Config()->setUint("HexDump", "CopyDataType", currentRow);
821827
}
822828

823829
void HexEditDialog::on_buttonCopy_clicked()

src/gui/Src/Gui/PatchDialog.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ void PatchDialog::on_btnImport_clicked()
505505
QList<QPair<DBGPATCHINFO, IMPORTSTATUS>> patchList;
506506
DBGPATCHINFO curPatch;
507507

508+
if(!filenamelist.size())
509+
return; // No files are selected, don't show the "No patches to apply in the current process." dialog.
510+
508511
for(const auto & filename1 : filenamelist)
509512
{
510513
if(!filename1.length())

src/gui/Src/Utils/Configuration.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
328328
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "SourceView", 4);
329329
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "Trace", 7);
330330
guiUint.insert("SIMDRegistersDisplayMode", 0);
331+
guiUint.insert("EditFloatRegisterDefaultMode", 0);
331332
addWindowPosConfig(guiUint, "AssembleDialog");
332333
addWindowPosConfig(guiUint, "AttachDialog");
333334
addWindowPosConfig(guiUint, "GotoDialog");
@@ -342,7 +343,11 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
342343
//uint settings
343344
QMap<QString, duint> hexdumpUint;
344345
hexdumpUint.insert("DefaultView", 0);
346+
hexdumpUint.insert("CopyDataType", 0);
345347
defaultUints.insert("HexDump", hexdumpUint);
348+
QMap<QString, bool> hexdumpBool;
349+
hexdumpBool.insert("KeepSize", false);
350+
defaultBools.insert("HexDump", hexdumpBool);
346351

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

0 commit comments

Comments
 (0)