From a927c51df14bdee0ecae9c5910a113be600f1089 Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Wed, 10 Dec 2014 19:18:05 +0100 Subject: [PATCH] Version 0.19.5 - solved a small bug in inserting compressed section - unknown 0xF0 section identified as SCT postcode data --- ffs.cpp | 9 ++++++--- ffs.h | 9 ++++++++- ffsengine.cpp | 17 +++++++++++++++++ uefitool.cpp | 2 +- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ffs.cpp b/ffs.cpp index 354f61d..576d1d7 100644 --- a/ffs.cpp +++ b/ffs.cpp @@ -160,6 +160,8 @@ QString sectionTypeToQString(const UINT8 type) return QObject::tr("PEI dependency"); case EFI_SECTION_SMM_DEPEX: return QObject::tr("SMM dependency"); + case SCT_SECTION_POSTCODE: + return QObject::tr("SCT postcode"); default: return QObject::tr("Unknown"); } @@ -173,11 +175,10 @@ UINT32 sizeOfSectionHeader(EFI_COMMON_SECTION_HEADER* header) switch (header->Type) { case EFI_SECTION_COMPRESSION: - return sizeof(EFI_COMMON_SECTION_HEADER); + return sizeof(EFI_COMPRESSION_SECTION); case EFI_SECTION_GUID_DEFINED: { EFI_GUID_DEFINED_SECTION* gdsHeader = (EFI_GUID_DEFINED_SECTION*)header; - return gdsHeader->DataOffset; - } + return gdsHeader->DataOffset; } case EFI_SECTION_DISPOSABLE: return sizeof(EFI_DISPOSABLE_SECTION); case EFI_SECTION_PE32: @@ -204,6 +205,8 @@ UINT32 sizeOfSectionHeader(EFI_COMMON_SECTION_HEADER* header) return sizeof(EFI_PEI_DEPEX_SECTION); case EFI_SECTION_SMM_DEPEX: return sizeof(EFI_SMM_DEPEX_SECTION); + case SCT_SECTION_POSTCODE: + return sizeof(SCT_POSTCODE_SECTION); default: return sizeof(EFI_COMMON_SECTION_HEADER); } diff --git a/ffs.h b/ffs.h index e2e2048..d2f796a 100644 --- a/ffs.h +++ b/ffs.h @@ -289,7 +289,6 @@ typedef struct { #define FFS_ATTRIB_FIXED 0x04 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38 #define FFS_ATTRIB_CHECKSUM 0x40 -//#define FFS_ATTRIB_LARGE_FILE 0x01 //This attribute is removed in new PI 1.3 specification, nice // FFS alignment table extern const UINT8 ffsAlignmentTable[]; @@ -361,6 +360,7 @@ typedef struct { #define EFI_SECTION_RAW 0x19 #define EFI_SECTION_PEI_DEPEX 0x1B #define EFI_SECTION_SMM_DEPEX 0x1C +#define SCT_SECTION_POSTCODE 0xF0 // Specific to Phoenix SCT images // Compression section typedef struct { @@ -415,6 +415,13 @@ typedef struct { EFI_GUID SubTypeGuid; } EFI_FREEFORM_SUBTYPE_GUID_SECTION; +// Phoenix SCT postcode section +typedef struct { + UINT8 Size[3]; + UINT8 Type; + UINT32 Postcode; +} SCT_POSTCODE_SECTION; + // Other sections typedef EFI_COMMON_SECTION_HEADER EFI_DISPOSABLE_SECTION; typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION; diff --git a/ffsengine.cpp b/ffsengine.cpp index 2ce9aae..42bff44 100644 --- a/ffsengine.cpp +++ b/ffsengine.cpp @@ -1677,6 +1677,23 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c } } break; + case SCT_SECTION_POSTCODE: { + header = section.left(sizeof(SCT_POSTCODE_SECTION)); + body = section.mid(sizeof(SCT_POSTCODE_SECTION), sectionSize - sizeof(SCT_POSTCODE_SECTION)); + + SCT_POSTCODE_SECTION* postcodeHeader = (SCT_POSTCODE_SECTION*)sectionHeader; + + // Get info + info = tr("Type: 0x%1\nSize: 0x%2\nPostcode: 0x%3") + .hexarg(postcodeHeader->Type, 2) + .hexarg(body.size(), 6) + .hexarg(postcodeHeader->Postcode, 2); + + // Add tree item + index = model->addItem(Types::Section, sectionHeader->Type, COMPRESSION_ALGORITHM_NONE, name, "", info, header, body, QByteArray(), parent, mode); + } + break; + default: header = section.left(sizeof(EFI_COMMON_SECTION_HEADER)); body = section.mid(sizeof(EFI_COMMON_SECTION_HEADER), sectionSize - sizeof(EFI_COMMON_SECTION_HEADER)); diff --git a/uefitool.cpp b/uefitool.cpp index 4e10a71..e53d614 100644 --- a/uefitool.cpp +++ b/uefitool.cpp @@ -17,7 +17,7 @@ UEFITool::UEFITool(QWidget *parent) : QMainWindow(parent), ui(new Ui::UEFITool), -version(tr("0.19.4")) +version(tr("0.19.5")) { clipboard = QApplication::clipboard();