From 10e2e601835411c18d4cb45e1aa95a31be2bdb4d Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Sun, 28 Aug 2022 12:01:43 +0200 Subject: [PATCH] Off with that PRI*Q bullshit --- common/ffsparser.cpp | 114 ++++++++++++++++++++--------------------- common/ffsreport.cpp | 2 +- common/meparser.cpp | 20 ++++---- common/nvramparser.cpp | 60 +++++++++++----------- common/uinttypes.h | 16 ------ 5 files changed, 98 insertions(+), 114 deletions(-) diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index b8ba089..e915c4f 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -161,7 +161,7 @@ USTATUS FfsParser::parseGenericImage(const UByteArray & buffer, const UINT32 loc { // Parse as generic UEFI image UString name("UEFI image"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", buffer.size(), buffer.size()); + UString info = usprintf("Full size: %Xh (%u)", buffer.size(), buffer.size()); // Add tree item index = model->addItem(localOffset, Types::Image, Subtypes::UefiImage, name, UString(), info, UByteArray(), buffer, UByteArray(), Fixed, parent); @@ -208,7 +208,7 @@ USTATUS FfsParser::parseCapsule(const UByteArray & capsule, const UINT32 localOf UByteArray body = capsule.mid(capsuleHeaderSize); UString name("UEFI capsule"); UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleGuid, false) + - usprintf("\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", capsule.size(), capsule.size(), capsuleHeaderSize, capsuleHeaderSize, capsuleHeader->CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleImageSize - capsuleHeaderSize, @@ -240,7 +240,7 @@ USTATUS FfsParser::parseCapsule(const UByteArray & capsule, const UINT32 localOf UByteArray body = capsule.mid(capsuleHeaderSize); UString name("Toshiba capsule"); UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleGuid, false) + - usprintf("\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", capsule.size(), capsule.size(), capsuleHeaderSize, capsuleHeaderSize, capsuleHeader->FullSize - capsuleHeaderSize, capsuleHeader->FullSize - capsuleHeaderSize, @@ -281,7 +281,7 @@ USTATUS FfsParser::parseCapsule(const UByteArray & capsule, const UINT32 localOf UByteArray body = capsule.mid(capsuleHeaderSize); UString name("AMI Aptio capsule"); UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleHeader.CapsuleGuid, false) + - usprintf("\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", capsule.size(), capsule.size(), capsuleHeaderSize, capsuleHeaderSize, capsuleHeader->CapsuleHeader.CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleHeader.CapsuleImageSize - capsuleHeaderSize, @@ -485,7 +485,7 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l // Intel image UString name("Intel image"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nFlash chips: %u\nRegions: %u\nMasters: %u\nPCH straps: %u\nPROC straps: %u", + UString info = usprintf("Full size: %Xh (%u)\nFlash chips: %u\nRegions: %u\nMasters: %u\nPCH straps: %u\nPROC straps: %u", intelImage.size(), intelImage.size(), descriptorMap->NumberOfFlashChips + 1, // descriptorMap->NumberOfRegions + 1, // Zero-based numbers in storage @@ -648,7 +648,7 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item @@ -680,7 +680,7 @@ USTATUS FfsParser::parseGbeRegion(const UByteArray & gbe, const UINT32 localOffs UString name("GbE region"); const GBE_MAC_ADDRESS* mac = (const GBE_MAC_ADDRESS*)gbe.constData(); const GBE_VERSION* version = (const GBE_VERSION*)(gbe.constData() + GBE_VERSION_OFFSET); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nMAC: %02X:%02X:%02X:%02X:%02X:%02X\nVersion: %u.%u", + UString info = usprintf("Full size: %Xh (%u)\nMAC: %02X:%02X:%02X:%02X:%02X:%02X\nVersion: %u.%u", gbe.size(), gbe.size(), mac->vendor[0], mac->vendor[1], mac->vendor[2], mac->device[0], mac->device[1], mac->device[2], @@ -701,7 +701,7 @@ USTATUS FfsParser::parseMeRegion(const UByteArray & me, const UINT32 localOffset // Get info UString name("ME region"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", me.size(), me.size()); + UString info = usprintf("Full size: %Xh (%u)", me.size(), me.size()); // Parse region bool versionFound = true; @@ -764,7 +764,7 @@ USTATUS FfsParser::parsePdrRegion(const UByteArray & pdr, const UINT32 localOffs // Get info UString name("PDR region"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", pdr.size(), pdr.size()); + UString info = usprintf("Full size: %Xh (%u)", pdr.size(), pdr.size()); // Add tree item index = model->addItem(localOffset, Types::Region, Subtypes::PdrRegion, name, UString(), info, UByteArray(), pdr, UByteArray(), Fixed, parent); @@ -785,7 +785,7 @@ USTATUS FfsParser::parseDevExp1Region(const UByteArray & devExp1, const UINT32 l // Get info UString name("DevExp1 region"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", devExp1.size(), devExp1.size()); + UString info = usprintf("Full size: %Xh (%u)", devExp1.size(), devExp1.size()); bool emptyRegion = false; // Check for empty region @@ -812,7 +812,7 @@ USTATUS FfsParser::parseGenericRegion(const UINT8 subtype, const UByteArray & re // Get info UString name = itemSubtypeToUString(Types::Region, subtype) + UString(" region"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", region.size(), region.size()); + UString info = usprintf("Full size: %Xh (%u)", region.size(), region.size()); // Add tree item index = model->addItem(localOffset, Types::Region, subtype, name, UString(), info, UByteArray(), region, UByteArray(), Fixed, parent); @@ -828,7 +828,7 @@ USTATUS FfsParser::parseBiosRegion(const UByteArray & bios, const UINT32 localOf // Get info UString name("BIOS region"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", bios.size(), bios.size()); + UString info = usprintf("Full size: %Xh (%u)", bios.size(), bios.size()); // Add tree item index = model->addItem(localOffset, Types::Region, Subtypes::BiosRegion, name, UString(), info, UByteArray(), bios, UByteArray(), Fixed, parent); @@ -873,7 +873,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index) // Get info UByteArray padding = data.left(prevItemOffset); name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item model->addItem(headerSize, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -894,7 +894,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index) // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item model->addItem(headerSize + paddingOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -907,7 +907,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index) // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item UModelIndex paddingIndex = model->addItem(headerSize + itemOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -947,7 +947,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index) // Get info name = UString("BPDT region"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", bpdtStore.size(), bpdtStore.size()); + info = usprintf("Full size: %Xh (%u)", bpdtStore.size(), bpdtStore.size()); // Add tree item UModelIndex bpdtIndex = model->addItem(headerSize + itemOffset, Types::BpdtStore, 0, name, UString(), info, UByteArray(), bpdtStore, UByteArray(), Fixed, index); @@ -980,7 +980,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index) // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item model->addItem(headerSize + itemOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -1022,7 +1022,7 @@ USTATUS FfsParser::parseVolumeHeader(const UByteArray & volume, const UINT32 loc // Check that there is space for the volume header if ((UINT32)volume.size() < sizeof(EFI_FIRMWARE_VOLUME_HEADER)) { - msg(usprintf("%s: input volume size %" PRIXQ "h (%" PRIuQ ") is smaller than volume header size 40h (64)", __FUNCTION__, volume.size(), volume.size())); + msg(usprintf("%s: input volume size %Xh (%u) is smaller than volume header size 40h (64)", __FUNCTION__, volume.size(), volume.size())); return U_INVALID_VOLUME; } @@ -1415,7 +1415,7 @@ USTATUS FfsParser::parseVolumeNonUefiData(const UByteArray & data, const UINT32 return U_INVALID_PARAMETER; // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", data.size(), data.size()); + UString info = usprintf("Full size: %Xh (%u)", data.size(), data.size()); // Add padding tree item UModelIndex paddingIndex = model->addItem(localOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), data, UByteArray(), Fixed, index); @@ -1514,7 +1514,7 @@ USTATUS FfsParser::parseVolumeBody(const UModelIndex & index) UByteArray free = freeSpace.left(i); // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", free.size(), free.size()); + UString info = usprintf("Full size: %Xh (%u)", free.size(), free.size()); // Add free space item model->addItem(volumeHeaderSize + fileOffset, Types::FreeSpace, 0, UString("Volume free space"), UString(), info, UByteArray(), free, UByteArray(), Movable, index); @@ -1525,7 +1525,7 @@ USTATUS FfsParser::parseVolumeBody(const UModelIndex & index) } else { // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", freeSpace.size(), freeSpace.size()); + UString info = usprintf("Full size: %Xh (%u)", freeSpace.size(), freeSpace.size()); // Add free space item model->addItem(volumeHeaderSize + fileOffset, Types::FreeSpace, 0, UString("Volume free space"), UString(), info, UByteArray(), freeSpace, UByteArray(), Movable, index); @@ -1747,7 +1747,7 @@ USTATUS FfsParser::parseFileHeader(const UByteArray & file, const UINT32 localOf } info = UString("File GUID: ") + guidToUString(fileHeader->Name, false) + - usprintf("\nType: %02Xh\nAttributes: %02Xh\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nTail size: %" PRIXQ "h (%" PRIuQ ")\nState: %02Xh", + usprintf("\nType: %02Xh\nAttributes: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nTail size: %Xh (%u)\nState: %02Xh", fileHeader->Type, fileHeader->Attributes, header.size() + body.size() + tail.size(), header.size() + body.size() + tail.size(), @@ -1926,7 +1926,7 @@ USTATUS FfsParser::parsePadFileBody(const UModelIndex & index) UByteArray free = body.left(nonEmptyByteOffset); // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", free.size(), free.size()); + UString info = usprintf("Full size: %Xh (%u)", free.size(), free.size()); // Add tree item model->addItem(headerSize, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), free, UByteArray(), Movable, index); @@ -1939,7 +1939,7 @@ USTATUS FfsParser::parsePadFileBody(const UModelIndex & index) UByteArray padding = body.mid(nonEmptyByteOffset); // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item UModelIndex dataIndex = model->addItem(headerSize + nonEmptyByteOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -1990,7 +1990,7 @@ USTATUS FfsParser::parseSections(const UByteArray & sections, const UModelIndex UByteArray padding = sections.mid(sectionOffset); // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item UModelIndex dataIndex = model->addItem(headerSize + sectionOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -2131,7 +2131,7 @@ USTATUS FfsParser::parseCommonSectionHeader(const UByteArray & section, const UI // Get info UString name = sectionTypeToUString(type) + UString(" section"); - UString info = usprintf("Type: %02Xh\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %Xh (%u)\nBody size: %" PRIXQ "h (%" PRIuQ ")", + UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", type, section.size(), section.size(), headerSize, headerSize, @@ -2192,7 +2192,7 @@ USTATUS FfsParser::parseCompressedSectionHeader(const UByteArray & section, cons // Get info UString name = sectionTypeToUString(sectionHeader->Type) + UString(" section"); - UString info = usprintf("Type: %02Xh\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %Xh (%u)\nBody size: %" PRIXQ "h (%" PRIuQ ")\nCompression type: %02Xh\nDecompressed size: %Xh (%u)", + UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nCompression type: %02Xh\nDecompressed size: %Xh (%u)", sectionHeader->Type, section.size(), section.size(), headerSize, headerSize, @@ -2362,7 +2362,7 @@ USTATUS FfsParser::parseGuidedSectionHeader(const UByteArray & section, const UI // Get info UString name = guidToUString(guid); UString info = UString("Section GUID: ") + guidToUString(guid, false) + - usprintf("\nType: %02Xh\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nData offset: %Xh\nAttributes: %04Xh", + usprintf("\nType: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nData offset: %Xh\nAttributes: %04Xh", sectionHeader->Type, section.size(), section.size(), header.size(), header.size(), @@ -2450,7 +2450,7 @@ USTATUS FfsParser::parseFreeformGuidedSectionHeader(const UByteArray & section, // Get info UString name = sectionTypeToUString(type) + (" section"); - UString info = usprintf("Type: %02Xh\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nSubtype GUID: ", + UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nSubtype GUID: ", type, section.size(), section.size(), header.size(), header.size(), @@ -2517,7 +2517,7 @@ USTATUS FfsParser::parseVersionSectionHeader(const UByteArray & section, const U // Get info UString name = sectionTypeToUString(type) + (" section"); - UString info = usprintf("Type: %02Xh\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nBuild number: %u", + UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nBuild number: %u", type, section.size(), section.size(), header.size(), header.size(), @@ -2576,7 +2576,7 @@ USTATUS FfsParser::parsePostcodeSectionHeader(const UByteArray & section, const // Get info UString name = sectionTypeToUString(type) + (" section"); - UString info = usprintf("Type: %02Xh\nFull size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nPostcode: %Xh", + UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nPostcode: %Xh", type, section.size(), section.size(), header.size(), header.size(), @@ -2657,12 +2657,12 @@ USTATUS FfsParser::parseCompressedSectionBody(const UModelIndex & index) // Check reported uncompressed size if (uncompressedSize != (UINT32)decompressed.size()) { - msg(usprintf("%s: decompressed size stored in header %Xh (%u) differs from actual %" PRIXQ "h (%" PRIuQ ")", + msg(usprintf("%s: decompressed size stored in header %Xh (%u) differs from actual %Xh (%u)", __FUNCTION__, uncompressedSize, uncompressedSize, decompressed.size(), decompressed.size()), index); - model->addInfo(index, usprintf("\nActual decompressed size: %" PRIXQ "h (%" PRIuQ ")", decompressed.size(), decompressed.size())); + model->addInfo(index, usprintf("\nActual decompressed size: %Xh (%u)", decompressed.size(), decompressed.size())); } // Check for undecided compression algorithm, this is a special case @@ -2753,7 +2753,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index) } info += UString("\nCompression algorithm: ") + compressionTypeToUString(algorithm); - info += usprintf("\nDecompressed size: %" PRIXQ "h (%" PRIuQ ")", processed.size(), processed.size()); + info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); } // LZMA compressed section else if (baGuid == EFI_GUIDED_SECTION_LZMA @@ -2766,7 +2766,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index) if (algorithm == COMPRESSION_ALGORITHM_LZMA) { info += UString("\nCompression algorithm: LZMA"); - info += usprintf("\nDecompressed size: %" PRIXQ "h (%" PRIuQ ")", processed.size(), processed.size()); + info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); info += usprintf("\nLZMA dictionary size: %Xh", dictionarySize); } else { @@ -2784,7 +2784,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index) if (algorithm == COMPRESSION_ALGORITHM_LZMAF86) { info += UString("\nCompression algorithm: LZMAF86"); - info += usprintf("\nDecompressed size: %" PRIXQ "h (%" PRIuQ ")", processed.size(), processed.size()); + info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); info += usprintf("\nLZMA dictionary size: %Xh", dictionarySize); } else { @@ -2801,7 +2801,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index) } info += UString("\nCompression algorithm: GZip"); - info += usprintf("\nDecompressed size: %" PRIXQ "h (%" PRIuQ ")", processed.size(), processed.size()); + info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); } // Add info @@ -4306,7 +4306,7 @@ USTATUS FfsParser::parseMicrocodeVolumeBody(const UModelIndex & index) if (offset < bodySize) { // Get info UString name = UString("Padding"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", ucode.size(), ucode.size()); + UString info = usprintf("Full size: %Xh (%u)", ucode.size(), ucode.size()); // Add tree item model->addItem(headerSize + offset, Types::Padding, getPaddingType(ucode), name, UString(), info, UByteArray(), ucode, UByteArray(), Fixed, index); @@ -4427,7 +4427,7 @@ USTATUS FfsParser::parseIntelMicrocodeHeader(const UByteArray & microcode, const // Add info UString name("Intel microcode"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: 0h (0u)\nBody size: %" PRIXQ "h (%" PRIuQ ")\nTail size: 0h (0u)\n" + UString info = usprintf("Full size: %Xh (%u)\nHeader size: 0h (0u)\nBody size: %Xh (%u)\nTail size: 0h (0u)\n" "Date: %02X.%02X.%04x\nCPU signature: %08Xh\nRevision: %08Xh\nCPU flags: %02Xh\nChecksum: %08Xh, ", microcodeBinary.size(), microcodeBinary.size(), microcodeBinary.size(), microcodeBinary.size(), @@ -4446,7 +4446,7 @@ USTATUS FfsParser::parseIntelMicrocodeHeader(const UByteArray & microcode, const if (msgInvalidChecksum) msg(usprintf("%s: invalid microcode checksum %08Xh, should be %08Xh", __FUNCTION__, ucodeHeader->Checksum, calculated), index); if (msgUnknownOrDamagedMicrocodeTail) - msg(usprintf("%s: extended header of size %" PRIXQ "h (%" PRIuQ ") found, but it's damaged or has unknown format", __FUNCTION__, tail.size(), tail.size()), index); + msg(usprintf("%s: extended header of size %Xh (%u) found, but it's damaged or has unknown format", __FUNCTION__, tail.size(), tail.size()), index); // No need to parse the body further for now return U_SUCCESS; @@ -4478,7 +4478,7 @@ USTATUS FfsParser::parseBpdtRegion(const UByteArray & region, const UINT32 local UByteArray body = region.mid(sizeof(BPDT_HEADER), ptBodySize); UString name = UString("BPDT partition table"); - UString info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nNumber of entries: %u\nVersion: %2Xh\n" + UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u\nVersion: %2Xh\n" "IFWI version: %Xh\nFITC version: %u.%u.%u.%u", ptSize, ptSize, header.size(), header.size(), @@ -4537,7 +4537,7 @@ USTATUS FfsParser::parseBpdtRegion(const UByteArray & region, const UINT32 local // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", + info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); // Add tree item @@ -4619,7 +4619,7 @@ make_partition_table_consistent: UByteArray partition = region.mid(partitions[i].ptEntry.Offset, partitions[i].ptEntry.Size); UByteArray signature = partition.left(sizeof(UINT32)); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nType: %Xh", + UString info = usprintf("Full size: %Xh (%u)\nType: %Xh", partition.size(), partition.size(), partitions[i].ptEntry.Type) + UString("\nSplit sub-partition first part: ") + (partitions[i].ptEntry.SplitSubPartitionFirstPart ? "Yes" : "No") + @@ -4659,7 +4659,7 @@ make_partition_table_consistent: // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item @@ -4674,7 +4674,7 @@ make_partition_table_consistent: // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item @@ -4721,7 +4721,7 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO UByteArray header = region.left(ptHeaderSize); UByteArray body = region.mid(ptHeaderSize, ptBodySize); UString name = usprintf("CPD partition table"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nNumber of entries: %u\n" + UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u\n" "Header version: %u\nEntry version: %u", ptSize, ptSize, header.size(), header.size(), @@ -4744,7 +4744,7 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO // Get info name = usprintf("%.12s", cpdEntry->EntryName); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nEntry offset: %Xh\nEntry length: %Xh\nHuffman compressed: ", + info = usprintf("Full size: %Xh (%u)\nEntry offset: %Xh\nEntry length: %Xh\nHuffman compressed: ", entry.size(), entry.size(), cpdEntry->Offset.Offset, cpdEntry->Length) @@ -4773,7 +4773,7 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", + info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); // Add tree item @@ -4953,7 +4953,7 @@ make_partition_table_consistent: UByteArray header = partition.left(manifestHeader->HeaderLength * sizeof(UINT32)); UByteArray body = partition.mid(manifestHeader->HeaderLength * sizeof(UINT32)); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")" + info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)" "\nHeader type: %u\nHeader length: %lXh (%lu)\nHeader version: %Xh\nFlags: %08Xh\nVendor: %Xh\n" "Date: %Xh\nSize: %lXh (%lu)\nVersion: %u.%u.%u.%u\nSecurity version number: %u\nModulus size: %lXh (%lu)\nExponent size: %lXh (%lu)", partition.size(), partition.size(), @@ -4981,7 +4981,7 @@ make_partition_table_consistent: } // It's a metadata else if (name.endsWith(".met")) { - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nHuffman compressed: ", + info = usprintf("Full size: %Xh (%u)\nHuffman compressed: ", partition.size(), partition.size()) + (partitions[i].ptEntry.Offset.HuffmanCompressed ? "Yes" : "No"); @@ -4998,7 +4998,7 @@ make_partition_table_consistent: } // It's a code else { - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nHuffman compressed: ", + info = usprintf("Full size: %Xh (%u)\nHuffman compressed: ", partition.size(), partition.size()) + (partitions[i].ptEntry.Offset.HuffmanCompressed ? "Yes" : "No"); @@ -5016,7 +5016,7 @@ make_partition_table_consistent: // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", partition.size(), partition.size()); + info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); // Add tree item model->addItem(localOffset + partitions[i].ptEntry.Offset.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); @@ -5044,7 +5044,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index) UByteArray partition = body.mid(offset, extHeader->Length); UString name = cpdExtensionTypeToUstring(extHeader->Type); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nType: %Xh", partition.size(), partition.size(), extHeader->Type); + UString info = usprintf("Full size: %Xh (%u)\nType: %Xh", partition.size(), partition.size(), extHeader->Type); // Parse Signed Package Info a bit further UModelIndex extIndex; @@ -5054,7 +5054,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index) const CPD_EXT_SIGNED_PACKAGE_INFO* infoHeader = (const CPD_EXT_SIGNED_PACKAGE_INFO*)header.constData(); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nType: %Xh\n" + info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %Xh\n" "Package name: %.4s\nVersion control number: %Xh\nSecurity version number: %Xh\n" "Usage bitmap: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", partition.size(), partition.size(), @@ -5090,7 +5090,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index) UByteArray hash((const char*)&attrHeader->CompletePartitionHash, hashSize); std::reverse(hash.begin(), hash.end()); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nType: %Xh\n" + info = usprintf("Full size: %Xh (%u)\nType: %Xh\n" "Partition name: %.4s\nPartition length: %Xh\nPartition version major: %Xh\nPartition version minor: %Xh\n" "Data format version: %Xh\nInstance ID: %Xh\nHash algorithm: %Xh\nHash size: %Xh\nAction on update: %Xh", partition.size(), partition.size(), @@ -5128,7 +5128,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index) UByteArray hash((const char*)attrHeader + CpdExtModuleImageHashOffset, hashSize); std::reverse(hash.begin(), hash.end()); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nType: %Xh\n" + info = usprintf("Full size: %Xh (%u)\nType: %Xh\n" "Compression type: %Xh\nUncompressed size: %Xh (%u)\nCompressed size: %Xh (%u)\nGlobal module ID: %Xh\nImage hash: ", partition.size(), partition.size(), attrHeader->ExtensionType, @@ -5185,7 +5185,7 @@ USTATUS FfsParser::parseSignedPackageInfoData(const UModelIndex & index) UByteArray hash((const char*)moduleHeader + CpdExtSignedPkgMetadataHashOffset, moduleHeader->HashSize); std::reverse(hash.begin(), hash.end()); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nType: %Xh\nHash algorithm: %Xh\nHash size: %Xh (%u)\nMetadata size: %Xh (%u)\nMetadata hash: ", + UString info = usprintf("Full size: %Xh (%u)\nType: %Xh\nHash algorithm: %Xh\nHash size: %Xh (%u)\nMetadata size: %Xh (%u)\nMetadata hash: ", module.size(), module.size(), moduleHeader->Type, moduleHeader->HashAlgorithm, diff --git a/common/ffsreport.cpp b/common/ffsreport.cpp index c19b532..8ece221 100644 --- a/common/ffsreport.cpp +++ b/common/ffsreport.cpp @@ -63,7 +63,7 @@ USTATUS FfsReport::generateRecursive(std::vector & report, const UModel UString(" ") + itemTypeToUString(model->type(index)).leftJustified(16) + UString("| ") + itemSubtypeToUString(model->type(index), model->subtype(index)).leftJustified(22) + offset - + usprintf("| %08" PRIXQ " | %08X | ", data.size(), crc) + + usprintf("| %08X | %08X | ", data.size(), crc) + urepeated('-', level) + UString(" ") + model->name(index) + (text.isEmpty() ? UString() : UString(" | ") + text) ); diff --git a/common/meparser.cpp b/common/meparser.cpp index 2acbb14..e993058 100755 --- a/common/meparser.cpp +++ b/common/meparser.cpp @@ -137,7 +137,7 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex & if (ptHeader->HeaderVersion == FPT_HEADER_VERSION_21) { const FPT_HEADER_21* ptHeader21 = (const FPT_HEADER_21*)ptHeader; - info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n" + info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n" "Header length: %02Xh\nFlags: %Xh\nTicks to add: %04Xh\nTokens to add: %04Xh\nSPS Flags: %Xh\nFITC version: %u.%u.%u.%u\nCRC32 Checksum: %08Xh", ptSize, ptSize, header.size(), header.size(), @@ -157,7 +157,7 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex & } // Default handling for all other versions, may be too generic in some corner cases else { - info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n" + info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n" "Header length: %02Xh\nFlash cycle life: %04Xh\nFlash cycle limit: %04Xh\nUMA size: %Xh\nFlags: %Xh\nFITC version: %u.%u.%u.%u\nChecksum: %02Xh", ptSize, ptSize, header.size(), header.size(), @@ -294,7 +294,7 @@ make_partition_table_consistent: UModelIndex partitionIndex; // Get info name = visibleAsciiOrHex((UINT8*) partitions[i].ptEntry.Name, 4); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nPartition type: %02Xh\n", + info = usprintf("Full size: %Xh (%u)\nPartition type: %02Xh\n", partition.size(), partition.size(), partitions[i].ptEntry.Type); @@ -310,7 +310,7 @@ make_partition_table_consistent: else if (partitions[i].type == Types::Padding) { // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", partition.size(), partition.size()); + info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); // Add tree item model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); @@ -335,7 +335,7 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex UByteArray header = region.left(ptSize); UString name = UString("IFWI 1.6 header"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n" + UString info = usprintf("Full size: %Xh (%u)\n" "Data partition offset: %Xh\nData partition size: %Xh\n" "Boot1 partition offset: %Xh\nBoot1 partition size: %Xh\n" "Boot2 partition offset: %Xh\nBoot2 partition size: %Xh\n" @@ -457,7 +457,7 @@ make_partition_table_consistent: } // Get info - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n", + info = usprintf("Full size: %Xh (%u)\n", partition.size(), partition.size()); // Add tree item @@ -477,7 +477,7 @@ make_partition_table_consistent: else if (partitions[i].type == Types::Padding) { // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", partition.size(), partition.size()); + info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); // Add tree item model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); @@ -503,7 +503,7 @@ USTATUS MeParser::parseIfwi17Region(const UByteArray & region, const UModelIndex UByteArray header = region.left(ptSize); UString name = UString("IFWI 1.7 header"); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n" + UString info = usprintf("Full size: %Xh (%u)\n" "Flags: %02Xh\n" "Reserved: %02Xh\n" "Checksum: %Xh\n" @@ -643,7 +643,7 @@ make_partition_table_consistent: } // Get info - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n", + info = usprintf("Full size: %Xh (%u)\n", partition.size(), partition.size()); // Add tree item @@ -663,7 +663,7 @@ make_partition_table_consistent: else if (partitions[i].type == Types::Padding) { // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", partition.size(), partition.size()); + info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); // Add tree item model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); diff --git a/common/nvramparser.cpp b/common/nvramparser.cpp index 58bfa88..2da6530 100755 --- a/common/nvramparser.cpp +++ b/common/nvramparser.cpp @@ -92,7 +92,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index) UByteArray padding = data.mid(offset, unparsedSize); // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); if ((UINT32)padding.count(emptyByte) == unparsedSize) { // Free space // Add tree item @@ -113,7 +113,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index) UByteArray guidArea = data.right(guidAreaSize); // Get info name = UString("GUID store"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nGUIDs in store: %u", + info = usprintf("Full size: %Xh (%u)\nGUIDs in store: %u", guidArea.size(), guidArea.size(), guidsInStore); // Add tree item @@ -315,7 +315,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index) info += usprintf("GUID index: %u\n", guidIndex); // Add header, body and extended data info - info += usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")", + info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", entryHeader->Size, entryHeader->Size, header.size(), header.size(), body.size(), body.size()); @@ -358,9 +358,9 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index) // Show messages if (msgUnknownExtDataFormat) msg(usprintf("%s: unknown extended data format", __FUNCTION__), varIndex); - if (msgExtHeaderTooLong) msg(usprintf("%s: extended header size (%Xh) is greater than body size (%" PRIXQ "h)", __FUNCTION__, + if (msgExtHeaderTooLong) msg(usprintf("%s: extended header size (%Xh) is greater than body size (%Xh)", __FUNCTION__, extendedHeaderSize, body.size()), varIndex); - if (msgExtDataTooShort) msg(usprintf("%s: extended header size (%" PRIXQ "h) is too small for timestamp and hash", __FUNCTION__, + if (msgExtDataTooShort) msg(usprintf("%s: extended header size (%Xh) is too small for timestamp and hash", __FUNCTION__, tail.size()), varIndex); // Try parsing the entry data as NVAR storage if it begins with NVAR signature @@ -409,7 +409,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index) // Get info UByteArray padding = data.left(prevStoreOffset); name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item model->addItem(localOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -428,7 +428,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index) // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item model->addItem(localOffset + paddingOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -449,7 +449,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index) // Get info name = UString("Padding"); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); // Add tree item UModelIndex paddingIndex = model->addItem(localOffset + storeOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); @@ -479,7 +479,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index) if ((UINT32)data.size() > storeOffset) { UByteArray padding = data.mid(storeOffset); // Add info - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); if (padding.count(emptyByte) == padding.size()) { // Free space // Add tree item @@ -804,7 +804,7 @@ USTATUS NvramParser::parseVssStoreHeader(const UByteArray & store, const UINT32 name = UString("VSS store"); } - UString info = usprintf("Signature: %Xh\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh", + UString info = usprintf("Signature: %Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh", vssStoreHeader->Signature, storeSize, storeSize, header.size(), header.size(), @@ -853,7 +853,7 @@ USTATUS NvramParser::parseVss2StoreHeader(const UByteArray & store, const UINT32 // Add info UString name = UString("VSS2 store"); UString info = UString("Signature: ") + guidToUString(vssStoreHeader->Signature, false) + - usprintf("\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh", + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh", storeSize, storeSize, header.size(), header.size(), body.size(), body.size(), @@ -923,7 +923,7 @@ USTATUS NvramParser::parseFtwStoreHeader(const UByteArray & store, const UINT32 // Add info UString name("FTW store"); UString info = UString("Signature: ") + guidToUString(ftw32BlockHeader->Signature, false) + - usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %" PRIXQ "h (%" PRIuQ ")\nState: %02Xh\nHeader CRC32: %08Xh", + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nHeader CRC32: %08Xh", ftwBlockSize, ftwBlockSize, headerSize, headerSize, body.size(), body.size(), @@ -964,7 +964,7 @@ USTATUS NvramParser::parseFdcStoreHeader(const UByteArray & store, const UINT32 // Add info UString name("FDC store"); - UString info = usprintf("Signature: _FDC\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")", + UString info = usprintf("Signature: _FDC\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", fdcStoreHeader->Size, fdcStoreHeader->Size, header.size(), header.size(), body.size(), body.size()); @@ -1007,7 +1007,7 @@ USTATUS NvramParser::parseFsysStoreHeader(const UByteArray & store, const UINT32 // Add info bool isGaidStore = (fsysStoreHeader->Signature == NVRAM_APPLE_GAID_STORE_SIGNATURE); UString name = isGaidStore ? UString("Gaid store") : UString("Fsys store"); - UString info = usprintf("Signature: %s\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nUnknown0: %02Xh\nUnknown1: %08Xh\nCRC32: %08Xh", + UString info = usprintf("Signature: %s\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nUnknown0: %02Xh\nUnknown1: %08Xh\nCRC32: %08Xh", isGaidStore ? "Gaid" : "Fsys", fsysStoreHeader->Size, fsysStoreHeader->Size, header.size(), header.size(), @@ -1053,7 +1053,7 @@ USTATUS NvramParser::parseEvsaStoreHeader(const UByteArray & store, const UINT32 // Add info UString name("EVSA store"); - UString info = usprintf("Signature: EVSA\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nType: %02Xh\nAttributes: %08Xh\nChecksum: %02Xh", + UString info = usprintf("Signature: EVSA\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nAttributes: %08Xh\nChecksum: %02Xh", evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize, header.size(), header.size(), body.size(), body.size(), @@ -1096,7 +1096,7 @@ USTATUS NvramParser::parseFlashMapStoreHeader(const UByteArray & store, const UI // Add info UString name("Phoenix SCT flash map"); - UString info = usprintf("Signature: _FLASH_MAP\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nNumber of entries: %u", + UString info = usprintf("Signature: _FLASH_MAP\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u", flashMapSize, flashMapSize, header.size(), header.size(), body.size(), body.size(), @@ -1135,7 +1135,7 @@ USTATUS NvramParser::parseCmdbStoreHeader(const UByteArray & store, const UINT32 // Add info UString name("CMDB store"); - UString info = usprintf("Signature: CMDB\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")", + UString info = usprintf("Signature: CMDB\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", cmdbSize, cmdbSize, header.size(), header.size(), body.size(), body.size()); @@ -1172,7 +1172,7 @@ USTATUS NvramParser::parseSlicPubkeyHeader(const UByteArray & store, const UINT3 // Add info UString name("SLIC pubkey"); - UString info = usprintf("Type: 0h\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: 0h (0)\n" + UString info = usprintf("Type: 0h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n" "Key type: %02Xh\nVersion: %02Xh\nAlgorithm: %08Xh\nMagic: RSA1\nBit length: %08Xh\nExponent: %08Xh", pubkeyHeader->Size, pubkeyHeader->Size, header.size(), header.size(), @@ -1214,7 +1214,7 @@ USTATUS NvramParser::parseSlicMarkerHeader(const UByteArray & store, const UINT3 // Add info UString name("SLIC marker"); - UString info = usprintf("Type: 1h\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: 0h (0)\n" + UString info = usprintf("Type: 1h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n" "Version: %08Xh\nOEM ID: %s\nOEM table ID: %s\nWindows flag: WINDOWS\nSLIC version: %08Xh", markerHeader->Size, markerHeader->Size, header.size(), header.size(), @@ -1475,7 +1475,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen // Check if the data left is a free space or a padding UByteArray padding = data.mid(offset, unparsedSize); // Get info - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size()); + UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); if (padding.count(emptyByte) == padding.size()) { // Free space // Add tree item @@ -1514,7 +1514,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen } // Add info - info += usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nState: %02Xh\nReserved: %02Xh\nAttributes: %08Xh (", + info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nReserved: %02Xh\nAttributes: %08Xh (", variableSize, variableSize, header.size(), header.size(), body.size(), body.size(), @@ -1595,7 +1595,7 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index) if (nameSize == 3 && name[0] == 'E' && name[1] == 'O' && name[2] == 'F') { // There is no data afterward, add EOF variable and free space and return UByteArray header = data.mid(offset, sizeof(UINT8) + nameSize); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", header.size(), header.size()); + UString info = usprintf("Full size: %Xh (%u)", header.size(), header.size()); // Add EOF tree item model->addItem(localOffset + offset, Types::FsysEntry, Subtypes::NormalFsysEntry, UString("EOF"), UString(), info, header, UByteArray(), UByteArray(), Fixed, index); @@ -1603,7 +1603,7 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index) // Add free space offset += header.size(); UByteArray body = data.mid(offset); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size()); + info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); // Add free space tree item model->addItem(localOffset + offset, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index); @@ -1620,7 +1620,7 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index) else { // Last variable is bad, add the rest as padding and return UByteArray body = data.mid(offset); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size()); + UString info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); // Add padding tree item model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index); @@ -1636,7 +1636,7 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index) UByteArray body = data.mid(offset + sizeof(UINT8) + nameSize + sizeof(UINT16), dataSize); // Add info - UString info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")", + UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", variableSize, variableSize, header.size(), header.size(), body.size(), body.size()); @@ -1696,7 +1696,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index) variableSize = sizeof(EVSA_ENTRY_HEADER); if (unparsedSize < variableSize || unparsedSize < entryHeader->Size) { body = data.mid(offset); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size()); + info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); if (body.count(emptyByte) == body.size()) { // Free space // Add free space tree item @@ -1724,7 +1724,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index) body = data.mid(offset + sizeof(EVSA_GUID_ENTRY), guidHeader->Header.Size - sizeof(EVSA_GUID_ENTRY)); EFI_GUID guid = *(EFI_GUID*)body.constData(); name = guidToUString(guid); - info = UString("GUID: ") + guidToUString(guid, false) + usprintf("\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nType: %02Xh\nChecksum: %02Xh", + info = UString("GUID: ") + guidToUString(guid, false) + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh", variableSize, variableSize, header.size(), header.size(), body.size(), body.size(), @@ -1748,7 +1748,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index) name = UString::fromUtf16((const CHAR16*)body.constData()); #endif - info = UString("Name: ") + name + usprintf("\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nType: %02Xh\nChecksum: %02Xh", + info = UString("Name: ") + name + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh", variableSize, variableSize, header.size(), header.size(), body.size(), body.size(), @@ -1794,7 +1794,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index) // Unknown entry or free space else { body = data.mid(offset); - info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size()); + info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); if (body.count(emptyByte) == body.size()) { // Free space // Add free space tree item @@ -1888,7 +1888,7 @@ USTATUS NvramParser::parseFlashMapBody(const UModelIndex & index) if (unparsedSize < sizeof(PHOENIX_FLASH_MAP_ENTRY)) { // Last variable is bad, add the rest as padding and return UByteArray body = data.mid(offset); - UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size()); + UString info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); // Add padding tree item model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index); diff --git a/common/uinttypes.h b/common/uinttypes.h index 0d767e8..e104dc0 100644 --- a/common/uinttypes.h +++ b/common/uinttypes.h @@ -19,22 +19,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include -#if QT_VERSION_MAJOR >= 6 -# define PRIdQ __PRI_64_LENGTH_MODIFIER__ "d" -# define PRIiQ __PRI_64_LENGTH_MODIFIER__ "i" -# define PRIoQ __PRI_64_LENGTH_MODIFIER__ "o" -# define PRIuQ __PRI_64_LENGTH_MODIFIER__ "u" -# define PRIxQ __PRI_64_LENGTH_MODIFIER__ "x" -# define PRIXQ __PRI_64_LENGTH_MODIFIER__ "X" -#else -# define PRIdQ "d" -# define PRIiQ "i" -# define PRIoQ "o" -# define PRIuQ "u" -# define PRIxQ "x" -# define PRIXQ "X" -#endif - #if defined(__clang__) || defined(__GNUC__) #define ATTRIBUTE_FORMAT_(t,f,a) __attribute__((format(t, f, a))) #else