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 #define EFI_FV_FILETYPE_FFS_MAX 0xFF
// File attributes // File attributes
#define FFS_ATTRIB_RESERVED 0x80 // ErasePolarity value can be obtained from that bit
#define FFS_ATTRIB_TAIL_PRESENT 0x01 #define FFS_ATTRIB_TAIL_PRESENT 0x01
#define FFS_ATTRIB_RECOVERY 0x02 #define FFS_ATTRIB_RECOVERY 0x02
#define FFS_ATTRIB_FIXED 0x04 #define FFS_ATTRIB_FIXED 0x04
@ -300,7 +299,6 @@ extern const UINT8 ffsAlignmentTable[];
#define EFI_FILE_MARKED_FOR_UPDATE 0x08 #define EFI_FILE_MARKED_FOR_UPDATE 0x08
#define EFI_FILE_DELETED 0x10 #define EFI_FILE_DELETED 0x10
#define EFI_FILE_HEADER_INVALID 0x20 #define EFI_FILE_HEADER_INVALID 0x20
#define EFI_FILE_ERASE_POLARITY 0x80
// Volume top file // Volume top file
const QByteArray EFI_FFS_VOLUME_TOP_FILE_GUID 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; UINT32 alignment;
if (volumeHeader->Revision == 1) { if (volumeHeader->Revision == 1) {
// Acquire alignment capability bit // Acquire alignment capability bit
bool alignmentCap = volumeHeader->Attributes | EFI_FVB_ALIGNMENT_CAP; bool alignmentCap = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_CAP;
if (!alignmentCap) { if (!alignmentCap) {
if (volumeHeader->Attributes & 0xFFFF0000) if (volumeHeader->Attributes & 0xFFFF0000)
msg("parseBios: Alignment bits set on volume without alignment capability", parent); 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 // Check attributes
// Determine value of empty byte // 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 // Get volume size
UINT8 result; 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(); EFI_FFS_FILE_HEADER* fileHeader = (EFI_FFS_FILE_HEADER*)file.constData();
// Check file state // 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 // Construct empty byte for this file
char empty = fileErasePolarity ? '\xFF' : '\x00'; char empty = erasePolarity ? '\xFF' : '\x00';
// Check header checksum // Check header checksum
QByteArray header = file.left(sizeof(EFI_FFS_FILE_HEADER)); QByteArray header = file.left(sizeof(EFI_FFS_FILE_HEADER));