Version 0.17.10.2

-removed useless and unreliable fileErasePolarity check
-solved a bug in chechecking values with | instead of &
This commit is contained in:
Nikolaj Schlej 2014-05-02 19:28:48 +02:00
parent b81f5712b5
commit 433a8ee171
2 changed files with 3 additions and 13 deletions

2
ffs.h
View File

@ -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

View File

@ -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));