mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-13 06:34:42 -04:00
Version 0.16.2
- solved minor bug in section reconstruction - removed some useless and dead code
This commit is contained in:
parent
5789e2f9e6
commit
4edeb4fbef
4 changed files with 49 additions and 74 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue