Version 0.2.2

Code changed to be compatible with XCode 5
This commit is contained in:
Nikolaj Schlej 2013-10-09 02:53:39 +02:00
parent 05f1becfe6
commit 5a57489a5e
8 changed files with 90 additions and 88 deletions

View File

@ -2078,7 +2078,7 @@ void LzmaEnc_Finish(CLzmaEncHandle pp)
if (p->mtMode) if (p->mtMode)
MatchFinderMt_ReleaseStream(&p->matchFinderMt); MatchFinderMt_ReleaseStream(&p->matchFinderMt);
#else #else
pp = pp; //pp = pp;
#endif #endif
} }

View File

@ -264,7 +264,7 @@ STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NU
// functions // functions
// //
UINT32 INT32
EfiCompress ( EfiCompress (
UINT8 *SrcBuffer, UINT8 *SrcBuffer,
UINT32 SrcSize, UINT32 SrcSize,

View File

@ -230,7 +230,8 @@ Returns:
} }
while (Index <= 16) { while (Index <= 16) {
Weight[Index++] = (UINT16) (1U << (16 - Index)); Weight[Index] = (UINT16) (1U << (16 - Index));
Index++;
} }
Index = (UINT16) (Start[TableBits + 1] >> JuBits); Index = (UINT16) (Start[TableBits + 1] >> JuBits);

View File

