diff --git a/LZMA/SDK/C/LzmaEnc.c b/LZMA/SDK/C/LzmaEnc.c index ef7f4ac..bafd158 100644 --- a/LZMA/SDK/C/LzmaEnc.c +++ b/LZMA/SDK/C/LzmaEnc.c @@ -2078,7 +2078,7 @@ void LzmaEnc_Finish(CLzmaEncHandle pp) if (p->mtMode) MatchFinderMt_ReleaseStream(&p->matchFinderMt); #else - pp = pp; + //pp = pp; #endif } diff --git a/Tiano/EfiCompress.c b/Tiano/EfiCompress.c index dda0436..ab8f06f 100644 --- a/Tiano/EfiCompress.c +++ b/Tiano/EfiCompress.c @@ -264,12 +264,12 @@ STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NU // functions // -UINT32 +INT32 EfiCompress ( UINT8 *SrcBuffer, UINT32 SrcSize, UINT8 *DstBuffer, - UINT32 *DstSize + UINT32 *DstSize ) /*++ diff --git a/Tiano/EfiTianoDecompress.c b/Tiano/EfiTianoDecompress.c index 0851374..8a6a6fd 100644 --- a/Tiano/EfiTianoDecompress.c +++ b/Tiano/EfiTianoDecompress.c @@ -230,7 +230,8 @@ Returns: } while (Index <= 16) { - Weight[Index++] = (UINT16) (1U << (16 - Index)); + Weight[Index] = (UINT16) (1U << (16 - Index)); + Index++; } Index = (UINT16) (Start[TableBits + 1] >> JuBits); diff --git a/descriptor.h b/descriptor.h index e6bb88f..1cd3d0e 100644 --- a/descriptor.h +++ b/descriptor.h @@ -155,9 +155,9 @@ typedef struct { // Calculate address of data structure addressed by descriptor address format // 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 -UINT8* calculateAddress16(UINT8* baseAddress, const UINT16 baseOrLimit); +extern UINT8* calculateAddress16(UINT8* baseAddress, const UINT16 baseOrLimit); //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 \ No newline at end of file diff --git a/treemodel.cpp b/treemodel.cpp index ab551bf..2ba8f23 100644 --- a/treemodel.cpp +++ b/treemodel.cpp @@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. TreeModel::TreeModel(QObject *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() @@ -167,15 +167,15 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head switch (type) { - case ItemTypes::RootItem: + case RootItem: // Do not allow to add another root item return QModelIndex(); break; - case ItemTypes::CapsuleItem: + case CapsuleItem: //typeName = tr("Capsule"); switch (subtype) { - case CapsuleSubtypes::AptioCapsule: + case AptioCapsule: name = tr("AMI Aptio capsule"); aptioCapsuleHeader = (APTIO_CAPSULE_HEADER*) header.constData(); 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')); //!TODO: more info about Aptio capsule break; - case CapsuleSubtypes::UefiCapsule: + case UefiCapsule: name = tr("UEFI capsule"); capsuleHeader = (EFI_CAPSULE_HEADER*) header.constData(); 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; - case ItemTypes::DescriptorItem: + case DescriptorItem: name = tr("Descriptor"); 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") @@ -212,22 +212,22 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head .arg(descriptorMap->NumberOfIccTableEntries); //!TODO: more info about descriptor break; - case ItemTypes::RegionItem: + case RegionItem: typeName = tr("Region"); info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0')); //!TODO: more info about GbE and ME regions switch (subtype) { - case RegionSubtypes::GbeRegion: + case GbeRegion: name = tr("GbE region"); break; - case RegionSubtypes::MeRegion: + case MeRegion: name = tr("ME region"); break; - case RegionSubtypes::BiosRegion: + case BiosRegion: name = tr("BIOS region"); break; - case RegionSubtypes::PdrRegion: + case PdrRegion: name = tr("PDR region"); break; default: @@ -235,11 +235,11 @@ QModelIndex TreeModel::addItem(UINT8 type, UINT8 subtype, const QByteArray &head break; } break; - case ItemTypes::PaddingItem: + case PaddingItem: name = tr("Padding"); info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0')); break; - case ItemTypes::VolumeItem: + case VolumeItem: typeName = tr("Volume"); // Parse volume header to determine its revision and file system 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->HeaderLength, 4, 16, QChar('0')); break; - case ItemTypes::FileItem: + case FileItem: typeName = tr("File"); // Parse file header to determine its GUID and type 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(fileHeader->State, 2, 16, QChar('0')); break; - case ItemTypes::SectionItem: + case SectionItem: typeName = tr("Section"); name = sectionTypeToQString(subtype) + tr(" section"); info = tr("Size: %1").arg(body.size(), 8, 16, QChar('0')); //!TODO: add more specific info for all section types with uncommon headers // Set name of file - if (subtype == SectionSubtypes::UserInterfaceSection) + if (subtype == UserInterfaceSection) { QString text = QString::fromUtf16((const ushort*)body.constData()); - setItemText(text, findParentOfType(ItemTypes::FileItem, parent)); + setItemText(text, findParentOfType(FileItem, parent)); } break; default: diff --git a/uefitool.cpp b/uefitool.cpp index 18b2de1..6f84573 100644 --- a/uefitool.cpp +++ b/uefitool.cpp @@ -12,6 +12,7 @@ */ #include "uefitool.h" +#include "treeitemtypes.h" #include "ui_uefitool.h" UEFITool::UEFITool(QWidget *parent) : @@ -202,7 +203,7 @@ UINT8 UEFITool::parseInputFile(const QByteArray & buffer) capsuleHeaderSize = capsuleHeader->HeaderSize; QByteArray header = buffer.left(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 @@ -211,7 +212,7 @@ UINT8 UEFITool::parseInputFile(const QByteArray & buffer) capsuleHeaderSize = aptioCapsuleHeader->RomImageOffset; QByteArray header = buffer.left(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 @@ -244,17 +245,17 @@ UINT8 UEFITool::parseInputFile(const QByteArray & buffer) // Add tree item QByteArray header = flashImage.left(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 QModelIndex gbeIndex(index); QModelIndex meIndex(index); QModelIndex biosIndex(index); QModelIndex pdrIndex(index); - gbeRegion = parseRegion(flashImage, RegionSubtypes::GbeRegion, regionSection->GbeBase, regionSection->GbeLimit, gbeIndex); - meRegion = parseRegion(flashImage, RegionSubtypes::MeRegion, regionSection->MeBase, regionSection->MeLimit, meIndex); - biosRegion = parseRegion(flashImage, RegionSubtypes::BiosRegion, regionSection->BiosBase, regionSection->BiosLimit, biosIndex); - pdrRegion = parseRegion(flashImage, RegionSubtypes::PdrRegion, regionSection->PdrBase, regionSection->PdrLimit, pdrIndex); + gbeRegion = parseRegion(flashImage, GbeRegion, regionSection->GbeBase, regionSection->GbeLimit, gbeIndex); + meRegion = parseRegion(flashImage, MeRegion, regionSection->MeBase, regionSection->MeLimit, meIndex); + biosRegion = parseRegion(flashImage, BiosRegion, regionSection->BiosBase, regionSection->BiosLimit, biosIndex); + pdrRegion = parseRegion(flashImage, PdrRegion, regionSection->PdrBase, regionSection->PdrLimit, pdrIndex); // Parse complete //!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; switch (regionSubtype) { - case RegionSubtypes::GbeRegion: + case GbeRegion: regionName = "GbE"; break; - case RegionSubtypes::MeRegion: + case MeRegion: regionName = "ME"; break; - case RegionSubtypes::BiosRegion: + case BiosRegion: regionName = "Bios"; break; - case RegionSubtypes::PdrRegion: + case PdrRegion: regionName = "PDR"; break; default: @@ -346,12 +347,12 @@ UINT8* UEFITool::parseRegion(const QByteArray & flashImage, UINT8 regionSubtype, // Add tree item QByteArray body = flashImage.mid(regionBase * 0x1000, regionSize); - index = addTreeItem(ItemTypes::RegionItem, regionSubtype, QByteArray(), body, index); + index = addTreeItem(RegionItem, regionSubtype, QByteArray(), body, index); return region; } -UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent) +UINT8 UEFITool::parseBios(const QByteArray & bios, const QModelIndex & parent) { // Search for first volume 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 if (prevVolumeIndex > 0) { QByteArray padding = bios.left(prevVolumeIndex); - addTreeItem(ItemTypes::PaddingItem, 0, QByteArray(), padding, parent); + addTreeItem(PaddingItem, 0, QByteArray(), padding, parent); } // Search for and parse all volumes @@ -378,7 +379,7 @@ UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent) if (volumeIndex > prevVolumeIndex + prevVolumeSize) { UINT32 size = volumeIndex - prevVolumeIndex - prevVolumeSize; QByteArray padding = bios.mid(prevVolumeIndex + prevVolumeSize, size); - addTreeItem(ItemTypes::PaddingItem, 0, QByteArray(), padding, parent); + addTreeItem(PaddingItem, 0, QByteArray(), padding, parent); } // Populate volume header @@ -394,23 +395,23 @@ UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent) UINT32 alignment; if (volumeHeader->Revision == 1) { // Aquire alignment bits - bool alignmentCap = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_CAP; - bool alignment2 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_2; - bool alignment4 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_4; - bool alignment8 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_8; - bool alignment16 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_16; - bool alignment32 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_32; - bool alignment64 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_64; - bool alignment128 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_128; - bool alignment256 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_256; - bool alignment512 = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_512; - bool alignment1k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_1K; - bool alignment2k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_2K; - bool alignment4k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_4K; - bool alignment8k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_8K; - bool alignment16k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_16K; - bool alignment32k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_32K; - bool alignment64k = volumeHeader->Attributes && EFI_FVB_ALIGNMENT_64K; + bool alignmentCap = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_CAP; + bool alignment2 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_2; + bool alignment4 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_4; + bool alignment8 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_8; + bool alignment16 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_16; + bool alignment32 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_32; + bool alignment64 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_64; + bool alignment128 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_128; + bool alignment256 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_256; + bool alignment512 = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_512; + bool alignment1k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_1K; + bool alignment2k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_2K; + bool alignment4k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_4K; + bool alignment8k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_8K; + bool alignment16k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_16K; + bool alignment32k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_32K; + bool alignment64k = volumeHeader->Attributes & EFI_FVB_ALIGNMENT_64K; // Check alignment setup if (!alignmentCap && @@ -511,7 +512,7 @@ UINT8 UEFITool::parseBios(const QByteArray & bios, QModelIndex & parent) // Adding tree item QByteArray header = bios.mid(volumeIndex, 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 if (parseCurrentVolume) { @@ -548,7 +549,7 @@ UINT32 UEFITool::getVolumeSize(const QByteArray & bios, INT32 volumeIndex) 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 // 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 if (header.count(empty) == header.size()) { QByteArray body = volume.right(volume.size() - fileIndex); - addTreeItem(ItemTypes::PaddingItem, 0, QByteArray(), body, parent); + addTreeItem(PaddingItem, 0, QByteArray(), body, parent); break; } @@ -693,7 +694,7 @@ UINT8 UEFITool::parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8 } // Add tree item - QModelIndex index = addTreeItem(ItemTypes::FileItem, fileHeader->Type, header, body, parent); + QModelIndex index = addTreeItem(FileItem, fileHeader->Type, header, body, parent); // Parse file if (parseCurrentFile) { @@ -721,7 +722,7 @@ UINT8 UEFITool::parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8 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 INT32 sectionIndex = 0; @@ -756,7 +757,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol { case EFI_NOT_COMPRESSED: 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 result = parseFile(body, revision, erasePolarity, index); if (result) @@ -765,7 +766,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol case EFI_STANDARD_COMPRESSION: //Must be Tiano for all revisions, needs checking 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 data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION)); @@ -794,7 +795,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol break; case EFI_CUSTOMIZED_COMPRESSION: 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 data = (VOID*) (file.constData() + sectionIndex + sizeof(EFI_COMPRESSION_SECTION)); @@ -825,7 +826,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol break; default: 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)); } @@ -833,7 +834,7 @@ UINT8 UEFITool::parseFile(const QByteArray & file, UINT8 revision, bool erasePol case EFI_SECTION_GUID_DEFINED: header = file.mid(sectionIndex, 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 guidDefinedSectionHeader = (EFI_GUID_DEFINED_SECTION*) (header.constData()); 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: header = file.mid(sectionIndex, 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; // Leaf sections case EFI_SECTION_PE32: header = file.mid(sectionIndex, 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; case EFI_SECTION_PIC: header = file.mid(sectionIndex, 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; case EFI_SECTION_TE: header = file.mid(sectionIndex, 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; case EFI_SECTION_VERSION: header = file.mid(sectionIndex, 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; case EFI_SECTION_USER_INTERFACE: header = file.mid(sectionIndex, 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; case EFI_SECTION_COMPATIBILITY16: header = file.mid(sectionIndex, 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; case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: 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)); - index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); + index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent); // Parse section body as BIOS space result = parseBios(body, index); 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: 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)); - index = addTreeItem(ItemTypes::SectionItem, sectionHeader->Type, header, body, parent); + index = addTreeItem(SectionItem, sectionHeader->Type, header, body, parent); break; case EFI_SECTION_RAW: header = file.mid(sectionIndex, 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 result = parseBios(body, index); 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: header = file.mid(sectionIndex, 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; case EFI_SECTION_PEI_DEPEX: header = file.mid(sectionIndex, 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; case EFI_SECTION_SMM_DEPEX: header = file.mid(sectionIndex, 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; default: debug(tr("Section with unknown type (%1)").arg(sectionHeader->Type, 2, 16, QChar('0'))); header = file.mid(sectionIndex, 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 diff --git a/uefitool.h b/uefitool.h index 2b17033..f36429c 100644 --- a/uefitool.h +++ b/uefitool.h @@ -33,10 +33,10 @@ #include "basetypes.h" #include "descriptor.h" #include "ffs.h" -#include "Tiano\EfiTianoCompress.h" -#include "Tiano\EfiTianoDecompress.h" -#include "LZMA\LzmaCompress.h" -#include "LZMA\LzmaDecompress.h" +#include "Tiano/EfiTianoCompress.h" +#include "Tiano/EfiTianoDecompress.h" +#include "LZMA/LzmaCompress.h" +#include "LZMA/LzmaDecompress.h" namespace Ui { class UEFITool; @@ -74,11 +74,11 @@ private: UINT8 parseInputFile(const QByteArray & buffer); 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); UINT32 getVolumeSize(const QByteArray & bios, INT32 volumeIndex); - UINT8 parseVolume(const QByteArray & volume, UINT32 volumeBase, UINT8 revision, bool erasePolarity, QModelIndex & parent = QModelIndex()); - UINT8 parseFile(const QByteArray & file, 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, const QModelIndex & parent = QModelIndex()); }; #endif diff --git a/uefitool.ui b/uefitool.ui index 4343608..5444e93 100644 --- a/uefitool.ui +++ b/uefitool.ui @@ -20,7 +20,7 @@ true - UEFITool 0.2.1 + UEFITool 0.2.2