mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-21 23:48:22 +08:00
Version 0.16.4
- code cleanup
This commit is contained in:
parent
070943c959
commit
e660b7ecea
@ -69,7 +69,7 @@ bool FfsEngine::hasIntersection(const UINT32 begin1, const UINT32 end1, const UI
|
||||
}
|
||||
|
||||
// Firmware image parsing
|
||||
UINT8 FfsEngine::parseInputFile(const QByteArray & buffer)
|
||||
UINT8 FfsEngine::parseImageFile(const QByteArray & buffer)
|
||||
{
|
||||
oldPeiCoreEntryPoint = 0;
|
||||
newPeiCoreEntryPoint = 0;
|
||||
@ -81,7 +81,7 @@ UINT8 FfsEngine::parseInputFile(const QByteArray & buffer)
|
||||
// Check buffer size to be more then or equal to sizeof(EFI_CAPSULE_HEADER)
|
||||
if ((UINT32) buffer.size() <= sizeof(EFI_CAPSULE_HEADER))
|
||||
{
|
||||
msg(tr("parseInputFile: Input file is smaller then minimum size of %1 bytes").arg(sizeof(EFI_CAPSULE_HEADER)));
|
||||
msg(tr("parseImageFile: Image file is smaller then minimum size of %1 bytes").arg(sizeof(EFI_CAPSULE_HEADER)));
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -2501,7 +2501,7 @@ UINT8 FfsEngine::reconstruct(const QModelIndex &index, QByteArray& reconstructed
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
//Other images types can be reconstructed like region
|
||||
//Other images types can be reconstructed like regions
|
||||
result = reconstructRegion(index, reconstructed);
|
||||
if (result)
|
||||
return result;
|
||||
@ -2591,6 +2591,11 @@ UINT8 FfsEngine::growVolume(QByteArray & header, const UINT32 size, UINT32 & new
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
UINT8 FfsEngine::reconstructImageFile(QByteArray & reconstructed)
|
||||
{
|
||||
return reconstruct(model->index(0,0), reconstructed);
|
||||
}
|
||||
|
||||
// Search routines
|
||||
UINT8 FfsEngine::findHexPattern(const QByteArray & pattern, const UINT8 mode)
|
||||
{
|
||||
|
22
ffsengine.h
22
ffsengine.h
@ -44,19 +44,15 @@ public:
|
||||
void clearMessages();
|
||||
|
||||
// Firmware image parsing
|
||||
UINT8 parseInputFile(const QByteArray & buffer);
|
||||
UINT8 parseImageFile(const QByteArray & buffer);
|
||||
UINT8 parseIntelImage(const QByteArray & intelImage, QModelIndex & index, const QModelIndex & parent = QModelIndex());
|
||||
UINT8 parseGbeRegion(const QByteArray & gbe, QModelIndex & index, const QModelIndex & parent);
|
||||
UINT8 parseMeRegion(const QByteArray & me, QModelIndex & index, const QModelIndex & parent);
|
||||
UINT8 parseBiosRegion(const QByteArray & bios, QModelIndex & index, const QModelIndex & parent);
|
||||
UINT8 parsePdrRegion(const QByteArray & pdr, QModelIndex & index, const QModelIndex & parent);
|
||||
UINT8 parseBios(const QByteArray & bios, const QModelIndex & parent = QModelIndex());
|
||||
UINT8 findNextVolume(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & nextVolumeOffset);
|
||||
UINT8 getVolumeSize(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & volumeSize);
|
||||
UINT8 parseVolume(const QByteArray & volume, QModelIndex & index, const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
||||
UINT8 getFileSize(const QByteArray & volume, const UINT32 fileOffset, UINT32 & fileSize);
|
||||
UINT8 parseFile(const QByteArray & file, QModelIndex & index, const UINT8 erasePolarity = ERASE_POLARITY_UNKNOWN, const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
||||
UINT8 getSectionSize(const QByteArray & file, const UINT32 sectionOffset, UINT32 & sectionSize);
|
||||
UINT8 parseSections(const QByteArray & body, const QModelIndex & parent = QModelIndex());
|
||||
UINT8 parseSection(const QByteArray & section, QModelIndex & index, const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
||||
|
||||
@ -65,8 +61,7 @@ public:
|
||||
UINT8 compress(const QByteArray & data, const UINT8 algorithm, QByteArray & compressedData);
|
||||
|
||||
// Construction routines
|
||||
UINT8 constructPadFile(const UINT32 size, const UINT8 revision, const UINT8 erasePolarity, QByteArray & pad);
|
||||
UINT8 growVolume(QByteArray & header, const UINT32 size, UINT32 & newSize);
|
||||
UINT8 reconstructImageFile(QByteArray &reconstructed);
|
||||
UINT8 reconstruct(const QModelIndex &index, QByteArray & reconstructed);
|
||||
UINT8 reconstructIntelImage(const QModelIndex& index, QByteArray & reconstructed);
|
||||
UINT8 reconstructRegion(const QModelIndex& index, QByteArray & reconstructed);
|
||||
@ -77,13 +72,10 @@ public:
|
||||
|
||||
// Operations on tree items
|
||||
UINT8 extract(const QModelIndex & index, QByteArray & extracted, const UINT8 mode);
|
||||
|
||||
UINT8 create(const QModelIndex & index, const UINT8 type, const QByteArray & header, const QByteArray & body, const UINT8 mode, const UINT8 action, const UINT8 algorithm = COMPRESSION_ALGORITHM_NONE);
|
||||
UINT8 insert(const QModelIndex & index, const QByteArray & object, const UINT8 mode);
|
||||
UINT8 replace(const QModelIndex & index, const QByteArray & object, const UINT8 mode);
|
||||
|
||||
UINT8 remove(const QModelIndex & index);
|
||||
|
||||
UINT8 rebuild(const QModelIndex & index);
|
||||
|
||||
// Search routines
|
||||
@ -99,6 +91,16 @@ private:
|
||||
UINT32 oldPeiCoreEntryPoint;
|
||||
UINT32 newPeiCoreEntryPoint;
|
||||
|
||||
// Parsing helpers
|
||||
UINT8 findNextVolume(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & nextVolumeOffset);
|
||||
UINT8 getVolumeSize(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & volumeSize);
|
||||
UINT8 getFileSize(const QByteArray & volume, const UINT32 fileOffset, UINT32 & fileSize);
|
||||
UINT8 getSectionSize(const QByteArray & file, const UINT32 sectionOffset, UINT32 & sectionSize);
|
||||
|
||||
// Reconstruction helpers
|
||||
UINT8 constructPadFile(const UINT32 size, const UINT8 revision, const UINT8 erasePolarity, QByteArray & pad);
|
||||
UINT8 growVolume(QByteArray & header, const UINT32 size, UINT32 & newSize);
|
||||
|
||||
// Rebase routines
|
||||
UINT8 getBase(const QByteArray& file, UINT32& base);
|
||||
UINT8 getEntryPoint(const QByteArray& file, UINT32 &entryPoint);
|
||||
|
@ -417,7 +417,7 @@ void UEFITool::extract(const UINT8 mode)
|
||||
void UEFITool::about()
|
||||
{
|
||||
QMessageBox::about(this, tr("About UEFITool"), tr(
|
||||
"Copyright (c) 2013, Nikolaj Schlej aka <b>CodeRush</b>.<br><br>"
|
||||
"Copyright (c) 2013-2014, Nikolaj Schlej aka <b>CodeRush</b>.<br><br>"
|
||||
"The program is dedicated to <b>RevoGirl</b>. Rest in peace, young genius.<br><br>"
|
||||
"The program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License.<br>"
|
||||
"The full text of the license may be found at <a href=http://opensource.org/licenses/bsd-license.php>OpenSource.org</a>.<br><br>"
|
||||
@ -448,7 +448,7 @@ void UEFITool::saveImageFile()
|
||||
}
|
||||
|
||||
QByteArray reconstructed;
|
||||
UINT8 result = ffsEngine->reconstruct(ffsEngine->treeModel()->index(0,0), reconstructed);
|
||||
UINT8 result = ffsEngine->reconstructImageFile(reconstructed);
|
||||
showMessages();
|
||||
if (result) {
|
||||
ui->statusBar->showMessage(tr("Reconstruction failed (%1)").arg(result));
|
||||
@ -487,7 +487,7 @@ void UEFITool::openImageFile(QString path)
|
||||
inputFile.close();
|
||||
|
||||
init();
|
||||
UINT8 result = ffsEngine->parseInputFile(buffer);
|
||||
UINT8 result = ffsEngine->parseImageFile(buffer);
|
||||
showMessages();
|
||||
if (result)
|
||||
ui->statusBar->showMessage(tr("Opened file can't be parsed (%1)").arg(result));
|
||||
|
@ -20,7 +20,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>UEFITool 0.16.3</string>
|
||||
<string>UEFITool 0.16.4</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<property name="sizePolicy">
|
||||
|
Loading…
Reference in New Issue
Block a user