mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
DEPEX again
- solved a bug with DEPEX parse introduced in previous commit
This commit is contained in:
parent
4c290c5204
commit
0b3c2aee9c
@ -146,7 +146,7 @@ UINT8 FfsEngine::parseImageFile(const QByteArray & buffer)
|
|||||||
|
|
||||||
// Check buffer size to be more then or equal to size of EFI_CAPSULE_HEADER
|
// Check buffer size to be more then or equal to size of EFI_CAPSULE_HEADER
|
||||||
if ((UINT32)buffer.size() <= sizeof(EFI_CAPSULE_HEADER)) {
|
if ((UINT32)buffer.size() <= sizeof(EFI_CAPSULE_HEADER)) {
|
||||||
msg(tr("parseImageFile: image file is smaller then minimum size of %1 bytes").arg(sizeof(EFI_CAPSULE_HEADER)));
|
msg(tr("parseImageFile: image file is smaller then minimum size of %1h (%2) bytes").hexarg(sizeof(EFI_CAPSULE_HEADER)).arg(sizeof(EFI_CAPSULE_HEADER)));
|
||||||
return ERR_INVALID_PARAMETER;
|
return ERR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,9 +1255,6 @@ UINT8 FfsEngine::parseDepexSection(const QByteArray & body, QString & parsed)
|
|||||||
parsed += tr("\nSOR");
|
parsed += tr("\nSOR");
|
||||||
current += EFI_DEP_OPCODE_SIZE;
|
current += EFI_DEP_OPCODE_SIZE;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return ERR_DEPEX_PARSE_FAILED;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the rest of depex
|
// Parse the rest of depex
|
||||||
@ -1318,7 +1315,6 @@ UINT8 FfsEngine::parseDepexSection(const QByteArray & body, QString & parsed)
|
|||||||
UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, const QModelIndex & parent, const UINT8 mode)
|
UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, const QModelIndex & parent, const UINT8 mode)
|
||||||
{
|
{
|
||||||
const EFI_COMMON_SECTION_HEADER* sectionHeader = (const EFI_COMMON_SECTION_HEADER*)(section.constData());
|
const EFI_COMMON_SECTION_HEADER* sectionHeader = (const EFI_COMMON_SECTION_HEADER*)(section.constData());
|
||||||
UINT32 sectionSize = uint24ToUint32(sectionHeader->Size);
|
|
||||||
QString name = sectionTypeToQString(sectionHeader->Type) + tr(" section");
|
QString name = sectionTypeToQString(sectionHeader->Type) + tr(" section");
|
||||||
QString info;
|
QString info;
|
||||||
QByteArray header;
|
QByteArray header;
|
||||||
@ -1335,7 +1331,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
UINT8 algorithm;
|
UINT8 algorithm;
|
||||||
const EFI_COMPRESSION_SECTION* compressedSectionHeader = (const EFI_COMPRESSION_SECTION*)sectionHeader;
|
const EFI_COMPRESSION_SECTION* compressedSectionHeader = (const EFI_COMPRESSION_SECTION*)sectionHeader;
|
||||||
header = section.left(sizeof(EFI_COMPRESSION_SECTION));
|
header = section.left(sizeof(EFI_COMPRESSION_SECTION));
|
||||||
body = section.mid(sizeof(EFI_COMPRESSION_SECTION), sectionSize - sizeof(EFI_COMPRESSION_SECTION));
|
body = section.mid(sizeof(EFI_COMPRESSION_SECTION));
|
||||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||||
// Decompress section
|
// Decompress section
|
||||||
result = decompress(body, compressedSectionHeader->CompressionType, decompressed, &algorithm);
|
result = decompress(body, compressedSectionHeader->CompressionType, decompressed, &algorithm);
|
||||||
@ -1379,7 +1375,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
guidDefinedSectionHeader = (const EFI_GUID_DEFINED_SECTION*)(header.constData());
|
guidDefinedSectionHeader = (const EFI_GUID_DEFINED_SECTION*)(header.constData());
|
||||||
header = section.left(guidDefinedSectionHeader->DataOffset);
|
header = section.left(guidDefinedSectionHeader->DataOffset);
|
||||||
guidDefinedSectionHeader = (const EFI_GUID_DEFINED_SECTION*)(header.constData());
|
guidDefinedSectionHeader = (const EFI_GUID_DEFINED_SECTION*)(header.constData());
|
||||||
body = section.mid(guidDefinedSectionHeader->DataOffset, sectionSize - guidDefinedSectionHeader->DataOffset);
|
body = section.mid(guidDefinedSectionHeader->DataOffset);
|
||||||
QByteArray processed = body;
|
QByteArray processed = body;
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
@ -1521,7 +1517,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
case EFI_SECTION_DISPOSABLE:
|
case EFI_SECTION_DISPOSABLE:
|
||||||
{
|
{
|
||||||
header = section.left(sizeof(EFI_DISPOSABLE_SECTION));
|
header = section.left(sizeof(EFI_DISPOSABLE_SECTION));
|
||||||
body = section.mid(sizeof(EFI_DISPOSABLE_SECTION), sectionSize - sizeof(EFI_DISPOSABLE_SECTION));
|
body = section.mid(sizeof(EFI_DISPOSABLE_SECTION));
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
@ -1546,7 +1542,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
bool msgDepexParseFailed = false;
|
bool msgDepexParseFailed = false;
|
||||||
headerSize = sizeOfSectionHeader(sectionHeader);
|
headerSize = sizeOfSectionHeader(sectionHeader);
|
||||||
header = section.left(headerSize);
|
header = section.left(headerSize);
|
||||||
body = section.mid(headerSize, sectionSize - headerSize);
|
body = section.mid(headerSize);
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
@ -1574,7 +1570,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
case EFI_SECTION_TE: {
|
case EFI_SECTION_TE: {
|
||||||
headerSize = sizeOfSectionHeader(sectionHeader);
|
headerSize = sizeOfSectionHeader(sectionHeader);
|
||||||
header = section.left(headerSize);
|
header = section.left(headerSize);
|
||||||
body = section.mid(headerSize, sectionSize - headerSize);
|
body = section.mid(headerSize);
|
||||||
|
|
||||||
// Get standard info
|
// Get standard info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
@ -1625,7 +1621,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
case EFI_SECTION_PIC: {
|
case EFI_SECTION_PIC: {
|
||||||
headerSize = sizeOfSectionHeader(sectionHeader);
|
headerSize = sizeOfSectionHeader(sectionHeader);
|
||||||
header = section.left(headerSize);
|
header = section.left(headerSize);
|
||||||
body = section.mid(headerSize, sectionSize - headerSize);
|
body = section.mid(headerSize);
|
||||||
|
|
||||||
// Get standard info
|
// Get standard info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
@ -1713,7 +1709,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
case EFI_SECTION_COMPATIBILITY16: {
|
case EFI_SECTION_COMPATIBILITY16: {
|
||||||
headerSize = sizeOfSectionHeader(sectionHeader);
|
headerSize = sizeOfSectionHeader(sectionHeader);
|
||||||
header = section.left(headerSize);
|
header = section.left(headerSize);
|
||||||
body = section.mid(headerSize, sectionSize - headerSize);
|
body = section.mid(headerSize);
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
@ -1728,7 +1724,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
|
|
||||||
case EFI_SECTION_FREEFORM_SUBTYPE_GUID: {
|
case EFI_SECTION_FREEFORM_SUBTYPE_GUID: {
|
||||||
header = section.left(sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION));
|
header = section.left(sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION));
|
||||||
body = section.mid(sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION), sectionSize - sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION));
|
body = section.mid(sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION));
|
||||||
|
|
||||||
const EFI_FREEFORM_SUBTYPE_GUID_SECTION* fsgHeader = (const EFI_FREEFORM_SUBTYPE_GUID_SECTION*)sectionHeader;
|
const EFI_FREEFORM_SUBTYPE_GUID_SECTION* fsgHeader = (const EFI_FREEFORM_SUBTYPE_GUID_SECTION*)sectionHeader;
|
||||||
// Get info
|
// Get info
|
||||||
@ -1748,7 +1744,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
|
|
||||||
case EFI_SECTION_VERSION: {
|
case EFI_SECTION_VERSION: {
|
||||||
header = section.left(sizeof(EFI_VERSION_SECTION));
|
header = section.left(sizeof(EFI_VERSION_SECTION));
|
||||||
body = section.mid(sizeof(EFI_VERSION_SECTION), sectionSize - sizeof(EFI_VERSION_SECTION));
|
body = section.mid(sizeof(EFI_VERSION_SECTION));
|
||||||
|
|
||||||
const EFI_VERSION_SECTION* versionHeader = (const EFI_VERSION_SECTION*)sectionHeader;
|
const EFI_VERSION_SECTION* versionHeader = (const EFI_VERSION_SECTION*)sectionHeader;
|
||||||
|
|
||||||
@ -1767,7 +1763,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
|
|
||||||
case EFI_SECTION_USER_INTERFACE: {
|
case EFI_SECTION_USER_INTERFACE: {
|
||||||
header = section.left(sizeof(EFI_USER_INTERFACE_SECTION));
|
header = section.left(sizeof(EFI_USER_INTERFACE_SECTION));
|
||||||
body = section.mid(sizeof(EFI_USER_INTERFACE_SECTION), sectionSize - sizeof(EFI_USER_INTERFACE_SECTION));
|
body = section.mid(sizeof(EFI_USER_INTERFACE_SECTION));
|
||||||
QString text = QString::fromUtf16((const ushort*)body.constData());
|
QString text = QString::fromUtf16((const ushort*)body.constData());
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
@ -1787,7 +1783,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
|
|
||||||
case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: {
|
case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: {
|
||||||
header = section.left(sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
|
header = section.left(sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
|
||||||
body = section.mid(sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION), sectionSize - sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
|
body = section.mid(sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
@ -1810,7 +1806,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
case EFI_SECTION_RAW: {
|
case EFI_SECTION_RAW: {
|
||||||
bool parsed = false;
|
bool parsed = false;
|
||||||
header = section.left(sizeof(EFI_RAW_SECTION));
|
header = section.left(sizeof(EFI_RAW_SECTION));
|
||||||
body = section.mid(sizeof(EFI_RAW_SECTION), sectionSize - sizeof(EFI_RAW_SECTION));
|
body = section.mid(sizeof(EFI_RAW_SECTION));
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
@ -1865,7 +1861,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
case SCT_SECTION_POSTCODE:
|
case SCT_SECTION_POSTCODE:
|
||||||
case INSYDE_SECTION_POSTCODE: {
|
case INSYDE_SECTION_POSTCODE: {
|
||||||
header = section.left(sizeof(POSTCODE_SECTION));
|
header = section.left(sizeof(POSTCODE_SECTION));
|
||||||
body = section.mid(sizeof(POSTCODE_SECTION), sectionSize - sizeof(POSTCODE_SECTION));
|
body = section.mid(sizeof(POSTCODE_SECTION));
|
||||||
|
|
||||||
const POSTCODE_SECTION* postcodeHeader = (const POSTCODE_SECTION*)sectionHeader;
|
const POSTCODE_SECTION* postcodeHeader = (const POSTCODE_SECTION*)sectionHeader;
|
||||||
|
|
||||||
@ -1883,7 +1879,7 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
header = section.left(sizeof(EFI_COMMON_SECTION_HEADER));
|
header = section.left(sizeof(EFI_COMMON_SECTION_HEADER));
|
||||||
body = section.mid(sizeof(EFI_COMMON_SECTION_HEADER), sectionSize - sizeof(EFI_COMMON_SECTION_HEADER));
|
body = section.mid(sizeof(EFI_COMMON_SECTION_HEADER));
|
||||||
// Get info
|
// Get info
|
||||||
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
info = tr("Type: %1h\nFull size: %2h (%3)\nHeader size: %4h (%5)\nBody size: %6h (%7)")
|
||||||
.hexarg2(sectionHeader->Type, 2)
|
.hexarg2(sectionHeader->Type, 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user