Version 0.16.5

- solved a bug in reconstructFile while reconstructing raw files with
volumes inside
- solved a bug in reconstructRegion, UEFI 2.0 capsule header was lost
during reconstruction
This commit is contained in:
Nikolaj Schlej 2014-01-15 23:27:29 +01:00
parent e660b7ecea
commit f65bebb398
2 changed files with 43 additions and 69 deletions

View File

@ -1927,6 +1927,7 @@ UINT8 FfsEngine::reconstructRegion(const QModelIndex& index, QByteArray& reconst
}
// Reconstruction successful
reconstructed = model->header(index).append(reconstructed);
return ERR_SUCCESS;
}
@ -2272,35 +2273,44 @@ UINT8 FfsEngine::reconstructFile(const QModelIndex& index, const UINT8 revision,
if (model->rowCount(index)) {
reconstructed.clear();
// Construct new file body
UINT32 offset = 0;
// File contains raw data, must be parsed as region
if (model->subtype(index) == EFI_FV_FILETYPE_ALL || model->subtype(index) == EFI_FV_FILETYPE_RAW) {
result = reconstructRegion(index, reconstructed);
if (result)
return result;
}
// File contains sections
else {
UINT32 offset = 0;
for (int i = 0; i < model->rowCount(index); i++) {
// Align to 4 byte boundary
UINT8 alignment = offset % 4;
if (alignment) {
alignment = 4 - alignment;
offset += alignment;
reconstructed.append(QByteArray(alignment, '\x00'));
for (int i = 0; i < model->rowCount(index); i++) {
// Align to 4 byte boundary
UINT8 alignment = offset % 4;
if (alignment) {
alignment = 4 - alignment;
offset += alignment;
reconstructed.append(QByteArray(alignment, '\x00'));
}
// Calculate section base
UINT32 sectionBase = base ? base + sizeof(EFI_FFS_FILE_HEADER) + offset : 0;
// Reconstruct section
QByteArray section;
result = reconstructSection(index.child(i, 0), sectionBase, section);
if (result)
return result;
// Check for empty section
if (section.isEmpty())
continue;
// Append current section to new file body
reconstructed.append(section);
// Change current file offset
offset += section.size();
}
// Calculate section base
UINT32 sectionBase = base ? base + sizeof(EFI_FFS_FILE_HEADER) + offset : 0;
// Reconstruct section
QByteArray section;
result = reconstructSection(index.child(i, 0), sectionBase, section);
if (result)
return result;
// Check for empty section
if (section.isEmpty())
continue;
// Append current section to new file body
reconstructed.append(section);
// Change current file offset
offset += section.size();
}
// Correct file size

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>500</height>
<height>600</height>
</rect>
</property>
<property name="sizePolicy">
@ -20,7 +20,7 @@
<bool>true</bool>
</property>
<property name="windowTitle">
<string>UEFITool 0.16.4</string>
<string>UEFITool 0.16.5</string>
</property>
<widget class="QWidget" name="centralWidget">
<property name="sizePolicy">
@ -33,16 +33,7 @@
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@ -62,16 +53,7 @@
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>5</number>
</property>
<item>
@ -109,16 +91,7 @@
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>5</number>
</property>
<item>
@ -148,16 +121,7 @@
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>5</number>
</property>
<item>