UEFITool 0.19.3

- new program icon made by Alexander Zhidkov
- spaces instead of tabs in source files
This commit is contained in:
Nikolaj Schlej 2014-11-18 16:01:20 +01:00
parent 39e53719d4
commit 93973d0042
11 changed files with 163 additions and 163 deletions

View File

@ -198,7 +198,7 @@ void FfsEngine::msg(const QString & message, const QModelIndex & index)
messageItems.enqueue(MessageListItem(message, NULL, 0, index)); messageItems.enqueue(MessageListItem(message, NULL, 0, index));
#else #else
(void) index; (void) index;
std::cout << message.toLatin1().constData() << std::endl; std::cout << message.toLatin1().constData() << std::endl;
#endif #endif
} }
@ -306,8 +306,8 @@ UINT8 FfsEngine::parseImageFile(const QByteArray & buffer)
UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & index, const QModelIndex & parent) UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & index, const QModelIndex & parent)
{ {
FLASH_DESCRIPTOR_MAP* descriptorMap; FLASH_DESCRIPTOR_MAP* descriptorMap;
FLASH_DESCRIPTOR_UPPER_MAP* upperMap; FLASH_DESCRIPTOR_UPPER_MAP* upperMap;
FLASH_DESCRIPTOR_REGION_SECTION* regionSection; FLASH_DESCRIPTOR_REGION_SECTION* regionSection;
FLASH_DESCRIPTOR_MASTER_SECTION* masterSection; FLASH_DESCRIPTOR_MASTER_SECTION* masterSection;
// Store the beginning of descriptor as descriptor base address // Store the beginning of descriptor as descriptor base address
@ -323,8 +323,8 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & in
// Parse descriptor map // Parse descriptor map
descriptorMap = (FLASH_DESCRIPTOR_MAP*)(descriptor + sizeof(FLASH_DESCRIPTOR_HEADER)); descriptorMap = (FLASH_DESCRIPTOR_MAP*)(descriptor + sizeof(FLASH_DESCRIPTOR_HEADER));
upperMap = (FLASH_DESCRIPTOR_UPPER_MAP*)(descriptor + FLASH_DESCRIPTOR_UPPER_MAP_BASE); upperMap = (FLASH_DESCRIPTOR_UPPER_MAP*)(descriptor + FLASH_DESCRIPTOR_UPPER_MAP_BASE);
regionSection = (FLASH_DESCRIPTOR_REGION_SECTION*)calculateAddress8(descriptor, descriptorMap->RegionBase); regionSection = (FLASH_DESCRIPTOR_REGION_SECTION*)calculateAddress8(descriptor, descriptorMap->RegionBase);
masterSection = (FLASH_DESCRIPTOR_MASTER_SECTION*)calculateAddress8(descriptor, descriptorMap->MasterBase); masterSection = (FLASH_DESCRIPTOR_MASTER_SECTION*)calculateAddress8(descriptor, descriptorMap->MasterBase);
// GbE region // GbE region
@ -496,16 +496,16 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & in
.arg(masterSection->BiosWrite & FLASH_DESCRIPTOR_REGION_ACCESS_PDR ? "Yes " : "No "); .arg(masterSection->BiosWrite & FLASH_DESCRIPTOR_REGION_ACCESS_PDR ? "Yes " : "No ");
// VSCC table // VSCC table
VSCC_TABLE_ENTRY* vsccTableEntry = (VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4)); VSCC_TABLE_ENTRY* vsccTableEntry = (VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4));
info += tr("\nFlash chips in VSCC table:"); info += tr("\nFlash chips in VSCC table:");
UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY); UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY);
for (int i = 0; i < vsscTableSize; i++) { for (int i = 0; i < vsscTableSize; i++) {
info += tr("\n0x%1%2%3") info += tr("\n0x%1%2%3")
.hexarg(vsccTableEntry->VendorId, 2) .hexarg(vsccTableEntry->VendorId, 2)
.hexarg(vsccTableEntry->DeviceId0, 2) .hexarg(vsccTableEntry->DeviceId0, 2)
.hexarg(vsccTableEntry->DeviceId1, 2); .hexarg(vsccTableEntry->DeviceId1, 2);
vsccTableEntry++; vsccTableEntry++;
} }
// Add descriptor tree item // Add descriptor tree item
model->addItem(Types::Region, Subtypes::DescriptorRegion, COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), body, QByteArray(), index); model->addItem(Types::Region, Subtypes::DescriptorRegion, COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), body, QByteArray(), index);
@ -649,11 +649,11 @@ UINT8 FfsEngine::parseBiosRegion(const QByteArray & bios, QModelIndex & index, c
UINT8 FfsEngine::getPaddingType(const QByteArray & padding) UINT8 FfsEngine::getPaddingType(const QByteArray & padding)
{ {
if (padding.count('\x00') == padding.count()) if (padding.count('\x00') == padding.count())
return Subtypes::ZeroPadding; return Subtypes::ZeroPadding;
if (padding.count('\xFF') == padding.count()) if (padding.count('\xFF') == padding.count())
return Subtypes::OnePadding; return Subtypes::OnePadding;
return Subtypes::DataPadding; return Subtypes::DataPadding;
} }
UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent) UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
@ -675,9 +675,9 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
name = tr("Padding"); name = tr("Padding");
info = tr("Size: 0x%1") info = tr("Size: 0x%1")
.hexarg(padding.size(), 8); .hexarg(padding.size(), 8);
// Add tree item // Add tree item
model->addItem(Types::Padding, getPaddingType(padding), COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), padding, QByteArray(), parent); model->addItem(Types::Padding, getPaddingType(padding), COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), padding, QByteArray(), parent);
} }
// Search for and parse all volumes // Search for and parse all volumes
@ -702,7 +702,7 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
info = tr("Size: 0x%1") info = tr("Size: 0x%1")
.hexarg(padding.size(), 8); .hexarg(padding.size(), 8);
// Add tree item // Add tree item
model->addItem(Types::Padding, getPaddingType(padding), COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), padding, QByteArray(), parent); model->addItem(Types::Padding, getPaddingType(padding), COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), padding, QByteArray(), parent);
} }
// Get volume size // Get volume size
@ -776,7 +776,7 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
info = tr("Size: 0x%1") info = tr("Size: 0x%1")
.hexarg(padding.size(), 8); .hexarg(padding.size(), 8);
// Add tree item // Add tree item
model->addItem(Types::Padding, getPaddingType(padding), COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), padding, QByteArray(), parent); model->addItem(Types::Padding, getPaddingType(padding), COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), padding, QByteArray(), parent);
} }
break; break;
} }
@ -942,13 +942,13 @@ UINT8 FfsEngine::parseVolume(const QByteArray & volume, QModelIndex & index, co
QByteArray header = file.left(sizeof(EFI_FFS_FILE_HEADER)); QByteArray header = file.left(sizeof(EFI_FFS_FILE_HEADER));
// If we are at empty space in the end of volume // If we are at empty space in the end of volume
if (header.count(empty) == header.size()) { if (header.count(empty) == header.size()) {
// Check free space to be actually free // Check free space to be actually free
QByteArray freeSpace = volume.right(volumeSize - fileOffset); QByteArray freeSpace = volume.right(volumeSize - fileOffset);
if (freeSpace.count(empty) != freeSpace.count()) if (freeSpace.count(empty) != freeSpace.count())
msg(tr("parseVolume: Non-UEFI data found in volume's free space will be destroyed after volume modification"), index); msg(tr("parseVolume: Non-UEFI data found in volume's free space will be destroyed after volume modification"), index);
break; // Exit from loop break; // Exit from loop
} }
// Check file alignment // Check file alignment
EFI_FFS_FILE_HEADER* fileHeader = (EFI_FFS_FILE_HEADER*)header.constData(); EFI_FFS_FILE_HEADER* fileHeader = (EFI_FFS_FILE_HEADER*)header.constData();
@ -993,11 +993,11 @@ UINT8 FfsEngine::getFileSize(const QByteArray & volume, const UINT32 fileOffset,
UINT8 FfsEngine::parseFile(const QByteArray & file, QModelIndex & index, const UINT8 erasePolarity, const QModelIndex & parent, const UINT8 mode) UINT8 FfsEngine::parseFile(const QByteArray & file, QModelIndex & index, const UINT8 erasePolarity, const QModelIndex & parent, const UINT8 mode)
{ {
bool msgInvalidHeaderChecksum = false; bool msgInvalidHeaderChecksum = false;
bool msgInvalidDataChecksum = false; bool msgInvalidDataChecksum = false;
bool msgInvalidTailValue = false; bool msgInvalidTailValue = false;
bool msgInvalidType = false; bool msgInvalidType = false;
bool msgNonEmptyPadFile = false; bool msgNonEmptyPadFile = false;
// Populate file header // Populate file header
EFI_FFS_FILE_HEADER* fileHeader = (EFI_FFS_FILE_HEADER*)file.constData(); EFI_FFS_FILE_HEADER* fileHeader = (EFI_FFS_FILE_HEADER*)file.constData();
@ -1013,8 +1013,8 @@ UINT8 FfsEngine::parseFile(const QByteArray & file, QModelIndex & index, const U
tempFileHeader->IntegrityCheck.Checksum.Header = 0; tempFileHeader->IntegrityCheck.Checksum.Header = 0;
tempFileHeader->IntegrityCheck.Checksum.File = 0; tempFileHeader->IntegrityCheck.Checksum.File = 0;
UINT8 calculated = calculateChecksum8((UINT8*)tempFileHeader, sizeof(EFI_FFS_FILE_HEADER) - 1); UINT8 calculated = calculateChecksum8((UINT8*)tempFileHeader, sizeof(EFI_FFS_FILE_HEADER) - 1);
if (fileHeader->IntegrityCheck.Checksum.Header != calculated) if (fileHeader->IntegrityCheck.Checksum.Header != calculated)
msgInvalidHeaderChecksum = true; msgInvalidHeaderChecksum = true;
// Check data checksum // Check data checksum
// Data checksum must be calculated // Data checksum must be calculated
@ -1101,10 +1101,10 @@ UINT8 FfsEngine::parseFile(const QByteArray & file, QModelIndex & index, const U
// No need to parse empty files // No need to parse empty files
parseCurrentFile = false; parseCurrentFile = false;
} }
// Check for non-empty pad file // Check for non-empty pad file
else if (fileHeader->Type == EFI_FV_FILETYPE_PAD) { else if (fileHeader->Type == EFI_FV_FILETYPE_PAD) {
msgNonEmptyPadFile = true; msgNonEmptyPadFile = true;
} }
// Get info // Get info
QString name; QString name;
@ -1124,16 +1124,16 @@ UINT8 FfsEngine::parseFile(const QByteArray & file, QModelIndex & index, const U
index = model->addItem(Types::File, fileHeader->Type, COMPRESSION_ALGORITHM_NONE, name, "", info, header, body, tail, parent, mode); index = model->addItem(Types::File, fileHeader->Type, COMPRESSION_ALGORITHM_NONE, name, "", info, header, body, tail, parent, mode);
// Show messages // Show messages
if (msgInvalidHeaderChecksum) if (msgInvalidHeaderChecksum)
msg(tr("parseFile: Invalid header checksum"), index); msg(tr("parseFile: Invalid header checksum"), index);
if (msgInvalidDataChecksum) if (msgInvalidDataChecksum)
msg(tr("parseFile: Invalid data checksum"), index); msg(tr("parseFile: Invalid data checksum"), index);
if (msgInvalidTailValue) if (msgInvalidTailValue)
msg(tr("parseFile: Invalid tail value"), index); msg(tr("parseFile: Invalid tail value"), index);
if (msgInvalidType) if (msgInvalidType)
msg(tr("parseFile: Unknown file type 0x%1").arg(fileHeader->Type, 2), index); msg(tr("parseFile: Unknown file type 0x%1").arg(fileHeader->Type, 2), index);
if (msgNonEmptyPadFile) if (msgNonEmptyPadFile)
msg(tr("parseFile: Non-empty pad file contents will be destroyed after volume modification"), index); msg(tr("parseFile: Non-empty pad file contents will be destroyed after volume modification"), index);
if (!parseCurrentFile) if (!parseCurrentFile)
return ERR_SUCCESS; return ERR_SUCCESS;
@ -1379,35 +1379,35 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_TIANO) { if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_TIANO) {
algorithm = COMPRESSION_ALGORITHM_UNKNOWN; algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
result = decompress(body, EFI_STANDARD_COMPRESSION, decompressed, &algorithm); result = decompress(body, EFI_STANDARD_COMPRESSION, decompressed, &algorithm);
if (result) if (result)
parseCurrentSection = false; parseCurrentSection = false;
if (algorithm == COMPRESSION_ALGORITHM_TIANO) { if (algorithm == COMPRESSION_ALGORITHM_TIANO) {
info += tr("\nCompression type: Tiano"); info += tr("\nCompression type: Tiano");
info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8); info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8);
} }
else if (algorithm == COMPRESSION_ALGORITHM_EFI11) { else if (algorithm == COMPRESSION_ALGORITHM_EFI11) {
info += tr("\nCompression type: EFI 1.1"); info += tr("\nCompression type: EFI 1.1");
info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8); info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8);
} }
else else
info += tr("\nCompression type: unknown"); info += tr("\nCompression type: unknown");
} }
// LZMA compressed section // LZMA compressed section
else if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_LZMA) { else if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_LZMA) {
algorithm = COMPRESSION_ALGORITHM_UNKNOWN; algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
result = decompress(body, EFI_CUSTOMIZED_COMPRESSION, decompressed, &algorithm); result = decompress(body, EFI_CUSTOMIZED_COMPRESSION, decompressed, &algorithm);
if (result) if (result)
parseCurrentSection = false; parseCurrentSection = false;
if (algorithm == COMPRESSION_ALGORITHM_LZMA) { if (algorithm == COMPRESSION_ALGORITHM_LZMA) {
info += tr("\nCompression type: LZMA"); info += tr("\nCompression type: LZMA");
info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8); info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8);
} }
else else
info += tr("\nCompression type: unknown"); info += tr("\nCompression type: unknown");
} }
// Intel signed section // Intel signed section
else if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_INTEL_SIGNED) { else if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_INTEL_SIGNED) {
@ -1546,8 +1546,8 @@ UINT8 FfsEngine::parseSection(const QByteArray & section, QModelIndex & index, c
// Special case of PEI Core // Special case of PEI Core
if ((sectionHeader->Type == EFI_SECTION_PE32 || sectionHeader->Type == EFI_SECTION_TE) if ((sectionHeader->Type == EFI_SECTION_PE32 || sectionHeader->Type == EFI_SECTION_TE)
&& model->subtype(parent) == EFI_FV_FILETYPE_PEI_CORE && model->subtype(parent) == EFI_FV_FILETYPE_PEI_CORE
&& oldPeiCoreEntryPoint == 0) { && oldPeiCoreEntryPoint == 0) {
result = getEntryPoint(model->body(index), oldPeiCoreEntryPoint); result = getEntryPoint(model->body(index), oldPeiCoreEntryPoint);
if (result) if (result)
msg(tr("parseSection: Can't get original PEI core entry point"), index); msg(tr("parseSection: Can't get original PEI core entry point"), index);
@ -3700,13 +3700,13 @@ UINT32 FfsEngine::crc32(UINT32 initial, const UINT8* buffer, UINT32 length)
UINT8 FfsEngine::dump(const QModelIndex & index, const QString & path, const QString & guid) UINT8 FfsEngine::dump(const QModelIndex & index, const QString & path, const QString & guid)
{ {
dumped = false; dumped = false;
UINT8 result = recursiveDump(index, path, guid); UINT8 result = recursiveDump(index, path, guid);
if (result) if (result)
return result; return result;
else if (!dumped) else if (!dumped)
return ERR_ITEM_NOT_FOUND; return ERR_ITEM_NOT_FOUND;
return ERR_SUCCESS; return ERR_SUCCESS;
} }
UINT8 FfsEngine::recursiveDump(const QModelIndex & index, const QString & path, const QString & guid) UINT8 FfsEngine::recursiveDump(const QModelIndex & index, const QString & path, const QString & guid)
@ -3715,45 +3715,45 @@ UINT8 FfsEngine::recursiveDump(const QModelIndex & index, const QString & path,
return ERR_INVALID_PARAMETER; return ERR_INVALID_PARAMETER;
QDir dir; QDir dir;
if (guid.isEmpty() || if (guid.isEmpty() ||
guidToQString(*(EFI_GUID*)model->header(index).constData()) == guid || guidToQString(*(EFI_GUID*)model->header(index).constData()) == guid ||
guidToQString(*(EFI_GUID*)model->header(model->findParentOfType(index, Types::File)).constData()) == guid) { guidToQString(*(EFI_GUID*)model->header(model->findParentOfType(index, Types::File)).constData()) == guid) {
if (dir.cd(path)) if (dir.cd(path))
return ERR_DIR_ALREADY_EXIST; return ERR_DIR_ALREADY_EXIST;
if (!dir.mkpath(path)) if (!dir.mkpath(path))
return ERR_DIR_CREATE; return ERR_DIR_CREATE;
QFile file; QFile file;
if (!model->header(index).isEmpty()) { if (!model->header(index).isEmpty()) {
file.setFileName(tr("%1/header.bin").arg(path)); file.setFileName(tr("%1/header.bin").arg(path));
if (!file.open(QFile::WriteOnly)) if (!file.open(QFile::WriteOnly))
return ERR_FILE_OPEN; return ERR_FILE_OPEN;
file.write(model->header(index)); file.write(model->header(index));
file.close(); file.close();
} }
if (!model->body(index).isEmpty()) { if (!model->body(index).isEmpty()) {
file.setFileName(tr("%1/body.bin").arg(path)); file.setFileName(tr("%1/body.bin").arg(path));
if (!file.open(QFile::WriteOnly)) if (!file.open(QFile::WriteOnly))
return ERR_FILE_OPEN; return ERR_FILE_OPEN;
file.write(model->body(index)); file.write(model->body(index));
file.close(); file.close();
} }
QString info = tr("Type: %1\nSubtype: %2\n%3%4") QString info = tr("Type: %1\nSubtype: %2\n%3%4")
.arg(model->typeString(index)) .arg(model->typeString(index))
.arg(model->subtypeString(index)) .arg(model->subtypeString(index))
.arg(model->textString(index).isEmpty() ? "" : tr("Text: %1\n").arg(model->textString(index))) .arg(model->textString(index).isEmpty() ? "" : tr("Text: %1\n").arg(model->textString(index)))
.arg(model->info(index)); .arg(model->info(index));
file.setFileName(tr("%1/info.txt").arg(path)); file.setFileName(tr("%1/info.txt").arg(path));
if (!file.open(QFile::Text | QFile::WriteOnly)) if (!file.open(QFile::Text | QFile::WriteOnly))
return ERR_FILE_OPEN; return ERR_FILE_OPEN;
file.write(info.toLatin1()); file.write(info.toLatin1());
file.close(); file.close();
dumped = true; dumped = true;
} }
UINT8 result; UINT8 result;
for (int i = 0; i < model->rowCount(index); i++) { for (int i = 0; i < model->rowCount(index); i++) {

View File

@ -110,10 +110,10 @@ private:
UINT32 newPeiCoreEntryPoint; UINT32 newPeiCoreEntryPoint;
// Parsing helpers // Parsing helpers
UINT8 getPaddingType(const QByteArray & padding); UINT8 getPaddingType(const QByteArray & padding);
void parseAprioriRawSection(const QByteArray & body, QString & parsed); void parseAprioriRawSection(const QByteArray & body, QString & parsed);
UINT8 parseDepexSection(const QByteArray & body, QString & parsed); UINT8 parseDepexSection(const QByteArray & body, QString & parsed);
UINT8 findNextVolume(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & nextVolumeOffset); UINT8 findNextVolume(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & nextVolumeOffset);
UINT8 getVolumeSize(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & volumeSize, UINT32 & bmVolumeSize); UINT8 getVolumeSize(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & volumeSize, UINT32 & bmVolumeSize);
UINT8 getFileSize(const QByteArray & volume, const UINT32 fileOffset, UINT32 & fileSize); UINT8 getFileSize(const QByteArray & volume, const UINT32 fileOffset, UINT32 & fileSize);
UINT8 getSectionSize(const QByteArray & file, const UINT32 sectionOffset, UINT32 & sectionSize); UINT8 getSectionSize(const QByteArray & file, const UINT32 sectionOffset, UINT32 & sectionSize);
@ -145,9 +145,9 @@ private:
bool hasIntersection(const UINT32 begin1, const UINT32 end1, const UINT32 begin2, const UINT32 end2); bool hasIntersection(const UINT32 begin1, const UINT32 end1, const UINT32 begin2, const UINT32 end2);
UINT32 crc32(UINT32 initial, const UINT8* buffer, UINT32 length); UINT32 crc32(UINT32 initial, const UINT8* buffer, UINT32 length);
// Recursive dump // Recursive dump
bool dumped; bool dumped;
UINT8 recursiveDump(const QModelIndex & index, const QString & path, const QString & filter); UINT8 recursiveDump(const QModelIndex & index, const QString & path, const QString & filter);
}; };
#endif #endif

View File

@ -14,12 +14,12 @@
#include "guidlineedit.h" #include "guidlineedit.h"
GuidLineEdit::GuidLineEdit(QWidget * parent) GuidLineEdit::GuidLineEdit(QWidget * parent)
:QLineEdit(parent) :QLineEdit(parent)
{ {
} }
GuidLineEdit::GuidLineEdit(const QString & contents, QWidget * parent) GuidLineEdit::GuidLineEdit(const QString & contents, QWidget * parent)
:QLineEdit(contents, parent) :QLineEdit(contents, parent)
{ {
} }
@ -29,33 +29,33 @@ GuidLineEdit::~GuidLineEdit()
void GuidLineEdit::keyPressEvent(QKeyEvent * event) void GuidLineEdit::keyPressEvent(QKeyEvent * event)
{ {
if (event == QKeySequence::Delete || event->key() == Qt::Key_Backspace) if (event == QKeySequence::Delete || event->key() == Qt::Key_Backspace)
{ {
int pos = cursorPosition(); int pos = cursorPosition();
if (event->key() == Qt::Key_Backspace && pos > 0) { if (event->key() == Qt::Key_Backspace && pos > 0) {
cursorBackward(false); cursorBackward(false);
pos = cursorPosition(); pos = cursorPosition();
} }
QString txt = text(); QString txt = text();
QString selected = selectedText(); QString selected = selectedText();
if (!selected.isEmpty()) { if (!selected.isEmpty()) {
pos = QLineEdit::selectionStart(); pos = QLineEdit::selectionStart();
for (int i = pos; i < pos + selected.count(); i++) for (int i = pos; i < pos + selected.count(); i++)
if (txt[i] != QChar('-')) if (txt[i] != QChar('-'))
txt[i] = QChar('.'); txt[i] = QChar('.');
} }
else else
txt[pos] = QChar('.'); txt[pos] = QChar('.');
setCursorPosition(0); setCursorPosition(0);
insert(txt); insert(txt);
setCursorPosition(pos); setCursorPosition(pos);
return; return;
} }
// Call original event handler // Call original event handler
QLineEdit::keyPressEvent(event); QLineEdit::keyPressEvent(event);
} }

View File

@ -24,12 +24,12 @@
class GuidLineEdit : public QLineEdit class GuidLineEdit : public QLineEdit
{ {
public: public:
GuidLineEdit(QWidget * parent = 0); GuidLineEdit(QWidget * parent = 0);
GuidLineEdit(const QString & contents, QWidget * parent = 0); GuidLineEdit(const QString & contents, QWidget * parent = 0);
~GuidLineEdit(); ~GuidLineEdit();
protected: protected:
void keyPressEvent(QKeyEvent * event); void keyPressEvent(QKeyEvent * event);
}; };

View File

@ -70,14 +70,14 @@ QString itemSubtypeToQString(const UINT8 type, const UINT8 subtype)
else else
return QObject::tr("Unknown"); return QObject::tr("Unknown");
case Types::Padding: case Types::Padding:
if (subtype == Subtypes::ZeroPadding) if (subtype == Subtypes::ZeroPadding)
return QObject::tr("Empty(0x00)"); return QObject::tr("Empty(0x00)");
else if (subtype == Subtypes::OnePadding) else if (subtype == Subtypes::OnePadding)
return QObject::tr("Empty(0xFF)"); return QObject::tr("Empty(0xFF)");
else if (subtype == Subtypes::DataPadding) else if (subtype == Subtypes::DataPadding)
return QObject::tr("Nonempty"); return QObject::tr("Nonempty");
else else
return ""; return "";
case Types::Volume: case Types::Volume:
if (subtype == Subtypes::BootVolume) if (subtype == Subtypes::BootVolume)
return QObject::tr("Boot"); return QObject::tr("Boot");

10
types.h
View File

@ -70,11 +70,11 @@ namespace Subtypes {
PdrRegion PdrRegion
}; };
enum PaddingSubtypes { enum PaddingSubtypes {
ZeroPadding = 110, ZeroPadding = 110,
OnePadding, OnePadding,
DataPadding DataPadding
}; };
}; };
// *ToQString conversion routines // *ToQString conversion routines

View File

@ -17,7 +17,7 @@
UEFITool::UEFITool(QWidget *parent) : UEFITool::UEFITool(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::UEFITool), ui(new Ui::UEFITool),
version(tr("0.19.2")) version(tr("0.19.3"))
{ {
clipboard = QApplication::clipboard(); clipboard = QApplication::clipboard();
@ -26,8 +26,8 @@ version(tr("0.19.2"))
searchDialog = new SearchDialog(this); searchDialog = new SearchDialog(this);
ffsEngine = NULL; ffsEngine = NULL;
// Set window title // Set window title
this->setWindowTitle(tr("UEFITool %1").arg(version)); this->setWindowTitle(tr("UEFITool %1").arg(version));
// Connect signals to slots // Connect signals to slots
connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile())); connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile()));
@ -89,8 +89,8 @@ void UEFITool::init()
ui->messageListWidget->clear(); ui->messageListWidget->clear();
ui->infoEdit->clear(); ui->infoEdit->clear();
// Set window title // Set window title
this->setWindowTitle(tr("UEFITool %1").arg(version)); this->setWindowTitle(tr("UEFITool %1").arg(version));
// Disable menus // Disable menus
ui->menuCapsuleActions->setDisabled(true); ui->menuCapsuleActions->setDisabled(true);
@ -485,7 +485,8 @@ void UEFITool::extract(const UINT8 mode)
void UEFITool::about() void UEFITool::about()
{ {
QMessageBox::about(this, tr("About UEFITool"), tr( QMessageBox::about(this, tr("About UEFITool"), tr(
"Copyright (c) 2014, Nikolaj Schlej aka <b>CodeRush</b>.<br><br>" "Copyright (c) 2014, Nikolaj Schlej aka <b>CodeRush</b>.<br>"
"Program icon made by <a href=https://www.behance.net/alzhidkov>Alexander Zhidkov</a>.<br><br>"
"The program is dedicated to <b>RevoGirl</b>. Rest in peace, young genius.<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 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>" "The full text of the license may be found at <a href=http://opensource.org/licenses/bsd-license.php>OpenSource.org</a>.<br><br>"
@ -565,7 +566,7 @@ void UEFITool::openImageFile(QString path)
inputFile.close(); inputFile.close();
init(); init();
this->setWindowTitle(tr("UEFITool %1 - %2").arg(version).arg(fileInfo.fileName())); this->setWindowTitle(tr("UEFITool %1 - %2").arg(version).arg(fileInfo.fileName()));
UINT8 result = ffsEngine->parseImageFile(buffer); UINT8 result = ffsEngine->parseImageFile(buffer);
showMessages(); showMessages();
@ -636,7 +637,7 @@ void UEFITool::showMessages()
ui->messageListWidget->addItem(new MessageListItem(messageItems.at(i))); ui->messageListWidget->addItem(new MessageListItem(messageItems.at(i)));
} }
ui->messageListWidget->scrollToBottom(); ui->messageListWidget->scrollToBottom();
} }
void UEFITool::scrollTreeView(QListWidgetItem* item) void UEFITool::scrollTreeView(QListWidgetItem* item)

View File

@ -95,8 +95,8 @@ private:
SearchDialog* searchDialog; SearchDialog* searchDialog;
QClipboard* clipboard; QClipboard* clipboard;
QString currentDir; QString currentDir;
QQueue<MessageListItem> messageItems; QQueue<MessageListItem> messageItems;
const QString version; const QString version;
void showMessages(); void showMessages();

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -23,7 +23,7 @@ SOURCES += uefitool_main.cpp \
Tiano/EfiTianoDecompress.c \ Tiano/EfiTianoDecompress.c \
Tiano/EfiTianoCompress.c \ Tiano/EfiTianoCompress.c \
Tiano/EfiTianoCompressLegacy.c Tiano/EfiTianoCompressLegacy.c
HEADERS += uefitool.h \ HEADERS += uefitool.h \
searchdialog.h \ searchdialog.h \
basetypes.h \ basetypes.h \
@ -42,7 +42,6 @@ HEADERS += uefitool.h \
LZMA/LzmaDecompress.h \ LZMA/LzmaDecompress.h \
Tiano/EfiTianoDecompress.h \ Tiano/EfiTianoDecompress.h \
Tiano/EfiTianoCompress.h Tiano/EfiTianoCompress.h
FORMS += uefitool.ui \ FORMS += uefitool.ui \
searchdialog.ui searchdialog.ui