1
0
Fork 0

Merge branch 'x64dbg:development' into Branch_fix_crash

This commit is contained in:
gmh5225 2022-09-24 21:34:38 +08:00 committed by GitHub
commit 818704155c
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 15 deletions

View File

@ -226,6 +226,7 @@ StackSelectionColor=#414141
StackTextColor=#E0E0E0
StructAlternateBackgroundColor=#313131
StructBackgroundColor=#212121
StructTextColor=#E0E0E0
SymbolUserTextColor=#E0E0E0
SymbolSystemTextColor=#E0E0E0
SymbolLoadedTextColor=#E0E0E0

View File

@ -118,8 +118,15 @@ static void ProcessFileSections(std::vector<MEMPAGE> & pageVector)
return;
auto & currentPage = pageVector.at(i);
auto modBase = ModBaseFromName(currentPage.info);
if(!modBase)
// Nothing to do for reserved or free pages
if(currentPage.mbi.State == MEM_RESERVE || currentPage.mbi.State == MEM_FREE)
continue;
auto pageBase = duint(currentPage.mbi.BaseAddress);
auto pageSize = currentPage.mbi.RegionSize;
auto modBase = ModBaseFromAddr(pageBase);
if(modBase == 0)
continue;
// Retrieve module info
@ -173,9 +180,6 @@ static void ProcessFileSections(std::vector<MEMPAGE> & pageVector)
}
}
auto pageBase = duint(currentPage.mbi.BaseAddress);
auto pageSize = currentPage.mbi.RegionSize;
// Section view
if(!bListAllPages)
{
@ -222,14 +226,14 @@ static void ProcessFileSections(std::vector<MEMPAGE> & pageVector)
else
{
// Report an error to make it easier to debug
auto summary = StringUtils::sprintf("Error replacing page: %p[%p]\n", pageBase, pageSize);
auto summary = StringUtils::sprintf("Error replacing page: %p[%p] (%s)\n", pageBase, pageSize, currentPage.info);
summary += "Sections:\n";
for(const auto & section : sections)
summary += StringUtils::sprintf(" \"%s\": %p[%p]\n", section.name, section.addr, section.size);
summary += "New pages:\n";
for(const auto & page : newPages)
summary += StringUtils::sprintf(" \"%s\": %p[%p]\n", page.info, page.mbi.BaseAddress, page.mbi.RegionSize);
summary += "Please report an issue!";
summary += "Please report an issue!\n";
GuiAddLogMessage(summary.c_str());
strncat_s(currentPage.info, " (error, see log)", _TRUNCATE);
}

View File

@ -592,6 +592,7 @@ void AppearanceDialog::colorInfoListInit()
colorInfoListAppend(tr("Memory Map Breakpoint"), "MemoryMapBreakpointColor", "MemoryMapBreakpointBackgroundColor");
colorInfoListAppend(tr("Memory Map %1").arg(ArchValue(tr("EIP"), tr("RIP"))), "MemoryMapCipColor", "MemoryMapCipBackgroundColor");
colorInfoListAppend(tr("Memory Map Section Text"), "MemoryMapSectionTextColor", "");
colorInfoListAppend(tr("Struct text"), "StructTextColor", "");
colorInfoListAppend(tr("Struct primary background"), "StructBackgroundColor", "");
colorInfoListAppend(tr("Struct secondary background"), "StructAlternateBackgroundColor", "");
colorInfoListAppend(tr("Breakpoint Summary Parentheses"), "BreakpointSummaryParenColor", "");

View File

@ -5,8 +5,9 @@
#include <QAbstractTextDocumentLayout>
#include <QApplication>
RichTextItemDelegate::RichTextItemDelegate(QObject* parent)
: QStyledItemDelegate(parent)
RichTextItemDelegate::RichTextItemDelegate(QColor* textColor, QObject* parent)
: QStyledItemDelegate(parent),
mTextColor(textColor)
{
}
@ -32,7 +33,7 @@ void RichTextItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &
QTextDocument doc;
doc.setDefaultTextOption(textOption);
doc.setHtml(option.text);
doc.setHtml(QString("<font color=\"%1\">%2</font>").arg(mTextColor->name(), option.text));
doc.setDefaultFont(option.font);
doc.setDocumentMargin(0);
doc.setTextWidth(option.rect.width());

View File

@ -8,10 +8,13 @@ class RichTextItemDelegate : public QStyledItemDelegate
Q_OBJECT
public:
explicit RichTextItemDelegate(QObject* parent = nullptr);
explicit RichTextItemDelegate(QColor* textColor, QObject* parent = nullptr);
protected:
void paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex & index) const override;
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const override;
private:
QColor* mTextColor = nullptr;
};

View File

@ -21,8 +21,8 @@ StructWidget::StructWidget(QWidget* parent) :
ui(new Ui::StructWidget)
{
ui->setupUi(this);
ui->treeWidget->setStyleSheet("QTreeWidget { color: #000000; background-color: #FFF8F0; alternate-background-color: #DCD9CF; }");
ui->treeWidget->setItemDelegate(new RichTextItemDelegate(ui->treeWidget));
ui->treeWidget->setStyleSheet("QTreeWidget { background-color: #FFF8F0; alternate-background-color: #DCD9CF; }");
ui->treeWidget->setItemDelegate(new RichTextItemDelegate(&mTextColor, ui->treeWidget));
connect(Bridge::getBridge(), SIGNAL(typeAddNode(void*, const TYPEDESCRIPTOR*)), this, SLOT(typeAddNode(void*, const TYPEDESCRIPTOR*)));
connect(Bridge::getBridge(), SIGNAL(typeClear()), this, SLOT(typeClear()));
connect(Bridge::getBridge(), SIGNAL(typeUpdateWidget()), this, SLOT(typeUpdateWidget()));
@ -71,10 +71,10 @@ void StructWidget::loadWindowSettings()
void StructWidget::colorsUpdatedSlot()
{
auto color = ConfigColor("AbstractTableViewTextColor");
mTextColor = ConfigColor("StructTextColor");
auto background = ConfigColor("StructBackgroundColor");
auto altBackground = ConfigColor("StructAlternateBackgroundColor");
auto style = QString("QTreeWidget { color: %1; background-color: %2; alternate-background-color: %3; }").arg(color.name(), background.name(), altBackground.name());
auto style = QString("QTreeWidget { background-color: %1; alternate-background-color: %2; }").arg(background.name(), altBackground.name());
ui->treeWidget->setStyleSheet(style);
}

View File

@ -36,6 +36,7 @@ private:
Ui::StructWidget* ui;
MenuBuilder* mMenuBuilder;
GotoDialog* mGotoDialog = nullptr;
QColor mTextColor;
void setupColumns();
void setupContextMenu();

View File

@ -232,6 +232,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
defaultColors.insert("MemoryMapSectionTextColor", QColor("#8B671F"));
defaultColors.insert("SearchListViewHighlightColor", QColor("#FF0000"));
defaultColors.insert("SearchListViewHighlightBackgroundColor", Qt::transparent);
defaultColors.insert("StructTextColor", QColor("#000000"));
defaultColors.insert("StructBackgroundColor", QColor("#FFF8F0"));
defaultColors.insert("StructAlternateBackgroundColor", QColor("#DCD9CF"));
defaultColors.insert("LogLinkColor", QColor("#00CC00"));