From 433a8ee171b8219ea9d9b8df79625a3df5e6dacf Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Fri, 2 May 2014 19:28:48 +0200 Subject: [PATCH] Version 0.17.10.2 -removed useless and unreliable fileErasePolarity check -solved a bug in chechecking values with | instead of & --- ffs.h | 2 -- ffsengine.cpp | 14 +++----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/ffs.h b/ffs.h index 6b9900e..885b23a 100644 --- a/ffs.h +++ b/ffs.h @@ -282,7 +282,6 @@ typedef struct { #define EFI_FV_FILETYPE_FFS_MAX 0xFF // File attributes -#define FFS_ATTRIB_RESERVED 0x80 // ErasePolarity value can be obtained from that bit #define FFS_ATTRIB_TAIL_PRESENT 0x01 #define FFS_ATTRIB_RECOVERY 0x02 #define FFS_ATTRIB_FIXED 0x04 @@ -300,7 +299,6 @@ extern const UINT8 ffsAlignmentTable[]; #define EFI_FILE_MARKED_FOR_UPDATE 0x08 #define EFI_FILE_DELETED 0x10 #define EFI_FILE_HEADER_INVALID 0x20 -#define EFI_FILE_ERASE_POLARITY 0x80 // Volume top file const QByteArray EFI_FFS_VOLUME_TOP_FILE_GUID diff --git a/ffsengine.cpp b/ffsengine.cpp index c458bc1..99e3dd1 100644 --- a/ffsengine.cpp +++ b/ffsengine.cpp @@ -516,7 +516,7 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent) UINT32 alignment; if (volumeHeader->Revision == 1) { // Acquire alignment capability bit - bool alignmentCap = volumeHeader->Attributes | EFI_FVB_ALIGNMENT_CAP; + bool alignmentCap = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_CAP; if (!alignmentCap) { if (volumeHeader->Attributes & 0xFFFF0000) msg("parseBios: Alignment bits set on volume without alignment capability", parent); @@ -657,7 +657,7 @@ UINT8 FfsEngine::parseVolume(const QByteArray & volume, QModelIndex & index, co // Check attributes // Determine value of empty byte - char empty = volumeHeader->Attributes | EFI_FVB_ERASE_POLARITY ? '\xFF' : '\x00'; + char empty = volumeHeader->Attributes & EFI_FVB_ERASE_POLARITY ? '\xFF' : '\x00'; // Get volume size UINT8 result; @@ -778,16 +778,8 @@ UINT8 FfsEngine::parseFile(const QByteArray & file, QModelIndex & index, const U EFI_FFS_FILE_HEADER* fileHeader = (EFI_FFS_FILE_HEADER*)file.constData(); // Check file state - // Determine file erase polarity - bool fileErasePolarity = fileHeader->State & EFI_FILE_ERASE_POLARITY; - - // Check file erase polarity to be the same as parent erase polarity - if (erasePolarity != ERASE_POLARITY_UNKNOWN && (bool)erasePolarity != fileErasePolarity) { - msg(tr("parseFile: %1, erase polarity differs from parent erase polarity"), parent); - } - // Construct empty byte for this file - char empty = fileErasePolarity ? '\xFF' : '\x00'; + char empty = erasePolarity ? '\xFF' : '\x00'; // Check header checksum QByteArray header = file.left(sizeof(EFI_FFS_FILE_HEADER));