MCPcopy Create free account
hub / github.com/LongSoft/UEFITool / getSectionSize

Method getSectionSize

ffsengine.cpp:1398–1415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396}
1397
1398UINT8 FfsEngine::getSectionSize(const QByteArray & file, const UINT32 sectionOffset, UINT32 & sectionSize)
1399{
1400 if ((UINT32)file.size() < sectionOffset + sizeof(EFI_COMMON_SECTION_HEADER))
1401 return ERR_INVALID_FILE;
1402
1403 const EFI_COMMON_SECTION_HEADER* sectionHeader = (const EFI_COMMON_SECTION_HEADER*)(file.constData() + sectionOffset);
1404 sectionSize = uint24ToUint32(sectionHeader->Size);
1405 // This may introduce a very rare error with a non-extended section of size equal to 0xFFFFFF
1406 if (sectionSize != 0xFFFFFF)
1407 return ERR_SUCCESS;
1408
1409 if ((UINT32)file.size() < sectionOffset + sizeof(EFI_COMMON_SECTION_HEADER2))
1410 return ERR_INVALID_FILE;
1411
1412 const EFI_COMMON_SECTION_HEADER2* sectionHeader2 = (const EFI_COMMON_SECTION_HEADER2*)(file.constData() + sectionOffset);
1413 sectionSize = sectionHeader2->ExtendedSize;
1414 return ERR_SUCCESS;
1415}
1416
1417UINT8 FfsEngine::parseSections(const QByteArray & body, const QModelIndex & parent)
1418{

Callers

nothing calls this directly

Calls 1

uint24ToUint32Function · 0.85

Tested by

no test coverage detected