@ -155,9 +155,9 @@ typedef struct {
// Calculate address of data structure addressed by descriptor address format // Calculate address of data structure addressed by descriptor address format
// 8 bit base or limit // 8 bit base or limit
UINT8* calculateAddress8(UINT8* baseAddress, const UINT8 baseOrLimit); extern UINT8* calculateAddress8(UINT8* baseAddress, const UINT8 baseOrLimit);
// 16 bit base or limit // 16 bit base or limit
UINT8* calculateAddress16(UINT8* baseAddress, const UINT16 baseOrLimit); extern UINT8* calculateAddress16(UINT8* baseAddress, const UINT16 baseOrLimit);
//Calculate size of region using its base and limit //Calculate size of region using its base and limit
size_t calculateRegionSize(const UINT16 base, const UINT16 limit); extern UINT32 calculateRegionSize(const UINT16 base, const UINT16 limit);
#endif #endif

View File

@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
TreeModel::TreeModel(QObject *parent) TreeModel::TreeModel(QObject *parent)
: QAbstractItemModel(parent) : QAbstractItemModel(parent)
{ {
rootItem = new TreeItem(ItemTypes::RootItem, 0, tr("Object"), tr("Type"), tr("Subtype"), tr("Text")); rootItem = new TreeItem(RootItem, 0, tr("Object"), tr("Type"), tr("Subtype"), tr("Text"));
} }
TreeModel::~TreeModel() TreeModel::~TreeModel()
@ -167,15 +167,15 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head
switch (type) switch (type)
{ {
case ItemTypes::RootItem: case RootItem:
// Do not allow to add another root item // Do not allow to add another root item
return QModelIndex(); return QModelIndex();
break; break;
case ItemTypes::CapsuleItem: case CapsuleItem:
//typeName = tr("Capsule"); //typeName = tr("Capsule");
switch (subtype) switch (subtype)
{ {
case CapsuleSubtypes::AptioCapsule: case AptioCapsule:
name = tr("AMI Aptio capsule"); name = tr("AMI Aptio capsule");
aptioCapsuleHeader = (APTIO_CAPSULE_HEADER*) header.constData(); aptioCapsuleHeader = (APTIO_CAPSULE_HEADER*) header.constData();
info = tr("GUID: %1\nHeader size: %2\nFlags: %3\nImage size: %4") info = tr("GUID: %1\nHeader size: %2\nFlags: %3\nImage size: %4")
@ -185,7 +185,7 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head
.arg(aptioCapsuleHeader->CapsuleHeader.CapsuleImageSize - aptioCapsuleHeader->RomImageOffset, 8, 16, QChar('0')); .arg(aptioCapsuleHeader->CapsuleHeader.CapsuleImageSize - aptioCapsuleHeader->RomImageOffset, 8, 16, QChar('0'));
//!TODO: more info about Aptio capsule //!TODO: more info about Aptio capsule
break; break;
case CapsuleSubtypes::UefiCapsule: case UefiCapsule:
name = tr("UEFI capsule"); name = tr("UEFI capsule");
capsuleHeader = (EFI_CAPSULE_HEADER*) header.constData(); capsuleHeader = (EFI_CAPSULE_HEADER*) header.constData();
info = tr("GUID: %1\nHeader size: %2\nFlags: %3\nImage size: %4") info = tr("GUID: %1\nHeader size: %2\nFlags: %3\nImage size: %4")
@ -200,7 +200,7 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head
break; break;
} }
break; break;
case ItemTypes::DescriptorItem: case DescriptorItem:
name = tr("Descriptor"); name = tr("Descriptor");
descriptorMap = (FLASH_DESCRIPTOR_MAP*) body.constData(); descriptorMap = (FLASH_DESCRIPTOR_MAP*) body.constData();
info = tr("Flash chips: %1\nRegions: %2\nMasters: %3\nPCH straps:%4\nPROC straps: %5\nICC table entries: %6") info = tr("Flash chips: %1\nRegions: %2\nMasters: %3\nPCH straps:%4\nPROC straps: %5\nICC table entries: %6")
@ -212,22 +212,22 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head
.arg(descriptorMap->NumberOfIccTableEntries); .arg(descriptorMap->NumberOfIccTableEntries);
//!TODO: more info about descriptor //!TODO: more info about descriptor
break; break;
case ItemTypes::RegionItem: case RegionItem:
typeName = tr("Region"); typeName = tr("Region");
info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0')); info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0'));
//!TODO: more info about GbE and ME regions //!TODO: more info about GbE and ME regions
switch (subtype) switch (subtype)
{ {
case RegionSubtypes::GbeRegion: case GbeRegion:
name = tr("GbE region"); name = tr("GbE region");
break; break;
case RegionSubtypes::MeRegion: case MeRegion:
name = tr("ME region"); name = tr("ME region");
break; break;
case RegionSubtypes::BiosRegion: case BiosRegion:
name = tr("BIOS region"); name = tr("BIOS region");
break; break;
case RegionSubtypes::PdrRegion: case PdrRegion:
name = tr("PDR region"); name = tr("PDR region");
break; break;
default: default:
@ -235,11 +235,11 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head
break; break;
} }
break; break;
case ItemTypes::PaddingItem: case PaddingItem:
name = tr("Padding"); name = tr("Padding");
info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0')); info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0'));
break; break;
case ItemTypes::VolumeItem: case VolumeItem:
typeName = tr("Volume"); typeName = tr("Volume");
// Parse volume header to determine its revision and file system // Parse volume header to determine its revision and file system
volumeHeader = (EFI_FIRMWARE_VOLUME_HEADER*) header.constData(); volumeHeader = (EFI_FIRMWARE_VOLUME_HEADER*) header.constData();
@ -251,7 +251,7 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head
.arg(volumeHeader->Attributes, 8, 16, QChar('0')) .arg(volumeHeader->Attributes, 8, 16, QChar('0'))
.arg(volumeHeader->HeaderLength, 4, 16, QChar('0')); .arg(volumeHeader->HeaderLength, 4, 16, QChar('0'));
break; break;
case ItemTypes::FileItem: case FileItem:
typeName = tr("File"); typeName = tr("File");
// Parse file header to determine its GUID and type // Parse file header to determine its GUID and type
fileHeader = (EFI_FFS_FILE_HEADER*) header.constData(); fileHeader = (EFI_FFS_FILE_HEADER*) header.constData();
@ -263,16 +263,16 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head
.arg(uint24ToUint32(fileHeader->Size), 6, 16, QChar('0')) .arg(uint24ToUint32(fileHeader->Size), 6, 16, QChar('0'))
.arg(fileHeader->State, 2, 16, QChar('0')); .arg(fileHeader->State, 2, 16, QChar('0'));
break; break;
case ItemTypes::SectionItem: case SectionItem:
typeName = tr("Section"); typeName = tr("Section");
name = sectionTypeToQString(subtype) + tr(" section"); name = sectionTypeToQString(subtype) + tr(" section");
info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0')); info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0'));
//!TODO: add more specific info for all section types with uncommon headers //!TODO: add more specific info for all section types with uncommon headers
// Set name of file // Set name of file
if (subtype == SectionSubtypes::UserInterfaceSection) if (subtype == UserInterfaceSection)
{ {
QString text = QString::fromUtf16((const ushort*)body.constData()); QString text = QString::fromUtf16((const ushort*)body.constData());
setItemText(text, findParentOfType(ItemTypes::FileItem, parent)); setItemText(text, findParentOfType(FileItem, parent));
} }
break; break;
default: default:

