mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-23 16:38:23 +08:00
Fix CPD Extension offset (reverts 29915ca
)
The CPD Extensions should have the header size added as an offset instead.
This commit is contained in:
parent
29915ca620
commit
4992474e83
@ -4673,10 +4673,13 @@ make_partition_table_consistent:
|
|||||||
manifestHeader->ExponentSize * (UINT32)sizeof(UINT32), manifestHeader->ExponentSize * (UINT32)sizeof(UINT32));
|
manifestHeader->ExponentSize * (UINT32)sizeof(UINT32), manifestHeader->ExponentSize * (UINT32)sizeof(UINT32));
|
||||||
|
|
||||||
// Add tree item
|
// Add tree item
|
||||||
UModelIndex partitionIndex = model->addItem(localOffset + header.size() + partitions[i].ptEntry.Offset.Offset, Types::CpdPartition, Subtypes::ManifestCpdPartition, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
UModelIndex partitionIndex = model->addItem(localOffset + partitions[i].ptEntry.Offset.Offset, Types::CpdPartition, Subtypes::ManifestCpdPartition, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||||
|
|
||||||
// Parse data as extensions area
|
// Parse data as extensions area
|
||||||
parseCpdExtensionsArea(partitionIndex);
|
// Add the header size as a local offset
|
||||||
|
// Since the body starts after the
|
||||||
|
// header length
|
||||||
|
parseCpdExtensionsArea(partitionIndex, header.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4695,7 +4698,7 @@ make_partition_table_consistent:
|
|||||||
UModelIndex partitionIndex = model->addItem(localOffset + partitions[i].ptEntry.Offset.Offset, Types::CpdPartition, Subtypes::MetadataCpdPartition, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
|
UModelIndex partitionIndex = model->addItem(localOffset + partitions[i].ptEntry.Offset.Offset, Types::CpdPartition, Subtypes::MetadataCpdPartition, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
|
||||||
|
|
||||||
// Parse data as extensions area
|
// Parse data as extensions area
|
||||||
parseCpdExtensionsArea(partitionIndex);
|
parseCpdExtensionsArea(partitionIndex, 0);
|
||||||
}
|
}
|
||||||
// It's a code
|
// It's a code
|
||||||
else {
|
else {
|
||||||
@ -4731,7 +4734,7 @@ make_partition_table_consistent:
|
|||||||
return U_SUCCESS;
|
return U_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
|
USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index, const UINT32 localOffset)
|
||||||
{
|
{
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
return U_INVALID_PARAMETER;
|
return U_INVALID_PARAMETER;
|
||||||
@ -4772,7 +4775,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
|
|||||||
infoHeader->UsageBitmap[12], infoHeader->UsageBitmap[13], infoHeader->UsageBitmap[14], infoHeader->UsageBitmap[15]);
|
infoHeader->UsageBitmap[12], infoHeader->UsageBitmap[13], infoHeader->UsageBitmap[14], infoHeader->UsageBitmap[15]);
|
||||||
|
|
||||||
// Add tree item
|
// Add tree item
|
||||||
extIndex = model->addItem(offset, Types::CpdExtension, 0, name, UString(), info, header, data, UByteArray(), Fixed, index);
|
extIndex = model->addItem(offset + localOffset, Types::CpdExtension, 0, name, UString(), info, header, data, UByteArray(), Fixed, index);
|
||||||
parseSignedPackageInfoData(extIndex);
|
parseSignedPackageInfoData(extIndex);
|
||||||
}
|
}
|
||||||
// Parse IFWI Partition Manifest a bit further
|
// Parse IFWI Partition Manifest a bit further
|
||||||
@ -4815,7 +4818,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
|
|||||||
+ UString("\nPartition hash: ") + UString(hash.toHex().constData());
|
+ UString("\nPartition hash: ") + UString(hash.toHex().constData());
|
||||||
|
|
||||||
// Add tree item
|
// Add tree item
|
||||||
extIndex = model->addItem(offset, Types::CpdExtension, 0, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, index);
|
extIndex = model->addItem(offset + localOffset, Types::CpdExtension, 0, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, index);
|
||||||
if (msgHashSizeMismatch) {
|
if (msgHashSizeMismatch) {
|
||||||
msg(usprintf("%s: IFWI Partition Manifest hash size is %u, maximum allowed is %u, truncated", __FUNCTION__, attrHeader->HashSize, (UINT32)sizeof(attrHeader->CompletePartitionHash)), extIndex);
|
msg(usprintf("%s: IFWI Partition Manifest hash size is %u, maximum allowed is %u, truncated", __FUNCTION__, attrHeader->HashSize, (UINT32)sizeof(attrHeader->CompletePartitionHash)), extIndex);
|
||||||
}
|
}
|
||||||
@ -4840,12 +4843,12 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
|
|||||||
attrHeader->GlobalModuleId) + UString(hash.toHex().constData());
|
attrHeader->GlobalModuleId) + UString(hash.toHex().constData());
|
||||||
|
|
||||||
// Add tree item
|
// Add tree item
|
||||||
extIndex = model->addItem(offset, Types::CpdExtension, 0, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, index);
|
extIndex = model->addItem(offset + localOffset, Types::CpdExtension, 0, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, index);
|
||||||
}
|
}
|
||||||
// Parse everything else
|
// Parse everything else
|
||||||
else {
|
else {
|
||||||
// Add tree item, if needed
|
// Add tree item, if needed
|
||||||
extIndex = model->addItem(offset, Types::CpdExtension, 0, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, index);
|
extIndex = model->addItem(offset + localOffset, Types::CpdExtension, 0, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There needs to be a more generic way to do it, but it is fine for now
|
// There needs to be a more generic way to do it, but it is fine for now
|
||||||
|
@ -130,7 +130,7 @@ private:
|
|||||||
|
|
||||||
USTATUS parseBpdtRegion(const UByteArray & region, const UINT32 localOffset, const UINT32 sbpdtOffsetFixup, const UModelIndex & parent, UModelIndex & index);
|
USTATUS parseBpdtRegion(const UByteArray & region, const UINT32 localOffset, const UINT32 sbpdtOffsetFixup, const UModelIndex & parent, UModelIndex & index);
|
||||||
USTATUS parseCpdRegion(const UByteArray & region, const UINT32 localOffset, const UModelIndex & parent, UModelIndex & index);
|
USTATUS parseCpdRegion(const UByteArray & region, const UINT32 localOffset, const UModelIndex & parent, UModelIndex & index);
|
||||||
USTATUS parseCpdExtensionsArea(const UModelIndex & index);
|
USTATUS parseCpdExtensionsArea(const UModelIndex & index, const UINT32 localOffset);
|
||||||
USTATUS parseSignedPackageInfoData(const UModelIndex & index);
|
USTATUS parseSignedPackageInfoData(const UModelIndex & index);
|
||||||
|
|
||||||
USTATUS parseRawArea(const UModelIndex & index);
|
USTATUS parseRawArea(const UModelIndex & index);
|
||||||
|
Loading…
Reference in New Issue
Block a user