mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 16:08:23 +08:00
Merge pull request #279 from LongSoft/PR/make_format_strings_sane_again
Make format strings sane again
This commit is contained in:
commit
67c568daf8
@ -1,15 +1,15 @@
|
||||
/* fssfinder.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "ffsfinder.h"
|
||||
|
||||
@ -64,166 +64,166 @@ USTATUS FfsFinder::findHexPattern(const UModelIndex & index, const UByteArray &
|
||||
while ((offset = (INT32)hexBody.indexOf(regexp, (qsizetype)offset, ®expmatch)) != -1)
|
||||
{
|
||||
#else
|
||||
QRegExp regexp = QRegExp(UString(hexPattern), Qt::CaseInsensitive);
|
||||
QRegExp regexp = QRegExp(UString(hexPattern), Qt::CaseInsensitive);
|
||||
|
||||
INT32 offset = regexp.indexIn(hexBody);
|
||||
INT32 offset = regexp.indexIn(hexBody);
|
||||
|
||||
while (offset >= 0) {
|
||||
while (offset >= 0) {
|
||||
#endif
|
||||
|
||||
if (offset % 2 == 0) {
|
||||
// For patterns that cross header|body boundary, skip patterns entirely located in body, since
|
||||
// children search above has already found them.
|
||||
if (!(hasChildren && mode == SEARCH_MODE_ALL && offset/2 >= model->header(index).size())) {
|
||||
msg(UString("Hex pattern \"") + UString(hexPattern)
|
||||
if (offset % 2 == 0) {
|
||||
// For patterns that cross header|body boundary, skip patterns entirely located in body, since
|
||||
// children search above has already found them.
|
||||
if (!(hasChildren && mode == SEARCH_MODE_ALL && offset/2 >= model->header(index).size())) {
|
||||
msg(UString("Hex pattern \"") + UString(hexPattern)
|
||||
+ UString("\" found as \"") + hexBody.mid(offset, hexPattern.length()).toUpper()
|
||||
+ UString("\" in ") + model->name(model->parent(index))
|
||||
+ UString("/") + model->name(index)
|
||||
+ usprintf(" at %s-offset %02Xh", mode == SEARCH_MODE_BODY ? "body" : "header", offset / 2),
|
||||
index);
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
offset += 1;
|
||||
#else
|
||||
offset = regexp.indexIn(hexBody, offset + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
USTATUS FfsFinder::findGuidPattern(const UModelIndex & index, const UByteArray & guidPattern, const UINT8 mode)
|
||||
{
|
||||
if (guidPattern.isEmpty())
|
||||
return U_INVALID_PARAMETER;
|
||||
|
||||
if (!index.isValid())
|
||||
return U_SUCCESS;
|
||||
|
||||
bool hasChildren = (model->rowCount(index) > 0);
|
||||
for (int i = 0; i < model->rowCount(index); i++) {
|
||||
findGuidPattern(index.model()->index(i, index.column(), index), guidPattern, mode);
|
||||
}
|
||||
|
||||
UByteArray data;
|
||||
if (hasChildren) {
|
||||
if (mode != SEARCH_MODE_BODY)
|
||||
data = model->header(index);
|
||||
}
|
||||
else {
|
||||
if (mode == SEARCH_MODE_HEADER)
|
||||
data.append(model->header(index));
|
||||
else if (mode == SEARCH_MODE_BODY)
|
||||
data.append(model->body(index));
|
||||
else
|
||||
data.append(model->header(index)).append(model->body(index));
|
||||
}
|
||||
|
||||
UString hexBody = UString(data.toHex());
|
||||
QList<UByteArray> list = guidPattern.split('-');
|
||||
if (list.count() != 5)
|
||||
return U_INVALID_PARAMETER;
|
||||
|
||||
UByteArray hexPattern;
|
||||
// Reverse first GUID block
|
||||
hexPattern.append(list.at(0).mid(6, 2));
|
||||
hexPattern.append(list.at(0).mid(4, 2));
|
||||
hexPattern.append(list.at(0).mid(2, 2));
|
||||
hexPattern.append(list.at(0).mid(0, 2));
|
||||
// Reverse second GUID block
|
||||
hexPattern.append(list.at(1).mid(2, 2));
|
||||
hexPattern.append(list.at(1).mid(0, 2));
|
||||
// Reverse third GUID block
|
||||
hexPattern.append(list.at(2).mid(2, 2));
|
||||
hexPattern.append(list.at(2).mid(0, 2));
|
||||
// Append fourth and fifth GUID blocks as is
|
||||
hexPattern.append(list.at(3)).append(list.at(4));
|
||||
|
||||
// Check for "all substrings" pattern
|
||||
if (hexPattern.count('.') == hexPattern.length())
|
||||
return U_SUCCESS;
|
||||
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
QRegularExpression regexp((QString)UString(hexPattern));
|
||||
regexp.setPatternOptions((QRegularExpression::PatternOptions)0x1);
|
||||
QRegularExpressionMatch regexpmatch;
|
||||
|
||||
INT32 offset = 0;
|
||||
offset = (INT32)hexBody.indexOf(regexp, (qsizetype)offset, ®expmatch);
|
||||
#else
|
||||
QRegExp regexp(UString(hexPattern), Qt::CaseInsensitive);
|
||||
|
||||
INT32 offset = regexp.indexIn(hexBody);
|
||||
#endif
|
||||
|
||||
while (offset >= 0) {
|
||||
if (offset % 2 == 0) {
|
||||
msg(UString("GUID pattern \"") + UString(guidPattern)
|
||||
+ UString("\" found as \"") + hexBody.mid(offset, hexPattern.length()).toUpper()
|
||||
+ UString("\" in ") + model->name(model->parent(index))
|
||||
+ UString("/") + model->name(index)
|
||||
+ usprintf(" at %s-offset %02Xh", mode == SEARCH_MODE_BODY ? "body" : "header", offset / 2),
|
||||
index);
|
||||
}
|
||||
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
offset = (INT32)hexBody.indexOf(regexp, (qsizetype)offset + 1, ®expmatch);
|
||||
#else
|
||||
offset = regexp.indexIn(hexBody, offset + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
offset += 1;
|
||||
#else
|
||||
offset = regexp.indexIn(hexBody, offset + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
USTATUS FfsFinder::findGuidPattern(const UModelIndex & index, const UByteArray & guidPattern, const UINT8 mode)
|
||||
{
|
||||
if (guidPattern.isEmpty())
|
||||
return U_INVALID_PARAMETER;
|
||||
|
||||
if (!index.isValid())
|
||||
return U_SUCCESS;
|
||||
|
||||
bool hasChildren = (model->rowCount(index) > 0);
|
||||
for (int i = 0; i < model->rowCount(index); i++) {
|
||||
findGuidPattern(index.model()->index(i, index.column(), index), guidPattern, mode);
|
||||
}
|
||||
|
||||
UByteArray data;
|
||||
if (hasChildren) {
|
||||
if (mode != SEARCH_MODE_BODY)
|
||||
data = model->header(index);
|
||||
}
|
||||
else {
|
||||
if (mode == SEARCH_MODE_HEADER)
|
||||
data.append(model->header(index));
|
||||
else if (mode == SEARCH_MODE_BODY)
|
||||
data.append(model->body(index));
|
||||
else
|
||||
data.append(model->header(index)).append(model->body(index));
|
||||
}
|
||||
USTATUS FfsFinder::findTextPattern(const UModelIndex & index, const UString & pattern, const UINT8 mode, const bool unicode, const Qt::CaseSensitivity caseSensitive)
|
||||
{
|
||||
if (pattern.isEmpty())
|
||||
return U_INVALID_PARAMETER;
|
||||
|
||||
UString hexBody = UString(data.toHex());
|
||||
QList<UByteArray> list = guidPattern.split('-');
|
||||
if (list.count() != 5)
|
||||
return U_INVALID_PARAMETER;
|
||||
if (!index.isValid())
|
||||
return U_SUCCESS;
|
||||
|
||||
UByteArray hexPattern;
|
||||
// Reverse first GUID block
|
||||
hexPattern.append(list.at(0).mid(6, 2));
|
||||
hexPattern.append(list.at(0).mid(4, 2));
|
||||
hexPattern.append(list.at(0).mid(2, 2));
|
||||
hexPattern.append(list.at(0).mid(0, 2));
|
||||
// Reverse second GUID block
|
||||
hexPattern.append(list.at(1).mid(2, 2));
|
||||
hexPattern.append(list.at(1).mid(0, 2));
|
||||
// Reverse third GUID block
|
||||
hexPattern.append(list.at(2).mid(2, 2));
|
||||
hexPattern.append(list.at(2).mid(0, 2));
|
||||
// Append fourth and fifth GUID blocks as is
|
||||
hexPattern.append(list.at(3)).append(list.at(4));
|
||||
|
||||
// Check for "all substrings" pattern
|
||||
if (hexPattern.count('.') == hexPattern.length())
|
||||
return U_SUCCESS;
|
||||
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
QRegularExpression regexp((QString)UString(hexPattern));
|
||||
regexp.setPatternOptions((QRegularExpression::PatternOptions)0x1);
|
||||
QRegularExpressionMatch regexpmatch;
|
||||
|
||||
INT32 offset = 0;
|
||||
offset = (INT32)hexBody.indexOf(regexp, (qsizetype)offset, ®expmatch);
|
||||
#else
|
||||
QRegExp regexp(UString(hexPattern), Qt::CaseInsensitive);
|
||||
|
||||
INT32 offset = regexp.indexIn(hexBody);
|
||||
#endif
|
||||
|
||||
while (offset >= 0) {
|
||||
if (offset % 2 == 0) {
|
||||
msg(UString("GUID pattern \"") + UString(guidPattern)
|
||||
+ UString("\" found as \"") + hexBody.mid(offset, hexPattern.length()).toUpper()
|
||||
+ UString("\" in ") + model->name(model->parent(index))
|
||||
+ UString("/") + model->name(index)
|
||||
+ usprintf(" at %s-offset %02Xh", mode == SEARCH_MODE_BODY ? "body" : "header", offset / 2),
|
||||
index);
|
||||
bool hasChildren = (model->rowCount(index) > 0);
|
||||
for (int i = 0; i < model->rowCount(index); i++) {
|
||||
findTextPattern(index.model()->index(i, index.column(), index), pattern, mode, unicode, caseSensitive);
|
||||
}
|
||||
|
||||
UByteArray body;
|
||||
if (hasChildren) {
|
||||
if (mode != SEARCH_MODE_BODY)
|
||||
body = model->header(index);
|
||||
}
|
||||
else {
|
||||
if (mode == SEARCH_MODE_HEADER)
|
||||
body.append(model->header(index));
|
||||
else if (mode == SEARCH_MODE_BODY)
|
||||
body.append(model->body(index));
|
||||
else
|
||||
body.append(model->header(index)).append(model->body(index));
|
||||
}
|
||||
|
||||
UString data;
|
||||
if (unicode)
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
offset = (INT32)hexBody.indexOf(regexp, (qsizetype)offset + 1, ®expmatch);
|
||||
#else
|
||||
offset = regexp.indexIn(hexBody, offset + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
USTATUS FfsFinder::findTextPattern(const UModelIndex & index, const UString & pattern, const UINT8 mode, const bool unicode, const Qt::CaseSensitivity caseSensitive)
|
||||
{
|
||||
if (pattern.isEmpty())
|
||||
return U_INVALID_PARAMETER;
|
||||
|
||||
if (!index.isValid())
|
||||
return U_SUCCESS;
|
||||
|
||||
bool hasChildren = (model->rowCount(index) > 0);
|
||||
for (int i = 0; i < model->rowCount(index); i++) {
|
||||
findTextPattern(index.model()->index(i, index.column(), index), pattern, mode, unicode, caseSensitive);
|
||||
}
|
||||
|
||||
UByteArray body;
|
||||
if (hasChildren) {
|
||||
if (mode != SEARCH_MODE_BODY)
|
||||
body = model->header(index);
|
||||
}
|
||||
else {
|
||||
if (mode == SEARCH_MODE_HEADER)
|
||||
body.append(model->header(index));
|
||||
else if (mode == SEARCH_MODE_BODY)
|
||||
body.append(model->body(index));
|
||||
else
|
||||
body.append(model->header(index)).append(model->body(index));
|
||||
}
|
||||
|
||||
UString data;
|
||||
if (unicode)
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
data = UString::fromUtf16((const char16_t*)body.constData(), (int)(body.length() / 2));
|
||||
data = UString::fromUtf16((const char16_t*)body.constData(), (int)(body.length() / 2));
|
||||
#else
|
||||
data = UString::fromUtf16((const ushort*)body.constData(), (int)(body.length() / 2));
|
||||
#endif
|
||||
else
|
||||
data = UString::fromLatin1((const char*)body.constData(), body.length());
|
||||
else
|
||||
data = UString::fromLatin1((const char*)body.constData(), body.length());
|
||||
|
||||
int offset = -1;
|
||||
while ((offset = (int)data.indexOf(pattern, (int)(offset + 1), caseSensitive)) >= 0) {
|
||||
int offset = -1;
|
||||
while ((offset = (int)data.indexOf(pattern, (int)(offset + 1), caseSensitive)) >= 0) {
|
||||
|
||||
msg((unicode ? UString("Unicode") : UString("ASCII")) + UString(" text \"") + UString(pattern)
|
||||
+ UString("\" in ") + model->name(model->parent(index))
|
||||
+ UString("/") + model->name(index)
|
||||
+ usprintf(" at %s-offset %02Xh", mode == SEARCH_MODE_BODY ? "body" : "header", (unicode ? offset * 2 : offset)),
|
||||
index);
|
||||
msg((unicode ? UString("Unicode") : UString("ASCII")) + UString(" text \"") + UString(pattern)
|
||||
+ UString("\" in ") + model->name(model->parent(index))
|
||||
+ UString("/") + model->name(index)
|
||||
+ usprintf(" at %s-offset %02Xh", mode == SEARCH_MODE_BODY ? "body" : "header", (unicode ? offset * 2 : offset)),
|
||||
index);
|
||||
}
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
/* guidlineedit.cpp
|
||||
|
||||
Copyright (c) 2014, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2014, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "guidlineedit.h"
|
||||
|
||||
GuidLineEdit::GuidLineEdit(QWidget * parent)
|
||||
:QLineEdit(parent)
|
||||
:QLineEdit(parent)
|
||||
{
|
||||
}
|
||||
|
||||
GuidLineEdit::GuidLineEdit(const QString & contents, QWidget * parent)
|
||||
:QLineEdit(contents, parent)
|
||||
:QLineEdit(contents, parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -42,12 +42,13 @@ void GuidLineEdit::keyPressEvent(QKeyEvent * event)
|
||||
|
||||
if (!selected.isEmpty()) {
|
||||
pos = QLineEdit::selectionStart();
|
||||
for (int i = pos; i < pos + selected.count(); i++)
|
||||
for (int i = pos; i < pos + selected.length(); i++)
|
||||
if (txt[i] != QChar('-'))
|
||||
txt[i] = QChar('.');
|
||||
}
|
||||
else
|
||||
else {
|
||||
txt[pos] = QChar('.');
|
||||
}
|
||||
|
||||
setCursorPosition(0);
|
||||
insert(txt);
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* hexspinbox.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "hexspinbox.h"
|
||||
#include <QDebug>
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* hexviewdialog.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "hexviewdialog.h"
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* searchdialog.cpp
|
||||
|
||||
Copyright (c) 2014, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2014, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "searchdialog.h"
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* uefitool.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "../version.h"
|
||||
#include "uefitool.h"
|
||||
@ -150,9 +150,9 @@ void UEFITool::init()
|
||||
|
||||
// Connect
|
||||
connect(ui->structureTreeView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
|
||||
this, SLOT(populateUi(const QModelIndex &)));
|
||||
this, SLOT(populateUi(const QModelIndex &)));
|
||||
connect(ui->structureTreeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
|
||||
this, SLOT(populateUi(const QItemSelection &)));
|
||||
this, SLOT(populateUi(const QItemSelection &)));
|
||||
connect(ui->parserMessagesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(scrollTreeView(QListWidgetItem*)));
|
||||
connect(ui->parserMessagesListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(enableMessagesCopyActions(QListWidgetItem*)));
|
||||
connect(ui->finderMessagesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(scrollTreeView(QListWidgetItem*)));
|
||||
@ -199,35 +199,35 @@ void UEFITool::populateUi(const QModelIndex ¤t)
|
||||
ui->menuFileActions->setEnabled(type == Types::File);
|
||||
ui->menuSectionActions->setEnabled(type == Types::Section);
|
||||
ui->menuEntryActions->setEnabled(type == Types::Microcode
|
||||
|| type == Types::SlicData
|
||||
|| type == Types::NvarEntry
|
||||
|| type == Types::VssEntry
|
||||
|| type == Types::FsysEntry
|
||||
|| type == Types::EvsaEntry
|
||||
|| type == Types::FlashMapEntry
|
||||
|| type == Types::IfwiHeader
|
||||
|| type == Types::IfwiPartition
|
||||
|| type == Types::FptPartition
|
||||
|| type == Types::FptEntry
|
||||
|| type == Types::BpdtPartition
|
||||
|| type == Types::BpdtEntry
|
||||
|| type == Types::CpdPartition
|
||||
|| type == Types::CpdEntry
|
||||
|| type == Types::CpdExtension
|
||||
|| type == Types::CpdSpiEntry
|
||||
);
|
||||
|| type == Types::SlicData
|
||||
|| type == Types::NvarEntry
|
||||
|| type == Types::VssEntry
|
||||
|| type == Types::FsysEntry
|
||||
|| type == Types::EvsaEntry
|
||||
|| type == Types::FlashMapEntry
|
||||
|| type == Types::IfwiHeader
|
||||
|| type == Types::IfwiPartition
|
||||
|| type == Types::FptPartition
|
||||
|| type == Types::FptEntry
|
||||
|| type == Types::BpdtPartition
|
||||
|| type == Types::BpdtEntry
|
||||
|| type == Types::CpdPartition
|
||||
|| type == Types::CpdEntry
|
||||
|| type == Types::CpdExtension
|
||||
|| type == Types::CpdSpiEntry
|
||||
);
|
||||
ui->menuStoreActions->setEnabled(type == Types::VssStore
|
||||
|| type == Types::Vss2Store
|
||||
|| type == Types::FdcStore
|
||||
|| type == Types::FsysStore
|
||||
|| type == Types::EvsaStore
|
||||
|| type == Types::FtwStore
|
||||
|| type == Types::FlashMapStore
|
||||
|| type == Types::CmdbStore
|
||||
|| type == Types::FptStore
|
||||
|| type == Types::BpdtStore
|
||||
|| type == Types::CpdStore
|
||||
);
|
||||
|| type == Types::Vss2Store
|
||||
|| type == Types::FdcStore
|
||||
|| type == Types::FsysStore
|
||||
|| type == Types::EvsaStore
|
||||
|| type == Types::FtwStore
|
||||
|| type == Types::FlashMapStore
|
||||
|| type == Types::CmdbStore
|
||||
|| type == Types::FptStore
|
||||
|| type == Types::BpdtStore
|
||||
|| type == Types::CpdStore
|
||||
);
|
||||
|
||||
// Enable actions
|
||||
ui->actionHexView->setDisabled(model->hasEmptyHeader(current) && model->hasEmptyBody(current) && model->hasEmptyTail(current));
|
||||
@ -307,7 +307,7 @@ void UEFITool::search()
|
||||
else
|
||||
mode = SEARCH_MODE_ALL;
|
||||
ffsFinder->findTextPattern(rootIndex, pattern, mode, searchDialog->ui->textUnicodeCheckBox->isChecked(),
|
||||
(Qt::CaseSensitivity) searchDialog->ui->textCaseSensitiveCheckBox->isChecked());
|
||||
(Qt::CaseSensitivity) searchDialog->ui->textCaseSensitiveCheckBox->isChecked());
|
||||
showFinderMessages();
|
||||
}
|
||||
}
|
||||
@ -482,72 +482,72 @@ void UEFITool::extract(const UINT8 mode)
|
||||
QString path;
|
||||
if (mode == EXTRACT_MODE_AS_IS) {
|
||||
switch (type) {
|
||||
case Types::Capsule: path = QFileDialog::getSaveFileName(this, tr("Save capsule to file"), name + ".cap", tr("Capsule files (*.cap *.bin);;All files (*)")); break;
|
||||
case Types::Image: path = QFileDialog::getSaveFileName(this, tr("Save image to file"), name + ".rom", tr("Image files (*.rom *.bin);;All files (*)")); break;
|
||||
case Types::Region: path = QFileDialog::getSaveFileName(this, tr("Save region to file"), name + ".rgn", tr("Region files (*.rgn *.bin);;All files (*)")); break;
|
||||
case Types::Padding: path = QFileDialog::getSaveFileName(this, tr("Save padding to file"), name + ".pad", tr("Padding files (*.pad *.bin);;All files (*)")); break;
|
||||
case Types::Volume: path = QFileDialog::getSaveFileName(this, tr("Save volume to file"), name + ".vol", tr("Volume files (*.vol *.bin);;All files (*)")); break;
|
||||
case Types::File: path = QFileDialog::getSaveFileName(this, tr("Save FFS file to file"), name + ".ffs", tr("FFS files (*.ffs *.bin);;All files (*)")); break;
|
||||
case Types::Section: path = QFileDialog::getSaveFileName(this, tr("Save section to file"), name + ".sct", tr("Section files (*.sct *.bin);;All files (*)")); break;
|
||||
case Types::NvarEntry: path = QFileDialog::getSaveFileName(this, tr("Save NVAR entry to file"), name + ".nvar", tr("NVAR entry files (*.nvar *.bin);;All files (*)")); break;
|
||||
case Types::VssEntry: path = QFileDialog::getSaveFileName(this, tr("Save VSS entry to file"), name + ".vss", tr("VSS entry files (*.vss *.bin);;All files (*)")); break;
|
||||
case Types::FsysEntry: path = QFileDialog::getSaveFileName(this, tr("Save Fsys entry to file"), name + ".fse", tr("Fsys entry files (*.fse *.bin);;All files (*)")); break;
|
||||
case Types::EvsaEntry: path = QFileDialog::getSaveFileName(this, tr("Save EVSA entry to file"), name + ".evse", tr("EVSA entry files (*.evse *.bin);;All files (*)")); break;
|
||||
case Types::FlashMapEntry: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap entry to file"), name + ".fme", tr("FlashMap entry files (*.fme *.bin);;All files (*)")); break;
|
||||
case Types::VssStore: path = QFileDialog::getSaveFileName(this, tr("Save VSS store to file"), name + ".vss", tr("VSS store files (*.vss *.bin);;All files (*)")); break;
|
||||
case Types::Vss2Store: path = QFileDialog::getSaveFileName(this, tr("Save VSS2 store to file"), name + ".vss2", tr("VSS2 store files (*.vss2 *.bin);;All files (*)")); break;
|
||||
case Types::FdcStore: path = QFileDialog::getSaveFileName(this, tr("Save FDC store to file"), name + ".fdc", tr("FDC store files (*.fdc *.bin);;All files (*)")); break;
|
||||
case Types::FsysStore: path = QFileDialog::getSaveFileName(this, tr("Save Fsys store to file"), name + ".fsys", tr("Fsys store files (*.fsys *.bin);;All files (*)")); break;
|
||||
case Types::EvsaStore: path = QFileDialog::getSaveFileName(this, tr("Save EVSA store to file"), name + ".evsa", tr("EVSA store files (*.evsa *.bin);;All files (*)")); break;
|
||||
case Types::FtwStore: path = QFileDialog::getSaveFileName(this, tr("Save FTW store to file"), name + ".ftw", tr("FTW store files (*.ftw *.bin);;All files (*)")); break;
|
||||
case Types::FlashMapStore: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap store to file"), name + ".fmap", tr("FlashMap store files (*.fmap *.bin);;All files (*)")); break;
|
||||
case Types::CmdbStore: path = QFileDialog::getSaveFileName(this, tr("Save CMDB store to file"), name + ".cmdb", tr("CMDB store files (*.cmdb *.bin);;All files (*)")); break;
|
||||
case Types::Microcode: path = QFileDialog::getSaveFileName(this, tr("Save microcode binary to file"), name + ".ucd", tr("Microcode binary files (*.ucd *.bin);;All files (*)")); break;
|
||||
case Types::SlicData:
|
||||
if (subtype == Subtypes::PubkeySlicData) path = QFileDialog::getSaveFileName(this, tr("Save SLIC pubkey to file"), name + ".spk", tr("SLIC pubkey files (*.spk *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save SLIC marker to file"), name + ".smk", tr("SLIC marker files (*.smk *.bin);;All files (*)"));
|
||||
break;
|
||||
default: path = QFileDialog::getSaveFileName(this, tr("Save object to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
|
||||
case Types::Capsule: path = QFileDialog::getSaveFileName(this, tr("Save capsule to file"), name + ".cap", tr("Capsule files (*.cap *.bin);;All files (*)")); break;
|
||||
case Types::Image: path = QFileDialog::getSaveFileName(this, tr("Save image to file"), name + ".rom", tr("Image files (*.rom *.bin);;All files (*)")); break;
|
||||
case Types::Region: path = QFileDialog::getSaveFileName(this, tr("Save region to file"), name + ".rgn", tr("Region files (*.rgn *.bin);;All files (*)")); break;
|
||||
case Types::Padding: path = QFileDialog::getSaveFileName(this, tr("Save padding to file"), name + ".pad", tr("Padding files (*.pad *.bin);;All files (*)")); break;
|
||||
case Types::Volume: path = QFileDialog::getSaveFileName(this, tr("Save volume to file"), name + ".vol", tr("Volume files (*.vol *.bin);;All files (*)")); break;
|
||||
case Types::File: path = QFileDialog::getSaveFileName(this, tr("Save FFS file to file"), name + ".ffs", tr("FFS files (*.ffs *.bin);;All files (*)")); break;
|
||||
case Types::Section: path = QFileDialog::getSaveFileName(this, tr("Save section to file"), name + ".sct", tr("Section files (*.sct *.bin);;All files (*)")); break;
|
||||
case Types::NvarEntry: path = QFileDialog::getSaveFileName(this, tr("Save NVAR entry to file"), name + ".nvar", tr("NVAR entry files (*.nvar *.bin);;All files (*)")); break;
|
||||
case Types::VssEntry: path = QFileDialog::getSaveFileName(this, tr("Save VSS entry to file"), name + ".vss", tr("VSS entry files (*.vss *.bin);;All files (*)")); break;
|
||||
case Types::FsysEntry: path = QFileDialog::getSaveFileName(this, tr("Save Fsys entry to file"), name + ".fse", tr("Fsys entry files (*.fse *.bin);;All files (*)")); break;
|
||||
case Types::EvsaEntry: path = QFileDialog::getSaveFileName(this, tr("Save EVSA entry to file"), name + ".evse", tr("EVSA entry files (*.evse *.bin);;All files (*)")); break;
|
||||
case Types::FlashMapEntry: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap entry to file"), name + ".fme", tr("FlashMap entry files (*.fme *.bin);;All files (*)")); break;
|
||||
case Types::VssStore: path = QFileDialog::getSaveFileName(this, tr("Save VSS store to file"), name + ".vss", tr("VSS store files (*.vss *.bin);;All files (*)")); break;
|
||||
case Types::Vss2Store: path = QFileDialog::getSaveFileName(this, tr("Save VSS2 store to file"), name + ".vss2", tr("VSS2 store files (*.vss2 *.bin);;All files (*)")); break;
|
||||
case Types::FdcStore: path = QFileDialog::getSaveFileName(this, tr("Save FDC store to file"), name + ".fdc", tr("FDC store files (*.fdc *.bin);;All files (*)")); break;
|
||||
case Types::FsysStore: path = QFileDialog::getSaveFileName(this, tr("Save Fsys store to file"), name + ".fsys", tr("Fsys store files (*.fsys *.bin);;All files (*)")); break;
|
||||
case Types::EvsaStore: path = QFileDialog::getSaveFileName(this, tr("Save EVSA store to file"), name + ".evsa", tr("EVSA store files (*.evsa *.bin);;All files (*)")); break;
|
||||
case Types::FtwStore: path = QFileDialog::getSaveFileName(this, tr("Save FTW store to file"), name + ".ftw", tr("FTW store files (*.ftw *.bin);;All files (*)")); break;
|
||||
case Types::FlashMapStore: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap store to file"), name + ".fmap", tr("FlashMap store files (*.fmap *.bin);;All files (*)")); break;
|
||||
case Types::CmdbStore: path = QFileDialog::getSaveFileName(this, tr("Save CMDB store to file"), name + ".cmdb", tr("CMDB store files (*.cmdb *.bin);;All files (*)")); break;
|
||||
case Types::Microcode: path = QFileDialog::getSaveFileName(this, tr("Save microcode binary to file"), name + ".ucd", tr("Microcode binary files (*.ucd *.bin);;All files (*)")); break;
|
||||
case Types::SlicData:
|
||||
if (subtype == Subtypes::PubkeySlicData) path = QFileDialog::getSaveFileName(this, tr("Save SLIC pubkey to file"), name + ".spk", tr("SLIC pubkey files (*.spk *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save SLIC marker to file"), name + ".smk", tr("SLIC marker files (*.smk *.bin);;All files (*)"));
|
||||
break;
|
||||
default: path = QFileDialog::getSaveFileName(this, tr("Save object to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
|
||||
}
|
||||
}
|
||||
else if (mode == EXTRACT_MODE_BODY || mode == EXTRACT_MODE_BODY_UNCOMPRESSED) {
|
||||
switch (type) {
|
||||
case Types::Capsule: path = QFileDialog::getSaveFileName(this, tr("Save capsule body to image file"), name + ".rom", tr("Image files (*.rom *.bin);;All files (*)")); break;
|
||||
case Types::Volume: path = QFileDialog::getSaveFileName(this, tr("Save volume body to file"), name + ".vbd", tr("Volume body files (*.vbd *.bin);;All files (*)")); break;
|
||||
case Types::File:
|
||||
if (subtype == EFI_FV_FILETYPE_ALL
|
||||
|| subtype == EFI_FV_FILETYPE_RAW) path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to raw file"), name + ".raw", tr("Raw files (*.raw *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to file"), name + ".fbd", tr("FFS file body files (*.fbd *.bin);;All files (*)"));
|
||||
break;
|
||||
case Types::Section:
|
||||
if (subtype == EFI_SECTION_COMPRESSION
|
||||
|| subtype == EFI_SECTION_GUID_DEFINED
|
||||
|| subtype == EFI_SECTION_DISPOSABLE) path = QFileDialog::getSaveFileName(this, tr("Save encapsulation section body to FFS body file"), name + ".fbd", tr("FFS file body files (*.fbd *.bin);;All files (*)"));
|
||||
else if (subtype == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) path = QFileDialog::getSaveFileName(this, tr("Save section body to volume file"), name + ".vol", tr("Volume files (*.vol *.bin);;All files (*)"));
|
||||
else if (subtype == EFI_SECTION_RAW) path = QFileDialog::getSaveFileName(this, tr("Save section body to raw file"), name + ".raw", tr("Raw files (*.raw *.bin);;All files (*)"));
|
||||
else if (subtype == EFI_SECTION_PE32
|
||||
|| subtype == EFI_SECTION_TE
|
||||
|| subtype == EFI_SECTION_PIC) path = QFileDialog::getSaveFileName(this, tr("Save section body to EFI executable file"), name + ".efi", tr("EFI executable files (*.efi *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save section body to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
|
||||
break;
|
||||
case Types::NvarEntry:
|
||||
case Types::VssEntry:
|
||||
case Types::EvsaEntry:
|
||||
case Types::FlashMapEntry:
|
||||
case Types::FsysEntry: path = QFileDialog::getSaveFileName(this, tr("Save entry body to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)")); break;
|
||||
case Types::VssStore:
|
||||
case Types::Vss2Store:
|
||||
case Types::FtwStore:
|
||||
case Types::FdcStore:
|
||||
case Types::FsysStore:
|
||||
case Types::FlashMapStore:
|
||||
case Types::CmdbStore: path = QFileDialog::getSaveFileName(this, tr("Save store body to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)")); break;
|
||||
case Types::Microcode: path = QFileDialog::getSaveFileName(this, tr("Save microcode body to file"), name + ".ucb", tr("Microcode body files (*.ucb *.bin);;All files (*)")); break;
|
||||
case Types::SlicData:
|
||||
if (subtype == Subtypes::PubkeySlicData) path = QFileDialog::getSaveFileName(this, tr("Save SLIC pubkey body to file"), name + ".spb", tr("SLIC pubkey body files (*.spb *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save SLIC marker body to file"), name + ".smb", tr("SLIC marker body files (*.smb *.bin);;All files (*)"));
|
||||
break;
|
||||
default: path = QFileDialog::getSaveFileName(this, tr("Save object to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
|
||||
case Types::Capsule: path = QFileDialog::getSaveFileName(this, tr("Save capsule body to image file"), name + ".rom", tr("Image files (*.rom *.bin);;All files (*)")); break;
|
||||
case Types::Volume: path = QFileDialog::getSaveFileName(this, tr("Save volume body to file"), name + ".vbd", tr("Volume body files (*.vbd *.bin);;All files (*)")); break;
|
||||
case Types::File:
|
||||
if (subtype == EFI_FV_FILETYPE_ALL
|
||||
|| subtype == EFI_FV_FILETYPE_RAW) path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to raw file"), name + ".raw", tr("Raw files (*.raw *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to file"), name + ".fbd", tr("FFS file body files (*.fbd *.bin);;All files (*)"));
|
||||
break;
|
||||
case Types::Section:
|
||||
if (subtype == EFI_SECTION_COMPRESSION
|
||||
|| subtype == EFI_SECTION_GUID_DEFINED
|
||||
|| subtype == EFI_SECTION_DISPOSABLE) path = QFileDialog::getSaveFileName(this, tr("Save encapsulation section body to FFS body file"), name + ".fbd", tr("FFS file body files (*.fbd *.bin);;All files (*)"));
|
||||
else if (subtype == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) path = QFileDialog::getSaveFileName(this, tr("Save section body to volume file"), name + ".vol", tr("Volume files (*.vol *.bin);;All files (*)"));
|
||||
else if (subtype == EFI_SECTION_RAW) path = QFileDialog::getSaveFileName(this, tr("Save section body to raw file"), name + ".raw", tr("Raw files (*.raw *.bin);;All files (*)"));
|
||||
else if (subtype == EFI_SECTION_PE32
|
||||
|| subtype == EFI_SECTION_TE
|
||||
|| subtype == EFI_SECTION_PIC) path = QFileDialog::getSaveFileName(this, tr("Save section body to EFI executable file"), name + ".efi", tr("EFI executable files (*.efi *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save section body to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
|
||||
break;
|
||||
case Types::NvarEntry:
|
||||
case Types::VssEntry:
|
||||
case Types::EvsaEntry:
|
||||
case Types::FlashMapEntry:
|
||||
case Types::FsysEntry: path = QFileDialog::getSaveFileName(this, tr("Save entry body to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)")); break;
|
||||
case Types::VssStore:
|
||||
case Types::Vss2Store:
|
||||
case Types::FtwStore:
|
||||
case Types::FdcStore:
|
||||
case Types::FsysStore:
|
||||
case Types::FlashMapStore:
|
||||
case Types::CmdbStore: path = QFileDialog::getSaveFileName(this, tr("Save store body to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)")); break;
|
||||
case Types::Microcode: path = QFileDialog::getSaveFileName(this, tr("Save microcode body to file"), name + ".ucb", tr("Microcode body files (*.ucb *.bin);;All files (*)")); break;
|
||||
case Types::SlicData:
|
||||
if (subtype == Subtypes::PubkeySlicData) path = QFileDialog::getSaveFileName(this, tr("Save SLIC pubkey body to file"), name + ".spb", tr("SLIC pubkey body files (*.spb *.bin);;All files (*)"));
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save SLIC marker body to file"), name + ".smb", tr("SLIC marker body files (*.smb *.bin);;All files (*)"));
|
||||
break;
|
||||
default: path = QFileDialog::getSaveFileName(this, tr("Save object to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
|
||||
}
|
||||
}
|
||||
else path = QFileDialog::getSaveFileName(this, tr("Save object to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
|
||||
@ -579,16 +579,16 @@ void UEFITool::remove()
|
||||
void UEFITool::about()
|
||||
{
|
||||
QMessageBox::about(this, tr("About UEFITool"), tr(
|
||||
"Copyright (c) 2019, Nikolaj Schlej.<br>"
|
||||
"Program icon made by <a href=https://www.behance.net/alzhidkov>Alexander Zhidkov</a>.<br>"
|
||||
"The program uses QHexEdit2 library made by <a href=https://github.com/Simsys/>Simsys</a>.<br>"
|
||||
"Qt-less engine is using Bstrlib made by <a href=https://github.com/websnarf/>Paul Hsieh</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>"
|
||||
"<b>THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN \"AS IS\" BASIS, "
|
||||
"WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, "
|
||||
"EITHER EXPRESS OR IMPLIED.</b>"));
|
||||
"Copyright (c) 2019, Nikolaj Schlej.<br>"
|
||||
"Program icon made by <a href=https://www.behance.net/alzhidkov>Alexander Zhidkov</a>.<br>"
|
||||
"The program uses QHexEdit2 library made by <a href=https://github.com/Simsys/>Simsys</a>.<br>"
|
||||
"Qt-less engine is using Bstrlib made by <a href=https://github.com/websnarf/>Paul Hsieh</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>"
|
||||
"<b>THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN \"AS IS\" BASIS, "
|
||||
"WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, "
|
||||
"EITHER EXPRESS OR IMPLIED.</b>"));
|
||||
}
|
||||
|
||||
void UEFITool::aboutQt()
|
||||
@ -803,307 +803,307 @@ void UEFITool::showParserMessages()
|
||||
|
||||
foreach (msg, messages) {
|
||||
#else
|
||||
for (const auto &msg : messages) {
|
||||
for (const auto &msg : messages) {
|
||||
#endif
|
||||
QListWidgetItem* item = new QListWidgetItem(msg.first, NULL, 0);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&msg.second, sizeof(msg.second)));
|
||||
ui->parserMessagesListWidget->addItem(item);
|
||||
QListWidgetItem* item = new QListWidgetItem(msg.first, NULL, 0);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&msg.second, sizeof(msg.second)));
|
||||
ui->parserMessagesListWidget->addItem(item);
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_PARSER);
|
||||
ui->parserMessagesListWidget->scrollToBottom();
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_PARSER);
|
||||
ui->parserMessagesListWidget->scrollToBottom();
|
||||
}
|
||||
|
||||
void UEFITool::showFinderMessages()
|
||||
{
|
||||
ui->finderMessagesListWidget->clear();
|
||||
if (!ffsParser)
|
||||
return;
|
||||
|
||||
std::vector<std::pair<QString, QModelIndex> > messages = ffsFinder->getMessages();
|
||||
|
||||
#if QT_VERSION_MAJOR < 6
|
||||
std::pair<QString, QModelIndex> msg;
|
||||
|
||||
foreach (msg, messages) {
|
||||
#else
|
||||
for (const auto &msg : messages) {
|
||||
#endif
|
||||
QListWidgetItem* item = new QListWidgetItem(msg.first, NULL, 0);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&msg.second, sizeof(msg.second)));;
|
||||
ui->finderMessagesListWidget->addItem(item);
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, true);
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_SEARCH);
|
||||
ui->finderMessagesListWidget->scrollToBottom();
|
||||
}
|
||||
|
||||
void UEFITool::showBuilderMessages()
|
||||
{
|
||||
ui->builderMessagesListWidget->clear();
|
||||
if (!ffsBuilder)
|
||||
return;
|
||||
|
||||
std::vector<std::pair<QString, QModelIndex> > messages = ffsBuilder->getMessages();
|
||||
|
||||
#if QT_VERSION_MAJOR < 6
|
||||
std::pair<QString, QModelIndex> msg;
|
||||
|
||||
foreach (msg, messages) {
|
||||
#else
|
||||
for (const auto &msg : messages) {
|
||||
#endif
|
||||
QListWidgetItem* item = new QListWidgetItem(msg.first, NULL, 0);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&msg.second, sizeof(msg.second)));
|
||||
ui->builderMessagesListWidget->addItem(item);
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, true);
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_BUILDER);
|
||||
ui->builderMessagesListWidget->scrollToBottom();
|
||||
}
|
||||
|
||||
void UEFITool::scrollTreeView(QListWidgetItem* item)
|
||||
{
|
||||
QByteArray second = item->data(Qt::UserRole).toByteArray();
|
||||
QModelIndex *index = (QModelIndex *)second.data();
|
||||
if (index && index->isValid()) {
|
||||
ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter);
|
||||
ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::scrollTreeView(QTableWidgetItem* item)
|
||||
{
|
||||
QByteArray second = item->data(Qt::UserRole).toByteArray();
|
||||
QModelIndex *index = (QModelIndex *)second.data();
|
||||
if (index && index->isValid()) {
|
||||
ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter);
|
||||
ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
// The checks involving underMouse do not work well enough on macOS, and result in right-click sometimes
|
||||
// not showing any context menu at all. Most likely it is a bug in Qt, which does not affect other systems.
|
||||
// For this reason we reimplement this manually.
|
||||
if (ui->parserMessagesListWidget->rect().contains(ui->parserMessagesListWidget->mapFromGlobal(event->globalPos())) ||
|
||||
ui->finderMessagesListWidget->rect().contains(ui->finderMessagesListWidget->mapFromGlobal(event->globalPos())) ||
|
||||
ui->builderMessagesListWidget->rect().contains(ui->builderMessagesListWidget->mapFromGlobal(event->globalPos()))) {
|
||||
ui->menuMessageActions->exec(event->globalPos());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!ui->structureTreeView->rect().contains(ui->structureTreeView->mapFromGlobal(event->globalPos())))
|
||||
return;
|
||||
|
||||
QPoint pt = event->pos();
|
||||
QModelIndex index = ui->structureTreeView->indexAt(ui->structureTreeView->viewport()->mapFrom(this, pt));
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (model->type(index))
|
||||
void UEFITool::showFinderMessages()
|
||||
{
|
||||
case Types::Capsule: ui->menuCapsuleActions->exec(event->globalPos()); break;
|
||||
case Types::Image: ui->menuImageActions->exec(event->globalPos()); break;
|
||||
case Types::Region: ui->menuRegionActions->exec(event->globalPos()); break;
|
||||
case Types::Padding: ui->menuPaddingActions->exec(event->globalPos()); break;
|
||||
case Types::Volume: ui->menuVolumeActions->exec(event->globalPos()); break;
|
||||
case Types::File: ui->menuFileActions->exec(event->globalPos()); break;
|
||||
case Types::Section: ui->menuSectionActions->exec(event->globalPos()); break;
|
||||
case Types::VssStore:
|
||||
case Types::Vss2Store:
|
||||
case Types::FdcStore:
|
||||
case Types::FsysStore:
|
||||
case Types::EvsaStore:
|
||||
case Types::FtwStore:
|
||||
case Types::FlashMapStore:
|
||||
case Types::CmdbStore:
|
||||
case Types::FptStore:
|
||||
case Types::CpdStore:
|
||||
case Types::BpdtStore: ui->menuStoreActions->exec(event->globalPos()); break;
|
||||
case Types::FreeSpace: break; // No menu needed for FreeSpace item
|
||||
default: ui->menuEntryActions->exec(event->globalPos()); break;
|
||||
}
|
||||
}
|
||||
ui->finderMessagesListWidget->clear();
|
||||
if (!ffsParser)
|
||||
return;
|
||||
|
||||
void UEFITool::readSettings()
|
||||
{
|
||||
QSettings settings(this);
|
||||
restoreGeometry(settings.value("mainWindow/geometry").toByteArray());
|
||||
restoreState(settings.value("mainWindow/windowState").toByteArray());
|
||||
QList<int> horList, vertList;
|
||||
horList.append(settings.value("mainWindow/treeWidth", 600).toInt());
|
||||
horList.append(settings.value("mainWindow/infoWidth", 180).toInt());
|
||||
vertList.append(settings.value("mainWindow/treeHeight", 400).toInt());
|
||||
vertList.append(settings.value("mainWindow/messageHeight", 180).toInt());
|
||||
ui->infoSplitter->setSizes(horList);
|
||||
ui->messagesSplitter->setSizes(vertList);
|
||||
ui->structureTreeView->setColumnWidth(0, settings.value("tree/columnWidth0", ui->structureTreeView->columnWidth(0)).toInt());
|
||||
ui->structureTreeView->setColumnWidth(1, settings.value("tree/columnWidth1", ui->structureTreeView->columnWidth(1)).toInt());
|
||||
ui->structureTreeView->setColumnWidth(2, settings.value("tree/columnWidth2", ui->structureTreeView->columnWidth(2)).toInt());
|
||||
ui->structureTreeView->setColumnWidth(3, settings.value("tree/columnWidth3", ui->structureTreeView->columnWidth(3)).toInt());
|
||||
markingEnabled = settings.value("tree/markingEnabled", true).toBool();
|
||||
ui->actionToggleBootGuardMarking->setChecked(markingEnabled);
|
||||
std::vector<std::pair<QString, QModelIndex> > messages = ffsFinder->getMessages();
|
||||
|
||||
// Set monospace font for some controls
|
||||
QString fontName;
|
||||
int fontSize;
|
||||
#if defined Q_OS_OSX
|
||||
fontName = settings.value("mainWindow/fontName", QString("Menlo")).toString();
|
||||
fontSize = settings.value("mainWindow/fontSize", 10).toInt();
|
||||
#elif defined Q_OS_WIN
|
||||
fontName = settings.value("mainWindow/fontName", QString("Consolas")).toString();
|
||||
fontSize = settings.value("mainWindow/fontSize", 9).toInt();
|
||||
#if QT_VERSION_MAJOR < 6
|
||||
std::pair<QString, QModelIndex> msg;
|
||||
|
||||
foreach (msg, messages) {
|
||||
#else
|
||||
fontName = settings.value("mainWindow/fontName", QString("Courier New")).toString();
|
||||
fontSize = settings.value("mainWindow/fontSize", 10).toInt();
|
||||
for (const auto &msg : messages) {
|
||||
#endif
|
||||
currentFont = QFont(fontName, fontSize);
|
||||
ui->infoEdit->setFont(currentFont);
|
||||
ui->parserMessagesListWidget->setFont(currentFont);
|
||||
ui->finderMessagesListWidget->setFont(currentFont);
|
||||
ui->builderMessagesListWidget->setFont(currentFont);
|
||||
ui->fitTableWidget->setFont(currentFont);
|
||||
ui->securityEdit->setFont(currentFont);
|
||||
ui->structureTreeView->setFont(currentFont);
|
||||
searchDialog->ui->guidEdit->setFont(currentFont);
|
||||
searchDialog->ui->hexEdit->setFont(currentFont);
|
||||
hexViewDialog->setFont(currentFont);
|
||||
goToAddressDialog->ui->hexSpinBox->setFont(currentFont);
|
||||
goToBaseDialog->ui->hexSpinBox->setFont(currentFont);
|
||||
}
|
||||
|
||||
void UEFITool::writeSettings()
|
||||
{
|
||||
QSettings settings(this);
|
||||
settings.setValue("mainWindow/geometry", saveGeometry());
|
||||
settings.setValue("mainWindow/windowState", saveState());
|
||||
settings.setValue("mainWindow/treeWidth", ui->structureGroupBox->width());
|
||||
settings.setValue("mainWindow/infoWidth", ui->infoGroupBox->width());
|
||||
settings.setValue("mainWindow/treeHeight", ui->structureGroupBox->height());
|
||||
settings.setValue("mainWindow/messageHeight", ui->messagesTabWidget->height());
|
||||
settings.setValue("tree/columnWidth0", ui->structureTreeView->columnWidth(0));
|
||||
settings.setValue("tree/columnWidth1", ui->structureTreeView->columnWidth(1));
|
||||
settings.setValue("tree/columnWidth2", ui->structureTreeView->columnWidth(2));
|
||||
settings.setValue("tree/columnWidth3", ui->structureTreeView->columnWidth(3));
|
||||
settings.setValue("tree/markingEnabled", markingEnabled);
|
||||
settings.setValue("mainWindow/fontName", currentFont.family());
|
||||
settings.setValue("mainWindow/fontSize", currentFont.pointSize());
|
||||
}
|
||||
|
||||
void UEFITool::showFitTable()
|
||||
{
|
||||
std::vector<std::pair<std::vector<UString>, UModelIndex> > fitTable = ffsParser->getFitTable();
|
||||
if (fitTable.empty()) {
|
||||
// Disable FIT tab
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_FIT, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable FIT tab
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_FIT, true);
|
||||
|
||||
// Set up the FIT table
|
||||
ui->fitTableWidget->clear();
|
||||
ui->fitTableWidget->setRowCount((int)fitTable.size());
|
||||
ui->fitTableWidget->setColumnCount(6);
|
||||
ui->fitTableWidget->setHorizontalHeaderLabels(QStringList() << tr("Address") << tr("Size") << tr("Version") << tr("Checksum") << tr("Type") << tr("Information"));
|
||||
ui->fitTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui->fitTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->fitTableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->fitTableWidget->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
// Add all data to the table widget
|
||||
for (size_t i = 0; i < fitTable.size(); i++) {
|
||||
for (UINT8 j = 0; j < 6; j++) {
|
||||
QTableWidgetItem* item = new QTableWidgetItem(fitTable[i].first[j]);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&fitTable[i].second, sizeof(fitTable[i].second)));
|
||||
ui->fitTableWidget->setItem((int)i, j, item);
|
||||
}
|
||||
}
|
||||
|
||||
ui->fitTableWidget->resizeColumnsToContents();
|
||||
ui->fitTableWidget->resizeRowsToContents();
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_FIT);
|
||||
}
|
||||
|
||||
void UEFITool::showSecurityInfo()
|
||||
{
|
||||
// Get security info
|
||||
UString secInfo = ffsParser->getSecurityInfo();
|
||||
if (secInfo.isEmpty()) {
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, true);
|
||||
ui->securityEdit->setPlainText(secInfo);
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_SECURITY);
|
||||
}
|
||||
|
||||
void UEFITool::currentTabChanged(int index)
|
||||
{
|
||||
U_UNUSED_PARAMETER(index);
|
||||
|
||||
ui->menuMessageActions->setEnabled(false);
|
||||
ui->actionMessagesCopy->setEnabled(false);
|
||||
ui->actionMessagesCopyAll->setEnabled(false);
|
||||
ui->actionMessagesClear->setEnabled(false);
|
||||
}
|
||||
|
||||
void UEFITool::loadGuidDatabase()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(this, tr("Select GUID database file to load"), currentDir, tr("Comma-separated values files (*.csv);;All files (*)"));
|
||||
if (!path.isEmpty()) {
|
||||
initGuidDatabase(path);
|
||||
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("New GUID database loaded"), tr("Apply new GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
|
||||
openImageFile(currentPath);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::unloadGuidDatabase()
|
||||
{
|
||||
initGuidDatabase();
|
||||
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("GUID database unloaded"), tr("Apply changes on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
|
||||
openImageFile(currentPath);
|
||||
}
|
||||
|
||||
void UEFITool::loadDefaultGuidDatabase()
|
||||
{
|
||||
initGuidDatabase(":/guids.csv");
|
||||
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("Default GUID database loaded"), tr("Apply default GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
|
||||
openImageFile(currentPath);
|
||||
}
|
||||
|
||||
void UEFITool::exportDiscoveredGuids()
|
||||
{
|
||||
GuidDatabase db = guidDatabaseFromTreeRecursive(model, model->index(0, 0));
|
||||
if (!db.empty()) {
|
||||
QString path = QFileDialog::getSaveFileName(this, tr("Save parsed GUIDs to database"), currentPath + ".guids.csv", tr("Comma-separated values files (*.csv);;All files (*)"));
|
||||
if (!path.isEmpty())
|
||||
guidDatabaseExportToFile(path, db);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::generateReport()
|
||||
{
|
||||
QString path = QFileDialog::getSaveFileName(this, tr("Save report to text file"), currentPath + ".report.txt", tr("Text files (*.txt);;All files (*)"));
|
||||
if (!path.isEmpty()) {
|
||||
std::vector<QString> report = ffsReport->generate();
|
||||
if (report.size()) {
|
||||
QFile file;
|
||||
file.setFileName(path);
|
||||
if (file.open(QFile::Text | QFile::WriteOnly)) {
|
||||
for (size_t i = 0; i < report.size(); i++) {
|
||||
file.write(report[i].toLatin1().append('\n'));
|
||||
}
|
||||
file.close();
|
||||
QListWidgetItem* item = new QListWidgetItem(msg.first, NULL, 0);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&msg.second, sizeof(msg.second)));;
|
||||
ui->finderMessagesListWidget->addItem(item);
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, true);
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_SEARCH);
|
||||
ui->finderMessagesListWidget->scrollToBottom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::showBuilderMessages()
|
||||
{
|
||||
ui->builderMessagesListWidget->clear();
|
||||
if (!ffsBuilder)
|
||||
return;
|
||||
|
||||
std::vector<std::pair<QString, QModelIndex> > messages = ffsBuilder->getMessages();
|
||||
|
||||
#if QT_VERSION_MAJOR < 6
|
||||
std::pair<QString, QModelIndex> msg;
|
||||
|
||||
foreach (msg, messages) {
|
||||
#else
|
||||
for (const auto &msg : messages) {
|
||||
#endif
|
||||
QListWidgetItem* item = new QListWidgetItem(msg.first, NULL, 0);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&msg.second, sizeof(msg.second)));
|
||||
ui->builderMessagesListWidget->addItem(item);
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, true);
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_BUILDER);
|
||||
ui->builderMessagesListWidget->scrollToBottom();
|
||||
}
|
||||
|
||||
void UEFITool::scrollTreeView(QListWidgetItem* item)
|
||||
{
|
||||
QByteArray second = item->data(Qt::UserRole).toByteArray();
|
||||
QModelIndex *index = (QModelIndex *)second.data();
|
||||
if (index && index->isValid()) {
|
||||
ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter);
|
||||
ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::scrollTreeView(QTableWidgetItem* item)
|
||||
{
|
||||
QByteArray second = item->data(Qt::UserRole).toByteArray();
|
||||
QModelIndex *index = (QModelIndex *)second.data();
|
||||
if (index && index->isValid()) {
|
||||
ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter);
|
||||
ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
// The checks involving underMouse do not work well enough on macOS, and result in right-click sometimes
|
||||
// not showing any context menu at all. Most likely it is a bug in Qt, which does not affect other systems.
|
||||
// For this reason we reimplement this manually.
|
||||
if (ui->parserMessagesListWidget->rect().contains(ui->parserMessagesListWidget->mapFromGlobal(event->globalPos())) ||
|
||||
ui->finderMessagesListWidget->rect().contains(ui->finderMessagesListWidget->mapFromGlobal(event->globalPos())) ||
|
||||
ui->builderMessagesListWidget->rect().contains(ui->builderMessagesListWidget->mapFromGlobal(event->globalPos()))) {
|
||||
ui->menuMessageActions->exec(event->globalPos());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!ui->structureTreeView->rect().contains(ui->structureTreeView->mapFromGlobal(event->globalPos())))
|
||||
return;
|
||||
|
||||
QPoint pt = event->pos();
|
||||
QModelIndex index = ui->structureTreeView->indexAt(ui->structureTreeView->viewport()->mapFrom(this, pt));
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (model->type(index))
|
||||
{
|
||||
case Types::Capsule: ui->menuCapsuleActions->exec(event->globalPos()); break;
|
||||
case Types::Image: ui->menuImageActions->exec(event->globalPos()); break;
|
||||
case Types::Region: ui->menuRegionActions->exec(event->globalPos()); break;
|
||||
case Types::Padding: ui->menuPaddingActions->exec(event->globalPos()); break;
|
||||
case Types::Volume: ui->menuVolumeActions->exec(event->globalPos()); break;
|
||||
case Types::File: ui->menuFileActions->exec(event->globalPos()); break;
|
||||
case Types::Section: ui->menuSectionActions->exec(event->globalPos()); break;
|
||||
case Types::VssStore:
|
||||
case Types::Vss2Store:
|
||||
case Types::FdcStore:
|
||||
case Types::FsysStore:
|
||||
case Types::EvsaStore:
|
||||
case Types::FtwStore:
|
||||
case Types::FlashMapStore:
|
||||
case Types::CmdbStore:
|
||||
case Types::FptStore:
|
||||
case Types::CpdStore:
|
||||
case Types::BpdtStore: ui->menuStoreActions->exec(event->globalPos()); break;
|
||||
case Types::FreeSpace: break; // No menu needed for FreeSpace item
|
||||
default: ui->menuEntryActions->exec(event->globalPos()); break;
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::readSettings()
|
||||
{
|
||||
QSettings settings(this);
|
||||
restoreGeometry(settings.value("mainWindow/geometry").toByteArray());
|
||||
restoreState(settings.value("mainWindow/windowState").toByteArray());
|
||||
QList<int> horList, vertList;
|
||||
horList.append(settings.value("mainWindow/treeWidth", 600).toInt());
|
||||
horList.append(settings.value("mainWindow/infoWidth", 180).toInt());
|
||||
vertList.append(settings.value("mainWindow/treeHeight", 400).toInt());
|
||||
vertList.append(settings.value("mainWindow/messageHeight", 180).toInt());
|
||||
ui->infoSplitter->setSizes(horList);
|
||||
ui->messagesSplitter->setSizes(vertList);
|
||||
ui->structureTreeView->setColumnWidth(0, settings.value("tree/columnWidth0", ui->structureTreeView->columnWidth(0)).toInt());
|
||||
ui->structureTreeView->setColumnWidth(1, settings.value("tree/columnWidth1", ui->structureTreeView->columnWidth(1)).toInt());
|
||||
ui->structureTreeView->setColumnWidth(2, settings.value("tree/columnWidth2", ui->structureTreeView->columnWidth(2)).toInt());
|
||||
ui->structureTreeView->setColumnWidth(3, settings.value("tree/columnWidth3", ui->structureTreeView->columnWidth(3)).toInt());
|
||||
markingEnabled = settings.value("tree/markingEnabled", true).toBool();
|
||||
ui->actionToggleBootGuardMarking->setChecked(markingEnabled);
|
||||
|
||||
// Set monospace font for some controls
|
||||
QString fontName;
|
||||
int fontSize;
|
||||
#if defined Q_OS_OSX
|
||||
fontName = settings.value("mainWindow/fontName", QString("Menlo")).toString();
|
||||
fontSize = settings.value("mainWindow/fontSize", 10).toInt();
|
||||
#elif defined Q_OS_WIN
|
||||
fontName = settings.value("mainWindow/fontName", QString("Consolas")).toString();
|
||||
fontSize = settings.value("mainWindow/fontSize", 9).toInt();
|
||||
#else
|
||||
fontName = settings.value("mainWindow/fontName", QString("Courier New")).toString();
|
||||
fontSize = settings.value("mainWindow/fontSize", 10).toInt();
|
||||
#endif
|
||||
currentFont = QFont(fontName, fontSize);
|
||||
ui->infoEdit->setFont(currentFont);
|
||||
ui->parserMessagesListWidget->setFont(currentFont);
|
||||
ui->finderMessagesListWidget->setFont(currentFont);
|
||||
ui->builderMessagesListWidget->setFont(currentFont);
|
||||
ui->fitTableWidget->setFont(currentFont);
|
||||
ui->securityEdit->setFont(currentFont);
|
||||
ui->structureTreeView->setFont(currentFont);
|
||||
searchDialog->ui->guidEdit->setFont(currentFont);
|
||||
searchDialog->ui->hexEdit->setFont(currentFont);
|
||||
hexViewDialog->setFont(currentFont);
|
||||
goToAddressDialog->ui->hexSpinBox->setFont(currentFont);
|
||||
goToBaseDialog->ui->hexSpinBox->setFont(currentFont);
|
||||
}
|
||||
|
||||
void UEFITool::writeSettings()
|
||||
{
|
||||
QSettings settings(this);
|
||||
settings.setValue("mainWindow/geometry", saveGeometry());
|
||||
settings.setValue("mainWindow/windowState", saveState());
|
||||
settings.setValue("mainWindow/treeWidth", ui->structureGroupBox->width());
|
||||
settings.setValue("mainWindow/infoWidth", ui->infoGroupBox->width());
|
||||
settings.setValue("mainWindow/treeHeight", ui->structureGroupBox->height());
|
||||
settings.setValue("mainWindow/messageHeight", ui->messagesTabWidget->height());
|
||||
settings.setValue("tree/columnWidth0", ui->structureTreeView->columnWidth(0));
|
||||
settings.setValue("tree/columnWidth1", ui->structureTreeView->columnWidth(1));
|
||||
settings.setValue("tree/columnWidth2", ui->structureTreeView->columnWidth(2));
|
||||
settings.setValue("tree/columnWidth3", ui->structureTreeView->columnWidth(3));
|
||||
settings.setValue("tree/markingEnabled", markingEnabled);
|
||||
settings.setValue("mainWindow/fontName", currentFont.family());
|
||||
settings.setValue("mainWindow/fontSize", currentFont.pointSize());
|
||||
}
|
||||
|
||||
void UEFITool::showFitTable()
|
||||
{
|
||||
std::vector<std::pair<std::vector<UString>, UModelIndex> > fitTable = ffsParser->getFitTable();
|
||||
if (fitTable.empty()) {
|
||||
// Disable FIT tab
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_FIT, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable FIT tab
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_FIT, true);
|
||||
|
||||
// Set up the FIT table
|
||||
ui->fitTableWidget->clear();
|
||||
ui->fitTableWidget->setRowCount((int)fitTable.size());
|
||||
ui->fitTableWidget->setColumnCount(6);
|
||||
ui->fitTableWidget->setHorizontalHeaderLabels(QStringList() << tr("Address") << tr("Size") << tr("Version") << tr("Checksum") << tr("Type") << tr("Information"));
|
||||
ui->fitTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui->fitTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->fitTableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->fitTableWidget->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
// Add all data to the table widget
|
||||
for (size_t i = 0; i < fitTable.size(); i++) {
|
||||
for (UINT8 j = 0; j < 6; j++) {
|
||||
QTableWidgetItem* item = new QTableWidgetItem(fitTable[i].first[j]);
|
||||
item->setData(Qt::UserRole, QByteArray((const char*)&fitTable[i].second, sizeof(fitTable[i].second)));
|
||||
ui->fitTableWidget->setItem((int)i, j, item);
|
||||
}
|
||||
}
|
||||
|
||||
ui->fitTableWidget->resizeColumnsToContents();
|
||||
ui->fitTableWidget->resizeRowsToContents();
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_FIT);
|
||||
}
|
||||
|
||||
void UEFITool::showSecurityInfo()
|
||||
{
|
||||
// Get security info
|
||||
UString secInfo = ffsParser->getSecurityInfo();
|
||||
if (secInfo.isEmpty()) {
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, true);
|
||||
ui->securityEdit->setPlainText(secInfo);
|
||||
ui->messagesTabWidget->setCurrentIndex(TAB_SECURITY);
|
||||
}
|
||||
|
||||
void UEFITool::currentTabChanged(int index)
|
||||
{
|
||||
U_UNUSED_PARAMETER(index);
|
||||
|
||||
ui->menuMessageActions->setEnabled(false);
|
||||
ui->actionMessagesCopy->setEnabled(false);
|
||||
ui->actionMessagesCopyAll->setEnabled(false);
|
||||
ui->actionMessagesClear->setEnabled(false);
|
||||
}
|
||||
|
||||
void UEFITool::loadGuidDatabase()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(this, tr("Select GUID database file to load"), currentDir, tr("Comma-separated values files (*.csv);;All files (*)"));
|
||||
if (!path.isEmpty()) {
|
||||
initGuidDatabase(path);
|
||||
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("New GUID database loaded"), tr("Apply new GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
|
||||
openImageFile(currentPath);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::unloadGuidDatabase()
|
||||
{
|
||||
initGuidDatabase();
|
||||
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("GUID database unloaded"), tr("Apply changes on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
|
||||
openImageFile(currentPath);
|
||||
}
|
||||
|
||||
void UEFITool::loadDefaultGuidDatabase()
|
||||
{
|
||||
initGuidDatabase(":/guids.csv");
|
||||
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("Default GUID database loaded"), tr("Apply default GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
|
||||
openImageFile(currentPath);
|
||||
}
|
||||
|
||||
void UEFITool::exportDiscoveredGuids()
|
||||
{
|
||||
GuidDatabase db = guidDatabaseFromTreeRecursive(model, model->index(0, 0));
|
||||
if (!db.empty()) {
|
||||
QString path = QFileDialog::getSaveFileName(this, tr("Save parsed GUIDs to database"), currentPath + ".guids.csv", tr("Comma-separated values files (*.csv);;All files (*)"));
|
||||
if (!path.isEmpty())
|
||||
guidDatabaseExportToFile(path, db);
|
||||
}
|
||||
}
|
||||
|
||||
void UEFITool::generateReport()
|
||||
{
|
||||
QString path = QFileDialog::getSaveFileName(this, tr("Save report to text file"), currentPath + ".report.txt", tr("Text files (*.txt);;All files (*)"));
|
||||
if (!path.isEmpty()) {
|
||||
std::vector<QString> report = ffsReport->generate();
|
||||
if (report.size()) {
|
||||
QFile file;
|
||||
file.setFileName(path);
|
||||
if (file.open(QFile::Text | QFile::WriteOnly)) {
|
||||
for (size_t i = 0; i < report.size(); i++) {
|
||||
file.write(report[i].toLatin1().append('\n'));
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* uefitool_main.cpp
|
||||
|
||||
Copyright (c) 2018, LongSoft. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2018, LongSoft. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QString>
|
||||
@ -21,7 +21,7 @@ class UEFIToolApplication : public QApplication
|
||||
|
||||
public:
|
||||
UEFIToolApplication(int &argc, char **argv)
|
||||
: QApplication(argc, argv)
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
setOrganizationName("LongSoft");
|
||||
setOrganizationDomain("longsoft.org");
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* descriptor.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
|
||||
#include "descriptor.h"
|
||||
|
||||
@ -44,206 +44,206 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1)
|
||||
{
|
||||
UINT32 jedecId = (UINT32)deviceId1 + ((UINT32)deviceId0 << 8) + ((UINT32)vendorId << 16);
|
||||
switch (jedecId) {
|
||||
// Winbond
|
||||
case 0xEF3010: return UString("Winbond W25X05");
|
||||
case 0xEF3011: return UString("Winbond W25X10");
|
||||
case 0xEF3012: return UString("Winbond W25X20");
|
||||
case 0xEF3013: return UString("Winbond W25X40");
|
||||
case 0xEF3014: return UString("Winbond W25X80");
|
||||
case 0xEF3015: return UString("Winbond W25X16");
|
||||
case 0xEF3016: return UString("Winbond W25X32");
|
||||
case 0xEF3017: return UString("Winbond W25X64");
|
||||
case 0xEF4012: return UString("Winbond W25Q20");
|
||||
case 0xEF4013: return UString("Winbond W25Q40");
|
||||
case 0xEF4014: return UString("Winbond W25Q80");
|
||||
case 0xEF4015: return UString("Winbond W25Q16");
|
||||
case 0xEF4016: return UString("Winbond W25Q32");
|
||||
case 0xEF4017: return UString("Winbond W25Q64");
|
||||
case 0xEF4018: return UString("Winbond W25Q128");
|
||||
case 0xEF4019: return UString("Winbond W25Q256");
|
||||
case 0xEF6011: return UString("Winbond W25Q10");
|
||||
case 0xEF6012: return UString("Winbond W25Q20");
|
||||
case 0xEF6013: return UString("Winbond W25Q40");
|
||||
case 0xEF6014: return UString("Winbond W25Q80");
|
||||
case 0xEF6015: return UString("Winbond W25Q16");
|
||||
case 0xEF6016: return UString("Winbond W25Q32");
|
||||
case 0xEF6017: return UString("Winbond W25Q64");
|
||||
case 0xEF6018: return UString("Winbond W25Q128");
|
||||
case 0xEF6019: return UString("Winbond W25Q256");
|
||||
case 0xEF7118: return UString("Winbond W25M256");
|
||||
case 0xEF7119: return UString("Winbond W25M512");
|
||||
// Winbond
|
||||
case 0xEF3010: return UString("Winbond W25X05");
|
||||
case 0xEF3011: return UString("Winbond W25X10");
|
||||
case 0xEF3012: return UString("Winbond W25X20");
|
||||
case 0xEF3013: return UString("Winbond W25X40");
|
||||
case 0xEF3014: return UString("Winbond W25X80");
|
||||
case 0xEF3015: return UString("Winbond W25X16");
|
||||
case 0xEF3016: return UString("Winbond W25X32");
|
||||
case 0xEF3017: return UString("Winbond W25X64");
|
||||
case 0xEF4012: return UString("Winbond W25Q20");
|
||||
case 0xEF4013: return UString("Winbond W25Q40");
|
||||
case 0xEF4014: return UString("Winbond W25Q80");
|
||||
case 0xEF4015: return UString("Winbond W25Q16");
|
||||
case 0xEF4016: return UString("Winbond W25Q32");
|
||||
case 0xEF4017: return UString("Winbond W25Q64");
|
||||
case 0xEF4018: return UString("Winbond W25Q128");
|
||||
case 0xEF4019: return UString("Winbond W25Q256");
|
||||
case 0xEF6011: return UString("Winbond W25Q10");
|
||||
case 0xEF6012: return UString("Winbond W25Q20");
|
||||
case 0xEF6013: return UString("Winbond W25Q40");
|
||||
case 0xEF6014: return UString("Winbond W25Q80");
|
||||
case 0xEF6015: return UString("Winbond W25Q16");
|
||||
case 0xEF6016: return UString("Winbond W25Q32");
|
||||
case 0xEF6017: return UString("Winbond W25Q64");
|
||||
case 0xEF6018: return UString("Winbond W25Q128");
|
||||
case 0xEF6019: return UString("Winbond W25Q256");
|
||||
case 0xEF7118: return UString("Winbond W25M256");
|
||||
case 0xEF7119: return UString("Winbond W25M512");
|
||||
|
||||
// Macronix
|
||||
case 0xC22013: return UString("Macronix MX25L40");
|
||||
case 0xC22014: return UString("Macronix MX25L80");
|
||||
case 0xC22015: return UString("Macronix MX25L16");
|
||||
case 0xC22016: return UString("Macronix MX25U16");
|
||||
case 0xC22017: return UString("Macronix MX25L64");
|
||||
case 0xC22018: return UString("Macronix MX25L128");
|
||||
case 0xC22019: return UString("Macronix MX25L256");
|
||||
case 0xC2201A: return UString("Macronix MX66L512");
|
||||
case 0xC22415: return UString("Macronix MX25L16");
|
||||
case 0xC22515: return UString("Macronix MX25L16");
|
||||
case 0xC22534: return UString("Macronix MX25U80");
|
||||
case 0xC22535: return UString("Macronix MX25U16");
|
||||
case 0xC22536: return UString("Macronix MX25U32");
|
||||
case 0xC22537: return UString("Macronix MX25U64");
|
||||
case 0xC22538: return UString("Macronix MX25U128");
|
||||
case 0xC22539: return UString("Macronix MX25U256");
|
||||
case 0xC2253A: return UString("Macronix MX25U512");
|
||||
case 0xC22617: return UString("Macronix MX25L64");
|
||||
case 0xC22618: return UString("Macronix MX25L128");
|
||||
case 0xC25E16: return UString("Macronix MX25L32");
|
||||
case 0xC29517: return UString("Macronix MX25L64");
|
||||
// Macronix
|
||||
case 0xC22013: return UString("Macronix MX25L40");
|
||||
case 0xC22014: return UString("Macronix MX25L80");
|
||||
case 0xC22015: return UString("Macronix MX25L16");
|
||||
case 0xC22016: return UString("Macronix MX25U16");
|
||||
case 0xC22017: return UString("Macronix MX25L64");
|
||||
case 0xC22018: return UString("Macronix MX25L128");
|
||||
case 0xC22019: return UString("Macronix MX25L256");
|
||||
case 0xC2201A: return UString("Macronix MX66L512");
|
||||
case 0xC22415: return UString("Macronix MX25L16");
|
||||
case 0xC22515: return UString("Macronix MX25L16");
|
||||
case 0xC22534: return UString("Macronix MX25U80");
|
||||
case 0xC22535: return UString("Macronix MX25U16");
|
||||
case 0xC22536: return UString("Macronix MX25U32");
|
||||
case 0xC22537: return UString("Macronix MX25U64");
|
||||
case 0xC22538: return UString("Macronix MX25U128");
|
||||
case 0xC22539: return UString("Macronix MX25U256");
|
||||
case 0xC2253A: return UString("Macronix MX25U512");
|
||||
case 0xC22617: return UString("Macronix MX25L64");
|
||||
case 0xC22618: return UString("Macronix MX25L128");
|
||||
case 0xC25E16: return UString("Macronix MX25L32");
|
||||
case 0xC29517: return UString("Macronix MX25L64");
|
||||
|
||||
// Micron
|
||||
case 0x202014: return UString("Micron M25P80");
|
||||
case 0x202015: return UString("Micron M25P16");
|
||||
case 0x202016: return UString("Micron M25P32");
|
||||
case 0x202017: return UString("Micron M25P64");
|
||||
case 0x202018: return UString("Micron M25P128");
|
||||
case 0x204011: return UString("Micron M45PE10");
|
||||
case 0x204012: return UString("Micron M45PE20");
|
||||
case 0x204013: return UString("Micron M45PE40");
|
||||
case 0x204014: return UString("Micron M45PE80");
|
||||
case 0x204015: return UString("Micron M45PE16");
|
||||
case 0x204017: return UString("Micron XM25QH64C");
|
||||
case 0x204018: return UString("Micron XM25QH128C");
|
||||
case 0x204019: return UString("Micron XM25QH256C");
|
||||
case 0x207114: return UString("Micron M25PX80");
|
||||
case 0x207115: return UString("Micron M25PX16");
|
||||
case 0x207116: return UString("Micron M25PX32");
|
||||
case 0x207117: return UString("Micron M25PX64");
|
||||
case 0x208011: return UString("Micron M25PE10");
|
||||
case 0x208012: return UString("Micron M25PE20");
|
||||
case 0x208013: return UString("Micron M25PE40");
|
||||
case 0x208014: return UString("Micron M25PE80");
|
||||
case 0x208015: return UString("Micron M25PE16");
|
||||
case 0x20BA15: return UString("Micron N25Q016");
|
||||
case 0x20BA16: return UString("Micron N25Q032");
|
||||
case 0x20BA17: return UString("Micron N25Q064");
|
||||
case 0x20BA18: return UString("Micron N25Q128");
|
||||
case 0x20BA19: return UString("Micron N25Q256");
|
||||
case 0x20BA20: return UString("Micron N25Q512");
|
||||
case 0x20BA21: return UString("Micron N25Q00A");
|
||||
case 0x20BB15: return UString("Micron N25Q016");
|
||||
case 0x20BB16: return UString("Micron N25Q032");
|
||||
case 0x20BB17: return UString("Micron N25Q064");
|
||||
case 0x20BB18: return UString("Micron MT25Q128");
|
||||
case 0x20BB19: return UString("Micron MT25Q256");
|
||||
case 0x20BB20: return UString("Micron MT25Q512");
|
||||
// Micron
|
||||
case 0x202014: return UString("Micron M25P80");
|
||||
case 0x202015: return UString("Micron M25P16");
|
||||
case 0x202016: return UString("Micron M25P32");
|
||||
case 0x202017: return UString("Micron M25P64");
|
||||
case 0x202018: return UString("Micron M25P128");
|
||||
case 0x204011: return UString("Micron M45PE10");
|
||||
case 0x204012: return UString("Micron M45PE20");
|
||||
case 0x204013: return UString("Micron M45PE40");
|
||||
case 0x204014: return UString("Micron M45PE80");
|
||||
case 0x204015: return UString("Micron M45PE16");
|
||||
case 0x204017: return UString("Micron XM25QH64C");
|
||||
case 0x204018: return UString("Micron XM25QH128C");
|
||||
case 0x204019: return UString("Micron XM25QH256C");
|
||||
case 0x207114: return UString("Micron M25PX80");
|
||||
case 0x207115: return UString("Micron M25PX16");
|
||||
case 0x207116: return UString("Micron M25PX32");
|
||||
case 0x207117: return UString("Micron M25PX64");
|
||||
case 0x208011: return UString("Micron M25PE10");
|
||||
case 0x208012: return UString("Micron M25PE20");
|
||||
case 0x208013: return UString("Micron M25PE40");
|
||||
case 0x208014: return UString("Micron M25PE80");
|
||||
case 0x208015: return UString("Micron M25PE16");
|
||||
case 0x20BA15: return UString("Micron N25Q016");
|
||||
case 0x20BA16: return UString("Micron N25Q032");
|
||||
case 0x20BA17: return UString("Micron N25Q064");
|
||||
case 0x20BA18: return UString("Micron N25Q128");
|
||||
case 0x20BA19: return UString("Micron N25Q256");
|
||||
case 0x20BA20: return UString("Micron N25Q512");
|
||||
case 0x20BA21: return UString("Micron N25Q00A");
|
||||
case 0x20BB15: return UString("Micron N25Q016");
|
||||
case 0x20BB16: return UString("Micron N25Q032");
|
||||
case 0x20BB17: return UString("Micron N25Q064");
|
||||
case 0x20BB18: return UString("Micron MT25Q128");
|
||||
case 0x20BB19: return UString("Micron MT25Q256");
|
||||
case 0x20BB20: return UString("Micron MT25Q512");
|
||||
|
||||
// Intel
|
||||
case 0x898911: return UString("Intel 25F160S33B8");
|
||||
case 0x898912: return UString("Intel 25F320S33B8");
|
||||
case 0x898913: return UString("Intel 25F640S33B8");
|
||||
case 0x898915: return UString("Intel 25F160S33T8");
|
||||
case 0x898916: return UString("Intel 25F320S33T8");
|
||||
case 0x898917: return UString("Intel 25F640S33T8");
|
||||
// Intel
|
||||
case 0x898911: return UString("Intel 25F160S33B8");
|
||||
case 0x898912: return UString("Intel 25F320S33B8");
|
||||
case 0x898913: return UString("Intel 25F640S33B8");
|
||||
case 0x898915: return UString("Intel 25F160S33T8");
|
||||
case 0x898916: return UString("Intel 25F320S33T8");
|
||||
case 0x898917: return UString("Intel 25F640S33T8");
|
||||
|
||||
// Atmel / Adesto
|
||||
case 0x1F3217: return UString("Atmel AT25SF641");
|
||||
case 0x1F4216: return UString("Atmel AT25SL321");
|
||||
case 0x1F4218: return UString("Atmel AT25SL128A");
|
||||
case 0x1F4317: return UString("Atmel AT25SL641");
|
||||
case 0x1F4500: return UString("Atmel AT26DF081");
|
||||
case 0x1F4501: return UString("Atmel AT26DF081A");
|
||||
case 0x1F4502: return UString("Atmel AT25DF081");
|
||||
case 0x1F4600: return UString("Atmel AT26DF161");
|
||||
case 0x1F4601: return UString("Atmel AT26DF161A");
|
||||
case 0x1F4602: return UString("Atmel AT25DF161");
|
||||
case 0x1F4700: return UString("Atmel AT25DF321");
|
||||
case 0x1F4701: return UString("Atmel AT25DF321A");
|
||||
case 0x1F4800: return UString("Atmel AT25DF641");
|
||||
case 0x1F7018: return UString("Atmel AT25QF128");
|
||||
case 0x1F8600: return UString("Atmel AT25DQ161");
|
||||
case 0x1F8800: return UString("Atmel AT25DQ641");
|
||||
// Atmel / Adesto
|
||||
case 0x1F3217: return UString("Atmel AT25SF641");
|
||||
case 0x1F4216: return UString("Atmel AT25SL321");
|
||||
case 0x1F4218: return UString("Atmel AT25SL128A");
|
||||
case 0x1F4317: return UString("Atmel AT25SL641");
|
||||
case 0x1F4500: return UString("Atmel AT26DF081");
|
||||
case 0x1F4501: return UString("Atmel AT26DF081A");
|
||||
case 0x1F4502: return UString("Atmel AT25DF081");
|
||||
case 0x1F4600: return UString("Atmel AT26DF161");
|
||||
case 0x1F4601: return UString("Atmel AT26DF161A");
|
||||
case 0x1F4602: return UString("Atmel AT25DF161");
|
||||
case 0x1F4700: return UString("Atmel AT25DF321");
|
||||
case 0x1F4701: return UString("Atmel AT25DF321A");
|
||||
case 0x1F4800: return UString("Atmel AT25DF641");
|
||||
case 0x1F7018: return UString("Atmel AT25QF128");
|
||||
case 0x1F8600: return UString("Atmel AT25DQ161");
|
||||
case 0x1F8800: return UString("Atmel AT25DQ641");
|
||||
|
||||
// Microchip
|
||||
case 0xBF2541: return UString("Microchip SST25VF016B");
|
||||
case 0xBF254A: return UString("Microchip SST25VF032B");
|
||||
case 0xBF258D: return UString("Microchip SST25VF040B");
|
||||
case 0xBF258E: return UString("Microchip SST25VF080B");
|
||||
case 0xBF254B: return UString("Microchip SST25VF064C");
|
||||
// Microchip
|
||||
case 0xBF2541: return UString("Microchip SST25VF016B");
|
||||
case 0xBF254A: return UString("Microchip SST25VF032B");
|
||||
case 0xBF258D: return UString("Microchip SST25VF040B");
|
||||
case 0xBF258E: return UString("Microchip SST25VF080B");
|
||||
case 0xBF254B: return UString("Microchip SST25VF064C");
|
||||
|
||||
// EON / ESMT
|
||||
case 0x1C3013: return UString("EON EN25Q40");
|
||||
case 0x1C3014: return UString("EON EN25Q80");
|
||||
case 0x1C3015: return UString("EON EN25Q16");
|
||||
case 0x1C3016: return UString("EON EN25Q32");
|
||||
case 0x1C3017: return UString("EON EN25Q64");
|
||||
case 0x1C3018: return UString("EON EN25Q128");
|
||||
case 0x1C3114: return UString("EON EN25F80");
|
||||
case 0x1C3115: return UString("EON EN25F16");
|
||||
case 0x1C3116: return UString("EON EN25F32");
|
||||
case 0x1C3117: return UString("EON EN25F64");
|
||||
case 0x1C3811: return UString("EON EN25S10");
|
||||
case 0x1C3812: return UString("EON EN25S20");
|
||||
case 0x1C3813: return UString("EON EN25S40");
|
||||
case 0x1C3814: return UString("EON EN25S80");
|
||||
case 0x1C3815: return UString("EON EN25S16");
|
||||
case 0x1C3816: return UString("EON EN25S32");
|
||||
case 0x1C3817: return UString("EON EN25S64");
|
||||
case 0x1C7014: return UString("EON EN25QH80");
|
||||
case 0x1C7015: return UString("EON EN25QH16");
|
||||
case 0x1C7016: return UString("EON EN25QH32");
|
||||
case 0x1C7017: return UString("EON EN25QH64");
|
||||
case 0x1C7018: return UString("EON EN25QH128");
|
||||
case 0x1C7019: return UString("EON EN25QH256");
|
||||
// EON / ESMT
|
||||
case 0x1C3013: return UString("EON EN25Q40");
|
||||
case 0x1C3014: return UString("EON EN25Q80");
|
||||
case 0x1C3015: return UString("EON EN25Q16");
|
||||
case 0x1C3016: return UString("EON EN25Q32");
|
||||
case 0x1C3017: return UString("EON EN25Q64");
|
||||
case 0x1C3018: return UString("EON EN25Q128");
|
||||
case 0x1C3114: return UString("EON EN25F80");
|
||||
case 0x1C3115: return UString("EON EN25F16");
|
||||
case 0x1C3116: return UString("EON EN25F32");
|
||||
case 0x1C3117: return UString("EON EN25F64");
|
||||
case 0x1C3811: return UString("EON EN25S10");
|
||||
case 0x1C3812: return UString("EON EN25S20");
|
||||
case 0x1C3813: return UString("EON EN25S40");
|
||||
case 0x1C3814: return UString("EON EN25S80");
|
||||
case 0x1C3815: return UString("EON EN25S16");
|
||||
case 0x1C3816: return UString("EON EN25S32");
|
||||
case 0x1C3817: return UString("EON EN25S64");
|
||||
case 0x1C7014: return UString("EON EN25QH80");
|
||||
case 0x1C7015: return UString("EON EN25QH16");
|
||||
case 0x1C7016: return UString("EON EN25QH32");
|
||||
case 0x1C7017: return UString("EON EN25QH64");
|
||||
case 0x1C7018: return UString("EON EN25QH128");
|
||||
case 0x1C7019: return UString("EON EN25QH256");
|
||||
|
||||
// GigaDevice
|
||||
case 0xC84014: return UString("GigaDevice GD25x80");
|
||||
case 0xC84015: return UString("GigaDevice GD25x16");
|
||||
case 0xC84016: return UString("GigaDevice GD25x32");
|
||||
case 0xC84017: return UString("GigaDevice GD25x64");
|
||||
case 0xC84018: return UString("GigaDevice GD25x128");
|
||||
case 0xC84019: return UString("GigaDevice GD25x256C");
|
||||
case 0xC86015: return UString("GigaDevice GD25LQ16V");
|
||||
case 0xC86017: return UString("GigaDevice GD25Lx64");
|
||||
case 0xC86018: return UString("GigaDevice GD25Lx128");
|
||||
case 0xC86019: return UString("GigaDevice GD25LQ256C");
|
||||
// GigaDevice
|
||||
case 0xC84014: return UString("GigaDevice GD25x80");
|
||||
case 0xC84015: return UString("GigaDevice GD25x16");
|
||||
case 0xC84016: return UString("GigaDevice GD25x32");
|
||||
case 0xC84017: return UString("GigaDevice GD25x64");
|
||||
case 0xC84018: return UString("GigaDevice GD25x128");
|
||||
case 0xC84019: return UString("GigaDevice GD25x256C");
|
||||
case 0xC86015: return UString("GigaDevice GD25LQ16V");
|
||||
case 0xC86017: return UString("GigaDevice GD25Lx64");
|
||||
case 0xC86018: return UString("GigaDevice GD25Lx128");
|
||||
case 0xC86019: return UString("GigaDevice GD25LQ256C");
|
||||
|
||||
// Fidelix
|
||||
case 0xF83215: return UString("Fidelix FM25Q16");
|
||||
case 0xF83216: return UString("Fidelix FM25Q32");
|
||||
case 0xF83217: return UString("Fidelix FM25Q64");
|
||||
case 0xF83218: return UString("Fidelix FM25Q128");
|
||||
// Fidelix
|
||||
case 0xF83215: return UString("Fidelix FM25Q16");
|
||||
case 0xF83216: return UString("Fidelix FM25Q32");
|
||||
case 0xF83217: return UString("Fidelix FM25Q64");
|
||||
case 0xF83218: return UString("Fidelix FM25Q128");
|
||||
|
||||
// Spansion
|
||||
case 0x014015: return UString("Spansion S25FL116K");
|
||||
case 0x014016: return UString("Spansion S25FL132K");
|
||||
case 0x014017: return UString("Spansion S25FL164K");
|
||||
// Spansion
|
||||
case 0x014015: return UString("Spansion S25FL116K");
|
||||
case 0x014016: return UString("Spansion S25FL132K");
|
||||
case 0x014017: return UString("Spansion S25FL164K");
|
||||
|
||||
// AMIC Technology
|
||||
case 0x373015: return UString("AMIC A25L016");
|
||||
case 0x373016: return UString("AMIC A25L032");
|
||||
case 0x374015: return UString("AMIC A25LQ16");
|
||||
case 0x374016: return UString("AMIC A25LQ32A");
|
||||
// AMIC Technology
|
||||
case 0x373015: return UString("AMIC A25L016");
|
||||
case 0x373016: return UString("AMIC A25L032");
|
||||
case 0x374015: return UString("AMIC A25LQ16");
|
||||
case 0x374016: return UString("AMIC A25LQ32A");
|
||||
|
||||
// PMC
|
||||
case 0x9DF713: return UString("PMC Pm25LV080B");
|
||||
case 0x9DF714: return UString("PMC Pm25LV016B");
|
||||
case 0x9DF744: return UString("PMC Pm25LQ080C");
|
||||
case 0x9DF745: return UString("PMC Pm25LQ016C");
|
||||
case 0x9DF746: return UString("PMC Pm25LQ032C");
|
||||
case 0x9DF77B: return UString("PMC Pm25LV512A");
|
||||
case 0x9DF77C: return UString("PMC Pm25LV010A");
|
||||
case 0x9DF77D: return UString("PMC Pm25LV020");
|
||||
case 0x9DF77E: return UString("PMC Pm25LV040");
|
||||
// PMC
|
||||
case 0x9DF713: return UString("PMC Pm25LV080B");
|
||||
case 0x9DF714: return UString("PMC Pm25LV016B");
|
||||
case 0x9DF744: return UString("PMC Pm25LQ080C");
|
||||
case 0x9DF745: return UString("PMC Pm25LQ016C");
|
||||
case 0x9DF746: return UString("PMC Pm25LQ032C");
|
||||
case 0x9DF77B: return UString("PMC Pm25LV512A");
|
||||
case 0x9DF77C: return UString("PMC Pm25LV010A");
|
||||
case 0x9DF77D: return UString("PMC Pm25LV020");
|
||||
case 0x9DF77E: return UString("PMC Pm25LV040");
|
||||
|
||||
// ISSI
|
||||
case 0x9D6014: return UString("ISSI Ix25LP080");
|
||||
case 0x9D6015: return UString("ISSI Ix25LP016");
|
||||
case 0x9D6016: return UString("ISSI Ix25LP032");
|
||||
case 0x9D6017: return UString("ISSI Ix25LP064");
|
||||
case 0x9D6018: return UString("ISSI Ix25LP128");
|
||||
case 0x9D6019: return UString("ISSI Ix25LP256");
|
||||
case 0x9D7014: return UString("ISSI Ix25WP080");
|
||||
case 0x9D7015: return UString("ISSI Ix25WP016");
|
||||
case 0x9D7016: return UString("ISSI Ix25WP032");
|
||||
case 0x9D7017: return UString("ISSI Ix25WP064");
|
||||
case 0x9D7018: return UString("ISSI Ix25WP128");
|
||||
case 0x9D7019: return UString("ISSI Ix25WP256");
|
||||
// ISSI
|
||||
case 0x9D6014: return UString("ISSI Ix25LP080");
|
||||
case 0x9D6015: return UString("ISSI Ix25LP016");
|
||||
case 0x9D6016: return UString("ISSI Ix25LP032");
|
||||
case 0x9D6017: return UString("ISSI Ix25LP064");
|
||||
case 0x9D6018: return UString("ISSI Ix25LP128");
|
||||
case 0x9D6019: return UString("ISSI Ix25LP256");
|
||||
case 0x9D7014: return UString("ISSI Ix25WP080");
|
||||
case 0x9D7015: return UString("ISSI Ix25WP016");
|
||||
case 0x9D7016: return UString("ISSI Ix25WP032");
|
||||
case 0x9D7017: return UString("ISSI Ix25WP064");
|
||||
case 0x9D7018: return UString("ISSI Ix25WP128");
|
||||
case 0x9D7019: return UString("ISSI Ix25WP256");
|
||||
}
|
||||
|
||||
return UString("Unknown");
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* ffs.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
@ -60,17 +60,17 @@ UString guidToUString(const EFI_GUID & guid, bool convertToString)
|
||||
}
|
||||
|
||||
return usprintf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
||||
guid.Data1,
|
||||
guid.Data2,
|
||||
guid.Data3,
|
||||
guid.Data4[0],
|
||||
guid.Data4[1],
|
||||
guid.Data4[2],
|
||||
guid.Data4[3],
|
||||
guid.Data4[4],
|
||||
guid.Data4[5],
|
||||
guid.Data4[6],
|
||||
guid.Data4[7]);
|
||||
guid.Data1,
|
||||
guid.Data2,
|
||||
guid.Data3,
|
||||
guid.Data4[0],
|
||||
guid.Data4[1],
|
||||
guid.Data4[2],
|
||||
guid.Data4[3],
|
||||
guid.Data4[4],
|
||||
guid.Data4[5],
|
||||
guid.Data4[6],
|
||||
guid.Data4[7]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* fssbuilder.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
#include "ffsbuilder.h"
|
||||
|
||||
#include "descriptor.h"
|
||||
@ -80,7 +80,7 @@ USTATUS FfsBuilder::buildCapsule(const UModelIndex & index, UByteArray & capsule
|
||||
|
||||
// Rebuild or Replace
|
||||
else if (model->action(index) == Actions::Rebuild
|
||||
|| model->action(index) == Actions::Replace) {
|
||||
|| model->action(index) == Actions::Replace) {
|
||||
if (model->rowCount(index)) {
|
||||
// Clear the supplied UByteArray
|
||||
capsule.clear();
|
||||
@ -188,33 +188,33 @@ USTATUS FfsBuilder::buildIntelImage(const UModelIndex & index, UByteArray & inte
|
||||
UByteArray region;
|
||||
UINT8 regionType = model->subtype(currentRegion);
|
||||
switch (regionType) {
|
||||
case Subtypes::BiosRegion:
|
||||
case Subtypes::PdrRegion:
|
||||
result = buildRawArea(currentRegion, region);
|
||||
if (result) {
|
||||
msg(UString("buildIntelImage: building of region ") + regionTypeToUString(regionType) + UString(" failed with error ") + errorCodeToUString(result), currentRegion);
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case Subtypes::MeRegion:
|
||||
case Subtypes::GbeRegion:
|
||||
case Subtypes::DevExp1Region:
|
||||
case Subtypes::Bios2Region:
|
||||
case Subtypes::MicrocodeRegion:
|
||||
case Subtypes::EcRegion:
|
||||
case Subtypes::DevExp2Region:
|
||||
case Subtypes::IeRegion:
|
||||
case Subtypes::Tgbe1Region:
|
||||
case Subtypes::Tgbe2Region:
|
||||
case Subtypes::Reserved1Region:
|
||||
case Subtypes::Reserved2Region:
|
||||
case Subtypes::PttRegion:
|
||||
// Add region as is
|
||||
region = model->header(currentRegion) + model->body(currentRegion);
|
||||
break;
|
||||
default:
|
||||
msg(UString("buildIntelImage: unknown region type"), currentRegion);
|
||||
return U_UNKNOWN_ITEM_TYPE;
|
||||
case Subtypes::BiosRegion:
|
||||
case Subtypes::PdrRegion:
|
||||
result = buildRawArea(currentRegion, region);
|
||||
if (result) {
|
||||
msg(UString("buildIntelImage: building of region ") + regionTypeToUString(regionType) + UString(" failed with error ") + errorCodeToUString(result), currentRegion);
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case Subtypes::MeRegion:
|
||||
case Subtypes::GbeRegion:
|
||||
case Subtypes::DevExp1Region:
|
||||
case Subtypes::Bios2Region:
|
||||
case Subtypes::MicrocodeRegion:
|
||||
case Subtypes::EcRegion:
|
||||
case Subtypes::DevExp2Region:
|
||||
case Subtypes::IeRegion:
|
||||
case Subtypes::Tgbe1Region:
|
||||
case Subtypes::Tgbe2Region:
|
||||
case Subtypes::Reserved1Region:
|
||||
case Subtypes::Reserved2Region:
|
||||
case Subtypes::PttRegion:
|
||||
// Add region as is
|
||||
region = model->header(currentRegion) + model->body(currentRegion);
|
||||
break;
|
||||
default:
|
||||
msg(UString("buildIntelImage: unknown region type"), currentRegion);
|
||||
return U_UNKNOWN_ITEM_TYPE;
|
||||
}
|
||||
|
||||
// Append the resulting region
|
||||
@ -260,7 +260,7 @@ USTATUS FfsBuilder::buildRawArea(const UModelIndex & index, UByteArray & rawArea
|
||||
}
|
||||
// Rebuild or Replace
|
||||
else if (model->action(index) == Actions::Rebuild
|
||||
|| model->action(index) == Actions::Replace) {
|
||||
|| model->action(index) == Actions::Replace) {
|
||||
// Rebuild if there is at least 1 child
|
||||
if (model->rowCount(index)) {
|
||||
// Clear the supplied UByteArray
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* fssops.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "ffsops.h"
|
||||
#include "ffs.h"
|
||||
@ -64,7 +64,7 @@ USTATUS FfsOperations::replace(const UModelIndex & index, UByteArray & data, con
|
||||
return U_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return U_UNKNOWN_REPLACE_MODE;
|
||||
return U_UNKNOWN_REPLACE_MODE;
|
||||
}
|
||||
|
||||
USTATUS FfsOperations::remove(const UModelIndex & index)
|
||||
@ -97,7 +97,7 @@ USTATUS FfsOperations::rebuild(const UModelIndex & index)
|
||||
UModelIndex parent = index.parent();
|
||||
if (parent.isValid() && model->type(parent) != Types::Root
|
||||
&& model->action(parent) == Actions::NoAction)
|
||||
rebuild(parent);
|
||||
rebuild(parent);
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
1076
common/ffsparser.cpp
1076
common/ffsparser.cpp
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,15 @@
|
||||
/* fssreport.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "ffsreport.h"
|
||||
#include "ffs.h"
|
||||
@ -60,12 +60,12 @@ USTATUS FfsReport::generateRecursive(std::vector<UString> & report, const UModel
|
||||
}
|
||||
|
||||
report.push_back(
|
||||
UString(" ") + itemTypeToUString(model->type(index)).leftJustified(16)
|
||||
+ UString("| ") + itemSubtypeToUString(model->type(index), model->subtype(index)).leftJustified(22)
|
||||
+ offset
|
||||
+ usprintf("| %08" PRIXQ " | %08X | ", data.size(), crc)
|
||||
+ urepeated('-', level) + UString(" ") + model->name(index) + (text.isEmpty() ? UString() : UString(" | ") + text)
|
||||
);
|
||||
UString(" ") + itemTypeToUString(model->type(index)).leftJustified(16)
|
||||
+ UString("| ") + itemSubtypeToUString(model->type(index), model->subtype(index)).leftJustified(22)
|
||||
+ offset
|
||||
+ usprintf("| %08X | %08X | ", (UINT32)data.size(), crc)
|
||||
+ urepeated('-', level) + UString(" ") + model->name(index) + (text.isEmpty() ? UString() : UString(" | ") + text)
|
||||
);
|
||||
|
||||
// Information on child items
|
||||
for (int i = 0; i < model->rowCount(index); i++) {
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* ffsutils.cpp
|
||||
|
||||
Copyright (c) 2019, LongSoft. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2019, LongSoft. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "ffsutils.h"
|
||||
#include "utility.h"
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* guiddatabase.cpp
|
||||
|
||||
Copyright (c) 2017, LongSoft. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2017, LongSoft. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
|
||||
#include "guiddatabase.h"
|
||||
#include "ubytearray.h"
|
||||
|
@ -1,16 +1,16 @@
|
||||
/* meparser.cpp
|
||||
|
||||
Copyright (c) 2019, Nikolaj Schlej. All rights reserved.
|
||||
Copyright (c) 2019, Nikolaj Schlej. All rights reserved.
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -137,42 +137,42 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex &
|
||||
if (ptHeader->HeaderVersion == FPT_HEADER_VERSION_21) {
|
||||
const FPT_HEADER_21* ptHeader21 = (const FPT_HEADER_21*)ptHeader;
|
||||
|
||||
info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
|
||||
"Header length: %02Xh\nFlags: %Xh\nTicks to add: %04Xh\nTokens to add: %04Xh\nSPS Flags: %Xh\nFITC version: %u.%u.%u.%u\nCRC32 Checksum: %08Xh",
|
||||
ptSize, ptSize,
|
||||
header.size(), header.size(),
|
||||
ptBodySize, ptBodySize,
|
||||
(romBypassVectorSize ? "present" : "absent"),
|
||||
ptHeader21->NumEntries,
|
||||
ptHeader21->HeaderVersion,
|
||||
ptHeader21->EntryVersion,
|
||||
ptHeader21->HeaderLength,
|
||||
ptHeader21->Flags,
|
||||
ptHeader21->TicksToAdd,
|
||||
ptHeader21->TokensToAdd,
|
||||
ptHeader21->SPSFlags,
|
||||
ptHeader21->FitcMajor, ptHeader21->FitcMinor, ptHeader21->FitcHotfix, ptHeader21->FitcBuild,
|
||||
ptHeader21->HeaderCrc32);
|
||||
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
|
||||
"Header length: %02Xh\nFlags: %Xh\nTicks to add: %04Xh\nTokens to add: %04Xh\nSPS Flags: %Xh\nFITC version: %u.%u.%u.%u\nCRC32 Checksum: %08Xh",
|
||||
ptSize, ptSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
ptBodySize, ptBodySize,
|
||||
(romBypassVectorSize ? "present" : "absent"),
|
||||
ptHeader21->NumEntries,
|
||||
ptHeader21->HeaderVersion,
|
||||
ptHeader21->EntryVersion,
|
||||
ptHeader21->HeaderLength,
|
||||
ptHeader21->Flags,
|
||||
ptHeader21->TicksToAdd,
|
||||
ptHeader21->TokensToAdd,
|
||||
ptHeader21->SPSFlags,
|
||||
ptHeader21->FitcMajor, ptHeader21->FitcMinor, ptHeader21->FitcHotfix, ptHeader21->FitcBuild,
|
||||
ptHeader21->HeaderCrc32);
|
||||
// TODO: verify header crc32
|
||||
}
|
||||
// Default handling for all other versions, may be too generic in some corner cases
|
||||
else {
|
||||
info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
|
||||
"Header length: %02Xh\nFlash cycle life: %04Xh\nFlash cycle limit: %04Xh\nUMA size: %Xh\nFlags: %Xh\nFITC version: %u.%u.%u.%u\nChecksum: %02Xh",
|
||||
ptSize, ptSize,
|
||||
header.size(), header.size(),
|
||||
ptBodySize, ptBodySize,
|
||||
(romBypassVectorSize ? "present" : "absent"),
|
||||
ptHeader->NumEntries,
|
||||
ptHeader->HeaderVersion,
|
||||
ptHeader->EntryVersion,
|
||||
ptHeader->HeaderLength,
|
||||
ptHeader->FlashCycleLife,
|
||||
ptHeader->FlashCycleLimit,
|
||||
ptHeader->UmaSize,
|
||||
ptHeader->Flags,
|
||||
ptHeader->FitcMajor, ptHeader->FitcMinor, ptHeader->FitcHotfix, ptHeader->FitcBuild,
|
||||
ptHeader->HeaderChecksum);
|
||||
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
|
||||
"Header length: %02Xh\nFlash cycle life: %04Xh\nFlash cycle limit: %04Xh\nUMA size: %Xh\nFlags: %Xh\nFITC version: %u.%u.%u.%u\nChecksum: %02Xh",
|
||||
ptSize, ptSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
ptBodySize, ptBodySize,
|
||||
(romBypassVectorSize ? "present" : "absent"),
|
||||
ptHeader->NumEntries,
|
||||
ptHeader->HeaderVersion,
|
||||
ptHeader->EntryVersion,
|
||||
ptHeader->HeaderLength,
|
||||
ptHeader->FlashCycleLife,
|
||||
ptHeader->FlashCycleLimit,
|
||||
ptHeader->UmaSize,
|
||||
ptHeader->Flags,
|
||||
ptHeader->FitcMajor, ptHeader->FitcMinor, ptHeader->FitcHotfix, ptHeader->FitcBuild,
|
||||
ptHeader->HeaderChecksum);
|
||||
// TODO: verify header checksum8
|
||||
}
|
||||
|
||||
@ -294,9 +294,9 @@ make_partition_table_consistent:
|
||||
UModelIndex partitionIndex;
|
||||
// Get info
|
||||
name = visibleAsciiOrHex((UINT8*) partitions[i].ptEntry.Name, 4);
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nPartition type: %02Xh\n",
|
||||
partition.size(), partition.size(),
|
||||
partitions[i].ptEntry.Type);
|
||||
info = usprintf("Full size: %Xh (%u)\nPartition type: %02Xh\n",
|
||||
(UINT32)partition.size(), (UINT32)partition.size(),
|
||||
partitions[i].ptEntry.Type);
|
||||
|
||||
// Add tree item
|
||||
UINT8 type = Subtypes::CodeFptPartition + partitions[i].ptEntry.Type;
|
||||
@ -310,7 +310,7 @@ make_partition_table_consistent:
|
||||
else if (partitions[i].type == Types::Padding) {
|
||||
// Get info
|
||||
name = UString("Padding");
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", partition.size(), partition.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size());
|
||||
|
||||
// Add tree item
|
||||
model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
|
||||
@ -335,7 +335,7 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex
|
||||
UByteArray header = region.left(ptSize);
|
||||
|
||||
UString name = UString("IFWI 1.6 header");
|
||||
UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n"
|
||||
UString info = usprintf("Full size: %Xh (%u)\n"
|
||||
"Data partition offset: %Xh\nData partition size: %Xh\n"
|
||||
"Boot1 partition offset: %Xh\nBoot1 partition size: %Xh\n"
|
||||
"Boot2 partition offset: %Xh\nBoot2 partition size: %Xh\n"
|
||||
@ -343,7 +343,7 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex
|
||||
"Boot4 partition offset: %Xh\nBoot4 partition size: %Xh\n"
|
||||
"Boot5 partition offset: %Xh\nBoot5 partition size: %Xh\n"
|
||||
"Checksum: %llXh",
|
||||
header.size(), header.size(),
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
ifwiHeader->DataPartition.Offset, ifwiHeader->DataPartition.Size,
|
||||
ifwiHeader->BootPartition[0].Offset, ifwiHeader->BootPartition[0].Size,
|
||||
ifwiHeader->BootPartition[1].Offset, ifwiHeader->BootPartition[1].Size,
|
||||
@ -457,8 +457,7 @@ make_partition_table_consistent:
|
||||
}
|
||||
|
||||
// Get info
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n",
|
||||
partition.size(), partition.size());
|
||||
info = usprintf("Full size: %Xh (%u)\n", (UINT32)partition.size(), (UINT32)partition.size());
|
||||
|
||||
// Add tree item
|
||||
partitionIndex = model->addItem(partitions[i].ptEntry.Offset, partitions[i].type, partitions[i].subtype, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
|
||||
@ -477,7 +476,7 @@ make_partition_table_consistent:
|
||||
else if (partitions[i].type == Types::Padding) {
|
||||
// Get info
|
||||
name = UString("Padding");
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", partition.size(), partition.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size());
|
||||
|
||||
// Add tree item
|
||||
model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
|
||||
@ -503,7 +502,7 @@ USTATUS MeParser::parseIfwi17Region(const UByteArray & region, const UModelIndex
|
||||
UByteArray header = region.left(ptSize);
|
||||
|
||||
UString name = UString("IFWI 1.7 header");
|
||||
UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n"
|
||||
UString info = usprintf("Full size: %Xh (%u)\n"
|
||||
"Flags: %02Xh\n"
|
||||
"Reserved: %02Xh\n"
|
||||
"Checksum: %Xh\n"
|
||||
@ -514,7 +513,7 @@ USTATUS MeParser::parseIfwi17Region(const UByteArray & region, const UModelIndex
|
||||
"Boot4 partition offset: %Xh\nBoot4 partition size: %Xh\n"
|
||||
"Boot5 partition offset: %Xh\nBoot5 partition size: %Xh\n"
|
||||
"Temp page offset: %Xh\nTemp page size: %Xh\n",
|
||||
header.size(), header.size(),
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
ifwiHeader->Flags,
|
||||
ifwiHeader->Reserved,
|
||||
ifwiHeader->Checksum,
|
||||
@ -643,8 +642,7 @@ make_partition_table_consistent:
|
||||
}
|
||||
|
||||
// Get info
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\n",
|
||||
partition.size(), partition.size());
|
||||
info = usprintf("Full size: %Xh (%u)\n", (UINT32)partition.size(), (UINT32)partition.size());
|
||||
|
||||
// Add tree item
|
||||
partitionIndex = model->addItem(partitions[i].ptEntry.Offset, partitions[i].type, partitions[i].subtype, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
|
||||
@ -663,7 +661,7 @@ make_partition_table_consistent:
|
||||
else if (partitions[i].type == Types::Padding) {
|
||||
// Get info
|
||||
name = UString("Padding");
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", partition.size(), partition.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size());
|
||||
|
||||
// Add tree item
|
||||
model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* nvram.cpp
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "nvram.h"
|
||||
|
||||
@ -81,13 +81,13 @@ UString evsaAttributesToUString(const UINT32 attributes)
|
||||
UString efiTimeToUString(const EFI_TIME & time)
|
||||
{
|
||||
return usprintf("%04u-%02u-%02uT%02u:%02u:%02u.%u",
|
||||
time.Year,
|
||||
time.Month,
|
||||
time.Day,
|
||||
time.Hour,
|
||||
time.Minute,
|
||||
time.Second,
|
||||
time.Nanosecond);
|
||||
time.Year,
|
||||
time.Month,
|
||||
time.Day,
|
||||
time.Hour,
|
||||
time.Minute,
|
||||
time.Second,
|
||||
time.Nanosecond);
|
||||
}
|
||||
|
||||
UString flashMapGuidToUString(const EFI_GUID & guid)
|
||||
|
@ -1,16 +1,16 @@
|
||||
/* nvramparser.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
//TODO: relax fixed restrictions once NVRAM builder is ready
|
||||
|
||||
@ -92,7 +92,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
|
||||
UByteArray padding = data.mid(offset, unparsedSize);
|
||||
|
||||
// Get info
|
||||
UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size());
|
||||
UString info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
|
||||
|
||||
if ((UINT32)padding.count(emptyByte) == unparsedSize) { // Free space
|
||||
// Add tree item
|
||||
@ -113,9 +113,9 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
|
||||
UByteArray guidArea = data.right(guidAreaSize);
|
||||
// Get info
|
||||
name = UString("GUID store");
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")\nGUIDs in store: %u",
|
||||
guidArea.size(), guidArea.size(),
|
||||
guidsInStore);
|
||||
info = usprintf("Full size: %Xh (%u)\nGUIDs in store: %u",
|
||||
(UINT32)guidArea.size(), (UINT32)guidArea.size(),
|
||||
guidsInStore);
|
||||
// Add tree item
|
||||
model->addItem((UINT32)(localOffset + offset + padding.size()), Types::Padding, getPaddingType(guidArea), name, UString(), info, UByteArray(), guidArea, UByteArray(), Fixed, index);
|
||||
|
||||
@ -315,10 +315,10 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
|
||||
info += usprintf("GUID index: %u\n", guidIndex);
|
||||
|
||||
// Add header, body and extended data info
|
||||
info += usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")",
|
||||
entryHeader->Size, entryHeader->Size,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size());
|
||||
info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
|
||||
entryHeader->Size, entryHeader->Size,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
// Add attributes info
|
||||
info += usprintf("\nAttributes: %02Xh", entryHeader->Attributes);
|
||||
@ -333,8 +333,8 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
|
||||
// Add extended header info
|
||||
if (hasExtendedHeader) {
|
||||
info += usprintf("\nExtended header size: %Xh (%u)\nExtended attributes: %Xh (",
|
||||
extendedHeaderSize, extendedHeaderSize,
|
||||
extendedAttributes) + nvarExtendedAttributesToUString(extendedAttributes) + UString(")");
|
||||
extendedHeaderSize, extendedHeaderSize,
|
||||
extendedAttributes) + nvarExtendedAttributesToUString(extendedAttributes) + UString(")");
|
||||
|
||||
// Add checksum
|
||||
if (hasChecksum)
|
||||
@ -358,10 +358,10 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
|
||||
|
||||
// Show messages
|
||||
if (msgUnknownExtDataFormat) msg(usprintf("%s: unknown extended data format", __FUNCTION__), varIndex);
|
||||
if (msgExtHeaderTooLong) msg(usprintf("%s: extended header size (%Xh) is greater than body size (%" PRIXQ "h)", __FUNCTION__,
|
||||
extendedHeaderSize, body.size()), varIndex);
|
||||
if (msgExtDataTooShort) msg(usprintf("%s: extended header size (%" PRIXQ "h) is too small for timestamp and hash", __FUNCTION__,
|
||||
tail.size()), varIndex);
|
||||
if (msgExtHeaderTooLong) msg(usprintf("%s: extended header size (%Xh) is greater than body size (%Xh)", __FUNCTION__,
|
||||
extendedHeaderSize, (UINT32)body.size()), varIndex);
|
||||
if (msgExtDataTooShort) msg(usprintf("%s: extended header size (%Xh) is too small for timestamp and hash", __FUNCTION__,
|
||||
(UINT32)tail.size()), varIndex);
|
||||
|
||||
// Try parsing the entry data as NVAR storage if it begins with NVAR signature
|
||||
if ((subtype == Subtypes::DataNvarEntry || subtype == Subtypes::FullNvarEntry)
|
||||
@ -409,7 +409,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
|
||||
// Get info
|
||||
UByteArray padding = data.left(prevStoreOffset);
|
||||
name = UString("Padding");
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
|
||||
|
||||
// Add tree item
|
||||
model->addItem(localOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
|
||||
@ -428,7 +428,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
|
||||
|
||||
// Get info
|
||||
name = UString("Padding");
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
|
||||
|
||||
// Add tree item
|
||||
model->addItem(localOffset + paddingOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
|
||||
@ -449,7 +449,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
|
||||
|
||||
// Get info
|
||||
name = UString("Padding");
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
|
||||
|
||||
// Add tree item
|
||||
UModelIndex paddingIndex = model->addItem(localOffset + storeOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
|
||||
@ -479,7 +479,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
|
||||
if ((UINT32)data.size() > storeOffset) {
|
||||
UByteArray padding = data.mid(storeOffset);
|
||||
// Add info
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
|
||||
|
||||
if (padding.count(emptyByte) == padding.size()) { // Free space
|
||||
// Add tree item
|
||||
@ -502,27 +502,27 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
|
||||
UModelIndex current = index.model()->index(i, 0, index);
|
||||
|
||||
switch (model->type(current)) {
|
||||
case Types::FdcStore:
|
||||
parseFdcStoreBody(current);
|
||||
break;
|
||||
case Types::VssStore:
|
||||
parseVssStoreBody(current, 0);
|
||||
break;
|
||||
case Types::Vss2Store:
|
||||
parseVssStoreBody(current, 4);
|
||||
break;
|
||||
case Types::FsysStore:
|
||||
parseFsysStoreBody(current);
|
||||
break;
|
||||
case Types::EvsaStore:
|
||||
parseEvsaStoreBody(current);
|
||||
break;
|
||||
case Types::FlashMapStore:
|
||||
parseFlashMapBody(current);
|
||||
break;
|
||||
default:
|
||||
// Ignore unknown!
|
||||
break;
|
||||
case Types::FdcStore:
|
||||
parseFdcStoreBody(current);
|
||||
break;
|
||||
case Types::VssStore:
|
||||
parseVssStoreBody(current, 0);
|
||||
break;
|
||||
case Types::Vss2Store:
|
||||
parseVssStoreBody(current, 4);
|
||||
break;
|
||||
case Types::FsysStore:
|
||||
parseFsysStoreBody(current);
|
||||
break;
|
||||
case Types::EvsaStore:
|
||||
parseEvsaStoreBody(current);
|
||||
break;
|
||||
case Types::FlashMapStore:
|
||||
parseFlashMapBody(current);
|
||||
break;
|
||||
default:
|
||||
// Ignore unknown!
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -783,8 +783,8 @@ USTATUS NvramParser::parseVssStoreHeader(const UByteArray & store, const UINT32
|
||||
// Check store size
|
||||
if (dataSize < storeSize) {
|
||||
msg(usprintf("%s: VSS store size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
storeSize, storeSize,
|
||||
dataSize, dataSize), parent);
|
||||
storeSize, storeSize,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -804,14 +804,14 @@ USTATUS NvramParser::parseVssStoreHeader(const UByteArray & store, const UINT32
|
||||
name = UString("VSS store");
|
||||
}
|
||||
|
||||
UString info = usprintf("Signature: %Xh\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh",
|
||||
vssStoreHeader->Signature,
|
||||
storeSize, storeSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
vssStoreHeader->Format,
|
||||
vssStoreHeader->State,
|
||||
vssStoreHeader->Unknown);
|
||||
UString info = usprintf("Signature: %Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh",
|
||||
vssStoreHeader->Signature,
|
||||
storeSize, storeSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
vssStoreHeader->Format,
|
||||
vssStoreHeader->State,
|
||||
vssStoreHeader->Unknown);
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::VssStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -841,8 +841,8 @@ USTATUS NvramParser::parseVss2StoreHeader(const UByteArray & store, const UINT32
|
||||
// Check store size
|
||||
if (dataSize < storeSize) {
|
||||
msg(usprintf("%s: VSS2 store size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
storeSize, storeSize,
|
||||
dataSize, dataSize), parent);
|
||||
storeSize, storeSize,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -853,13 +853,13 @@ USTATUS NvramParser::parseVss2StoreHeader(const UByteArray & store, const UINT32
|
||||
// Add info
|
||||
UString name = UString("VSS2 store");
|
||||
UString info = UString("Signature: ") + guidToUString(vssStoreHeader->Signature, false) +
|
||||
usprintf("\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh",
|
||||
storeSize, storeSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
vssStoreHeader->Format,
|
||||
vssStoreHeader->State,
|
||||
vssStoreHeader->Unknown);
|
||||
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh",
|
||||
storeSize, storeSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
vssStoreHeader->Format,
|
||||
vssStoreHeader->State,
|
||||
vssStoreHeader->Unknown);
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::Vss2Store, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -903,8 +903,8 @@ USTATUS NvramParser::parseFtwStoreHeader(const UByteArray & store, const UINT32
|
||||
}
|
||||
if (dataSize < ftwBlockSize) {
|
||||
msg(usprintf("%s: FTW store size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
ftwBlockSize, ftwBlockSize,
|
||||
dataSize, dataSize), parent);
|
||||
ftwBlockSize, ftwBlockSize,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -923,13 +923,13 @@ USTATUS NvramParser::parseFtwStoreHeader(const UByteArray & store, const UINT32
|
||||
// Add info
|
||||
UString name("FTW store");
|
||||
UString info = UString("Signature: ") + guidToUString(ftw32BlockHeader->Signature, false) +
|
||||
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %" PRIXQ "h (%" PRIuQ ")\nState: %02Xh\nHeader CRC32: %08Xh",
|
||||
ftwBlockSize, ftwBlockSize,
|
||||
headerSize, headerSize,
|
||||
body.size(), body.size(),
|
||||
ftw32BlockHeader->State,
|
||||
ftw32BlockHeader->Crc) +
|
||||
(ftw32BlockHeader->Crc != calculatedCrc ? usprintf(", invalid, should be %08Xh", calculatedCrc) : UString(", valid"));
|
||||
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nHeader CRC32: %08Xh",
|
||||
ftwBlockSize, ftwBlockSize,
|
||||
headerSize, headerSize,
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
ftw32BlockHeader->State,
|
||||
ftw32BlockHeader->Crc) +
|
||||
(ftw32BlockHeader->Crc != calculatedCrc ? usprintf(", invalid, should be %08Xh", calculatedCrc) : UString(", valid"));
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::FtwStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -953,8 +953,8 @@ USTATUS NvramParser::parseFdcStoreHeader(const UByteArray & store, const UINT32
|
||||
// Check store size
|
||||
if (dataSize < fdcStoreHeader->Size) {
|
||||
msg(usprintf("%s: FDC store size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
fdcStoreHeader->Size, fdcStoreHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
fdcStoreHeader->Size, fdcStoreHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -964,10 +964,10 @@ USTATUS NvramParser::parseFdcStoreHeader(const UByteArray & store, const UINT32
|
||||
|
||||
// Add info
|
||||
UString name("FDC store");
|
||||
UString info = usprintf("Signature: _FDC\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")",
|
||||
fdcStoreHeader->Size, fdcStoreHeader->Size,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size());
|
||||
UString info = usprintf("Signature: _FDC\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
|
||||
fdcStoreHeader->Size, fdcStoreHeader->Size,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::FdcStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -991,8 +991,8 @@ USTATUS NvramParser::parseFsysStoreHeader(const UByteArray & store, const UINT32
|
||||
// Check store size
|
||||
if (dataSize < fsysStoreHeader->Size) {
|
||||
msg(usprintf("%s: Fsys store size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
fsysStoreHeader->Size, fsysStoreHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
fsysStoreHeader->Size, fsysStoreHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1007,15 +1007,15 @@ USTATUS NvramParser::parseFsysStoreHeader(const UByteArray & store, const UINT32
|
||||
// Add info
|
||||
bool isGaidStore = (fsysStoreHeader->Signature == NVRAM_APPLE_GAID_STORE_SIGNATURE);
|
||||
UString name = isGaidStore ? UString("Gaid store") : UString("Fsys store");
|
||||
UString info = usprintf("Signature: %s\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nUnknown0: %02Xh\nUnknown1: %08Xh\nCRC32: %08Xh",
|
||||
isGaidStore ? "Gaid" : "Fsys",
|
||||
fsysStoreHeader->Size, fsysStoreHeader->Size,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
fsysStoreHeader->Unknown0,
|
||||
fsysStoreHeader->Unknown1,
|
||||
storedCrc)
|
||||
+ (storedCrc != calculatedCrc ? usprintf(", invalid, should be %08Xh", calculatedCrc) : UString(", valid"));
|
||||
UString info = usprintf("Signature: %s\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nUnknown0: %02Xh\nUnknown1: %08Xh\nCRC32: %08Xh",
|
||||
isGaidStore ? "Gaid" : "Fsys",
|
||||
fsysStoreHeader->Size, fsysStoreHeader->Size,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
fsysStoreHeader->Unknown0,
|
||||
fsysStoreHeader->Unknown1,
|
||||
storedCrc)
|
||||
+ (storedCrc != calculatedCrc ? usprintf(", invalid, should be %08Xh", calculatedCrc) : UString(", valid"));
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::FsysStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -1039,8 +1039,8 @@ USTATUS NvramParser::parseEvsaStoreHeader(const UByteArray & store, const UINT32
|
||||
// Check store size
|
||||
if (dataSize < evsaStoreHeader->StoreSize) {
|
||||
msg(usprintf("%s: EVSA store size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize,
|
||||
dataSize, dataSize), parent);
|
||||
evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1053,14 +1053,14 @@ USTATUS NvramParser::parseEvsaStoreHeader(const UByteArray & store, const UINT32
|
||||
|
||||
// Add info
|
||||
UString name("EVSA store");
|
||||
UString info = usprintf("Signature: EVSA\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nType: %02Xh\nAttributes: %08Xh\nChecksum: %02Xh",
|
||||
evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
evsaStoreHeader->Header.Type,
|
||||
evsaStoreHeader->Attributes,
|
||||
evsaStoreHeader->Header.Checksum) +
|
||||
(evsaStoreHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"));
|
||||
UString info = usprintf("Signature: EVSA\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nAttributes: %08Xh\nChecksum: %02Xh",
|
||||
evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
evsaStoreHeader->Header.Type,
|
||||
evsaStoreHeader->Attributes,
|
||||
evsaStoreHeader->Header.Checksum) +
|
||||
(evsaStoreHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"));
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::EvsaStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -1085,8 +1085,8 @@ USTATUS NvramParser::parseFlashMapStoreHeader(const UByteArray & store, const UI
|
||||
UINT32 flashMapSize = sizeof(PHOENIX_FLASH_MAP_HEADER) + flashMapHeader->NumEntries * sizeof(PHOENIX_FLASH_MAP_ENTRY);
|
||||
if (dataSize < flashMapSize) {
|
||||
msg(usprintf("%s: FlashMap block size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
flashMapSize, flashMapSize,
|
||||
dataSize, dataSize), parent);
|
||||
flashMapSize, flashMapSize,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1096,11 +1096,11 @@ USTATUS NvramParser::parseFlashMapStoreHeader(const UByteArray & store, const UI
|
||||
|
||||
// Add info
|
||||
UString name("Phoenix SCT flash map");
|
||||
UString info = usprintf("Signature: _FLASH_MAP\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nNumber of entries: %u",
|
||||
flashMapSize, flashMapSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
flashMapHeader->NumEntries);
|
||||
UString info = usprintf("Signature: _FLASH_MAP\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u",
|
||||
flashMapSize, flashMapSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
flashMapHeader->NumEntries);
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::FlashMapStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -1121,8 +1121,8 @@ USTATUS NvramParser::parseCmdbStoreHeader(const UByteArray & store, const UINT32
|
||||
UINT32 cmdbSize = NVRAM_PHOENIX_CMDB_SIZE;
|
||||
if (dataSize < cmdbSize) {
|
||||
msg(usprintf("%s: CMDB store size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
cmdbSize, cmdbSize,
|
||||
dataSize, dataSize), parent);
|
||||
cmdbSize, cmdbSize,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1135,10 +1135,10 @@ USTATUS NvramParser::parseCmdbStoreHeader(const UByteArray & store, const UINT32
|
||||
|
||||
// Add info
|
||||
UString name("CMDB store");
|
||||
UString info = usprintf("Signature: CMDB\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")",
|
||||
cmdbSize, cmdbSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size());
|
||||
UString info = usprintf("Signature: CMDB\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
|
||||
cmdbSize, cmdbSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::CmdbStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||
@ -1162,8 +1162,8 @@ USTATUS NvramParser::parseSlicPubkeyHeader(const UByteArray & store, const UINT3
|
||||
// Check store size
|
||||
if (dataSize < pubkeyHeader->Size) {
|
||||
msg(usprintf("%s: SLIC pubkey size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
pubkeyHeader->Size, pubkeyHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
pubkeyHeader->Size, pubkeyHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1172,15 +1172,15 @@ USTATUS NvramParser::parseSlicPubkeyHeader(const UByteArray & store, const UINT3
|
||||
|
||||
// Add info
|
||||
UString name("SLIC pubkey");
|
||||
UString info = usprintf("Type: 0h\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: 0h (0)\n"
|
||||
"Key type: %02Xh\nVersion: %02Xh\nAlgorithm: %08Xh\nMagic: RSA1\nBit length: %08Xh\nExponent: %08Xh",
|
||||
pubkeyHeader->Size, pubkeyHeader->Size,
|
||||
header.size(), header.size(),
|
||||
pubkeyHeader->KeyType,
|
||||
pubkeyHeader->Version,
|
||||
pubkeyHeader->Algorithm,
|
||||
pubkeyHeader->BitLength,
|
||||
pubkeyHeader->Exponent);
|
||||
UString info = usprintf("Type: 0h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n"
|
||||
"Key type: %02Xh\nVersion: %02Xh\nAlgorithm: %08Xh\nMagic: RSA1\nBit length: %08Xh\nExponent: %08Xh",
|
||||
pubkeyHeader->Size, pubkeyHeader->Size,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
pubkeyHeader->KeyType,
|
||||
pubkeyHeader->Version,
|
||||
pubkeyHeader->Algorithm,
|
||||
pubkeyHeader->BitLength,
|
||||
pubkeyHeader->Exponent);
|
||||
|
||||
// Add tree item
|
||||
index = model->addItem(localOffset, Types::SlicData, Subtypes::PubkeySlicData, name, UString(), info, header, UByteArray(), UByteArray(), Fixed, parent);
|
||||
@ -1204,8 +1204,8 @@ USTATUS NvramParser::parseSlicMarkerHeader(const UByteArray & store, const UINT3
|
||||
// Check store size
|
||||
if (dataSize < markerHeader->Size) {
|
||||
msg(usprintf("%s: SLIC marker size %Xh (%u) is greater than volume body size %Xh (%u)", __FUNCTION__,
|
||||
markerHeader->Size, markerHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
markerHeader->Size, markerHeader->Size,
|
||||
dataSize, dataSize), parent);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1214,14 +1214,14 @@ USTATUS NvramParser::parseSlicMarkerHeader(const UByteArray & store, const UINT3
|
||||
|
||||
// Add info
|
||||
UString name("SLIC marker");
|
||||
UString info = usprintf("Type: 1h\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: 0h (0)\n"
|
||||
"Version: %08Xh\nOEM ID: %s\nOEM table ID: %s\nWindows flag: WINDOWS\nSLIC version: %08Xh",
|
||||
markerHeader->Size, markerHeader->Size,
|
||||
header.size(), header.size(),
|
||||
markerHeader->Version,
|
||||
(const char*)UString((const char*)&(markerHeader->OemId)).left(6).toLocal8Bit(),
|
||||
(const char*)UString((const char*)&(markerHeader->OemTableId)).left(8).toLocal8Bit(),
|
||||
markerHeader->SlicVersion);
|
||||
UString info = usprintf("Type: 1h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n"
|
||||
"Version: %08Xh\nOEM ID: %s\nOEM table ID: %s\nWindows flag: WINDOWS\nSLIC version: %08Xh",
|
||||
markerHeader->Size, markerHeader->Size,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
markerHeader->Version,
|
||||
(const char*)UString((const char*)&(markerHeader->OemId)).left(6).toLocal8Bit(),
|
||||
(const char*)UString((const char*)&(markerHeader->OemTableId)).left(8).toLocal8Bit(),
|
||||
markerHeader->SlicVersion);
|
||||
|
||||
|
||||
// Add tree item
|
||||
@ -1406,9 +1406,9 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
|
||||
|
||||
// Authenticated variable
|
||||
else if ((variableHeader->Attributes & NVRAM_VSS_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
|
||||
|| (variableHeader->Attributes & NVRAM_VSS_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
|
||||
|| (variableHeader->Attributes & NVRAM_VSS_VARIABLE_APPEND_WRITE)
|
||||
|| (variableHeader->NameSize == 0 && variableHeader->DataSize == 0)) { // If both NameSize and DataSize are zeros, it's auth variable with zero montonic counter
|
||||
|| (variableHeader->Attributes & NVRAM_VSS_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
|
||||
|| (variableHeader->Attributes & NVRAM_VSS_VARIABLE_APPEND_WRITE)
|
||||
|| (variableHeader->NameSize == 0 && variableHeader->DataSize == 0)) { // If both NameSize and DataSize are zeros, it's auth variable with zero montonic counter
|
||||
isAuthenticated = true;
|
||||
if (unparsedSize < sizeof(VSS_AUTH_VARIABLE_HEADER)) {
|
||||
variableSize = 0;
|
||||
@ -1430,7 +1430,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
|
||||
|
||||
// Intel special variable
|
||||
else if (variableHeader->State == NVRAM_VSS_INTEL_VARIABLE_VALID
|
||||
|| variableHeader->State == NVRAM_VSS_INTEL_VARIABLE_INVALID) {
|
||||
|| variableHeader->State == NVRAM_VSS_INTEL_VARIABLE_INVALID) {
|
||||
isIntelSpecial = true;
|
||||
const VSS_INTEL_VARIABLE_HEADER* intelVariableHeader = (const VSS_INTEL_VARIABLE_HEADER*)variableHeader;
|
||||
variableSize = intelVariableHeader->TotalSize;
|
||||
@ -1475,7 +1475,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
|
||||
// Check if the data left is a free space or a padding
|
||||
UByteArray padding = data.mid(offset, unparsedSize);
|
||||
// Get info
|
||||
UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", padding.size(), padding.size());
|
||||
UString info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
|
||||
|
||||
if (padding.count(emptyByte) == padding.size()) { // Free space
|
||||
// Add tree item
|
||||
@ -1514,13 +1514,13 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
|
||||
}
|
||||
|
||||
// Add info
|
||||
info += usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nState: %02Xh\nReserved: %02Xh\nAttributes: %08Xh (",
|
||||
variableSize, variableSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
variableHeader->State,
|
||||
variableHeader->Reserved,
|
||||
variableHeader->Attributes) + vssAttributesToUString(variableHeader->Attributes) + UString(")");
|
||||
info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nReserved: %02Xh\nAttributes: %08Xh (",
|
||||
variableSize, variableSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
variableHeader->State,
|
||||
variableHeader->Reserved,
|
||||
variableHeader->Attributes) + vssAttributesToUString(variableHeader->Attributes) + UString(")");
|
||||
|
||||
// Set subtype and add related info
|
||||
if (isInvalid)
|
||||
@ -1528,12 +1528,12 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
|
||||
else if (isAuthenticated) {
|
||||
subtype = Subtypes::AuthVssEntry;
|
||||
info += usprintf("\nMonotonic counter: %" PRIX64 "h\nTimestamp: ", monotonicCounter) + efiTimeToUString(timestamp)
|
||||
+ usprintf("\nPubKey index: %u", pubKeyIndex);
|
||||
+ usprintf("\nPubKey index: %u", pubKeyIndex);
|
||||
}
|
||||
else if (isAppleCrc32) {
|
||||
subtype = Subtypes::AppleVssEntry;
|
||||
info += usprintf("\nData checksum: %08Xh", storedCrc32) +
|
||||
(storedCrc32 != calculatedCrc32 ? usprintf(", invalid, should be %08Xh", calculatedCrc32) : UString(", valid"));
|
||||
(storedCrc32 != calculatedCrc32 ? usprintf(", invalid, should be %08Xh", calculatedCrc32) : UString(", valid"));
|
||||
}
|
||||
else if (isIntelSpecial) {
|
||||
subtype = Subtypes::IntelVssEntry;
|
||||
@ -1595,15 +1595,15 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index)
|
||||
if (nameSize == 3 && name[0] == 'E' && name[1] == 'O' && name[2] == 'F') {
|
||||
// There is no data afterward, add EOF variable and free space and return
|
||||
UByteArray header = data.mid(offset, sizeof(UINT8) + nameSize);
|
||||
UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", header.size(), header.size());
|
||||
UString info = usprintf("Full size: %Xh (%u)", (UINT32)header.size(), (UINT32)header.size());
|
||||
|
||||
// Add EOF tree item
|
||||
model->addItem(localOffset + offset, Types::FsysEntry, Subtypes::NormalFsysEntry, UString("EOF"), UString(), info, header, UByteArray(), UByteArray(), Fixed, index);
|
||||
|
||||
// Add free space
|
||||
offset += header.size();
|
||||
offset += (UINT32)header.size();
|
||||
UByteArray body = data.mid(offset);
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
// Add free space tree item
|
||||
model->addItem(localOffset + offset, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index);
|
||||
@ -1620,7 +1620,7 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index)
|
||||
else {
|
||||
// Last variable is bad, add the rest as padding and return
|
||||
UByteArray body = data.mid(offset);
|
||||
UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size());
|
||||
UString info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
// Add padding tree item
|
||||
model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index);
|
||||
@ -1636,10 +1636,10 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index)
|
||||
UByteArray body = data.mid(offset + sizeof(UINT8) + nameSize + sizeof(UINT16), dataSize);
|
||||
|
||||
// Add info
|
||||
UString info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")",
|
||||
variableSize, variableSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size());
|
||||
UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
|
||||
variableSize, variableSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
// Add tree item
|
||||
model->addItem(localOffset + offset, Types::FsysEntry, valid ? Subtypes::NormalFsysEntry : Subtypes::InvalidFsysEntry, UString(name.constData()), UString(), info, header, body, UByteArray(), Fixed, index);
|
||||
@ -1696,7 +1696,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
|
||||
variableSize = sizeof(EVSA_ENTRY_HEADER);
|
||||
if (unparsedSize < variableSize || unparsedSize < entryHeader->Size) {
|
||||
body = data.mid(offset);
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
if (body.count(emptyByte) == body.size()) { // Free space
|
||||
// Add free space tree item
|
||||
@ -1724,20 +1724,21 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
|
||||
body = data.mid(offset + sizeof(EVSA_GUID_ENTRY), guidHeader->Header.Size - sizeof(EVSA_GUID_ENTRY));
|
||||
EFI_GUID guid = *(EFI_GUID*)body.constData();
|
||||
name = guidToUString(guid);
|
||||
info = UString("GUID: ") + guidToUString(guid, false) + usprintf("\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nType: %02Xh\nChecksum: %02Xh",
|
||||
variableSize, variableSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
guidHeader->Header.Type,
|
||||
guidHeader->Header.Checksum)
|
||||
+ (guidHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
|
||||
+ usprintf("\nGuidId: %04Xh", guidHeader->GuidId);
|
||||
info = UString("GUID: ") + guidToUString(guid, false)
|
||||
+ usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh",
|
||||
variableSize, variableSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
guidHeader->Header.Type,
|
||||
guidHeader->Header.Checksum)
|
||||
+ (guidHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
|
||||
+ usprintf("\nGuidId: %04Xh", guidHeader->GuidId);
|
||||
subtype = Subtypes::GuidEvsaEntry;
|
||||
guidMap.insert(std::pair<UINT16, EFI_GUID>(guidHeader->GuidId, guid));
|
||||
}
|
||||
// Name entry
|
||||
else if (entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_NAME1 ||
|
||||
entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_NAME2) {
|
||||
entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_NAME2) {
|
||||
const EVSA_NAME_ENTRY* nameHeader = (const EVSA_NAME_ENTRY*)entryHeader;
|
||||
header = data.mid(offset, sizeof(EVSA_NAME_ENTRY));
|
||||
body = data.mid(offset + sizeof(EVSA_NAME_ENTRY), nameHeader->Header.Size - sizeof(EVSA_NAME_ENTRY));
|
||||
@ -1748,21 +1749,22 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
|
||||
name = UString::fromUtf16((const CHAR16*)body.constData());
|
||||
#endif
|
||||
|
||||
info = UString("Name: ") + name + usprintf("\nFull size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %" PRIXQ "h (%" PRIuQ ")\nType: %02Xh\nChecksum: %02Xh",
|
||||
variableSize, variableSize,
|
||||
header.size(), header.size(),
|
||||
body.size(), body.size(),
|
||||
nameHeader->Header.Type,
|
||||
nameHeader->Header.Checksum)
|
||||
+ (nameHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
|
||||
+ usprintf("\nVarId: %04Xh", nameHeader->VarId);
|
||||
info = UString("Name: ") + name
|
||||
+ usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh",
|
||||
variableSize, variableSize,
|
||||
(UINT32)header.size(), (UINT32)header.size(),
|
||||
(UINT32)body.size(), (UINT32)body.size(),
|
||||
nameHeader->Header.Type,
|
||||
nameHeader->Header.Checksum)
|
||||
+ (nameHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
|
||||
+ usprintf("\nVarId: %04Xh", nameHeader->VarId);
|
||||
subtype = Subtypes::NameEvsaEntry;
|
||||
nameMap.insert(std::pair<UINT16, UString>(nameHeader->VarId, name));
|
||||
}
|
||||
// Data entry
|
||||
else if (entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_DATA1 ||
|
||||
entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_DATA2 ||
|
||||
entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_DATA_INVALID) {
|
||||
entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_DATA2 ||
|
||||
entryHeader->Type == NVRAM_EVSA_ENTRY_TYPE_DATA_INVALID) {
|
||||
const EVSA_DATA_ENTRY* dataHeader = (const EVSA_DATA_ENTRY*)entryHeader;
|
||||
// Check for extended header
|
||||
UINT32 headerSize = sizeof(EVSA_DATA_ENTRY);
|
||||
@ -1778,23 +1780,23 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
|
||||
body = data.mid(offset + headerSize, dataSize);
|
||||
name = UString("Data");
|
||||
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh",
|
||||
variableSize, variableSize,
|
||||
headerSize, headerSize,
|
||||
dataSize, dataSize,
|
||||
dataHeader->Header.Type,
|
||||
dataHeader->Header.Checksum)
|
||||
+ (dataHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
|
||||
+ usprintf("\nVarId: %04Xh\nGuidId: %04Xh\nAttributes: %08Xh (",
|
||||
dataHeader->VarId,
|
||||
dataHeader->GuidId,
|
||||
dataHeader->Attributes)
|
||||
+ evsaAttributesToUString(dataHeader->Attributes) + UString(")");
|
||||
variableSize, variableSize,
|
||||
headerSize, headerSize,
|
||||
dataSize, dataSize,
|
||||
dataHeader->Header.Type,
|
||||
dataHeader->Header.Checksum)
|
||||
+ (dataHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
|
||||
+ usprintf("\nVarId: %04Xh\nGuidId: %04Xh\nAttributes: %08Xh (",
|
||||
dataHeader->VarId,
|
||||
dataHeader->GuidId,
|
||||
dataHeader->Attributes)
|
||||
+ evsaAttributesToUString(dataHeader->Attributes) + UString(")");
|
||||
subtype = Subtypes::DataEvsaEntry;
|
||||
}
|
||||
// Unknown entry or free space
|
||||
else {
|
||||
body = data.mid(offset);
|
||||
info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size());
|
||||
info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
if (body.count(emptyByte) == body.size()) { // Free space
|
||||
// Add free space tree item
|
||||
@ -1888,7 +1890,7 @@ USTATUS NvramParser::parseFlashMapBody(const UModelIndex & index)
|
||||
if (unparsedSize < sizeof(PHOENIX_FLASH_MAP_ENTRY)) {
|
||||
// Last variable is bad, add the rest as padding and return
|
||||
UByteArray body = data.mid(offset);
|
||||
UString info = usprintf("Full size: %" PRIXQ "h (%" PRIuQ ")", body.size(), body.size());
|
||||
UString info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
|
||||
|
||||
// Add padding tree item
|
||||
model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index);
|
||||
@ -1907,23 +1909,23 @@ USTATUS NvramParser::parseFlashMapBody(const UModelIndex & index)
|
||||
|
||||
// Add info
|
||||
UString info = UString("Entry GUID: ") + guidToUString(entryHeader->Guid, false) +
|
||||
usprintf("\nFull size: 24h (36)\nHeader size: 24h (36)\nBody size: 0h (0)\n"
|
||||
"Entry type: %04Xh\nData type: %04Xh\nMemory address: %08llXh\nSize: %08Xh\nOffset: %08Xh",
|
||||
entryHeader->EntryType,
|
||||
entryHeader->DataType,
|
||||
(unsigned long long)entryHeader->PhysicalAddress,
|
||||
entryHeader->Size,
|
||||
entryHeader->Offset);
|
||||
usprintf("\nFull size: 24h (36)\nHeader size: 24h (36)\nBody size: 0h (0)\n"
|
||||
"Entry type: %04Xh\nData type: %04Xh\nMemory address: %08llXh\nSize: %08Xh\nOffset: %08Xh",
|
||||
entryHeader->EntryType,
|
||||
entryHeader->DataType,
|
||||
(unsigned long long)entryHeader->PhysicalAddress,
|
||||
entryHeader->Size,
|
||||
entryHeader->Offset);
|
||||
|
||||
// Determine subtype
|
||||
UINT8 subtype = 0;
|
||||
switch (entryHeader->DataType) {
|
||||
case NVRAM_PHOENIX_FLASH_MAP_ENTRY_TYPE_VOLUME:
|
||||
subtype = Subtypes::VolumeFlashMapEntry;
|
||||
break;
|
||||
case NVRAM_PHOENIX_FLASH_MAP_ENTRY_TYPE_DATA_BLOCK:
|
||||
subtype = Subtypes::DataFlashMapEntry;
|
||||
break;
|
||||
case NVRAM_PHOENIX_FLASH_MAP_ENTRY_TYPE_VOLUME:
|
||||
subtype = Subtypes::VolumeFlashMapEntry;
|
||||
break;
|
||||
case NVRAM_PHOENIX_FLASH_MAP_ENTRY_TYPE_DATA_BLOCK:
|
||||
subtype = Subtypes::DataFlashMapEntry;
|
||||
break;
|
||||
}
|
||||
|
||||
// Add tree item
|
||||
|
@ -1,35 +1,35 @@
|
||||
/* peimage.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "peimage.h"
|
||||
|
||||
UString machineTypeToUString(UINT16 machineType)
|
||||
{
|
||||
switch (machineType) {
|
||||
case EFI_IMAGE_FILE_MACHINE_AMD64: return UString("x86-64");
|
||||
case EFI_IMAGE_FILE_MACHINE_ARM: return UString("ARM");
|
||||
case EFI_IMAGE_FILE_MACHINE_ARMNT: return UString("ARMv7");
|
||||
case EFI_IMAGE_FILE_MACHINE_APPLE_ARM: return UString("Apple ARM");
|
||||
case EFI_IMAGE_FILE_MACHINE_AARCH64: return UString("AArch64");
|
||||
case EFI_IMAGE_FILE_MACHINE_EBC: return UString("EBC");
|
||||
case EFI_IMAGE_FILE_MACHINE_I386: return UString("x86");
|
||||
case EFI_IMAGE_FILE_MACHINE_IA64: return UString("IA64");
|
||||
case EFI_IMAGE_FILE_MACHINE_POWERPC: return UString("PowerPC");
|
||||
case EFI_IMAGE_FILE_MACHINE_POWERPCFP: return UString("PowerPC FP");
|
||||
case EFI_IMAGE_FILE_MACHINE_THUMB: return UString("ARM Thumb");
|
||||
case EFI_IMAGE_FILE_MACHINE_RISCV32: return UString("RISC-V 32-bit");
|
||||
case EFI_IMAGE_FILE_MACHINE_RISCV64: return UString("RISC-V 64-bit");
|
||||
case EFI_IMAGE_FILE_MACHINE_RISCV128: return UString("RISC-V 128-bit");
|
||||
default: return usprintf("Unknown (%04Xh)", machineType);
|
||||
case EFI_IMAGE_FILE_MACHINE_AMD64: return UString("x86-64");
|
||||
case EFI_IMAGE_FILE_MACHINE_ARM: return UString("ARM");
|
||||
case EFI_IMAGE_FILE_MACHINE_ARMNT: return UString("ARMv7");
|
||||
case EFI_IMAGE_FILE_MACHINE_APPLE_ARM: return UString("Apple ARM");
|
||||
case EFI_IMAGE_FILE_MACHINE_AARCH64: return UString("AArch64");
|
||||
case EFI_IMAGE_FILE_MACHINE_EBC: return UString("EBC");
|
||||
case EFI_IMAGE_FILE_MACHINE_I386: return UString("x86");
|
||||
case EFI_IMAGE_FILE_MACHINE_IA64: return UString("IA64");
|
||||
case EFI_IMAGE_FILE_MACHINE_POWERPC: return UString("PowerPC");
|
||||
case EFI_IMAGE_FILE_MACHINE_POWERPCFP: return UString("PowerPC FP");
|
||||
case EFI_IMAGE_FILE_MACHINE_THUMB: return UString("ARM Thumb");
|
||||
case EFI_IMAGE_FILE_MACHINE_RISCV32: return UString("RISC-V 32-bit");
|
||||
case EFI_IMAGE_FILE_MACHINE_RISCV64: return UString("RISC-V 64-bit");
|
||||
case EFI_IMAGE_FILE_MACHINE_RISCV128: return UString("RISC-V 128-bit");
|
||||
default: return usprintf("Unknown (%04Xh)", machineType);
|
||||
}
|
||||
}
|
@ -1,38 +1,38 @@
|
||||
/* treeitem.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "treeitem.h"
|
||||
#include "types.h"
|
||||
|
||||
TreeItem::TreeItem(const UINT32 offset, const UINT8 type, const UINT8 subtype,
|
||||
const UString & name, const UString & text, const UString & info,
|
||||
const UByteArray & header, const UByteArray & body, const UByteArray & tail,
|
||||
const bool fixed, const bool compressed,
|
||||
TreeItem *parent) :
|
||||
itemOffset(offset),
|
||||
itemAction(Actions::NoAction),
|
||||
itemType(type),
|
||||
itemSubtype(subtype),
|
||||
itemMarking(0),
|
||||
itemName(name),
|
||||
itemText(text),
|
||||
itemInfo(info),
|
||||
itemHeader(header),
|
||||
itemBody(body),
|
||||
itemTail(tail),
|
||||
itemFixed(fixed),
|
||||
itemCompressed(compressed),
|
||||
parentItem(parent)
|
||||
const UString & name, const UString & text, const UString & info,
|
||||
const UByteArray & header, const UByteArray & body, const UByteArray & tail,
|
||||
const bool fixed, const bool compressed,
|
||||
TreeItem *parent) :
|
||||
itemOffset(offset),
|
||||
itemAction(Actions::NoAction),
|
||||
itemType(type),
|
||||
itemSubtype(subtype),
|
||||
itemMarking(0),
|
||||
itemName(name),
|
||||
itemText(text),
|
||||
itemInfo(info),
|
||||
itemHeader(header),
|
||||
itemBody(body),
|
||||
itemTail(tail),
|
||||
itemFixed(fixed),
|
||||
itemCompressed(compressed),
|
||||
parentItem(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -66,18 +66,18 @@ UString TreeItem::data(int column) const
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
case 0: // Name
|
||||
return itemName;
|
||||
case 1: // Action
|
||||
return actionTypeToUString(itemAction);
|
||||
case 2: // Type
|
||||
return itemTypeToUString(itemType);
|
||||
case 3: // Subtype
|
||||
return itemSubtypeToUString(itemType, itemSubtype);
|
||||
case 4: // Text
|
||||
return itemText;
|
||||
default:
|
||||
return UString();
|
||||
case 0: // Name
|
||||
return itemName;
|
||||
case 1: // Action
|
||||
return actionTypeToUString(itemAction);
|
||||
case 2: // Type
|
||||
return itemTypeToUString(itemType);
|
||||
case 3: // Subtype
|
||||
return itemSubtypeToUString(itemType, itemSubtype);
|
||||
case 4: // Text
|
||||
return itemText;
|
||||
default:
|
||||
return UString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* treemodel.cpp
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "treemodel.h"
|
||||
|
||||
@ -49,15 +49,15 @@ Qt::ItemFlags TreeModel::flags(const UModelIndex &index) const
|
||||
}
|
||||
|
||||
QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
|
||||
int role) const
|
||||
int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||
switch (section) {
|
||||
case 0: return tr("Name");
|
||||
case 1: return tr("Action");
|
||||
case 2: return tr("Type");
|
||||
case 3: return tr("Subtype");
|
||||
case 4: return tr("Text");
|
||||
case 0: return tr("Name");
|
||||
case 1: return tr("Action");
|
||||
case 2: return tr("Type");
|
||||
case 3: return tr("Subtype");
|
||||
case 4: return tr("Text");
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,16 +81,16 @@ UString TreeModel::data(const UModelIndex &index, int role) const
|
||||
}
|
||||
|
||||
UString TreeModel::headerData(int section, int orientation,
|
||||
int role) const
|
||||
int role) const
|
||||
{
|
||||
if (orientation == 1 && role == 0) {
|
||||
switch (section)
|
||||
{
|
||||
case 0: return UString("Name");
|
||||
case 1: return UString("Action");
|
||||
case 2: return UString("Type");
|
||||
case 3: return UString("Subtype");
|
||||
case 4: return UString("Text");
|
||||
case 0: return UString("Name");
|
||||
case 1: return UString("Action");
|
||||
case 2: return UString("Type");
|
||||
case 3: return UString("Subtype");
|
||||
case 4: return UString("Text");
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,10 +489,10 @@ void TreeModel::setUncompressedData(const UModelIndex &index, const UByteArray &
|
||||
}
|
||||
|
||||
UModelIndex TreeModel::addItem(const UINT32 offset, const UINT8 type, const UINT8 subtype,
|
||||
const UString & name, const UString & text, const UString & info,
|
||||
const UByteArray & header, const UByteArray & body, const UByteArray & tail,
|
||||
const ItemFixedState fixed,
|
||||
const UModelIndex & parent, const UINT8 mode)
|
||||
const UString & name, const UString & text, const UString & info,
|
||||
const UByteArray & header, const UByteArray & body, const UByteArray & tail,
|
||||
const ItemFixedState fixed,
|
||||
const UModelIndex & parent, const UINT8 mode)
|
||||
{
|
||||
TreeItem *item = 0;
|
||||
TreeItem *parentItem = 0;
|
||||
@ -552,9 +552,9 @@ UModelIndex TreeModel::findParentOfType(const UModelIndex& index, UINT8 type) co
|
||||
UModelIndex parent = index.parent();
|
||||
|
||||
for (item = static_cast<TreeItem*>(parent.internalPointer());
|
||||
item != NULL && item != rootItem && item->type() != type;
|
||||
item = static_cast<TreeItem*>(parent.internalPointer()))
|
||||
parent = parent.parent();
|
||||
item != NULL && item != rootItem && item->type() != type;
|
||||
item = static_cast<TreeItem*>(parent.internalPointer()))
|
||||
parent = parent.parent();
|
||||
if (item != NULL && item != rootItem)
|
||||
return parent;
|
||||
|
||||
|
326
common/types.cpp
326
common/types.cpp
@ -1,14 +1,14 @@
|
||||
/* types.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
|
||||
#include "ustring.h"
|
||||
#include "types.h"
|
||||
@ -18,22 +18,22 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
UString regionTypeToUString(const UINT8 type)
|
||||
{
|
||||
switch (type) {
|
||||
case Subtypes::DescriptorRegion: return UString("Descriptor");
|
||||
case Subtypes::BiosRegion: return UString("BIOS");
|
||||
case Subtypes::MeRegion: return UString("ME");
|
||||
case Subtypes::GbeRegion: return UString("GbE");
|
||||
case Subtypes::PdrRegion: return UString("PDR");
|
||||
case Subtypes::DevExp1Region: return UString("DevExp1");
|
||||
case Subtypes::Bios2Region: return UString("BIOS2");
|
||||
case Subtypes::MicrocodeRegion: return UString("Microcode");
|
||||
case Subtypes::EcRegion: return UString("EC");
|
||||
case Subtypes::DevExp2Region: return UString("DevExp2");
|
||||
case Subtypes::IeRegion: return UString("IE");
|
||||
case Subtypes::Tgbe1Region: return UString("10GbE1");
|
||||
case Subtypes::Tgbe2Region: return UString("10GbE2");
|
||||
case Subtypes::Reserved1Region: return UString("Reserved1");
|
||||
case Subtypes::Reserved2Region: return UString("Reserved2");
|
||||
case Subtypes::PttRegion: return UString("PTT");
|
||||
case Subtypes::DescriptorRegion: return UString("Descriptor");
|
||||
case Subtypes::BiosRegion: return UString("BIOS");
|
||||
case Subtypes::MeRegion: return UString("ME");
|
||||
case Subtypes::GbeRegion: return UString("GbE");
|
||||
case Subtypes::PdrRegion: return UString("PDR");
|
||||
case Subtypes::DevExp1Region: return UString("DevExp1");
|
||||
case Subtypes::Bios2Region: return UString("BIOS2");
|
||||
case Subtypes::MicrocodeRegion: return UString("Microcode");
|
||||
case Subtypes::EcRegion: return UString("EC");
|
||||
case Subtypes::DevExp2Region: return UString("DevExp2");
|
||||
case Subtypes::IeRegion: return UString("IE");
|
||||
case Subtypes::Tgbe1Region: return UString("10GbE1");
|
||||
case Subtypes::Tgbe2Region: return UString("10GbE2");
|
||||
case Subtypes::Reserved1Region: return UString("Reserved1");
|
||||
case Subtypes::Reserved2Region: return UString("Reserved2");
|
||||
case Subtypes::PttRegion: return UString("PTT");
|
||||
};
|
||||
|
||||
return UString("Unknown");
|
||||
@ -42,44 +42,44 @@ UString regionTypeToUString(const UINT8 type)
|
||||
UString itemTypeToUString(const UINT8 type)
|
||||
{
|
||||
switch (type) {
|
||||
case Types::Root: return UString("Root");
|
||||
case Types::Image: return UString("Image");
|
||||
case Types::Capsule: return UString("Capsule");
|
||||
case Types::Region: return UString("Region");
|
||||
case Types::Volume: return UString("Volume");
|
||||
case Types::Padding: return UString("Padding");
|
||||
case Types::File: return UString("File");
|
||||
case Types::Section: return UString("Section");
|
||||
case Types::FreeSpace: return UString("Free space");
|
||||
case Types::VssStore: return UString("VSS store");
|
||||
case Types::Vss2Store: return UString("VSS2 store");
|
||||
case Types::FtwStore: return UString("FTW store");
|
||||
case Types::FdcStore: return UString("FDC store");
|
||||
case Types::FsysStore: return UString("Fsys store");
|
||||
case Types::EvsaStore: return UString("EVSA store");
|
||||
case Types::CmdbStore: return UString("CMDB store");
|
||||
case Types::FlashMapStore: return UString("FlashMap store");
|
||||
case Types::NvarEntry: return UString("NVAR entry");
|
||||
case Types::VssEntry: return UString("VSS entry");
|
||||
case Types::FsysEntry: return UString("Fsys entry");
|
||||
case Types::EvsaEntry: return UString("EVSA entry");
|
||||
case Types::FlashMapEntry: return UString("FlashMap entry");
|
||||
case Types::Microcode: return UString("Microcode");
|
||||
case Types::SlicData: return UString("SLIC data");
|
||||
// ME-specific
|
||||
case Types::FptStore: return UString("FPT store");
|
||||
case Types::FptEntry: return UString("FPT entry");
|
||||
case Types::IfwiHeader: return UString("IFWI header");
|
||||
case Types::IfwiPartition: return UString("IFWI partition");
|
||||
case Types::FptPartition: return UString("FPT partition");
|
||||
case Types::BpdtStore: return UString("BPDT store");
|
||||
case Types::BpdtEntry: return UString("BPDT entry");
|
||||
case Types::BpdtPartition: return UString("BPDT partition");
|
||||
case Types::CpdStore: return UString("CPD store");
|
||||
case Types::CpdEntry: return UString("CPD entry");
|
||||
case Types::CpdPartition: return UString("CPD partition");
|
||||
case Types::CpdExtension: return UString("CPD extension");
|
||||
case Types::CpdSpiEntry: return UString("CPD SPI entry");
|
||||
case Types::Root: return UString("Root");
|
||||
case Types::Image: return UString("Image");
|
||||
case Types::Capsule: return UString("Capsule");
|
||||
case Types::Region: return UString("Region");
|
||||
case Types::Volume: return UString("Volume");
|
||||
case Types::Padding: return UString("Padding");
|
||||
case Types::File: return UString("File");
|
||||
case Types::Section: return UString("Section");
|
||||
case Types::FreeSpace: return UString("Free space");
|
||||
case Types::VssStore: return UString("VSS store");
|
||||
case Types::Vss2Store: return UString("VSS2 store");
|
||||
case Types::FtwStore: return UString("FTW store");
|
||||
case Types::FdcStore: return UString("FDC store");
|
||||
case Types::FsysStore: return UString("Fsys store");
|
||||
case Types::EvsaStore: return UString("EVSA store");
|
||||
case Types::CmdbStore: return UString("CMDB store");
|
||||
case Types::FlashMapStore: return UString("FlashMap store");
|
||||
case Types::NvarEntry: return UString("NVAR entry");
|
||||
case Types::VssEntry: return UString("VSS entry");
|
||||
case Types::FsysEntry: return UString("Fsys entry");
|
||||
case Types::EvsaEntry: return UString("EVSA entry");
|
||||
case Types::FlashMapEntry: return UString("FlashMap entry");
|
||||
case Types::Microcode: return UString("Microcode");
|
||||
case Types::SlicData: return UString("SLIC data");
|
||||
// ME-specific
|
||||
case Types::FptStore: return UString("FPT store");
|
||||
case Types::FptEntry: return UString("FPT entry");
|
||||
case Types::IfwiHeader: return UString("IFWI header");
|
||||
case Types::IfwiPartition: return UString("IFWI partition");
|
||||
case Types::FptPartition: return UString("FPT partition");
|
||||
case Types::BpdtStore: return UString("BPDT store");
|
||||
case Types::BpdtEntry: return UString("BPDT entry");
|
||||
case Types::BpdtPartition: return UString("BPDT partition");
|
||||
case Types::CpdStore: return UString("CPD store");
|
||||
case Types::CpdEntry: return UString("CPD entry");
|
||||
case Types::CpdPartition: return UString("CPD partition");
|
||||
case Types::CpdExtension: return UString("CPD extension");
|
||||
case Types::CpdSpiEntry: return UString("CPD SPI entry");
|
||||
}
|
||||
|
||||
return UString("Unknown");
|
||||
@ -88,84 +88,84 @@ UString itemTypeToUString(const UINT8 type)
|
||||
UString itemSubtypeToUString(const UINT8 type, const UINT8 subtype)
|
||||
{
|
||||
switch (type) {
|
||||
case Types::Image:
|
||||
if (subtype == Subtypes::IntelImage) return UString("Intel");
|
||||
if (subtype == Subtypes::UefiImage) return UString("UEFI");
|
||||
break;
|
||||
case Types::Padding:
|
||||
if (subtype == Subtypes::ZeroPadding) return UString("Empty (0x00)");
|
||||
if (subtype == Subtypes::OnePadding) return UString("Empty (0xFF)");
|
||||
if (subtype == Subtypes::DataPadding) return UString("Non-empty");
|
||||
break;
|
||||
case Types::Volume:
|
||||
if (subtype == Subtypes::UnknownVolume) return UString("Unknown");
|
||||
if (subtype == Subtypes::Ffs2Volume) return UString("FFSv2");
|
||||
if (subtype == Subtypes::Ffs3Volume) return UString("FFSv3");
|
||||
if (subtype == Subtypes::NvramVolume) return UString("NVRAM");
|
||||
if (subtype == Subtypes::MicrocodeVolume) return UString("Microcode");
|
||||
break;
|
||||
case Types::Capsule:
|
||||
if (subtype == Subtypes::AptioSignedCapsule) return UString("Aptio signed");
|
||||
if (subtype == Subtypes::AptioUnsignedCapsule) return UString("Aptio unsigned");
|
||||
if (subtype == Subtypes::UefiCapsule) return UString("UEFI 2.0");
|
||||
if (subtype == Subtypes::ToshibaCapsule) return UString("Toshiba");
|
||||
break;
|
||||
case Types::Region: return regionTypeToUString(subtype);
|
||||
case Types::File: return fileTypeToUString(subtype);
|
||||
case Types::Section: return sectionTypeToUString(subtype);
|
||||
case Types::NvarEntry:
|
||||
if (subtype == Subtypes::InvalidNvarEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::InvalidLinkNvarEntry) return UString("Invalid link");
|
||||
if (subtype == Subtypes::LinkNvarEntry) return UString("Link");
|
||||
if (subtype == Subtypes::DataNvarEntry) return UString("Data");
|
||||
if (subtype == Subtypes::FullNvarEntry) return UString("Full");
|
||||
break;
|
||||
case Types::VssEntry:
|
||||
if (subtype == Subtypes::InvalidVssEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::StandardVssEntry) return UString("Standard");
|
||||
if (subtype == Subtypes::AppleVssEntry) return UString("Apple");
|
||||
if (subtype == Subtypes::AuthVssEntry) return UString("Auth");
|
||||
if (subtype == Subtypes::IntelVssEntry) return UString("Intel");
|
||||
break;
|
||||
case Types::FsysEntry:
|
||||
if (subtype == Subtypes::InvalidFsysEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::NormalFsysEntry) return UString("Normal");
|
||||
break;
|
||||
case Types::EvsaEntry:
|
||||
if (subtype == Subtypes::InvalidEvsaEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::UnknownEvsaEntry) return UString("Unknown");
|
||||
if (subtype == Subtypes::GuidEvsaEntry) return UString("GUID");
|
||||
if (subtype == Subtypes::NameEvsaEntry) return UString("Name");
|
||||
if (subtype == Subtypes::DataEvsaEntry) return UString("Data");
|
||||
break;
|
||||
case Types::FlashMapEntry:
|
||||
if (subtype == Subtypes::VolumeFlashMapEntry) return UString("Volume");
|
||||
if (subtype == Subtypes::DataFlashMapEntry) return UString("Data");
|
||||
break;
|
||||
case Types::Microcode:
|
||||
if (subtype == Subtypes::IntelMicrocode) return UString("Intel");
|
||||
if (subtype == Subtypes::AmdMicrocode) return UString("AMD");
|
||||
break;
|
||||
// ME-specific
|
||||
case Types::FptEntry:
|
||||
if (subtype == Subtypes::ValidFptEntry) return UString("Valid");
|
||||
if (subtype == Subtypes::InvalidFptEntry) return UString("Invalid");
|
||||
break;
|
||||
case Types::FptPartition:
|
||||
if (subtype == Subtypes::CodeFptPartition) return UString("Code");
|
||||
if (subtype == Subtypes::DataFptPartition) return UString("Data");
|
||||
if (subtype == Subtypes::GlutFptPartition) return UString("GLUT");
|
||||
break;
|
||||
case Types::IfwiPartition:
|
||||
if (subtype == Subtypes::BootIfwiPartition) return UString("Boot");
|
||||
if (subtype == Subtypes::DataIfwiPartition) return UString("Data");
|
||||
break;
|
||||
case Types::CpdPartition:
|
||||
if (subtype == Subtypes::ManifestCpdPartition) return UString("Manifest");
|
||||
if (subtype == Subtypes::MetadataCpdPartition) return UString("Metadata");
|
||||
if (subtype == Subtypes::KeyCpdPartition) return UString("Key");
|
||||
if (subtype == Subtypes::CodeCpdPartition) return UString("Code");
|
||||
break;
|
||||
case Types::Image:
|
||||
if (subtype == Subtypes::IntelImage) return UString("Intel");
|
||||
if (subtype == Subtypes::UefiImage) return UString("UEFI");
|
||||
break;
|
||||
case Types::Padding:
|
||||
if (subtype == Subtypes::ZeroPadding) return UString("Empty (0x00)");
|
||||
if (subtype == Subtypes::OnePadding) return UString("Empty (0xFF)");
|
||||
if (subtype == Subtypes::DataPadding) return UString("Non-empty");
|
||||
break;
|
||||
case Types::Volume:
|
||||
if (subtype == Subtypes::UnknownVolume) return UString("Unknown");
|
||||
if (subtype == Subtypes::Ffs2Volume) return UString("FFSv2");
|
||||
if (subtype == Subtypes::Ffs3Volume) return UString("FFSv3");
|
||||
if (subtype == Subtypes::NvramVolume) return UString("NVRAM");
|
||||
if (subtype == Subtypes::MicrocodeVolume) return UString("Microcode");
|
||||
break;
|
||||
case Types::Capsule:
|
||||
if (subtype == Subtypes::AptioSignedCapsule) return UString("Aptio signed");
|
||||
if (subtype == Subtypes::AptioUnsignedCapsule) return UString("Aptio unsigned");
|
||||
if (subtype == Subtypes::UefiCapsule) return UString("UEFI 2.0");
|
||||
if (subtype == Subtypes::ToshibaCapsule) return UString("Toshiba");
|
||||
break;
|
||||
case Types::Region: return regionTypeToUString(subtype);
|
||||
case Types::File: return fileTypeToUString(subtype);
|
||||
case Types::Section: return sectionTypeToUString(subtype);
|
||||
case Types::NvarEntry:
|
||||
if (subtype == Subtypes::InvalidNvarEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::InvalidLinkNvarEntry) return UString("Invalid link");
|
||||
if (subtype == Subtypes::LinkNvarEntry) return UString("Link");
|
||||
if (subtype == Subtypes::DataNvarEntry) return UString("Data");
|
||||
if (subtype == Subtypes::FullNvarEntry) return UString("Full");
|
||||
break;
|
||||
case Types::VssEntry:
|
||||
if (subtype == Subtypes::InvalidVssEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::StandardVssEntry) return UString("Standard");
|
||||
if (subtype == Subtypes::AppleVssEntry) return UString("Apple");
|
||||
if (subtype == Subtypes::AuthVssEntry) return UString("Auth");
|
||||
if (subtype == Subtypes::IntelVssEntry) return UString("Intel");
|
||||
break;
|
||||
case Types::FsysEntry:
|
||||
if (subtype == Subtypes::InvalidFsysEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::NormalFsysEntry) return UString("Normal");
|
||||
break;
|
||||
case Types::EvsaEntry:
|
||||
if (subtype == Subtypes::InvalidEvsaEntry) return UString("Invalid");
|
||||
if (subtype == Subtypes::UnknownEvsaEntry) return UString("Unknown");
|
||||
if (subtype == Subtypes::GuidEvsaEntry) return UString("GUID");
|
||||
if (subtype == Subtypes::NameEvsaEntry) return UString("Name");
|
||||
if (subtype == Subtypes::DataEvsaEntry) return UString("Data");
|
||||
break;
|
||||
case Types::FlashMapEntry:
|
||||
if (subtype == Subtypes::VolumeFlashMapEntry) return UString("Volume");
|
||||
if (subtype == Subtypes::DataFlashMapEntry) return UString("Data");
|
||||
break;
|
||||
case Types::Microcode:
|
||||
if (subtype == Subtypes::IntelMicrocode) return UString("Intel");
|
||||
if (subtype == Subtypes::AmdMicrocode) return UString("AMD");
|
||||
break;
|
||||
// ME-specific
|
||||
case Types::FptEntry:
|
||||
if (subtype == Subtypes::ValidFptEntry) return UString("Valid");
|
||||
if (subtype == Subtypes::InvalidFptEntry) return UString("Invalid");
|
||||
break;
|
||||
case Types::FptPartition:
|
||||
if (subtype == Subtypes::CodeFptPartition) return UString("Code");
|
||||
if (subtype == Subtypes::DataFptPartition) return UString("Data");
|
||||
if (subtype == Subtypes::GlutFptPartition) return UString("GLUT");
|
||||
break;
|
||||
case Types::IfwiPartition:
|
||||
if (subtype == Subtypes::BootIfwiPartition) return UString("Boot");
|
||||
if (subtype == Subtypes::DataIfwiPartition) return UString("Data");
|
||||
break;
|
||||
case Types::CpdPartition:
|
||||
if (subtype == Subtypes::ManifestCpdPartition) return UString("Manifest");
|
||||
if (subtype == Subtypes::MetadataCpdPartition) return UString("Metadata");
|
||||
if (subtype == Subtypes::KeyCpdPartition) return UString("Key");
|
||||
if (subtype == Subtypes::CodeCpdPartition) return UString("Code");
|
||||
break;
|
||||
}
|
||||
|
||||
return UString();
|
||||
@ -174,12 +174,12 @@ UString itemSubtypeToUString(const UINT8 type, const UINT8 subtype)
|
||||
UString compressionTypeToUString(const UINT8 algorithm)
|
||||
{
|
||||
switch (algorithm) {
|
||||
case COMPRESSION_ALGORITHM_NONE: return UString("None");
|
||||
case COMPRESSION_ALGORITHM_EFI11: return UString("EFI 1.1");
|
||||
case COMPRESSION_ALGORITHM_TIANO: return UString("Tiano");
|
||||
case COMPRESSION_ALGORITHM_UNDECIDED: return UString("Undecided Tiano/EFI 1.1");
|
||||
case COMPRESSION_ALGORITHM_LZMA: return UString("LZMA");
|
||||
case COMPRESSION_ALGORITHM_LZMA_INTEL_LEGACY: return UString("Intel legacy LZMA");
|
||||
case COMPRESSION_ALGORITHM_NONE: return UString("None");
|
||||
case COMPRESSION_ALGORITHM_EFI11: return UString("EFI 1.1");
|
||||
case COMPRESSION_ALGORITHM_TIANO: return UString("Tiano");
|
||||
case COMPRESSION_ALGORITHM_UNDECIDED: return UString("Undecided Tiano/EFI 1.1");
|
||||
case COMPRESSION_ALGORITHM_LZMA: return UString("LZMA");
|
||||
case COMPRESSION_ALGORITHM_LZMA_INTEL_LEGACY: return UString("Intel legacy LZMA");
|
||||
}
|
||||
|
||||
return UString("Unknown");
|
||||
@ -188,13 +188,13 @@ UString compressionTypeToUString(const UINT8 algorithm)
|
||||
UString actionTypeToUString(const UINT8 action)
|
||||
{
|
||||
switch (action) {
|
||||
case Actions::NoAction: return UString();
|
||||
case Actions::Create: return UString("Create");
|
||||
case Actions::Insert: return UString("Insert");
|
||||
case Actions::Replace: return UString("Replace");
|
||||
case Actions::Remove: return UString("Remove");
|
||||
case Actions::Rebuild: return UString("Rebuild");
|
||||
case Actions::Rebase: return UString("Rebase");
|
||||
case Actions::NoAction: return UString();
|
||||
case Actions::Create: return UString("Create");
|
||||
case Actions::Insert: return UString("Insert");
|
||||
case Actions::Replace: return UString("Replace");
|
||||
case Actions::Remove: return UString("Remove");
|
||||
case Actions::Rebuild: return UString("Rebuild");
|
||||
case Actions::Rebase: return UString("Rebase");
|
||||
}
|
||||
|
||||
return UString("Unknown");
|
||||
@ -203,16 +203,16 @@ UString actionTypeToUString(const UINT8 action)
|
||||
UString fitEntryTypeToUString(const UINT8 type)
|
||||
{
|
||||
switch (type & 0x7F) {
|
||||
case FIT_TYPE_HEADER: return UString("FIT Header");
|
||||
case FIT_TYPE_MICROCODE: return UString("Microcode");
|
||||
case FIT_TYPE_BIOS_AC_MODULE: return UString("BIOS ACM");
|
||||
case FIT_TYPE_BIOS_INIT_MODULE: return UString("BIOS Init");
|
||||
case FIT_TYPE_TPM_POLICY: return UString("TPM Policy");
|
||||
case FIT_TYPE_BIOS_POLICY_DATA: return UString("BIOS Policy Data");
|
||||
case FIT_TYPE_TXT_CONF_POLICY: return UString("TXT Configuration Policy");
|
||||
case FIT_TYPE_AC_KEY_MANIFEST: return UString("BootGuard Key Manifest");
|
||||
case FIT_TYPE_AC_BOOT_POLICY: return UString("BootGuard Boot Policy");
|
||||
case FIT_TYPE_EMPTY: return UString("Empty");
|
||||
case FIT_TYPE_HEADER: return UString("FIT Header");
|
||||
case FIT_TYPE_MICROCODE: return UString("Microcode");
|
||||
case FIT_TYPE_BIOS_AC_MODULE: return UString("BIOS ACM");
|
||||
case FIT_TYPE_BIOS_INIT_MODULE: return UString("BIOS Init");
|
||||
case FIT_TYPE_TPM_POLICY: return UString("TPM Policy");
|
||||
case FIT_TYPE_BIOS_POLICY_DATA: return UString("BIOS Policy Data");
|
||||
case FIT_TYPE_TXT_CONF_POLICY: return UString("TXT Configuration Policy");
|
||||
case FIT_TYPE_AC_KEY_MANIFEST: return UString("BootGuard Key Manifest");
|
||||
case FIT_TYPE_AC_BOOT_POLICY: return UString("BootGuard Boot Policy");
|
||||
case FIT_TYPE_EMPTY: return UString("Empty");
|
||||
}
|
||||
|
||||
return UString("Unknown");
|
||||
|
@ -16,25 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
// A workaround for compilers not supporting c++11 and c11
|
||||
// for using PRIX64.
|
||||
#define __STDC_FORMAT_MACROS
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#if QT_VERSION_MAJOR >= 6
|
||||
# define PRIdQ __PRI_64_LENGTH_MODIFIER__ "d"
|
||||
# define PRIiQ __PRI_64_LENGTH_MODIFIER__ "i"
|
||||
# define PRIoQ __PRI_64_LENGTH_MODIFIER__ "o"
|
||||
# define PRIuQ __PRI_64_LENGTH_MODIFIER__ "u"
|
||||
# define PRIxQ __PRI_64_LENGTH_MODIFIER__ "x"
|
||||
# define PRIXQ __PRI_64_LENGTH_MODIFIER__ "X"
|
||||
#else
|
||||
# define PRIdQ "d"
|
||||
# define PRIiQ "i"
|
||||
# define PRIoQ "o"
|
||||
# define PRIuQ "u"
|
||||
# define PRIxQ "x"
|
||||
# define PRIXQ "X"
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#define ATTRIBUTE_FORMAT_(t,f,a) __attribute__((format(t, f, a)))
|
||||
#else
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* ustring.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
|
||||
#include "ustring.h"
|
||||
#include <stdarg.h>
|
||||
@ -37,16 +37,16 @@ UString urepeated(char c, int len)
|
||||
#else
|
||||
#ifdef BSTRLIB_NOVSNP
|
||||
/* This is just a hack. If you are using a system without a vsnprintf, it is
|
||||
not recommended that bformat be used at all. */
|
||||
not recommended that bformat be used at all. */
|
||||
#define exvsnprintf(r,b,n,f,a) {vsprintf (b,f,a); r = -1;}
|
||||
#define START_VSNBUFF (256)
|
||||
#else
|
||||
|
||||
#if defined (__GNUC__) && !defined (__PPC__) && !defined(__WIN32__)
|
||||
/* Something is making gcc complain about this prototype not being here, so
|
||||
I've just gone ahead and put it in. */
|
||||
I've just gone ahead and put it in. */
|
||||
extern "C" {
|
||||
extern int vsnprintf(char *buf, size_t count, const char *format, va_list arg);
|
||||
extern int vsnprintf(char *buf, size_t count, const char *format, va_list arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/* utility.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
@ -79,25 +79,25 @@ UString uniqueItemName(const UModelIndex & index)
|
||||
// Default name
|
||||
UString name = itemName;
|
||||
switch (model->type(index)) {
|
||||
case Types::NvarEntry:
|
||||
case Types::VssEntry:
|
||||
case Types::FsysEntry:
|
||||
case Types::EvsaEntry:
|
||||
case Types::FlashMapEntry:
|
||||
case Types::File:
|
||||
name = itemText.isEmpty() ? itemName : itemName + '_' + itemText;
|
||||
break;
|
||||
case Types::Section: {
|
||||
// Get parent file name
|
||||
UModelIndex fileIndex = model->findParentOfType(index, Types::File);
|
||||
UString fileText = model->text(fileIndex);
|
||||
name = fileText.isEmpty() ? model->name(fileIndex) : model->name(fileIndex) + '_' + fileText;
|
||||
case Types::NvarEntry:
|
||||
case Types::VssEntry:
|
||||
case Types::FsysEntry:
|
||||
case Types::EvsaEntry:
|
||||
case Types::FlashMapEntry:
|
||||
case Types::File:
|
||||
name = itemText.isEmpty() ? itemName : itemName + '_' + itemText;
|
||||
break;
|
||||
case Types::Section: {
|
||||
// Get parent file name
|
||||
UModelIndex fileIndex = model->findParentOfType(index, Types::File);
|
||||
UString fileText = model->text(fileIndex);
|
||||
name = fileText.isEmpty() ? model->name(fileIndex) : model->name(fileIndex) + '_' + fileText;
|
||||
|
||||
// Special case of GUIDed sections
|
||||
if (model->subtype(index) == EFI_SECTION_GUID_DEFINED || model->subtype(index) == EFI_SECTION_FREEFORM_SUBTYPE_GUID) {
|
||||
name = model->name(index) +'_' + name;
|
||||
}
|
||||
} break;
|
||||
// Special case of GUIDed sections
|
||||
if (model->subtype(index) == EFI_SECTION_GUID_DEFINED || model->subtype(index) == EFI_SECTION_FREEFORM_SUBTYPE_GUID) {
|
||||
name = model->name(index) +'_' + name;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
// Populate subtypeString
|
||||
@ -105,8 +105,8 @@ UString uniqueItemName(const UModelIndex & index)
|
||||
|
||||
// Create final name
|
||||
name = itemTypeToUString(model->type(index))
|
||||
+ (subtypeString.length() ? ('_' + subtypeString) : UString())
|
||||
+ '_' + name;
|
||||
+ (subtypeString.length() ? ('_' + subtypeString) : UString())
|
||||
+ '_' + name;
|
||||
|
||||
fixFileName(name, true);
|
||||
|
||||
@ -127,10 +127,10 @@ void fixFileName(UString &name, bool replaceSpaces)
|
||||
name[i] < (char)0x20 || // ASCII control characters, banned in Windows, hard to work with in *nix
|
||||
name[i] > (char)0x7f || // high ASCII characters
|
||||
(replaceSpaces && name[i] == ' ') // Provides better readability
|
||||
) {
|
||||
name[i] = '_';
|
||||
continue;
|
||||
}
|
||||
) {
|
||||
name[i] = '_';
|
||||
continue;
|
||||
}
|
||||
for (size_t j = 0; j < sizeof(table); j++) {
|
||||
if (name[i] == table[j]) {
|
||||
name[i] = '_';
|
||||
@ -147,57 +147,57 @@ void fixFileName(UString &name, bool replaceSpaces)
|
||||
UString errorCodeToUString(USTATUS errorCode)
|
||||
{
|
||||
switch (errorCode) {
|
||||
case U_SUCCESS: return UString("Success");
|
||||
case U_NOT_IMPLEMENTED: return UString("Not implemented");
|
||||
case U_INVALID_PARAMETER: return UString("Function called with invalid parameter");
|
||||
case U_BUFFER_TOO_SMALL: return UString("Buffer too small");
|
||||
case U_OUT_OF_RESOURCES: return UString("Out of resources");
|
||||
case U_OUT_OF_MEMORY: return UString("Out of memory");
|
||||
case U_FILE_OPEN: return UString("File can't be opened");
|
||||
case U_FILE_READ: return UString("File can't be read");
|
||||
case U_FILE_WRITE: return UString("File can't be written");
|
||||
case U_ITEM_NOT_FOUND: return UString("Item not found");
|
||||
case U_UNKNOWN_ITEM_TYPE: return UString("Unknown item type");
|
||||
case U_INVALID_FLASH_DESCRIPTOR: return UString("Invalid flash descriptor");
|
||||
case U_INVALID_REGION: return UString("Invalid region");
|
||||
case U_EMPTY_REGION: return UString("Empty region");
|
||||
case U_BIOS_REGION_NOT_FOUND: return UString("BIOS region not found");
|
||||
case U_VOLUMES_NOT_FOUND: return UString("UEFI volumes not found");
|
||||
case U_INVALID_VOLUME: return UString("Invalid UEFI volume");
|
||||
case U_VOLUME_REVISION_NOT_SUPPORTED: return UString("Volume revision not supported");
|
||||
//case U_VOLUME_GROW_FAILED: return UString("Volume grow failed");
|
||||
case U_UNKNOWN_FFS: return UString("Unknown file system");
|
||||
case U_INVALID_FILE: return UString("Invalid file");
|
||||
case U_INVALID_SECTION: return UString("Invalid section");
|
||||
case U_UNKNOWN_SECTION: return UString("Unknown section");
|
||||
case U_STANDARD_COMPRESSION_FAILED: return UString("Standard compression failed");
|
||||
case U_CUSTOMIZED_COMPRESSION_FAILED: return UString("Customized compression failed");
|
||||
case U_STANDARD_DECOMPRESSION_FAILED: return UString("Standard decompression failed");
|
||||
case U_CUSTOMIZED_DECOMPRESSION_FAILED: return UString("Customized decompression failed");
|
||||
case U_UNKNOWN_COMPRESSION_TYPE: return UString("Unknown compression type");
|
||||
case U_UNKNOWN_EXTRACT_MODE: return UString("Unknown extract mode");
|
||||
case U_UNKNOWN_REPLACE_MODE: return UString("Unknown replace mode");
|
||||
//case U_UNKNOWN_INSERT_MODE: return UString("Unknown insert mode");
|
||||
case U_UNKNOWN_IMAGE_TYPE: return UString("Unknown executable image type");
|
||||
case U_UNKNOWN_PE_OPTIONAL_HEADER_TYPE: return UString("Unknown PE optional header type");
|
||||
case U_UNKNOWN_RELOCATION_TYPE: return UString("Unknown relocation type");
|
||||
//case U_GENERIC_CALL_NOT_SUPPORTED: return UString("Generic call not supported");
|
||||
//case U_VOLUME_BASE_NOT_FOUND: return UString("Volume base address not found");
|
||||
//case U_PEI_CORE_ENTRY_POINT_NOT_FOUND: return UString("PEI core entry point not found");
|
||||
case U_COMPLEX_BLOCK_MAP: return UString("Block map structure too complex for correct analysis");
|
||||
case U_DIR_ALREADY_EXIST: return UString("Directory already exists");
|
||||
case U_DIR_CREATE: return UString("Directory can't be created");
|
||||
case U_DIR_CHANGE: return UString("Change directory failed");
|
||||
//case U_UNKNOWN_PATCH_TYPE: return UString("Unknown patch type");
|
||||
//case U_PATCH_OFFSET_OUT_OF_BOUNDS: return UString("Patch offset out of bounds");
|
||||
//case U_INVALID_SYMBOL: return UString("Invalid symbol");
|
||||
//case U_NOTHING_TO_PATCH: return UString("Nothing to patch");
|
||||
case U_DEPEX_PARSE_FAILED: return UString("Dependency expression parsing failed");
|
||||
case U_TRUNCATED_IMAGE: return UString("Image is truncated");
|
||||
case U_INVALID_CAPSULE: return UString("Invalid capsule");
|
||||
case U_STORES_NOT_FOUND: return UString("Stores not found");
|
||||
case U_INVALID_STORE_SIZE: return UString("Invalid store size");
|
||||
default: return usprintf("Unknown error %02lX", errorCode);
|
||||
case U_SUCCESS: return UString("Success");
|
||||
case U_NOT_IMPLEMENTED: return UString("Not implemented");
|
||||
case U_INVALID_PARAMETER: return UString("Function called with invalid parameter");
|
||||
case U_BUFFER_TOO_SMALL: return UString("Buffer too small");
|
||||
case U_OUT_OF_RESOURCES: return UString("Out of resources");
|
||||
case U_OUT_OF_MEMORY: return UString("Out of memory");
|
||||
case U_FILE_OPEN: return UString("File can't be opened");
|
||||
case U_FILE_READ: return UString("File can't be read");
|
||||
case U_FILE_WRITE: return UString("File can't be written");
|
||||
case U_ITEM_NOT_FOUND: return UString("Item not found");
|
||||
case U_UNKNOWN_ITEM_TYPE: return UString("Unknown item type");
|
||||
case U_INVALID_FLASH_DESCRIPTOR: return UString("Invalid flash descriptor");
|
||||
case U_INVALID_REGION: return UString("Invalid region");
|
||||
case U_EMPTY_REGION: return UString("Empty region");
|
||||
case U_BIOS_REGION_NOT_FOUND: return UString("BIOS region not found");
|
||||
case U_VOLUMES_NOT_FOUND: return UString("UEFI volumes not found");
|
||||
case U_INVALID_VOLUME: return UString("Invalid UEFI volume");
|
||||
case U_VOLUME_REVISION_NOT_SUPPORTED: return UString("Volume revision not supported");
|
||||
//case U_VOLUME_GROW_FAILED: return UString("Volume grow failed");
|
||||
case U_UNKNOWN_FFS: return UString("Unknown file system");
|
||||
case U_INVALID_FILE: return UString("Invalid file");
|
||||
case U_INVALID_SECTION: return UString("Invalid section");
|
||||
case U_UNKNOWN_SECTION: return UString("Unknown section");
|
||||
case U_STANDARD_COMPRESSION_FAILED: return UString("Standard compression failed");
|
||||
case U_CUSTOMIZED_COMPRESSION_FAILED: return UString("Customized compression failed");
|
||||
case U_STANDARD_DECOMPRESSION_FAILED: return UString("Standard decompression failed");
|
||||
case U_CUSTOMIZED_DECOMPRESSION_FAILED: return UString("Customized decompression failed");
|
||||
case U_UNKNOWN_COMPRESSION_TYPE: return UString("Unknown compression type");
|
||||
case U_UNKNOWN_EXTRACT_MODE: return UString("Unknown extract mode");
|
||||
case U_UNKNOWN_REPLACE_MODE: return UString("Unknown replace mode");
|
||||
//case U_UNKNOWN_INSERT_MODE: return UString("Unknown insert mode");
|
||||
case U_UNKNOWN_IMAGE_TYPE: return UString("Unknown executable image type");
|
||||
case U_UNKNOWN_PE_OPTIONAL_HEADER_TYPE: return UString("Unknown PE optional header type");
|
||||
case U_UNKNOWN_RELOCATION_TYPE: return UString("Unknown relocation type");
|
||||
//case U_GENERIC_CALL_NOT_SUPPORTED: return UString("Generic call not supported");
|
||||
//case U_VOLUME_BASE_NOT_FOUND: return UString("Volume base address not found");
|
||||
//case U_PEI_CORE_ENTRY_POINT_NOT_FOUND: return UString("PEI core entry point not found");
|
||||
case U_COMPLEX_BLOCK_MAP: return UString("Block map structure too complex for correct analysis");
|
||||
case U_DIR_ALREADY_EXIST: return UString("Directory already exists");
|
||||
case U_DIR_CREATE: return UString("Directory can't be created");
|
||||
case U_DIR_CHANGE: return UString("Change directory failed");
|
||||
//case U_UNKNOWN_PATCH_TYPE: return UString("Unknown patch type");
|
||||
//case U_PATCH_OFFSET_OUT_OF_BOUNDS: return UString("Patch offset out of bounds");
|
||||
//case U_INVALID_SYMBOL: return UString("Invalid symbol");
|
||||
//case U_NOTHING_TO_PATCH: return UString("Nothing to patch");
|
||||
case U_DEPEX_PARSE_FAILED: return UString("Dependency expression parsing failed");
|
||||
case U_TRUNCATED_IMAGE: return UString("Image is truncated");
|
||||
case U_INVALID_CAPSULE: return UString("Invalid capsule");
|
||||
case U_STORES_NOT_FOUND: return UString("Stores not found");
|
||||
case U_INVALID_STORE_SIZE: return UString("Invalid store size");
|
||||
default: return usprintf("Unknown error %02lX", errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,163 +218,163 @@ USTATUS decompress(const UByteArray & compressedData, const UINT8 compressionTyp
|
||||
|
||||
switch (compressionType)
|
||||
{
|
||||
case EFI_NOT_COMPRESSED: {
|
||||
decompressedData = compressedData;
|
||||
algorithm = COMPRESSION_ALGORITHM_NONE;
|
||||
return U_SUCCESS;
|
||||
case EFI_NOT_COMPRESSED: {
|
||||
decompressedData = compressedData;
|
||||
algorithm = COMPRESSION_ALGORITHM_NONE;
|
||||
return U_SUCCESS;
|
||||
}
|
||||
case EFI_STANDARD_COMPRESSION: {
|
||||
// Set default algorithm to unknown
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
case EFI_STANDARD_COMPRESSION: {
|
||||
// Set default algorithm to unknown
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
|
||||
// Get buffer sizes
|
||||
data = (UINT8*)compressedData.data();
|
||||
dataSize = (UINT32)compressedData.size();
|
||||
// Get buffer sizes
|
||||
data = (UINT8*)compressedData.data();
|
||||
dataSize = (UINT32)compressedData.size();
|
||||
|
||||
// Check header to be valid
|
||||
header = (const EFI_TIANO_HEADER*)data;
|
||||
if (header->CompSize + sizeof(EFI_TIANO_HEADER) != dataSize)
|
||||
return U_STANDARD_DECOMPRESSION_FAILED;
|
||||
// Check header to be valid
|
||||
header = (const EFI_TIANO_HEADER*)data;
|
||||
if (header->CompSize + sizeof(EFI_TIANO_HEADER) != dataSize)
|
||||
return U_STANDARD_DECOMPRESSION_FAILED;
|
||||
|
||||
// Get info function is the same for both algorithms
|
||||
if (U_SUCCESS != EfiTianoGetInfo(data, dataSize, &decompressedSize, &scratchSize))
|
||||
return U_STANDARD_DECOMPRESSION_FAILED;
|
||||
// Get info function is the same for both algorithms
|
||||
if (U_SUCCESS != EfiTianoGetInfo(data, dataSize, &decompressedSize, &scratchSize))
|
||||
return U_STANDARD_DECOMPRESSION_FAILED;
|
||||
|
||||
// Allocate memory
|
||||
decompressed = (UINT8*)malloc(decompressedSize);
|
||||
efiDecompressed = (UINT8*)malloc(decompressedSize);
|
||||
scratch = (UINT8*)malloc(scratchSize);
|
||||
if (!decompressed || !efiDecompressed || !scratch) {
|
||||
free(decompressed);
|
||||
free(efiDecompressed);
|
||||
free(scratch);
|
||||
return U_STANDARD_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
// Decompress section data using both algorithms
|
||||
USTATUS result = U_SUCCESS;
|
||||
// Try Tiano
|
||||
USTATUS TianoResult = TianoDecompress(data, dataSize, decompressed, decompressedSize, scratch, scratchSize);
|
||||
// Try EFI 1.1
|
||||
USTATUS EfiResult = EfiDecompress(data, dataSize, efiDecompressed, decompressedSize, scratch, scratchSize);
|
||||
|
||||
if (decompressedSize > INT32_MAX) {
|
||||
result = U_STANDARD_DECOMPRESSION_FAILED;
|
||||
}
|
||||
else if (EfiResult == U_SUCCESS && TianoResult == U_SUCCESS) { // Both decompressions are OK
|
||||
algorithm = COMPRESSION_ALGORITHM_UNDECIDED;
|
||||
decompressedData = UByteArray((const char*)decompressed, (int)decompressedSize);
|
||||
efiDecompressedData = UByteArray((const char*)efiDecompressed, (int)decompressedSize);
|
||||
}
|
||||
else if (TianoResult == U_SUCCESS) { // Only Tiano is OK
|
||||
algorithm = COMPRESSION_ALGORITHM_TIANO;
|
||||
decompressedData = UByteArray((const char*)decompressed, (int)decompressedSize);
|
||||
}
|
||||
else if (EfiResult == U_SUCCESS) { // Only EFI 1.1 is OK
|
||||
algorithm = COMPRESSION_ALGORITHM_EFI11;
|
||||
decompressedData = UByteArray((const char*)efiDecompressed, (int)decompressedSize);
|
||||
}
|
||||
else { // Both decompressions failed
|
||||
result = U_STANDARD_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
// Allocate memory
|
||||
decompressed = (UINT8*)malloc(decompressedSize);
|
||||
efiDecompressed = (UINT8*)malloc(decompressedSize);
|
||||
scratch = (UINT8*)malloc(scratchSize);
|
||||
if (!decompressed || !efiDecompressed || !scratch) {
|
||||
free(decompressed);
|
||||
free(efiDecompressed);
|
||||
free(scratch);
|
||||
return U_STANDARD_DECOMPRESSION_FAILED;
|
||||
return result;
|
||||
}
|
||||
case EFI_CUSTOMIZED_COMPRESSION: {
|
||||
// Set default algorithm to unknown
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
|
||||
// Decompress section data using both algorithms
|
||||
USTATUS result = U_SUCCESS;
|
||||
// Try Tiano
|
||||
USTATUS TianoResult = TianoDecompress(data, dataSize, decompressed, decompressedSize, scratch, scratchSize);
|
||||
// Try EFI 1.1
|
||||
USTATUS EfiResult = EfiDecompress(data, dataSize, efiDecompressed, decompressedSize, scratch, scratchSize);
|
||||
// Get buffer sizes
|
||||
data = (const UINT8*)compressedData.constData();
|
||||
dataSize = (UINT32)compressedData.size();
|
||||
|
||||
if (decompressedSize > INT32_MAX) {
|
||||
result = U_STANDARD_DECOMPRESSION_FAILED;
|
||||
}
|
||||
else if (EfiResult == U_SUCCESS && TianoResult == U_SUCCESS) { // Both decompressions are OK
|
||||
algorithm = COMPRESSION_ALGORITHM_UNDECIDED;
|
||||
// Get info as normal LZMA section
|
||||
if (U_SUCCESS != LzmaGetInfo(data, dataSize, &decompressedSize)) {
|
||||
// Get info as Intel legacy LZMA section
|
||||
data += sizeof(UINT32);
|
||||
if (U_SUCCESS != LzmaGetInfo(data, dataSize, &decompressedSize)) {
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
else {
|
||||
algorithm = COMPRESSION_ALGORITHM_LZMA_INTEL_LEGACY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
algorithm = COMPRESSION_ALGORITHM_LZMA;
|
||||
}
|
||||
|
||||
// Allocate memory
|
||||
decompressed = (UINT8*)malloc(decompressedSize);
|
||||
if (!decompressed) {
|
||||
return U_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Decompress section data
|
||||
if (U_SUCCESS != LzmaDecompress(data, dataSize, decompressed)) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
if (decompressedSize > INT32_MAX) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
dictionarySize = readUnaligned((UINT32*)(data + 1)); // LZMA dictionary size is stored in bytes 1-4 of LZMA properties header
|
||||
decompressedData = UByteArray((const char*)decompressed, (int)decompressedSize);
|
||||
efiDecompressedData = UByteArray((const char*)efiDecompressed, (int)decompressedSize);
|
||||
}
|
||||
else if (TianoResult == U_SUCCESS) { // Only Tiano is OK
|
||||
algorithm = COMPRESSION_ALGORITHM_TIANO;
|
||||
decompressedData = UByteArray((const char*)decompressed, (int)decompressedSize);
|
||||
}
|
||||
else if (EfiResult == U_SUCCESS) { // Only EFI 1.1 is OK
|
||||
algorithm = COMPRESSION_ALGORITHM_EFI11;
|
||||
decompressedData = UByteArray((const char*)efiDecompressed, (int)decompressedSize);
|
||||
}
|
||||
else { // Both decompressions failed
|
||||
result = U_STANDARD_DECOMPRESSION_FAILED;
|
||||
free(decompressed);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
case EFI_CUSTOMIZED_COMPRESSION_LZMAF86: {
|
||||
// Set default algorithm to unknown
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
|
||||
free(decompressed);
|
||||
free(efiDecompressed);
|
||||
free(scratch);
|
||||
return result;
|
||||
}
|
||||
case EFI_CUSTOMIZED_COMPRESSION: {
|
||||
// Set default algorithm to unknown
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
// Get buffer sizes
|
||||
data = (const UINT8*)compressedData.constData();
|
||||
dataSize = (UINT32)compressedData.size();
|
||||
|
||||
// Get buffer sizes
|
||||
data = (const UINT8*)compressedData.constData();
|
||||
dataSize = (UINT32)compressedData.size();
|
||||
|
||||
// Get info as normal LZMA section
|
||||
if (U_SUCCESS != LzmaGetInfo(data, dataSize, &decompressedSize)) {
|
||||
// Get info as Intel legacy LZMA section
|
||||
data += sizeof(UINT32);
|
||||
// Get info as normal LZMA section
|
||||
if (U_SUCCESS != LzmaGetInfo(data, dataSize, &decompressedSize)) {
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
else {
|
||||
algorithm = COMPRESSION_ALGORITHM_LZMA_INTEL_LEGACY;
|
||||
algorithm = COMPRESSION_ALGORITHM_LZMAF86;
|
||||
|
||||
// Allocate memory
|
||||
decompressed = (UINT8*)malloc(decompressedSize);
|
||||
if (!decompressed) {
|
||||
return U_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
algorithm = COMPRESSION_ALGORITHM_LZMA;
|
||||
}
|
||||
|
||||
// Allocate memory
|
||||
decompressed = (UINT8*)malloc(decompressedSize);
|
||||
if (!decompressed) {
|
||||
return U_OUT_OF_MEMORY;
|
||||
}
|
||||
// Decompress section data
|
||||
if (U_SUCCESS != LzmaDecompress(data, dataSize, decompressed)) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
// Decompress section data
|
||||
if (U_SUCCESS != LzmaDecompress(data, dataSize, decompressed)) {
|
||||
if (decompressedSize > INT32_MAX) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
// After LZMA decompression, the data need to be converted to the raw data.
|
||||
UINT32 state = 0;
|
||||
const UINT8 x86LookAhead = 4;
|
||||
if (decompressedSize != x86LookAhead + x86_Convert(decompressed, decompressedSize, 0, &state, 0)) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
dictionarySize = readUnaligned((UINT32*)(data + 1)); // LZMA dictionary size is stored in bytes 1-4 of LZMA properties header
|
||||
decompressedData = UByteArray((const char*)decompressed, (int)decompressedSize);
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
if (decompressedSize > INT32_MAX) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
dictionarySize = readUnaligned((UINT32*)(data + 1)); // LZMA dictionary size is stored in bytes 1-4 of LZMA properties header
|
||||
decompressedData = UByteArray((const char*)decompressed, (int)decompressedSize);
|
||||
free(decompressed);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
case EFI_CUSTOMIZED_COMPRESSION_LZMAF86: {
|
||||
// Set default algorithm to unknown
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
|
||||
// Get buffer sizes
|
||||
data = (const UINT8*)compressedData.constData();
|
||||
dataSize = (UINT32)compressedData.size();
|
||||
|
||||
// Get info as normal LZMA section
|
||||
if (U_SUCCESS != LzmaGetInfo(data, dataSize, &decompressedSize)) {
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
algorithm = COMPRESSION_ALGORITHM_LZMAF86;
|
||||
|
||||
// Allocate memory
|
||||
decompressed = (UINT8*)malloc(decompressedSize);
|
||||
if (!decompressed) {
|
||||
return U_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Decompress section data
|
||||
if (U_SUCCESS != LzmaDecompress(data, dataSize, decompressed)) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
if (decompressedSize > INT32_MAX) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
// After LZMA decompression, the data need to be converted to the raw data.
|
||||
UINT32 state = 0;
|
||||
const UINT8 x86LookAhead = 4;
|
||||
if (decompressedSize != x86LookAhead + x86_Convert(decompressed, decompressedSize, 0, &state, 0)) {
|
||||
free(decompressed);
|
||||
return U_CUSTOMIZED_DECOMPRESSION_FAILED;
|
||||
}
|
||||
|
||||
dictionarySize = readUnaligned((UINT32*)(data + 1)); // LZMA dictionary size is stored in bytes 1-4 of LZMA properties header
|
||||
decompressedData = UByteArray((const char*)decompressed, (int)decompressedSize);
|
||||
free(decompressed);
|
||||
return U_SUCCESS;
|
||||
}
|
||||
default: {
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
return U_UNKNOWN_COMPRESSION_TYPE;
|
||||
default: {
|
||||
algorithm = COMPRESSION_ALGORITHM_UNKNOWN;
|
||||
return U_UNKNOWN_COMPRESSION_TYPE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -462,7 +462,7 @@ static inline int char2hex(char c)
|
||||
}
|
||||
|
||||
INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSize,
|
||||
const UINT8 *data, UINTN dataSize, UINTN dataOff)
|
||||
const UINT8 *data, UINTN dataSize, UINTN dataOff)
|
||||
{
|
||||
if (patternSize == 0 || dataSize == 0 || dataOff >= dataSize || dataSize - dataOff < patternSize)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user