View File

@ -12,6 +12,7 @@
*/ */
#include "uefitool.h" #include "uefitool.h"
#include "treeitemtypes.h"
#include "ui_uefitool.h" #include "ui_uefitool.h"
UEFITool::UEFITool(QWidget *parent) : UEFITool::UEFITool(QWidget *parent) :
@ -202,7 +203,7 @@ UINT8 UEFITool::parseInputFile(const QByteArray & buffer)
capsuleHeaderSize = capsuleHeader->HeaderSize; capsuleHeaderSize = capsuleHeader->HeaderSize;
QByteArray header = buffer.left(capsuleHeaderSize); QByteArray header = buffer.left(capsuleHeaderSize);
QByteArray body = buffer.right(buffer.size() - capsuleHeaderSize); QByteArray body = buffer.right(buffer.size() - capsuleHeaderSize);
index = addTreeItem(ItemTypes::CapsuleItem, CapsuleSubtypes::UefiCapsule, header, body); index = addTreeItem(CapsuleItem, UefiCapsule, header, body);
} }
// Check buffer for being extended Aptio capsule header // Check buffer for being extended Aptio capsule header
@ -211,7 +212,7 @@ UINT8 UEFITool::parseInputFile(const QByteArray & buffer)
capsuleHeaderSize = aptioCapsuleHeader->RomImageOffset; capsuleHeaderSize = aptioCapsuleHeader->RomImageOffset;
QByteArray header = buffer.left(capsuleHeaderSize); QByteArray header = buffer.left(capsuleHeaderSize);
QByteArray body = buffer.right(buffer.size() - capsuleHeaderSize); QByteArray body = buffer.right(buffer.size() - capsuleHeaderSize);
index = addTreeItem(ItemTypes::CapsuleItem, CapsuleSubtypes::AptioCapsule, header, body); index = addTreeItem(CapsuleItem, AptioCapsule, header, body);
} }
// Skip capsule header to have flash chip image // Skip capsule header to have flash chip image
@ -244,17 +245,17 @@ UINT8 UEFITool::parseInputFile(const QByteArray & buffer)
// Add tree item // Add tree item
QByteArray header = flashImage.left(sizeof(FLASH_DESCRIPTOR_HEADER)); QByteArray header = flashImage.left(sizeof(FLASH_DESCRIPTOR_HEADER));
QByteArray body = flashImage.mid(sizeof(FLASH_DESCRIPTOR_HEADER), FLASH_DESCRIPTOR_SIZE - sizeof(FLASH_DESCRIPTOR_HEADER)); QByteArray body = flashImage.mid(sizeof(FLASH_DESCRIPTOR_HEADER), FLASH_DESCRIPTOR_SIZE - sizeof(FLASH_DESCRIPTOR_HEADER));
index = addTreeItem(ItemTypes::DescriptorItem, 0, header, body, index); index = addTreeItem(DescriptorItem, 0, header, body, index);
// Parse region section // Parse region section
QModelIndex gbeIndex(index); QModelIndex gbeIndex(index);
QModelIndex meIndex(index); QModelIndex meIndex(index);
QModelIndex biosIndex(index); QModelIndex biosIndex(index);
QModelIndex pdrIndex(index); QModelIndex pdrIndex(index);
gbeRegion = parseRegion(flashImage, RegionSubtypes::GbeRegion, regionSection->GbeBase, regionSection->GbeLimit, gbeIndex); gbeRegion = parseRegion(flashImage, GbeRegion, regionSection->GbeBase, regionSection->GbeLimit, gbeIndex);
meRegion = parseRegion(flashImage, RegionSubtypes::MeRegion, regionSection->MeBase, regionSection->MeLimit, meIndex); meRegion = parseRegion(flashImage, MeRegion, regionSection->MeBase, regionSection->MeLimit, meIndex);
biosRegion = parseRegion(flashImage, RegionSubtypes::BiosRegion, regionSection->BiosBase, regionSection->BiosLimit, biosIndex); biosRegion = parseRegion(flashImage, BiosRegion, regionSection->BiosBase, regionSection->BiosLimit, biosIndex);
pdrRegion = parseRegion(flashImage, RegionSubtypes::PdrRegion, regionSection->PdrBase, regionSection->PdrLimit, pdrIndex); pdrRegion = parseRegion(flashImage, PdrRegion, regionSection->PdrBase, regionSection->PdrLimit, pdrIndex);
// Parse complete // Parse complete
//!TODO: show some info about GbE, ME and PDR regions if found //!TODO: show some info about GbE, ME and PDR regions if found
@ -298,16 +299,16 @@ UINT8* UEFITool::parseRegion(const QByteArray & flashImage, UINT8 regionSubtype,
QString regionName; QString regionName;
switch (regionSubtype) switch (regionSubtype)
{ {
case RegionSubtypes::GbeRegion: case GbeRegion:
regionName = "GbE"; regionName = "GbE";
break; break;
case RegionSubtypes::MeRegion: case MeRegion:
regionName = "ME"; regionName = "ME";
break; break;
case RegionSubtypes::BiosRegion: case BiosRegion:
regionName = "Bios"; regionName = "Bios";
break; break;
case RegionSubtypes::PdrRegion: case PdrRegion:
regionName = "PDR"; regionName = "PDR";
break; break;
default: default:
@ -346,12 +347,12 @@ UINT8* UEFITool::parseRegion(const QByteArray & flashImage, UINT8 regionSubtype,
// Add tree item // Add tree item
QByteArray body = flashImage.mid(regionBase * 0x1000, regionSize); QByteArray body = flashImage.mid(regionBase * 0x1000, regionSize);
index = addTreeItem(ItemTypes::RegionItem, regionSubtype, QByteArray(), body, index); index = addTreeItem(RegionItem, regionSubtype, QByteArray(), body, index);
return region; return region;
} }
UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent) UINT8 UEFITool::parseBios(const QByteArray & bios, const QModelIndex & parent)
{ {
// Search for first volume // Search for first volume
INT32 prevVolumeIndex = getNextVolumeIndex(bios); INT32 prevVolumeIndex = getNextVolumeIndex(bios);
@ -364,7 +365,7 @@ UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent)
// First volume is not at the beginning of bios space // First volume is not at the beginning of bios space
if (prevVolumeIndex > 0) { if (prevVolumeIndex > 0) {
QByteArray padding = bios.left(prevVolumeIndex); QByteArray padding = bios.left(prevVolumeIndex);
addTreeItem(ItemTypes::PaddingItem, 0, QByteArray(), padding, parent); addTreeItem(PaddingItem, 0, QByteArray(), padding, parent);
} }
// Search for and parse all volumes // Search for and parse all volumes
@ -378,7 +379,7 @@ UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent)
if (volumeIndex > prevVolumeIndex + prevVolumeSize) { if (volumeIndex > prevVolumeIndex + prevVolumeSize) {
UINT32 size = volumeIndex - prevVolumeIndex - prevVolumeSize; UINT32 size = volumeIndex - prevVolumeIndex - prevVolumeSize;
QByteArray padding = bios.mid(prevVolumeIndex + prevVolumeSize, size); QByteArray padding = bios.mid(prevVolumeIndex + prevVolumeSize, size);
addTreeItem(ItemTypes::PaddingItem, 0, QByteArray(), padding, parent); addTreeItem(PaddingItem, 0, QByteArray(), padding, parent);
} }
// Populate volume header // Populate volume header
@ -394,23 +395,23 @@ UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent)
UINT32 alignment; UINT32 alignment;
if (volumeHeader->Revision == 1) { if (volumeHeader->Revision == 1) {
// Aquire alignment bits // Aquire alignment bits
bool alignmentCap = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_CAP; bool alignmentCap = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_CAP;
bool alignment2 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_2; bool alignment2 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_2;
bool alignment4 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_4; bool alignment4 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_4;
bool alignment8 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_8; bool alignment8 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_8;
bool alignment16 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_16; bool alignment16 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_16;
bool alignment32 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_32; bool alignment32 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_32;
bool alignment64 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_64; bool alignment64 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_64;
bool alignment128 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_128; bool alignment128 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_128;
bool alignment256 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_256; bool alignment256 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_256;
bool alignment512 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_512; bool alignment512 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_512;
bool alignment1k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_1K; bool alignment1k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_1K;
bool alignment2k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_2K; bool alignment2k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_2K;
bool alignment4k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_4K; bool alignment4k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_4K;
bool alignment8k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_8K; bool alignment8k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_8K;
bool alignment16k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_16K; bool alignment16k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_16K;
bool alignment32k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_32K; bool alignment32k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_32K;
bool alignment64k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_64K; bool alignment64k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_64K;
// Check alignment setup // Check alignment setup
if (!alignmentCap && if (!alignmentCap &&
@ -511,7 +512,7 @@ UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent)
// Adding tree item // Adding tree item
QByteArray header = bios.mid(volumeIndex, headerSize); QByteArray header = bios.mid(volumeIndex, headerSize);
QByteArray body = bios.mid(volumeIndex + headerSize, volumeHeader->FvLength - headerSize); QByteArray body = bios.mid(volumeIndex + headerSize, volumeHeader->FvLength - headerSize);
QModelIndex index = addTreeItem(ItemTypes::VolumeItem, 0, header, body, parent); QModelIndex index = addTreeItem(VolumeItem, 0, header, body, parent);
// Parse volume // Parse volume
if (parseCurrentVolume) { if (parseCurrentVolume) {
@ -548,7 +549,7 @@ UINT32 UEFITool::getVolumeSize(const QByteArray & bios, INT32 volumeIndex)
return volumeHeader->FvLength; return volumeHeader->FvLength;
} }
UINT8 UEFITool::parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8 revision, bool erasePolarity, QModelIndex & parent) UINT8 UEFITool::parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8 revision, bool erasePolarity, const QModelIndex & parent)
{ {
// Construct empty byte based on erasePolarity value // Construct empty byte based on erasePolarity value
// Native char type is used because QByteArray.count() takes it // Native char type is used because QByteArray.count() takes it
@ -571,7 +572,7 @@ UINT8 UEFITool::parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8
// We are at empty space in the end of volume // We are at empty space in the end of volume
if (header.count(empty) == header.size()) { if (header.count(empty) == header.size()) {
QByteArray body = volume.right(volume.size() - fileIndex); QByteArray body = volume.right(volume.size() - fileIndex);
addTreeItem(ItemTypes::PaddingItem, 0, QByteArray(), body, parent); addTreeItem(PaddingItem, 0, QByteArray(), body, parent);
break; break;
} }
@ -693,7 +694,7 @@ UINT8 UEFITool::parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8
} }
// Add tree item // Add tree item
QModelIndex index = addTreeItem(ItemTypes::FileItem, fileHeader->Type, header, body, parent); QModelIndex index = addTreeItem(FileItem, fileHeader->Type, header, body, parent);
// Parse file // Parse file
if (parseCurrentFile) { if (parseCurrentFile) {
@ -721,7 +722,7 @@ UINT8 UEFITool::parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8
return ERR_SUCCESS; return ERR_SUCCESS;
} }
UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePolarity, QModelIndex & parent) UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePolarity, const QModelIndex & parent)
{ {
// Search for and parse all sections // Search for and parse all sections
INT32 sectionIndex = 0; INT32 sectionIndex = 0;
@ -756,7 +757,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
{ {
case EFI_NOT_COMPRESSED: case EFI_NOT_COMPRESSED:
body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), compressedSectionHeader->UncompressedLength); body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), compressedSectionHeader->UncompressedLength);
index = addTreeItem(ItemTypes::SectionItem, SectionSubtypes::CompressionSection, header, body, parent); index = addTreeItem(SectionItem, CompressionSection, header, body, parent);
// Parse stored file // Parse stored file
result = parseFile(body, revision, erasePolarity, index); result = parseFile(body, revision, erasePolarity, index);
if (result) if (result)
@ -765,7 +766,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
case EFI_STANDARD_COMPRESSION: case EFI_STANDARD_COMPRESSION:
//Must be Tiano for all revisions, needs checking //Must be Tiano for all revisions, needs checking
body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), sectionSize - sizeof(EFI_COMPRESSION_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), sectionSize - sizeof(EFI_COMPRESSION_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
// Get buffer sizes // Get buffer sizes
data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION)); data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION));
@ -794,7 +795,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
break; break;
case EFI_CUSTOMIZED_COMPRESSION: case EFI_CUSTOMIZED_COMPRESSION:
body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), sectionSize - sizeof(EFI_COMPRESSION_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), sectionSize - sizeof(EFI_COMPRESSION_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
// Get buffer sizes // Get buffer sizes
data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION)); data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION));
@ -825,7 +826,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
break; break;
default: default:
body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), sectionSize - sizeof(EFI_COMPRESSION_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_COMPRESSION_SECTION), sectionSize - sizeof(EFI_COMPRESSION_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
debug(tr("Compressed section with unknown compression type found (%1)").arg(compressedSectionHeader->CompressionType)); debug(tr("Compressed section with unknown compression type found (%1)").arg(compressedSectionHeader->CompressionType));
} }
@ -833,7 +834,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
case EFI_SECTION_GUID_DEFINED: case EFI_SECTION_GUID_DEFINED:
header = file.mid(sectionIndex, sizeof(EFI_GUID_DEFINED_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_GUID_DEFINED_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_GUID_DEFINED_SECTION), sectionSize - sizeof(EFI_GUID_DEFINED_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_GUID_DEFINED_SECTION), sectionSize - sizeof(EFI_GUID_DEFINED_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
// Parse section body as file // Parse section body as file
guidDefinedSectionHeader = (EFI_GUID_DEFINED_SECTION*) (header.constData()); guidDefinedSectionHeader = (EFI_GUID_DEFINED_SECTION*) (header.constData());
body = file.mid(sectionIndex + guidDefinedSectionHeader->DataOffset, sectionSize - guidDefinedSectionHeader->DataOffset); body = file.mid(sectionIndex + guidDefinedSectionHeader->DataOffset, sectionSize - guidDefinedSectionHeader->DataOffset);
@ -844,43 +845,43 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
case EFI_SECTION_DISPOSABLE: case EFI_SECTION_DISPOSABLE:
header = file.mid(sectionIndex, sizeof(EFI_DISPOSABLE_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_DISPOSABLE_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_DISPOSABLE_SECTION), sectionSize - sizeof(EFI_DISPOSABLE_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_DISPOSABLE_SECTION), sectionSize - sizeof(EFI_DISPOSABLE_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
// Leaf sections // Leaf sections
case EFI_SECTION_PE32: case EFI_SECTION_PE32:
header = file.mid(sectionIndex, sizeof(EFI_PE32_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_PE32_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_PE32_SECTION), sectionSize - sizeof(EFI_PE32_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_PE32_SECTION), sectionSize - sizeof(EFI_PE32_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_PIC: case EFI_SECTION_PIC:
header = file.mid(sectionIndex, sizeof(EFI_PIC_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_PIC_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_PIC_SECTION), sectionSize - sizeof(EFI_PIC_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_PIC_SECTION), sectionSize - sizeof(EFI_PIC_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_TE: case EFI_SECTION_TE:
header = file.mid(sectionIndex, sizeof(EFI_TE_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_TE_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_TE_SECTION), sectionSize - sizeof(EFI_TE_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_TE_SECTION), sectionSize - sizeof(EFI_TE_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_VERSION: case EFI_SECTION_VERSION:
header = file.mid(sectionIndex, sizeof(EFI_VERSION_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_VERSION_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_VERSION_SECTION), sectionSize - sizeof(EFI_VERSION_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_VERSION_SECTION), sectionSize - sizeof(EFI_VERSION_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_USER_INTERFACE: case EFI_SECTION_USER_INTERFACE:
header = file.mid(sectionIndex, sizeof(EFI_USER_INTERFACE_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_USER_INTERFACE_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_USER_INTERFACE_SECTION), sectionSize - sizeof(EFI_USER_INTERFACE_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_USER_INTERFACE_SECTION), sectionSize - sizeof(EFI_USER_INTERFACE_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_COMPATIBILITY16: case EFI_SECTION_COMPATIBILITY16:
header = file.mid(sectionIndex, sizeof(EFI_COMPATIBILITY16_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_COMPATIBILITY16_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_COMPATIBILITY16_SECTION), sectionSize - sizeof(EFI_COMPATIBILITY16_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_COMPATIBILITY16_SECTION), sectionSize - sizeof(EFI_COMPATIBILITY16_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:
header = file.mid(sectionIndex, sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION), sectionSize - sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION), sectionSize - sizeof(EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
// Parse section body as BIOS space // Parse section body as BIOS space
result = parseBios(body, index); result = parseBios(body, index);
if (result && result != ERR_VOLUMES_NOT_FOUND) if (result && result != ERR_VOLUMES_NOT_FOUND)
@ -889,12 +890,12 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
case EFI_SECTION_FREEFORM_SUBTYPE_GUID: case EFI_SECTION_FREEFORM_SUBTYPE_GUID:
header = file.mid(sectionIndex, sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION), sectionSize - sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION), sectionSize - sizeof(EFI_FREEFORM_SUBTYPE_GUID_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_RAW: case EFI_SECTION_RAW:
header = file.mid(sectionIndex, sizeof(EFI_RAW_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_RAW_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_RAW_SECTION), sectionSize - sizeof(EFI_RAW_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_RAW_SECTION), sectionSize - sizeof(EFI_RAW_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
// Parse section body as BIOS space // Parse section body as BIOS space
result = parseBios(body, index); result = parseBios(body, index);
if (result && result != ERR_VOLUMES_NOT_FOUND) if (result && result != ERR_VOLUMES_NOT_FOUND)
@ -904,23 +905,23 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol
case EFI_SECTION_DXE_DEPEX: case EFI_SECTION_DXE_DEPEX:
header = file.mid(sectionIndex, sizeof(EFI_DXE_DEPEX_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_DXE_DEPEX_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_DXE_DEPEX_SECTION), sectionSize - sizeof(EFI_DXE_DEPEX_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_DXE_DEPEX_SECTION), sectionSize - sizeof(EFI_DXE_DEPEX_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_PEI_DEPEX: case EFI_SECTION_PEI_DEPEX:
header = file.mid(sectionIndex, sizeof(EFI_PEI_DEPEX_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_PEI_DEPEX_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_PEI_DEPEX_SECTION), sectionSize - sizeof(EFI_PEI_DEPEX_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_PEI_DEPEX_SECTION), sectionSize - sizeof(EFI_PEI_DEPEX_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
case EFI_SECTION_SMM_DEPEX: case EFI_SECTION_SMM_DEPEX:
header = file.mid(sectionIndex, sizeof(EFI_SMM_DEPEX_SECTION)); header = file.mid(sectionIndex, sizeof(EFI_SMM_DEPEX_SECTION));
body = file.mid(sectionIndex + sizeof(EFI_SMM_DEPEX_SECTION), sectionSize - sizeof(EFI_SMM_DEPEX_SECTION)); body = file.mid(sectionIndex + sizeof(EFI_SMM_DEPEX_SECTION), sectionSize - sizeof(EFI_SMM_DEPEX_SECTION));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
break; break;
default: default:
debug(tr("Section with unknown type (%1)").arg(sectionHeader->Type, 2, 16, QChar('0'))); debug(tr("Section with unknown type (%1)").arg(sectionHeader->Type, 2, 16, QChar('0')));
header = file.mid(sectionIndex, sizeof(EFI_COMMON_SECTION_HEADER)); header = file.mid(sectionIndex, sizeof(EFI_COMMON_SECTION_HEADER));
body = file.mid(sectionIndex + sizeof(EFI_COMMON_SECTION_HEADER), sectionSize - sizeof(EFI_COMMON_SECTION_HEADER)); body = file.mid(sectionIndex + sizeof(EFI_COMMON_SECTION_HEADER), sectionSize - sizeof(EFI_COMMON_SECTION_HEADER));
index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent);
} }
// Move to next section // Move to next section

View File

@ -33,10 +33,10 @@
#include "basetypes.h" #include "basetypes.h"
#include "descriptor.h" #include "descriptor.h"
#include "ffs.h" #include "ffs.h"
#include "Tiano\EfiTianoCompress.h" #include "Tiano/EfiTianoCompress.h"
#include "Tiano\EfiTianoDecompress.h" #include "Tiano/EfiTianoDecompress.h"
#include "LZMA\LzmaCompress.h" #include "LZMA/LzmaCompress.h"
#include "LZMA\LzmaDecompress.h" #include "LZMA/LzmaDecompress.h"
namespace Ui { namespace Ui {
class UEFITool; class UEFITool;
@ -74,11 +74,11 @@ private:
UINT8 parseInputFile(const QByteArray & buffer); UINT8 parseInputFile(const QByteArray & buffer);
UINT8* parseRegion(const QByteArray & flashImage, UINT8 regionSubtype, const UINT16 regionBase, const UINT16 regionLimit, QModelIndex & index); UINT8* parseRegion(const QByteArray & flashImage, UINT8 regionSubtype, const UINT16 regionBase, const UINT16 regionLimit, QModelIndex & index);
UINT8 parseBios(const QByteArray & bios, QModelIndex & parent = QModelIndex()); UINT8 parseBios(const QByteArray & bios, const QModelIndex & parent = QModelIndex());
INT32 getNextVolumeIndex(const QByteArray & bios, INT32 volumeIndex = 0); INT32 getNextVolumeIndex(const QByteArray & bios, INT32 volumeIndex = 0);
UINT32 getVolumeSize(const QByteArray & bios, INT32 volumeIndex); UINT32 getVolumeSize(const QByteArray & bios, INT32 volumeIndex);
UINT8 parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8 revision, bool erasePolarity, QModelIndex & parent = QModelIndex()); UINT8 parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8 revision, bool erasePolarity, const QModelIndex & parent = QModelIndex());
UINT8 parseFile(const QByteArray & file, UINT8 revision, bool erasePolarity, QModelIndex & parent = QModelIndex()); UINT8 parseFile(const QByteArray & file, UINT8 revision, bool erasePolarity, const QModelIndex & parent = QModelIndex());
}; };
#endif #endif

View File

@ -20,7 +20,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>UEFITool 0.2.1</string> <string>UEFITool 0.2.2</string>
</property> </property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<property name="sizePolicy"> <property name="sizePolicy">