From 41448ea49ff804ccd500e467f1c8ed47ffee82bb Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Thu, 14 Aug 2014 14:02:35 +0200 Subject: [PATCH] UEFITool 0.18.6 - solved a bug with unneeded original PEI core entry point recalculation - name of opened file is now shown in window title - added compression type and decompressed size info for compressed GUID-defined sections --- ffsengine.cpp | 32 ++++++++++++++++++++++++++------ uefitool.cpp | 11 ++++++++++- uefitool.h | 3 ++- uefitool.ui | 2 +- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/ffsengine.cpp b/ffsengine.cpp index 82c0037..5b5d196 100644 --- a/ffsengine.cpp +++ b/ffsengine.cpp @@ -1240,18 +1240,36 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c // Tiano compressed section if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_TIANO) { algorithm = COMPRESSION_ALGORITHM_UNKNOWN; - info += tr("\nCompression type: Tiano"); - result = decompress(body, EFI_STANDARD_COMPRESSION, decompressed, &algorithm); + + result = decompress(body, EFI_STANDARD_COMPRESSION, decompressed, &algorithm); if (result) parseCurrentSection = false; + + if (algorithm == COMPRESSION_ALGORITHM_TIANO) { + info += tr("\nCompression type: Tiano"); + info += tr("\nDecompressed size: %1").arg(decompressed.length(), 8, 16, QChar('0')); + } + else if (algorithm == COMPRESSION_ALGORITHM_EFI11) { + info += tr("\nCompression type: EFI 1.1"); + info += tr("\nDecompressed size: %1").arg(decompressed.length(), 8, 16, QChar('0')); + } + else + info += tr("\nCompression type: unknown"); } // LZMA compressed section else if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_LZMA) { algorithm = COMPRESSION_ALGORITHM_UNKNOWN; - info += tr("\nCompression type: LZMA"); + result = decompress(body, EFI_CUSTOMIZED_COMPRESSION, decompressed, &algorithm); - if (result) + if (result) parseCurrentSection = false; + + if (algorithm == COMPRESSION_ALGORITHM_LZMA) { + info += tr("\nCompression type: LZMA"); + info += tr("\nDecompressed size: %1").arg(decompressed.length(), 8, 16, QChar('0')); + } + else + info += tr("\nCompression type: unknown"); } // Unknown GUIDed section else { @@ -1342,10 +1360,12 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c index = model->addItem(Types::Section, sectionHeader->Type, COMPRESSION_ALGORITHM_NONE, name, "", info, header, body, QByteArray(), parent, mode); // Special case of PEI Core - if ((sectionHeader->Type == EFI_SECTION_PE32 || sectionHeader->Type == EFI_SECTION_TE) && model->subtype(parent) == EFI_FV_FILETYPE_PEI_CORE) { + if ((sectionHeader->Type == EFI_SECTION_PE32 || sectionHeader->Type == EFI_SECTION_TE) + && model->subtype(parent) == EFI_FV_FILETYPE_PEI_CORE + && oldPeiCoreEntryPoint == 0) { result = getEntryPoint(model->body(index), oldPeiCoreEntryPoint); if (result) - msg(tr("parseSection: Can't get entry point of image file"), index); + msg(tr("parseSection: Can't get original PEI core entry point"), index); } } break; diff --git a/uefitool.cpp b/uefitool.cpp index 5d2a5b8..58e8f69 100644 --- a/uefitool.cpp +++ b/uefitool.cpp @@ -16,7 +16,8 @@ UEFITool::UEFITool(QWidget *parent) : QMainWindow(parent), -ui(new Ui::UEFITool) +ui(new Ui::UEFITool), +version(tr("0.18.6")) { clipboard = QApplication::clipboard(); @@ -25,6 +26,9 @@ ui(new Ui::UEFITool) searchDialog = new SearchDialog(this); ffsEngine = NULL; + // Set window title + this->setWindowTitle(tr("UEFITool %1").arg(version)); + // Connect signals to slots connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile())); connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile())); @@ -72,6 +76,9 @@ void UEFITool::init() ui->messageListWidget->clear(); ui->infoEdit->clear(); + // Set window title + this->setWindowTitle(tr("UEFITool %1").arg(version)); + // Disable menus ui->menuCapsuleActions->setDisabled(true); ui->menuImageActions->setDisabled(true); @@ -544,6 +551,8 @@ void UEFITool::openImageFile(QString path) inputFile.close(); init(); + this->setWindowTitle(tr("UEFITool %1 - %2").arg(version).arg(fileInfo.fileName())); + UINT8 result = ffsEngine->parseImageFile(buffer); showMessages(); if (result) diff --git a/uefitool.h b/uefitool.h index 7a919af..af233a7 100644 --- a/uefitool.h +++ b/uefitool.h @@ -95,7 +95,8 @@ private: SearchDialog* searchDialog; QClipboard* clipboard; QString currentDir; - QQueue messageItems; + QQueue messageItems; + const QString version; void showMessages(); diff --git a/uefitool.ui b/uefitool.ui index 3e958c5..3bcb6bc 100644 --- a/uefitool.ui +++ b/uefitool.ui @@ -20,7 +20,7 @@ true - UEFITool 0.18.5 + UEFITool