mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
Version 0.2.4
Better shitty LZMA section handling. Thank you, Intel, for breaking your own specifications.
This commit is contained in:
parent
a86829a27e
commit
56a0ed00b0
39
ffs.cpp
39
ffs.cpp
@ -155,3 +155,42 @@ QString sectionTypeToQString(const UINT8 type)
|
|||||||
return QObject::tr("Unknown");
|
return QObject::tr("Unknown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT32 sizeOfSectionHeaderOfType(const UINT8 type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case EFI_SECTION_COMPRESSION:
|
||||||
|
return sizeof(EFI_COMMON_SECTION_HEADER);
|
||||||
|
case EFI_SECTION_GUID_DEFINED:
|
||||||
|
return sizeof(EFI_GUID_DEFINED_SECTION);
|
||||||
|
case EFI_SECTION_DISPOSABLE:
|
||||||
|
return sizeof(EFI_DISPOSABLE_SECTION);
|
||||||
|
case EFI_SECTION_PE32:
|
||||||
|
return sizeof(EFI_PE32_SECTION);
|
||||||
|
case EFI_SECTION_PIC:
|
||||||
|
return sizeof(EFI_PIC_SECTION);
|
||||||
|
case EFI_SECTION_TE:
|
||||||
|
return sizeof(EFI_TE_SECTION);
|
||||||
|
case EFI_SECTION_DXE_DEPEX:
|
||||||
|
return sizeof(EFI_DXE_DEPEX_SECTION);
|
||||||
|
case EFI_SECTION_VERSION:
|
||||||
|
return sizeof(EFI_VERSION_SECTION);
|
||||||
|
case EFI_SECTION_USER_INTERFACE:
|
||||||
|
return sizeof(EFI_USER_INTERFACE_SECTION);
|
||||||
|
case EFI_SECTION_COMPATIBILITY16:
|
||||||
|
return sizeof(EFI_COMPATIBILITY16_SECTION);
|
||||||
|
case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:
|
||||||
|
return sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION);
|
||||||
|
case EFI_SECTION_FREEFORM_SUBTYPE_GUID:
|
||||||
|
return sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION);
|
||||||
|
case EFI_SECTION_RAW:
|
||||||
|
return sizeof(EFI_RAW_SECTION);
|
||||||
|
case EFI_SECTION_PEI_DEPEX:
|
||||||
|
return sizeof(EFI_PEI_DEPEX_SECTION);
|
||||||
|
case EFI_SECTION_SMM_DEPEX:
|
||||||
|
return sizeof(EFI_SMM_DEPEX_SECTION);
|
||||||
|
default:
|
||||||
|
return sizeof(EFI_COMMON_SECTION_HEADER);
|
||||||
|
}
|
||||||
|
}
|
3
ffs.h
3
ffs.h
@ -406,6 +406,9 @@ typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
|
|||||||
typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
|
||||||
typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
|
typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
|
||||||
|
|
||||||
|
//Section routines
|
||||||
|
extern UINT32 sizeOfSectionHeaderOfType(const UINT8 type);
|
||||||
|
|
||||||
// Restore previous packing rules
|
// Restore previous packing rules
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -744,6 +744,8 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
|
|||||||
UINT32 dataSize;
|
UINT32 dataSize;
|
||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
UINT32 result;
|
UINT32 result;
|
||||||
|
UINT32 shittySectionSize;
|
||||||
|
EFI_COMMON_SECTION_HEADER* shittySectionHeader;
|
||||||
|
|
||||||
switch (sectionHeader->Type)
|
switch (sectionHeader->Type)
|
||||||
{
|
{
|
||||||
@ -804,8 +806,11 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
|
|||||||
|| decompressedSize != compressedSectionHeader->UncompressedLength)
|
|| decompressedSize != compressedSectionHeader->UncompressedLength)
|
||||||
{
|
{
|
||||||
// Shitty file with a section header between COMPRESSED_SECTION_HEADER and LZMA_HEADER
|
// Shitty file with a section header between COMPRESSED_SECTION_HEADER and LZMA_HEADER
|
||||||
data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION) + sizeof(EFI_COMMON_SECTION_HEADER));
|
// We must determine section header size by checking it's type before we can unpack that non-standard compressed section
|
||||||
dataSize = uint24ToUint32(sectionHeader->Size) - sizeof(EFI_COMPRESSION_SECTION) - sizeof(EFI_COMMON_SECTION_HEADER);
|
shittySectionHeader = (EFI_COMMON_SECTION_HEADER*) data;
|
||||||
|
shittySectionSize = sizeOfSectionHeaderOfType(shittySectionHeader->Type);
|
||||||
|
data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION) + shittySectionSize);
|
||||||
|
dataSize = uint24ToUint32(sectionHeader->Size) - sizeof(EFI_COMPRESSION_SECTION) - shittySectionSize;
|
||||||
if (LzmaGetInfo(data, dataSize, &decompressedSize) != ERR_SUCCESS)
|
if (LzmaGetInfo(data, dataSize, &decompressedSize) != ERR_SUCCESS)
|
||||||
debug(tr("LzmaGetInfo failed"));
|
debug(tr("LzmaGetInfo failed"));
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>UEFITool 0.2.3</string>
|
<string>UEFITool 0.2.4</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
Loading…
Reference in New Issue
Block a user