diff --git a/ffs.h b/ffs.h index 1c737b7..56455c7 100644 --- a/ffs.h +++ b/ffs.h @@ -99,8 +99,6 @@ const QByteArray EFI_APPLE_BOOT_VOLUME_FILE_SYSTEM_GUID const QByteArray EFI_FIRMWARE_FILE_SYSTEM2_GUID ("\x78\xE5\x8C\x8C\x3D\x8A\x1C\x4F\x99\x35\x89\x61\x85\xC3\x2D\xD3", 16); - - // Firmware volume signature const QByteArray EFI_FV_SIGNATURE("_FVH", 4); #define EFI_FV_SIGNATURE_OFFSET 0x28 @@ -216,7 +214,6 @@ typedef struct { //UINT8 Data[]; } EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE; - // Volume header 16bit checksum calculation routine extern UINT16 calculateChecksum16(UINT16* buffer, UINT32 bufferSize); @@ -305,13 +302,6 @@ extern const UINT8 ffsAlignmentTable[]; const QByteArray EFI_FFS_VOLUME_TOP_FILE_GUID ("\x2E\x06\xA0\x1B\x79\xC7\x82\x45\x85\x66\x33\x6A\xE8\xF7\x8F\x09", 16); -// AMI volume top file -// This file must also be located near the end volume, right before VTF -const QByteArray EFI_AMI_FFS_FILE_BEFORE_VTF_GUID -("\x50\x9F\xE5\xD1\xC3\xE8\x45\x45\xBF\x61\x11\xF0\x02\x23\x3C\x97", 16); -// Offset of this file -#define EFI_AMI_FFS_FILE_BEFORE_VTF_OFFSET 0xEF0 - // FFS size conversion routines extern VOID uint32ToUint24(UINT32 size, UINT8* ffsSize); extern UINT32 uint24ToUint32(UINT8* ffsSize); diff --git a/ffsengine.cpp b/ffsengine.cpp index a800272..1f95901 100644 --- a/ffsengine.cpp +++ b/ffsengine.cpp @@ -2073,8 +2073,8 @@ out: UINT32 offset = 0; QByteArray vtf; QModelIndex vtfIndex; - QByteArray amiBeforeVtf; - QModelIndex amiBeforeVtfIndex; + //QByteArray amiBeforeVtf; + //QModelIndex amiBeforeVtfIndex; for (int i = 0; i < model->rowCount(index); i++) { // Align to 8 byte boundary UINT32 alignment = offset % 8; @@ -2101,11 +2101,11 @@ out: continue; // AMI file before VTF - if (file.left(sizeof(EFI_GUID)) == EFI_AMI_FFS_FILE_BEFORE_VTF_GUID) { - amiBeforeVtf = file; - amiBeforeVtfIndex = index.child(i, 0); - continue; - } + //if (file.left(sizeof(EFI_GUID)) == EFI_AMI_FFS_FILE_BEFORE_VTF_GUID) { + // amiBeforeVtf = file; + // amiBeforeVtfIndex = index.child(i, 0); + // continue; + //} // Volume Top File if (file.left(sizeof(EFI_GUID)) == EFI_FFS_VOLUME_TOP_FILE_GUID) { @@ -2146,49 +2146,6 @@ out: offset += file.size(); } - // Insert AMI file before VTF to it's correct place - if (!amiBeforeVtf.isEmpty()) { - // Determine correct offset - UINT32 amiOffset = volumeSize - header.size() - amiBeforeVtf.size() - EFI_AMI_FFS_FILE_BEFORE_VTF_OFFSET; - - // Insert pad file to fill the gap - if (amiOffset > offset) { - // Determine pad file size - UINT32 size = amiOffset - offset; - // Construct pad file - QByteArray pad; - result = constructPadFile(size, volumeHeader->Revision, polarity, pad); - if (result) - return result; - // Append constructed pad file to volume body - reconstructed.append(pad); - offset = amiOffset; - } - if (amiOffset < offset) { - msg(tr("reconstructVolume: %1: volume has no free space left").arg(guidToQString(volumeHeader->FileSystemGuid)), index); - return ERR_INVALID_VOLUME; - } - - // Reconstruct file again - result = reconstructFile(amiBeforeVtfIndex, volumeHeader->Revision, polarity, volumeBase + amiOffset, amiBeforeVtf); - if (result) - return result; - - // Append AMI file before VTF - reconstructed.append(amiBeforeVtf); - - // Change current file offset - offset += amiBeforeVtf.size(); - - // Align to 8 byte boundary - UINT32 alignment = offset % 8; - if (alignment) { - alignment = 8 - alignment; - offset += alignment; - reconstructed.append(QByteArray(alignment, empty)); - } - } - // Insert VTF to it's correct place if (!vtf.isEmpty()) { // Determine correct VTF offset @@ -2307,9 +2264,6 @@ UINT8 FfsEngine::reconstructFile(const QModelIndex& index, const UINT8 revision, return ERR_INVALID_PARAMETER; } - // Construct empty char for this file - char empty = (erasePolarity == ERASE_POLARITY_TRUE ? '\xFF' : '\x00'); - // Check file state // Invert it first if erase polarity is true UINT8 state = fileHeader->State; @@ -2365,7 +2319,7 @@ UINT8 FfsEngine::reconstructFile(const QModelIndex& index, const UINT8 revision, if (alignment) { alignment = 4 - alignment; offset += alignment; - reconstructed.append(QByteArray(alignment, empty)); + reconstructed.append(QByteArray(alignment, '\x00')); } // Calculate section base diff --git a/uefitool.cpp b/uefitool.cpp index 4f7dcbf..2f5fe8a 100644 --- a/uefitool.cpp +++ b/uefitool.cpp @@ -184,7 +184,6 @@ void UEFITool::insert(const UINT8 mode) TreeModel* model = ffsEngine->treeModel(); UINT8 type; - UINT8 objectType; if (mode == CREATE_MODE_BEFORE || mode == CREATE_MODE_AFTER) type = model->type(index.parent()); @@ -195,12 +194,10 @@ void UEFITool::insert(const UINT8 mode) switch (type) { case Volume: path = QFileDialog::getOpenFileName(this, tr("Select FFS file to insert"),".","FFS files (*.ffs *.bin);;All files (*.*)"); - objectType = File; break; case File: case Section: path = QFileDialog::getOpenFileName(this, tr("Select section file to insert"),".","Section files (*.sct *.bin);;All files (*.*)"); - objectType = Section; break; default: return; @@ -601,7 +598,6 @@ void UEFITool::readSettings() ui->structureTreeView->setColumnWidth(1, settings.value("tree/columnWidth1", ui->structureTreeView->columnWidth(1)).toInt()); ui->structureTreeView->setColumnWidth(2, settings.value("tree/columnWidth2", ui->structureTreeView->columnWidth(2)).toInt()); ui->structureTreeView->setColumnWidth(3, settings.value("tree/columnWidth3", ui->structureTreeView->columnWidth(3)).toInt()); - //ui->structureTreeView->setColumnWidth(4, settings.value("tree/columnWidth4", 10).toInt()); } void UEFITool::writeSettings() @@ -617,5 +613,4 @@ void UEFITool::writeSettings() settings.setValue("tree/columnWidth1", ui->structureTreeView->columnWidth(1)); settings.setValue("tree/columnWidth2", ui->structureTreeView->columnWidth(2)); settings.setValue("tree/columnWidth3", ui->structureTreeView->columnWidth(3)); - //settings.setValue("tree/columnWidth4", ui->structureTreeView->columnWidth(4)); } diff --git a/uefitool.ui b/uefitool.ui index 70f30a8..dcf3045 100644 --- a/uefitool.ui +++ b/uefitool.ui @@ -20,7 +20,7 @@ true - UEFITool 0.16.1 + UEFITool 0.16.2 @@ -33,7 +33,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -53,7 +62,16 @@ 0 - + + 5 + + + 5 + + + 5 + + 5 @@ -91,7 +109,16 @@ 0 - + + 5 + + + 5 + + + 5 + + 5 @@ -121,7 +148,16 @@ 0 - + + 5 + + + 5 + + + 5 + + 5