mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
UEFITool 0.19.3
- new program icon made by Alexander Zhidkov - spaces instead of tabs in source files
This commit is contained in:
parent
39e53719d4
commit
93973d0042
196
ffsengine.cpp
196
ffsengine.cpp
@ -198,7 +198,7 @@ void FfsEngine::msg(const QString & message, const QModelIndex & index)
|
||||
messageItems.enqueue(MessageListItem(message, NULL, 0, index));
|
||||
#else
|
||||
(void) index;
|
||||
std::cout << message.toLatin1().constData() << std::endl;
|
||||
std::cout << message.toLatin1().constData() << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -306,8 +306,8 @@ UINT8 FfsEngine::parseImageFile(const QByteArray & buffer)
|
||||
UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & index, const QModelIndex & parent)
|
||||
{
|
||||
FLASH_DESCRIPTOR_MAP* descriptorMap;
|
||||
FLASH_DESCRIPTOR_UPPER_MAP* upperMap;
|
||||
FLASH_DESCRIPTOR_REGION_SECTION* regionSection;
|
||||
FLASH_DESCRIPTOR_UPPER_MAP* upperMap;
|
||||
FLASH_DESCRIPTOR_REGION_SECTION* regionSection;
|
||||
FLASH_DESCRIPTOR_MASTER_SECTION* masterSection;
|
||||
|
||||
// Store the beginning of descriptor as descriptor base address
|
||||
@ -323,8 +323,8 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & in
|
||||
|
||||
// Parse descriptor map
|
||||
descriptorMap = (FLASH_DESCRIPTOR_MAP*)(descriptor + sizeof(FLASH_DESCRIPTOR_HEADER));
|
||||
upperMap = (FLASH_DESCRIPTOR_UPPER_MAP*)(descriptor + FLASH_DESCRIPTOR_UPPER_MAP_BASE);
|
||||
regionSection = (FLASH_DESCRIPTOR_REGION_SECTION*)calculateAddress8(descriptor, descriptorMap->RegionBase);
|
||||
upperMap = (FLASH_DESCRIPTOR_UPPER_MAP*)(descriptor + FLASH_DESCRIPTOR_UPPER_MAP_BASE);
|
||||
regionSection = (FLASH_DESCRIPTOR_REGION_SECTION*)calculateAddress8(descriptor, descriptorMap->RegionBase);
|
||||
masterSection = (FLASH_DESCRIPTOR_MASTER_SECTION*)calculateAddress8(descriptor, descriptorMap->MasterBase);
|
||||
|
||||
// GbE region
|
||||
@ -496,16 +496,16 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & in
|
||||
.arg(masterSection->BiosWrite & FLASH_DESCRIPTOR_REGION_ACCESS_PDR ? "Yes " : "No ");
|
||||
|
||||
// VSCC table
|
||||
VSCC_TABLE_ENTRY* vsccTableEntry = (VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4));
|
||||
info += tr("\nFlash chips in VSCC table:");
|
||||
UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY);
|
||||
for (int i = 0; i < vsscTableSize; i++) {
|
||||
info += tr("\n0x%1%2%3")
|
||||
VSCC_TABLE_ENTRY* vsccTableEntry = (VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4));
|
||||
info += tr("\nFlash chips in VSCC table:");
|
||||
UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY);
|
||||
for (int i = 0; i < vsscTableSize; i++) {
|
||||
info += tr("\n0x%1%2%3")
|
||||
.hexarg(vsccTableEntry->VendorId, 2)
|
||||
.hexarg(vsccTableEntry->DeviceId0, 2)
|
||||
.hexarg(vsccTableEntry->DeviceId1, 2);
|
||||
vsccTableEntry++;
|
||||
}
|
||||
vsccTableEntry++;
|
||||
}
|
||||
|
||||
// Add descriptor tree item
|
||||
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)
|
||||
{
|
||||
if (padding.count('\x00') == padding.count())
|
||||
return Subtypes::ZeroPadding;
|
||||
if (padding.count('\xFF') == padding.count())
|
||||
return Subtypes::OnePadding;
|
||||
return Subtypes::DataPadding;
|
||||
if (padding.count('\x00') == padding.count())
|
||||
return Subtypes::ZeroPadding;
|
||||
if (padding.count('\xFF') == padding.count())
|
||||
return Subtypes::OnePadding;
|
||||
return Subtypes::DataPadding;
|
||||
}
|
||||
|
||||
UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
|
||||
@ -677,7 +677,7 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
|
||||
.hexarg(padding.size(), 8);
|
||||
|
||||
// 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
|
||||
@ -702,7 +702,7 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
|
||||
info = tr("Size: 0x%1")
|
||||
.hexarg(padding.size(), 8);
|
||||
// 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
|
||||
@ -776,7 +776,7 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
|
||||
info = tr("Size: 0x%1")
|
||||
.hexarg(padding.size(), 8);
|
||||
// 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;
|
||||
}
|
||||
@ -942,13 +942,13 @@ UINT8 FfsEngine::parseVolume(const QByteArray & volume, QModelIndex & index, co
|
||||
QByteArray header = file.left(sizeof(EFI_FFS_FILE_HEADER));
|
||||
|
||||
// If we are at empty space in the end of volume
|
||||
if (header.count(empty) == header.size()) {
|
||||
// Check free space to be actually free
|
||||
QByteArray freeSpace = volume.right(volumeSize - fileOffset);
|
||||
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);
|
||||
break; // Exit from loop
|
||||
}
|
||||
if (header.count(empty) == header.size()) {
|
||||
// Check free space to be actually free
|
||||
QByteArray freeSpace = volume.right(volumeSize - fileOffset);
|
||||
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);
|
||||
break; // Exit from loop
|
||||
}
|
||||
|
||||
// Check file alignment
|
||||
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)
|
||||
{
|
||||
bool msgInvalidHeaderChecksum = false;
|
||||
bool msgInvalidDataChecksum = false;
|
||||
bool msgInvalidHeaderChecksum = false;
|
||||
bool msgInvalidDataChecksum = false;
|
||||
bool msgInvalidTailValue = false;
|
||||
bool msgInvalidType = false;
|
||||
bool msgNonEmptyPadFile = false;
|
||||
bool msgNonEmptyPadFile = false;
|
||||
|
||||
// Populate file header
|
||||
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.File = 0;
|
||||
UINT8 calculated = calculateChecksum8((UINT8*)tempFileHeader, sizeof(EFI_FFS_FILE_HEADER) - 1);
|
||||
if (fileHeader->IntegrityCheck.Checksum.Header != calculated)
|
||||
msgInvalidHeaderChecksum = true;
|
||||
if (fileHeader->IntegrityCheck.Checksum.Header != calculated)
|
||||
msgInvalidHeaderChecksum = true;
|
||||
|
||||
// Check data checksum
|
||||
// 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
|
||||
parseCurrentFile = false;
|
||||
}
|
||||
// Check for non-empty pad file
|
||||
else if (fileHeader->Type == EFI_FV_FILETYPE_PAD) {
|
||||
msgNonEmptyPadFile = true;
|
||||
}
|
||||
// Check for non-empty pad file
|
||||
else if (fileHeader->Type == EFI_FV_FILETYPE_PAD) {
|
||||
msgNonEmptyPadFile = true;
|
||||
}
|
||||
|
||||
// Get info
|
||||
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);
|
||||
|
||||
// Show messages
|
||||
if (msgInvalidHeaderChecksum)
|
||||
msg(tr("parseFile: Invalid header checksum"), index);
|
||||
if (msgInvalidHeaderChecksum)
|
||||
msg(tr("parseFile: Invalid header checksum"), index);
|
||||
if (msgInvalidDataChecksum)
|
||||
msg(tr("parseFile: Invalid data checksum"), index);
|
||||
if (msgInvalidTailValue)
|
||||
msg(tr("parseFile: Invalid tail value"), index);
|
||||
if (msgInvalidType)
|
||||
msg(tr("parseFile: Unknown file type 0x%1").arg(fileHeader->Type, 2), index);
|
||||
if (msgNonEmptyPadFile)
|
||||
msg(tr("parseFile: Non-empty pad file contents will be destroyed after volume modification"), index);
|
||||
if (msgNonEmptyPadFile)
|
||||
msg(tr("parseFile: Non-empty pad file contents will be destroyed after volume modification"), index);
|
||||
|
||||
if (!parseCurrentFile)
|
||||
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) {
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
|
||||
result = decompress(body, EFI_STANDARD_COMPRESSION, decompressed, &algorithm);
|
||||
result = decompress(body, EFI_STANDARD_COMPRESSION, decompressed, &algorithm);
|
||||
if (result)
|
||||
parseCurrentSection = false;
|
||||
|
||||
if (algorithm == COMPRESSION_ALGORITHM_TIANO) {
|
||||
info += tr("\nCompression type: Tiano");
|
||||
if (algorithm == COMPRESSION_ALGORITHM_TIANO) {
|
||||
info += tr("\nCompression type: Tiano");
|
||||
info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8);
|
||||
}
|
||||
else if (algorithm == COMPRESSION_ALGORITHM_EFI11) {
|
||||
info += tr("\nCompression type: EFI 1.1");
|
||||
}
|
||||
else if (algorithm == COMPRESSION_ALGORITHM_EFI11) {
|
||||
info += tr("\nCompression type: EFI 1.1");
|
||||
info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8);
|
||||
}
|
||||
else
|
||||
info += tr("\nCompression type: unknown");
|
||||
}
|
||||
else
|
||||
info += tr("\nCompression type: unknown");
|
||||
}
|
||||
// LZMA compressed section
|
||||
else if (QByteArray((const char*)&guidDefinedSectionHeader->SectionDefinitionGuid, sizeof(EFI_GUID)) == EFI_GUIDED_SECTION_LZMA) {
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
|
||||
result = decompress(body, EFI_CUSTOMIZED_COMPRESSION, decompressed, &algorithm);
|
||||
if (result)
|
||||
if (result)
|
||||
parseCurrentSection = false;
|
||||
|
||||
if (algorithm == COMPRESSION_ALGORITHM_LZMA) {
|
||||
info += tr("\nCompression type: LZMA");
|
||||
if (algorithm == COMPRESSION_ALGORITHM_LZMA) {
|
||||
info += tr("\nCompression type: LZMA");
|
||||
info += tr("\nDecompressed size: 0x%1").hexarg(decompressed.length(), 8);
|
||||
}
|
||||
else
|
||||
info += tr("\nCompression type: unknown");
|
||||
}
|
||||
else
|
||||
info += tr("\nCompression type: unknown");
|
||||
}
|
||||
// Intel signed section
|
||||
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
|
||||
if ((sectionHeader->Type == EFI_SECTION_PE32 || sectionHeader->Type == EFI_SECTION_TE)
|
||||
&& model->subtype(parent) == EFI_FV_FILETYPE_PEI_CORE
|
||||
&& oldPeiCoreEntryPoint == 0) {
|
||||
&& model->subtype(parent) == EFI_FV_FILETYPE_PEI_CORE
|
||||
&& oldPeiCoreEntryPoint == 0) {
|
||||
result = getEntryPoint(model->body(index), oldPeiCoreEntryPoint);
|
||||
if (result)
|
||||
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)
|
||||
{
|
||||
dumped = false;
|
||||
UINT8 result = recursiveDump(index, path, guid);
|
||||
if (result)
|
||||
return result;
|
||||
else if (!dumped)
|
||||
return ERR_ITEM_NOT_FOUND;
|
||||
return ERR_SUCCESS;
|
||||
dumped = false;
|
||||
UINT8 result = recursiveDump(index, path, guid);
|
||||
if (result)
|
||||
return result;
|
||||
else if (!dumped)
|
||||
return ERR_ITEM_NOT_FOUND;
|
||||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
QDir dir;
|
||||
if (guid.isEmpty() ||
|
||||
guidToQString(*(EFI_GUID*)model->header(index).constData()) == guid ||
|
||||
guidToQString(*(EFI_GUID*)model->header(model->findParentOfType(index, Types::File)).constData()) == guid) {
|
||||
if (guid.isEmpty() ||
|
||||
guidToQString(*(EFI_GUID*)model->header(index).constData()) == guid ||
|
||||
guidToQString(*(EFI_GUID*)model->header(model->findParentOfType(index, Types::File)).constData()) == guid) {
|
||||
|
||||
if (dir.cd(path))
|
||||
return ERR_DIR_ALREADY_EXIST;
|
||||
if (dir.cd(path))
|
||||
return ERR_DIR_ALREADY_EXIST;
|
||||
|
||||
if (!dir.mkpath(path))
|
||||
return ERR_DIR_CREATE;
|
||||
if (!dir.mkpath(path))
|
||||
return ERR_DIR_CREATE;
|
||||
|
||||
QFile file;
|
||||
if (!model->header(index).isEmpty()) {
|
||||
file.setFileName(tr("%1/header.bin").arg(path));
|
||||
if (!file.open(QFile::WriteOnly))
|
||||
return ERR_FILE_OPEN;
|
||||
file.write(model->header(index));
|
||||
file.close();
|
||||
}
|
||||
QFile file;
|
||||
if (!model->header(index).isEmpty()) {
|
||||
file.setFileName(tr("%1/header.bin").arg(path));
|
||||
if (!file.open(QFile::WriteOnly))
|
||||
return ERR_FILE_OPEN;
|
||||
file.write(model->header(index));
|
||||
file.close();
|
||||
}
|
||||
|
||||
if (!model->body(index).isEmpty()) {
|
||||
file.setFileName(tr("%1/body.bin").arg(path));
|
||||
if (!file.open(QFile::WriteOnly))
|
||||
return ERR_FILE_OPEN;
|
||||
file.write(model->body(index));
|
||||
file.close();
|
||||
}
|
||||
if (!model->body(index).isEmpty()) {
|
||||
file.setFileName(tr("%1/body.bin").arg(path));
|
||||
if (!file.open(QFile::WriteOnly))
|
||||
return ERR_FILE_OPEN;
|
||||
file.write(model->body(index));
|
||||
file.close();
|
||||
}
|
||||
|
||||
QString info = tr("Type: %1\nSubtype: %2\n%3%4")
|
||||
.arg(model->typeString(index))
|
||||
.arg(model->subtypeString(index))
|
||||
.arg(model->textString(index).isEmpty() ? "" : tr("Text: %1\n").arg(model->textString(index)))
|
||||
.arg(model->info(index));
|
||||
file.setFileName(tr("%1/info.txt").arg(path));
|
||||
if (!file.open(QFile::Text | QFile::WriteOnly))
|
||||
return ERR_FILE_OPEN;
|
||||
file.write(info.toLatin1());
|
||||
file.close();
|
||||
dumped = true;
|
||||
}
|
||||
QString info = tr("Type: %1\nSubtype: %2\n%3%4")
|
||||
.arg(model->typeString(index))
|
||||
.arg(model->subtypeString(index))
|
||||
.arg(model->textString(index).isEmpty() ? "" : tr("Text: %1\n").arg(model->textString(index)))
|
||||
.arg(model->info(index));
|
||||
file.setFileName(tr("%1/info.txt").arg(path));
|
||||
if (!file.open(QFile::Text | QFile::WriteOnly))
|
||||
return ERR_FILE_OPEN;
|
||||
file.write(info.toLatin1());
|
||||
file.close();
|
||||
dumped = true;
|
||||
}
|
||||
|
||||
UINT8 result;
|
||||
for (int i = 0; i < model->rowCount(index); i++) {
|
||||
|
10
ffsengine.h
10
ffsengine.h
@ -110,10 +110,10 @@ private:
|
||||
UINT32 newPeiCoreEntryPoint;
|
||||
|
||||
// Parsing helpers
|
||||
UINT8 getPaddingType(const QByteArray & padding);
|
||||
UINT8 getPaddingType(const QByteArray & padding);
|
||||
void parseAprioriRawSection(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 getFileSize(const QByteArray & volume, const UINT32 fileOffset, UINT32 & fileSize);
|
||||
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);
|
||||
UINT32 crc32(UINT32 initial, const UINT8* buffer, UINT32 length);
|
||||
|
||||
// Recursive dump
|
||||
bool dumped;
|
||||
UINT8 recursiveDump(const QModelIndex & index, const QString & path, const QString & filter);
|
||||
// Recursive dump
|
||||
bool dumped;
|
||||
UINT8 recursiveDump(const QModelIndex & index, const QString & path, const QString & filter);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -14,12 +14,12 @@
|
||||
#include "guidlineedit.h"
|
||||
|
||||
GuidLineEdit::GuidLineEdit(QWidget * parent)
|
||||
:QLineEdit(parent)
|
||||
:QLineEdit(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)
|
||||
{
|
||||
if (event == QKeySequence::Delete || event->key() == Qt::Key_Backspace)
|
||||
{
|
||||
int pos = cursorPosition();
|
||||
if (event->key() == Qt::Key_Backspace && pos > 0) {
|
||||
cursorBackward(false);
|
||||
pos = cursorPosition();
|
||||
}
|
||||
if (event == QKeySequence::Delete || event->key() == Qt::Key_Backspace)
|
||||
{
|
||||
int pos = cursorPosition();
|
||||
if (event->key() == Qt::Key_Backspace && pos > 0) {
|
||||
cursorBackward(false);
|
||||
pos = cursorPosition();
|
||||
}
|
||||
|
||||
QString txt = text();
|
||||
QString selected = selectedText();
|
||||
QString txt = text();
|
||||
QString selected = selectedText();
|
||||
|
||||
if (!selected.isEmpty()) {
|
||||
pos = QLineEdit::selectionStart();
|
||||
for (int i = pos; i < pos + selected.count(); i++)
|
||||
if (txt[i] != QChar('-'))
|
||||
txt[i] = QChar('.');
|
||||
}
|
||||
else
|
||||
txt[pos] = QChar('.');
|
||||
if (!selected.isEmpty()) {
|
||||
pos = QLineEdit::selectionStart();
|
||||
for (int i = pos; i < pos + selected.count(); i++)
|
||||
if (txt[i] != QChar('-'))
|
||||
txt[i] = QChar('.');
|
||||
}
|
||||
else
|
||||
txt[pos] = QChar('.');
|
||||
|
||||
setCursorPosition(0);
|
||||
insert(txt);
|
||||
setCursorPosition(pos);
|
||||
setCursorPosition(0);
|
||||
insert(txt);
|
||||
setCursorPosition(pos);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Call original event handler
|
||||
QLineEdit::keyPressEvent(event);
|
||||
// Call original event handler
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
@ -24,12 +24,12 @@
|
||||
class GuidLineEdit : public QLineEdit
|
||||
{
|
||||
public:
|
||||
GuidLineEdit(QWidget * parent = 0);
|
||||
GuidLineEdit(const QString & contents, QWidget * parent = 0);
|
||||
~GuidLineEdit();
|
||||
GuidLineEdit(QWidget * parent = 0);
|
||||
GuidLineEdit(const QString & contents, QWidget * parent = 0);
|
||||
~GuidLineEdit();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
|
||||
};
|
||||
|
||||
|
16
types.cpp
16
types.cpp
@ -70,14 +70,14 @@ QString itemSubtypeToQString(const UINT8 type, const UINT8 subtype)
|
||||
else
|
||||
return QObject::tr("Unknown");
|
||||
case Types::Padding:
|
||||
if (subtype == Subtypes::ZeroPadding)
|
||||
return QObject::tr("Empty(0x00)");
|
||||
else if (subtype == Subtypes::OnePadding)
|
||||
return QObject::tr("Empty(0xFF)");
|
||||
else if (subtype == Subtypes::DataPadding)
|
||||
return QObject::tr("Nonempty");
|
||||
else
|
||||
return "";
|
||||
if (subtype == Subtypes::ZeroPadding)
|
||||
return QObject::tr("Empty(0x00)");
|
||||
else if (subtype == Subtypes::OnePadding)
|
||||
return QObject::tr("Empty(0xFF)");
|
||||
else if (subtype == Subtypes::DataPadding)
|
||||
return QObject::tr("Nonempty");
|
||||
else
|
||||
return "";
|
||||
case Types::Volume:
|
||||
if (subtype == Subtypes::BootVolume)
|
||||
return QObject::tr("Boot");
|
||||
|
10
types.h
10
types.h
@ -70,11 +70,11 @@ namespace Subtypes {
|
||||
PdrRegion
|
||||
};
|
||||
|
||||
enum PaddingSubtypes {
|
||||
ZeroPadding = 110,
|
||||
OnePadding,
|
||||
DataPadding
|
||||
};
|
||||
enum PaddingSubtypes {
|
||||
ZeroPadding = 110,
|
||||
OnePadding,
|
||||
DataPadding
|
||||
};
|
||||
};
|
||||
|
||||
// *ToQString conversion routines
|
||||
|
17
uefitool.cpp
17
uefitool.cpp
@ -17,7 +17,7 @@
|
||||
UEFITool::UEFITool(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::UEFITool),
|
||||
version(tr("0.19.2"))
|
||||
version(tr("0.19.3"))
|
||||
{
|
||||
clipboard = QApplication::clipboard();
|
||||
|
||||
@ -26,8 +26,8 @@ version(tr("0.19.2"))
|
||||
searchDialog = new SearchDialog(this);
|
||||
ffsEngine = NULL;
|
||||
|
||||
// Set window title
|
||||
this->setWindowTitle(tr("UEFITool %1").arg(version));
|
||||
// Set window title
|
||||
this->setWindowTitle(tr("UEFITool %1").arg(version));
|
||||
|
||||
// Connect signals to slots
|
||||
connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile()));
|
||||
@ -89,8 +89,8 @@ void UEFITool::init()
|
||||
ui->messageListWidget->clear();
|
||||
ui->infoEdit->clear();
|
||||
|
||||
// Set window title
|
||||
this->setWindowTitle(tr("UEFITool %1").arg(version));
|
||||
// Set window title
|
||||
this->setWindowTitle(tr("UEFITool %1").arg(version));
|
||||
|
||||
// Disable menus
|
||||
ui->menuCapsuleActions->setDisabled(true);
|
||||
@ -485,7 +485,8 @@ void UEFITool::extract(const UINT8 mode)
|
||||
void UEFITool::about()
|
||||
{
|
||||
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 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>"
|
||||
@ -565,7 +566,7 @@ void UEFITool::openImageFile(QString path)
|
||||
inputFile.close();
|
||||
|
||||
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);
|
||||
showMessages();
|
||||
@ -636,7 +637,7 @@ void UEFITool::showMessages()
|
||||
ui->messageListWidget->addItem(new MessageListItem(messageItems.at(i)));
|
||||
}
|
||||
|
||||
ui->messageListWidget->scrollToBottom();
|
||||
ui->messageListWidget->scrollToBottom();
|
||||
}
|
||||
|
||||
void UEFITool::scrollTreeView(QListWidgetItem* item)
|
||||
|
@ -95,8 +95,8 @@ private:
|
||||
SearchDialog* searchDialog;
|
||||
QClipboard* clipboard;
|
||||
QString currentDir;
|
||||
QQueue<MessageListItem> messageItems;
|
||||
const QString version;
|
||||
QQueue<MessageListItem> messageItems;
|
||||
const QString version;
|
||||
|
||||
void showMessages();
|
||||
|
||||
|
BIN
uefitool.icns
BIN
uefitool.icns
Binary file not shown.
BIN
uefitool.ico
BIN
uefitool.ico
Binary file not shown.
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
@ -43,7 +43,6 @@ HEADERS += uefitool.h \
|
||||
Tiano/EfiTianoDecompress.h \
|
||||
Tiano/EfiTianoCompress.h
|
||||
|
||||
|
||||
FORMS += uefitool.ui \
|
||||
searchdialog.ui
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user