diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 0000000..4baa858
--- /dev/null
+++ b/.appveyor.yml
@@ -0,0 +1,28 @@
+image: Visual Studio 2015
+
+environment:
+ matrix:
+ - MSYS2_ARCH: i686
+ MSYSTEM: MINGW32
+
+clone_depth: 10
+
+build_script:
+ - cd %APPVEYOR_BUILD_FOLDER%
+ - set PATH=C:\msys64\mingw32\bin;C:\msys64\usr\bin;%PATH%
+ - bash ./unixbuild.sh
+
+deploy:
+ provider: GitHub
+ force_update: true
+ auth_token:
+ secure: zSJnpSnrKY1NO5RPVBaD/uq7UPyc+GW7ecjPFqEMsLjtnd6H+iNfROdoeuxJgt5T
+ artifact: Binaries
+ on:
+ appveyor_repo_tag: true
+
+artifacts:
+ - path: dist\**\*.zip
+ name: Binaries
+
+
diff --git a/.gitignore b/.gitignore
index 1a4afc2..9eb95c6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -231,3 +231,10 @@ pip-log.txt
#############
*.o
Makefile
+
+UEFITool/uefitool_plugin_import.cpp
+UEFITool.app/
+.qmake.stash
+CMakeCache.txt
+CMakeFiles
+cmake_install.cmake
diff --git a/.travis.yml b/.travis.yml
index aadc7d2..91f88f1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,28 +1,52 @@
language: cpp
-compiler: gcc
-sudo: require
-dist: trusty
+matrix:
+ include:
+ - os: osx
+ osx_image: xcode9.2
-before_install:
- - sudo add-apt-repository ppa:beineri/opt-qt58-trusty -y
- - sudo apt-get update -qq
-
-install:
- - sudo apt-get -y install qt58base
- - source /opt/qt58/bin/qt58-env.sh
+ compiler: clang
-script:
- - cd UEFITool
- - qmake PREFIX=/usr
- - make -j4
- - mkdir -p appdir/usr/bin ; mkdir -p appdir/usr/share/{applications,icons} ; cd appdir
- - cp ../UEFITool usr/bin/uefitool
- - cp ../uefitool.desktop .
- - cp ../icons/uefitool_256x256.png uefitool.png
- - cd ..
- - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/3/linuxdeployqt-3-x86_64.AppImage"
- - chmod a+x linuxdeployqt*.AppImage
- - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
- - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -bundle-non-qt-libs
- - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -appimage
- - curl --upload-file ./UEFITool-*.AppImage https://transfer.sh/UEFITool-git.$(git rev-parse --short HEAD)-x86_64.AppImage
+ script:
+ - ./unixbuild.sh
+
+ deploy:
+ provider: releases
+ skip_cleanup: true
+ file: "dist/*.zip"
+ file_glob: true
+ api_key:
+ secure: "WjYd93lVLKHULBpUXS/WtGrkdXyAwxHOUnLJotyDmQipAQP5Ox7Kj12JwkSJGEmVOEdcbIQJyi0QxPjn1UYbYsAt6Op8zrjnYLS4G4fMdBtcxprWzid85uTW7oAAIFs7ygMVhpzxRKpu70yNb683vbThqNmaOu6RyG9aJOLtPAg="
+ on:
+ tags: true
+
+ - os: linux
+ dist: trusty
+ compiler: clang
+
+ before_install:
+ - sudo apt-get update -qq
+ - sudo apt-get install -qq qt5-default qt5-qmake qtbase5-dev-tools cmake
+
+ script:
+ - ./unixbuild.sh
+
+ - os: linux
+ dist: trusty
+ compiler: gcc
+
+ before_install:
+ - sudo apt-get update -qq
+ - sudo apt-get install -qq qt5-default qt5-qmake qtbase5-dev-tools cmake
+
+ script:
+ - ./unixbuild.sh
+
+ deploy:
+ provider: releases
+ skip_cleanup: true
+ file: "dist/*.zip"
+ file_glob: true
+ api_key:
+ secure: "WjYd93lVLKHULBpUXS/WtGrkdXyAwxHOUnLJotyDmQipAQP5Ox7Kj12JwkSJGEmVOEdcbIQJyi0QxPjn1UYbYsAt6Op8zrjnYLS4G4fMdBtcxprWzid85uTW7oAAIFs7ygMVhpzxRKpu70yNb683vbThqNmaOu6RyG9aJOLtPAg="
+ on:
+ tags: true
diff --git a/UEFIDump/uefidump_main.cpp b/UEFIDump/uefidump_main.cpp
index b280a3d..57558ad 100644
--- a/UEFIDump/uefidump_main.cpp
+++ b/UEFIDump/uefidump_main.cpp
@@ -1,6 +1,6 @@
/* uefidump_main.cpp
-Copyright (c) 2017, LongSoft. All rights reserved.
+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
@@ -29,7 +29,7 @@ int main(int argc, char *argv[])
return (uefidumper.dump(buffer, UString(argv[1])) != U_SUCCESS);
}
- std::cout << "UEFIDump 0.1.6" << std::endl << std::endl
+ std::cout << "UEFIDump 0.1.9" << std::endl << std::endl
<< "Usage: UEFIDump imagefile" << std::endl;
return 0;
}
diff --git a/UEFIExtract/uefiextract.pro b/UEFIExtract/uefiextract.pro
index d2411e9..8ecc101 100644
--- a/UEFIExtract/uefiextract.pro
+++ b/UEFIExtract/uefiextract.pro
@@ -25,7 +25,7 @@ SOURCES += \
../common/LZMA/LzmaDecompress.c \
../common/LZMA/SDK/C/LzmaDec.c \
../common/Tiano/EfiTianoDecompress.c \
- ../common/ustring.cpp
+ ../common/ustring.cpp \
../common/sha256.c
HEADERS += \
diff --git a/UEFIExtract/uefiextract_main.cpp b/UEFIExtract/uefiextract_main.cpp
index d8a9cb5..b9aa980 100644
--- a/UEFIExtract/uefiextract_main.cpp
+++ b/UEFIExtract/uefiextract_main.cpp
@@ -1,5 +1,5 @@
/* uefiextract_main.cpp
-Copyright (c) 2017, LongSoft. All rights reserved.
+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
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
}
}
// If parameters are different, show version and usage information
- std::cout << "UEFIExtract 0.13.5" << std::endl << std::endl
+ std::cout << "UEFIExtract 0.13.8" << std::endl << std::endl
<< "Usage: UEFIExtract imagefile - generate report and dump only leaf tree items into .dump folder." << std::endl
<< " UEFIExtract imagefile all - generate report and dump all tree items." << std::endl
<< " UEFIExtract imagefile dump - only generate dump, no report needed." << std::endl
@@ -129,4 +129,4 @@ int main(int argc, char *argv[])
<< " UEFIExtract imagefile GUID_1 GUID_2 ... GUID_31 - dump only FFS file(s) with specific GUID(s), without report." << std::endl
<< "Return value is a bit mask where 0 at position N means that file with GUID_N was found and unpacked, 1 otherwise." << std::endl;
return 1;
-}
\ No newline at end of file
+}
diff --git a/UEFIFind/uefifind_main.cpp b/UEFIFind/uefifind_main.cpp
index 09c64ec..834fa82 100644
--- a/UEFIFind/uefifind_main.cpp
+++ b/UEFIFind/uefifind_main.cpp
@@ -1,6 +1,6 @@
/* uefifind_main.cpp
-Copyright (c) 2017, LongSoft. All rights reserved.
+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
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
return U_SUCCESS;
}
else {
- std::cout << "UEFIFind 0.10.10" << std::endl << std::endl <<
+ std::cout << "UEFIFind 0.10.13" << std::endl << std::endl <<
"Usage: UEFIFind {header | body | all} {list | count} pattern imagefile" << std::endl <<
" or UEFIFind file patternsfile imagefile" << std::endl;
return U_INVALID_PARAMETER;
diff --git a/UEFITool/hexviewdialog.cpp b/UEFITool/hexviewdialog.cpp
index e1d217f..11e6ed1 100644
--- a/UEFITool/hexviewdialog.cpp
+++ b/UEFITool/hexviewdialog.cpp
@@ -47,8 +47,8 @@ void HexViewDialog::setItem(const UModelIndex & index, bool bodyOnly)
setWindowTitle(UString("Hex view: ") + (itemText.isEmpty() ? itemName : itemName + " | " + itemText));
// Set hex data
- QByteArray data;
- if (bodyOnly) data = model->body(index);
- else data = model->header(index) + model->body(index) + model->tail(index);
- hexView->setData(data);
+ QByteArray hexdata;
+ if (bodyOnly) hexdata = model->body(index);
+ else hexdata = model->header(index) + model->body(index) + model->tail(index);
+ hexView->setData(hexdata);
}
\ No newline at end of file
diff --git a/UEFITool/qhexedit2/qhexedit.cpp b/UEFITool/qhexedit2/qhexedit.cpp
index 25e3151..6ecfc8b 100644
--- a/UEFITool/qhexedit2/qhexedit.cpp
+++ b/UEFITool/qhexedit2/qhexedit.cpp
@@ -165,7 +165,7 @@ void QHexEdit::setCursorPosition(qint64 position)
// 3. Calc new position of cursor
_bPosCurrent = position / 2;
- _pxCursorY = ((position / 2 - _bPosFirst) / _bytesPerLine + 1) * _pxCharHeight;
+ _pxCursorY = (int)((position / 2 - _bPosFirst) / _bytesPerLine + 1) * _pxCharHeight;
int x = (position % (2 * _bytesPerLine));
if (_editAreaIsAscii)
{
@@ -341,7 +341,7 @@ void QHexEdit::insert(qint64 pos, const QByteArray &ba)
void QHexEdit::replace(qint64 pos, qint64 len, const QByteArray &ba)
{
- _undoStack->overwrite(pos, len, ba);
+ _undoStack->overwrite(pos, (int)len, ba);
refresh();
}
diff --git a/UEFITool/uefitool.cpp b/UEFITool/uefitool.cpp
index 95bd58a..77abdd6 100644
--- a/UEFITool/uefitool.cpp
+++ b/UEFITool/uefitool.cpp
@@ -17,7 +17,7 @@
UEFITool::UEFITool(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::UEFITool),
-version(tr("NE alpha 45"))
+version(tr("NE alpha 50"))
{
clipboard = QApplication::clipboard();
@@ -32,6 +32,7 @@ version(tr("NE alpha 45"))
ffsFinder = NULL;
ffsOps = NULL;
ffsBuilder = NULL;
+ ffsReport = NULL;
// Connect signals to slots
connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile()));
@@ -60,35 +61,21 @@ version(tr("NE alpha 45"))
connect(ui->actionGoToOffset, SIGNAL(triggered()), this, SLOT(goToOffset()));
connect(ui->actionGoToAddress, SIGNAL(triggered()), this, SLOT(goToAddress()));
connect(ui->actionLoadGuidDatabase, SIGNAL(triggered()), this, SLOT(loadGuidDatabase()));
+ connect(ui->actionUnloadGuidDatabase, SIGNAL(triggered()), this, SLOT(unloadGuidDatabase()));
+ connect(ui->actionLoadDefaultGuidDatabase, SIGNAL(triggered()), this, SLOT(loadDefaultGuidDatabase()));
+ connect(ui->actionGenerateReport, SIGNAL(triggered()), this, SLOT(generateReport()));
connect(ui->actionToggleBootGuardMarking, SIGNAL(toggled(bool)), this, SLOT(toggleBootGuardMarking(bool)));
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(writeSettings()));
// Enable Drag-and-Drop actions
setAcceptDrops(true);
+ // Disable Builder tab, doesn't work right now
+ ui->messagesTabWidget->setTabEnabled(4, false);
+
// Set current directory
currentDir = ".";
- // Set monospace font for some controls
- QFont font("Courier New", 10);
-#if defined Q_OS_OSX
- font = QFont("Menlo", 10);
-#elif defined Q_OS_WIN
- font = QFont("Consolas", 9);
-#endif
- ui->infoEdit->setFont(font);
- ui->parserMessagesListWidget->setFont(font);
- ui->finderMessagesListWidget->setFont(font);
- ui->builderMessagesListWidget->setFont(font);
- ui->fitTableWidget->setFont(font);
- ui->bootGuardEdit->setFont(font);
- ui->structureTreeView->setFont(font);
- searchDialog->ui->guidEdit->setFont(font);
- searchDialog->ui->hexEdit->setFont(font);
- hexViewDialog->setFont(font);
- goToOffsetDialog->ui->hexSpinBox->setFont(font);
- goToAddressDialog->ui->hexSpinBox->setFont(font);
-
// Load built-in GUID database
initGuidDatabase(":/guids.csv");
@@ -105,6 +92,7 @@ UEFITool::~UEFITool()
delete ffsOps;
delete ffsFinder;
delete ffsParser;
+ delete ffsReport;
delete model;
delete hexViewDialog;
delete searchDialog;
@@ -171,8 +159,9 @@ void UEFITool::init()
void UEFITool::populateUi(const QItemSelection &selected)
{
- if (selected.isEmpty())
+ if (selected.isEmpty()) {
return;
+ }
populateUi(selected.indexes().at(0));
}
@@ -180,8 +169,9 @@ void UEFITool::populateUi(const QItemSelection &selected)
void UEFITool::populateUi(const QModelIndex ¤t)
{
// Check sanity
- if (!current.isValid())
+ if (!current.isValid()) {
return;
+ }
UINT8 type = model->type(current);
UINT8 subtype = model->subtype(current);
@@ -364,7 +354,7 @@ void UEFITool::goToAddress()
return;
UINT32 address = (UINT32)goToAddressDialog->ui->hexSpinBox->value();
- QModelIndex index = model->findByOffset(address - ffsParser->getAddressDiff());
+ QModelIndex index = model->findByOffset(address - (UINT32)ffsParser->getAddressDiff());
if (index.isValid()) {
ui->structureTreeView->scrollTo(index, QAbstractItemView::PositionAtCenter);
ui->structureTreeView->selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear);
@@ -384,8 +374,8 @@ void UEFITool::goToData()
if (model->hasEmptyParsingData(index))
continue;
- UByteArray data = model->parsingData(index);
- const NVAR_ENTRY_PARSING_DATA* pdata = (const NVAR_ENTRY_PARSING_DATA*)data.constData();
+ UByteArray rdata = model->parsingData(index);
+ const NVAR_ENTRY_PARSING_DATA* pdata = (const NVAR_ENTRY_PARSING_DATA*)rdata.constData();
UINT32 lastVariableFlag = pdata->emptyByte ? 0xFFFFFF : 0;
UINT32 offset = model->offset(index);
if (pdata->next == lastVariableFlag) {
@@ -622,75 +612,75 @@ 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", "Capsule files (*.cap *.bin);;All files (*)"); break;
- case Types::Image: path = QFileDialog::getSaveFileName(this, tr("Save image to file"), name + ".rom", "Image files (*.rom *.bin);;All files (*)"); break;
- case Types::Region: path = QFileDialog::getSaveFileName(this, tr("Save region to file"), name + ".rgn", "Region files (*.rgn *.bin);;All files (*)"); break;
- case Types::Padding: path = QFileDialog::getSaveFileName(this, tr("Save padding to file"), name + ".pad", "Padding files (*.pad *.bin);;All files (*)"); break;
- case Types::Volume: path = QFileDialog::getSaveFileName(this, tr("Save volume to file"), name + ".vol", "Volume files (*.vol *.bin);;All files (*)"); break;
- case Types::File: path = QFileDialog::getSaveFileName(this, tr("Save FFS file to file"), name + ".ffs", "FFS files (*.ffs *.bin);;All files (*)"); break;
- case Types::Section: path = QFileDialog::getSaveFileName(this, tr("Save section to file"), name + ".sct", "Section files (*.sct *.bin);;All files (*)"); break;
- case Types::NvarEntry: path = QFileDialog::getSaveFileName(this, tr("Save NVAR entry to file"), name + ".nvar", "NVAR entry files (*.nvar *.bin);;All files (*)"); break;
- case Types::VssEntry: path = QFileDialog::getSaveFileName(this, tr("Save VSS entry to file"), name + ".vss", "VSS entry files (*.vss *.bin);;All files (*)"); break;
- case Types::FsysEntry: path = QFileDialog::getSaveFileName(this, tr("Save Fsys entry to file"), name + ".fse", "Fsys entry files (*.fse *.bin);;All files (*)"); break;
- case Types::EvsaEntry: path = QFileDialog::getSaveFileName(this, tr("Save EVSA entry to file"), name + ".evse", "EVSA entry files (*.evse *.bin);;All files (*)"); break;
- case Types::FlashMapEntry: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap entry to file"), name + ".fme", "FlashMap entry files (*.fme *.bin);;All files (*)"); break;
- case Types::VssStore: path = QFileDialog::getSaveFileName(this, tr("Save VSS store to file"), name + ".vss", "VSS store files (*.vss *.bin);;All files (*)"); break;
- case Types::Vss2Store: path = QFileDialog::getSaveFileName(this, tr("Save VSS2 store to file"), name + ".vss2", "VSS2 store files (*.vss2 *.bin);;All files (*)"); break;
- case Types::FdcStore: path = QFileDialog::getSaveFileName(this, tr("Save FDC store to file"), name + ".fdc", "FDC store files (*.fdc *.bin);;All files (*)"); break;
- case Types::FsysStore: path = QFileDialog::getSaveFileName(this, tr("Save Fsys store to file"), name + ".fsys", "Fsys store files (*.fsys *.bin);;All files (*)"); break;
- case Types::EvsaStore: path = QFileDialog::getSaveFileName(this, tr("Save EVSA store to file"), name + ".evsa", "EVSA store files (*.evsa *.bin);;All files (*)"); break;
- case Types::FtwStore: path = QFileDialog::getSaveFileName(this, tr("Save FTW store to file"), name + ".ftw", "FTW store files (*.ftw *.bin);;All files (*)"); break;
- case Types::FlashMapStore: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap store to file"), name + ".fmap", "FlashMap store files (*.fmap *.bin);;All files (*)"); break;
- case Types::CmdbStore: path = QFileDialog::getSaveFileName(this, tr("Save CMDB store to file"), name + ".cmdb", "CMDB store files (*.cmdb *.bin);;All files (*)"); break;
- case Types::Microcode: path = QFileDialog::getSaveFileName(this, tr("Save microcode binary to file"), name + ".ucd", "Microcode binary files (*.ucd *.bin);;All files (*)"); break;
+ 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", "SLIC pubkey files (*.spk *.bin);;All files (*)");
- else path = QFileDialog::getSaveFileName(this, tr("Save SLIC marker to file"), name + ".smk", "SLIC marker files (*.smk *.bin);;All files (*)");
+ 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", "Binary files (*.bin);;All files (*)");
+ 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", "Image files (*.rom *.bin);;All files (*)"); break;
- case Types::Volume: path = QFileDialog::getSaveFileName(this, tr("Save volume body to file"), name + ".vbd", "Volume body files (*.vbd *.bin);;All files (*)"); break;
+ 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", "Raw files (*.raw *.bin);;All files (*)");
- else path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to file"), name + ".fbd", "FFS file body files (*.fbd *.bin);;All files (*)");
+ || 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", "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", "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", "Raw files (*.raw *.bin);;All files (*)");
+ || 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", "EFI executable files (*.efi *.bin);;All files (*)");
- else path = QFileDialog::getSaveFileName(this, tr("Save section body to file"), name + ".bin", "Binary files (*.bin);;All files (*)");
+ || 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", "Binary files (*.bin);;All files (*)"); break;
+ 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", "Binary files (*.bin);;All files (*)"); break;
- case Types::Microcode: path = QFileDialog::getSaveFileName(this, tr("Save microcode body to file"), name + ".ucb", "Microcode body files (*.ucb *.bin);;All files (*)"); break;
+ 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", "SLIC pubkey body files (*.spb *.bin);;All files (*)");
- else path = QFileDialog::getSaveFileName(this, tr("Save SLIC marker body to file"), name + ".smb", "SLIC marker body files (*.smb *.bin);;All files (*)");
+ 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", "Binary files (*.bin);;All files (*)");
+ 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", "Binary files (*.bin);;All files (*)");
+ else path = QFileDialog::getSaveFileName(this, tr("Save object to file"), name + ".bin", tr("Binary files (*.bin);;All files (*)"));
if (path.trimmed().isEmpty())
return;
@@ -733,7 +723,7 @@ void UEFITool::remove()
void UEFITool::about()
{
QMessageBox::about(this, tr("About UEFITool"), tr(
- "Copyright (c) 2016, Nikolaj Schlej aka CodeRush.
"
+ "Copyright (c) 2018, LongSoft"
"Program icon made by Alexander Zhidkov.
"
"The program uses QHexEdit2 library made by Simsys.
"
"Qt-less engine is using Bstrlib made by Paul Hsieh.
"
@@ -757,7 +747,7 @@ void UEFITool::exit()
void UEFITool::saveImageFile()
{
- /*QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.scap *.bio *.fd *.wph *.dec);;All files (*)");
+ /*QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, tr("BIOS image files (*.rom *.bin *.cap *.scap *.bio *.fd *.wph *.dec);;All files (*)"));
if (path.isEmpty())
return;
@@ -790,13 +780,13 @@ void UEFITool::saveImageFile()
void UEFITool::openImageFile()
{
- QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *scap *.bio *.fd *.wph *.dec);;All files (*)");
+ QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"), currentDir, tr("BIOS image files (*.rom *.bin *.cap *scap *.bio *.fd *.wph *.dec);;All files (*)"));
openImageFile(path);
}
void UEFITool::openImageFileInNewWindow()
{
- QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file in new window"), currentDir, "BIOS image files (*.rom *.bin *.cap *scap *.bio *.fd *.wph *.dec);;All files (*)");
+ QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file in new window"), currentDir, tr("BIOS image files (*.rom *.bin *.cap *scap *.bio *.fd *.wph *.dec);;All files (*)"));
if (path.trimmed().isEmpty())
return;
QProcess::startDetached(currentProgramPath, QStringList(path));
@@ -848,12 +838,18 @@ void UEFITool::openImageFile(QString path)
// ... and other operations
delete ffsOps;
ffsOps = new FfsOperations(model);
+ // ... and reports
+ delete ffsReport;
+ ffsReport = new FfsReport(model);
// Enable goToOffset and goToAddress
ui->actionGoToOffset->setEnabled(true);
if (ffsParser->getAddressDiff() < 0xFFFFFFFFUL)
ui->actionGoToAddress->setEnabled(true);
+ // Enable generateReport
+ ui->actionGenerateReport->setEnabled(true);
+
// Set current directory
currentDir = fileInfo.absolutePath();
@@ -1023,13 +1019,15 @@ void UEFITool::contextMenuEvent(QContextMenuEvent* event)
return;
}
- if (!ui->structureTreeView->underMouse())
+ if (!ui->structureTreeView->underMouse()) {
return;
+ }
QPoint pt = event->pos();
QModelIndex index = ui->structureTreeView->indexAt(ui->structureTreeView->viewport()->mapFrom(this, pt));
- if (!index.isValid())
+ if (!index.isValid()) {
return;
+ }
switch (model->type(index))
{
@@ -1075,6 +1073,34 @@ void UEFITool::readSettings()
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->bootGuardEdit->setFont(currentFont);
+ ui->structureTreeView->setFont(currentFont);
+ searchDialog->ui->guidEdit->setFont(currentFont);
+ searchDialog->ui->hexEdit->setFont(currentFont);
+ hexViewDialog->setFont(currentFont);
+ goToOffsetDialog->ui->hexSpinBox->setFont(currentFont);
+ goToAddressDialog->ui->hexSpinBox->setFont(currentFont);
}
void UEFITool::writeSettings()
@@ -1091,6 +1117,8 @@ void UEFITool::writeSettings()
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()
@@ -1155,10 +1183,44 @@ void UEFITool::currentTabChanged(int index)
void UEFITool::loadGuidDatabase()
{
- QString path = QFileDialog::getOpenFileName(this, tr("Select GUID database file to load"), currentDir, "GUID database files (*.gdb);;All files (*)");
+ 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::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 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();
+ }
+ }
+ }
+}
diff --git a/UEFITool/uefitool.h b/UEFITool/uefitool.h
index dbc243e..ced3065 100644
--- a/UEFITool/uefitool.h
+++ b/UEFITool/uefitool.h
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -41,6 +42,7 @@
#include "../common/ffsparser.h"
#include "../common/ffsops.h"
#include "../common/ffsbuilder.h"
+#include "../common/ffsreport.h"
#include "../common/guiddatabase.h"
#include "searchdialog.h"
@@ -115,6 +117,9 @@ private slots:
void writeSettings();
void loadGuidDatabase();
+ void unloadGuidDatabase();
+ void loadDefaultGuidDatabase();
+ void generateReport();
void currentTabChanged(int index);
@@ -123,6 +128,7 @@ private:
TreeModel* model;
FfsParser* ffsParser;
FfsFinder* ffsFinder;
+ FfsReport* ffsReport;
FfsOperations* ffsOps;
FfsBuilder* ffsBuilder;
SearchDialog* searchDialog;
@@ -133,6 +139,7 @@ private:
QString currentDir;
QString currentPath;
QString currentProgramPath;
+ QFont currentFont;
const QString version;
bool markingEnabled;
diff --git a/UEFITool/uefitool.pro b/UEFITool/uefitool.pro
index 2acb10a..468aefa 100644
--- a/UEFITool/uefitool.pro
+++ b/UEFITool/uefitool.pro
@@ -32,6 +32,7 @@ HEADERS += uefitool.h \
../common/parsingdata.h \
../common/ffsbuilder.h \
../common/ffsparser.h \
+ ../common/ffsreport.h \
../common/treeitem.h \
../common/treemodel.h \
../common/LZMA/LzmaCompress.h \
@@ -64,6 +65,7 @@ SOURCES += uefitool_main.cpp \
../common/utility.cpp \
../common/ffsbuilder.cpp \
../common/ffsparser.cpp \
+ ../common/ffsreport.cpp \
../common/treeitem.cpp \
../common/treemodel.cpp \
../common/LZMA/LzmaCompress.c \
diff --git a/UEFITool/uefitool.ui b/UEFITool/uefitool.ui
index 98142e5..6950a81 100644
--- a/UEFITool/uefitool.ui
+++ b/UEFITool/uefitool.ui
@@ -322,7 +322,11 @@
+
+
+
+
@@ -473,7 +477,7 @@
false
- Entry
+ &Entry
@@ -532,7 +536,7 @@
-
@@ -718,7 +722,7 @@
false
- Sear&ch...
+ Searc&h...
Ctrl+F
@@ -867,12 +871,42 @@
true
- &BootGuard marking
+ BootGuard &markings
Ctrl+Shift+B
+
+
+ false
+
+
+ Generate &report...
+
+
+ Generate report
+
+
+ Ctrl+Alt+R
+
+
+
+
+ &Unload GUID database
+
+
+ Ctrl+Alt+U
+
+
+
+
+ Load &default GUID database
+
+
+ Ctrl+Alt+D
+
+
diff --git a/UEFITool/uefitool_main.cpp b/UEFITool/uefitool_main.cpp
index ca81d24..1b2df2a 100644
--- a/UEFITool/uefitool_main.cpp
+++ b/UEFITool/uefitool_main.cpp
@@ -1,6 +1,6 @@
/* uefitool_main.cpp
- Copyright (c) 2014, Nikolaj Schlej. All rights reserved.
+ 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
diff --git a/common/LZMA/LzmaCompress.c b/common/LZMA/LzmaCompress.c
index f796cfd..25ca4e3 100644
--- a/common/LZMA/LzmaCompress.c
+++ b/common/LZMA/LzmaCompress.c
@@ -25,7 +25,7 @@ static ISzAlloc SzAllocForLzma = { &AllocForLzma, &FreeForLzma };
SRes OnProgress(void *p, UInt64 inSize, UInt64 outSize)
{
- (void)p; (void) inSize; (void) outSize;
+ (void)p; (void)inSize; (void)outSize;
return SZ_OK;
}
@@ -34,9 +34,9 @@ static ICompressProgress g_ProgressCallback = { &OnProgress };
STATIC
UINT64
EFIAPI
-RShiftU64(
-UINT64 Operand,
-UINT32 Count
+RShiftU64 (
+ UINT64 Operand,
+ UINT32 Count
)
{
return Operand >> Count;
@@ -44,8 +44,8 @@ UINT32 Count
VOID
SetEncodedSizeOfBuf(
-UINT64 EncodedSize,
-UINT8 *EncodedData
+ UINT64 EncodedSize,
+ UINT8* EncodedData
)
{
INT32 Index;
@@ -58,13 +58,13 @@ UINT8 *EncodedData
}
}
-INT32
+USTATUS
EFIAPI
-LzmaCompress(
-CONST UINT8 *Source,
-UINT32 SourceSize,
-UINT8 *Destination,
-UINT32 *DestinationSize
+LzmaCompress (
+ CONST UINT8 *Source,
+ UINT32 SourceSize,
+ UINT8 *Destination,
+ UINT32 *DestinationSize
)
{
SRes LzmaResult;
@@ -72,13 +72,14 @@ UINT32 *DestinationSize
SizeT propsSize = LZMA_PROPS_SIZE;
SizeT destLen = SourceSize + SourceSize / 3 + 128;
- if (*DestinationSize < destLen)
+ if (*DestinationSize < (UINT32)destLen)
{
*DestinationSize = (UINT32)destLen;
return EFI_BUFFER_TOO_SMALL;
}
LzmaEncProps_Init(&props);
+ // TODO: need to detect this instead of hardcoding
props.dictSize = LZMA_DICTIONARY_SIZE;
props.level = 9;
props.fb = 273;
@@ -87,7 +88,7 @@ UINT32 *DestinationSize
(Byte*)((UINT8*)Destination + LZMA_HEADER_SIZE),
&destLen,
Source,
- SourceSize,
+ (SizeT)SourceSize,
&props,
(UINT8*)Destination,
&propsSize,
@@ -98,7 +99,7 @@ UINT32 *DestinationSize
*DestinationSize = (UINT32)(destLen + LZMA_HEADER_SIZE);
- SetEncodedSizeOfBuf((UINT64)SourceSize, Destination);
+ SetEncodedSizeOfBuf(SourceSize, Destination);
if (LzmaResult == SZ_OK) {
return EFI_SUCCESS;
diff --git a/common/LZMA/LzmaCompress.h b/common/LZMA/LzmaCompress.h
index eeadb5c..94ec9ed 100644
--- a/common/LZMA/LzmaCompress.h
+++ b/common/LZMA/LzmaCompress.h
@@ -24,13 +24,13 @@ extern "C" {
#define LZMA_DICTIONARY_SIZE 0x800000
#define _LZMA_SIZE_OPT
- INT32
+ USTATUS
EFIAPI
- LzmaCompress(
- const UINT8 *Source,
- UINT32 SourceSize,
- UINT8 *Destination,
- UINT32 *DestinationSize
+ LzmaCompress (
+ const UINT8 *Source,
+ UINT32 SourceSize,
+ UINT8 *Destination,
+ UINT32 *DestinationSize
);
#ifdef __cplusplus
diff --git a/common/LZMA/LzmaDecompress.c b/common/LZMA/LzmaDecompress.c
index 1bac9d7..8ff8283 100644
--- a/common/LZMA/LzmaDecompress.c
+++ b/common/LZMA/LzmaDecompress.c
@@ -19,10 +19,10 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
UINT64
EFIAPI
-LShiftU64(
-UINT64 Operand,
-UINT32 Count
-)
+LShiftU64 (
+ UINT64 Operand,
+ UINT32 Count
+ )
{
return Operand << Count;
}
@@ -39,12 +39,12 @@ Get the size of the uncompressed buffer by parsing EncodeData header.
@return The size of the uncompressed buffer.
*/
UINT64
-GetDecodedSizeOfBuf(
-UINT8 *EncodedData
-)
+GetDecodedSizeOfBuf (
+ UINT8 *EncodedData
+ )
{
UINT64 DecodedSize;
- INT32 Index;
+ INT32 Index;
// Parse header
DecodedSize = 0;
@@ -85,22 +85,27 @@ DestinationSize and the size of the scratch
buffer was returned ScratchSize.
*/
-INT32
+USTATUS
EFIAPI
-LzmaGetInfo(
-CONST VOID *Source,
-UINT32 SourceSize,
-UINT32 *DestinationSize
-)
+LzmaGetInfo (
+ CONST VOID *Source,
+ UINT32 SourceSize,
+ UINT32 *DestinationSize
+ )
{
- UInt64 DecodedSize;
+ UINT64 DecodedSize;
+ ASSERT(SourceSize >= LZMA_HEADER_SIZE);
+ (void)SourceSize;
- ASSERT(SourceSize >= LZMA_HEADER_SIZE); (void)SourceSize;
-
DecodedSize = GetDecodedSizeOfBuf((UINT8*)Source);
- *DestinationSize = (UINT32)DecodedSize;
- return U_SUCCESS;
+ if (DecodedSize <= UINT32_MAX) {
+ *DestinationSize = (UINT32)DecodedSize;
+ return U_SUCCESS;
+ }
+ else {
+ return U_INVALID_PARAMETER;
+ }
}
/*
@@ -122,13 +127,13 @@ the uncompressed buffer is returned Destination.
The source buffer specified by Source is corrupted
(not a valid compressed format).
*/
-INT32
+USTATUS
EFIAPI
-LzmaDecompress(
-CONST VOID *Source,
-UINT32 SourceSize,
-VOID *Destination
-)
+LzmaDecompress (
+ CONST VOID *Source,
+ UINT32 SourceSize,
+ VOID *Destination
+ )
{
SRes LzmaResult;
ELzmaStatus Status;
diff --git a/common/LZMA/LzmaDecompress.h b/common/LZMA/LzmaDecompress.h
index fe89b86..82a162c 100644
--- a/common/LZMA/LzmaDecompress.h
+++ b/common/LZMA/LzmaDecompress.h
@@ -23,13 +23,6 @@ extern "C" {
#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
- UINT64
- EFIAPI
- LShiftU64(
- UINT64 Operand,
- UINT32 Count
- );
-
/*
Given a Lzma compressed source buffer, this function retrieves the size of
the uncompressed buffer and the size of the scratch buffer required
@@ -57,12 +50,12 @@ extern "C" {
buffer was returned ScratchSize.
*/
- INT32
+ USTATUS
EFIAPI
- LzmaGetInfo(
- const VOID *Source,
- UINT32 SourceSize,
- UINT32 *DestinationSize
+ LzmaGetInfo (
+ CONST VOID *Source,
+ UINT32 SourceSize,
+ UINT32 *DestinationSize
);
/*
@@ -84,12 +77,12 @@ extern "C" {
The source buffer specified by Source is corrupted
(not a valid compressed format).
*/
- INT32
+ USTATUS
EFIAPI
- LzmaDecompress(
- const VOID *Source,
- UINT32 SourceSize,
- VOID *Destination
+ LzmaDecompress (
+ CONST VOID *Source,
+ UINT32 SourceSize,
+ VOID *Destination
);
#ifdef __cplusplus
diff --git a/common/Tiano/EfiTianoCompress.c b/common/Tiano/EfiTianoCompress.c
index a2fe4bf..afd2ec2 100644
--- a/common/Tiano/EfiTianoCompress.c
+++ b/common/Tiano/EfiTianoCompress.c
@@ -69,18 +69,15 @@ PutDword(
STATIC
EFI_STATUS
-AllocateMemory (
- );
+AllocateMemory (VOID);
STATIC
VOID
-FreeMemory (
- );
+FreeMemory (VOID);
STATIC
VOID
-InitSlide (
- );
+InitSlide (VOID);
STATIC
NODE
@@ -105,28 +102,23 @@ Split (
STATIC
VOID
-InsertNode (
- );
+InsertNode (VOID);
STATIC
VOID
-DeleteNode (
- );
+DeleteNode (VOID);
STATIC
VOID
-GetNextMatch (
- );
+GetNextMatch (VOID);
STATIC
EFI_STATUS
-Encode (
- );
+Encode (VOID);
STATIC
VOID
-CountTFreq (
- );
+CountTFreq (VOID);
STATIC
VOID
@@ -138,8 +130,7 @@ WritePTLen (
STATIC
VOID
-WriteCLen (
- );
+WriteCLen (VOID);
STATIC
VOID
@@ -155,8 +146,7 @@ EncodeP (
STATIC
VOID
-SendBlock (
- );
+SendBlock (VOID);
STATIC
VOID
@@ -167,18 +157,15 @@ Output (
STATIC
VOID
-HufEncodeStart (
- );
+HufEncodeStart (VOID);
STATIC
VOID
-HufEncodeEnd (
- );
+HufEncodeEnd (VOID);
STATIC
VOID
-MakeCrcTable (
- );
+MakeCrcTable (VOID);
STATIC
VOID
@@ -196,8 +183,7 @@ FreadCrc (
STATIC
VOID
-InitPutBits (
- );
+InitPutBits (VOID);
STATIC
VOID
diff --git a/common/Tiano/EfiTianoCompress.h b/common/Tiano/EfiTianoCompress.h
index 9dc042e..512c39b 100644
--- a/common/Tiano/EfiTianoCompress.h
+++ b/common/Tiano/EfiTianoCompress.h
@@ -56,22 +56,20 @@ extern "C" {
--*/
EFI_STATUS
- TianoCompress(
- CONST VOID *SrcBuffer,
- UINT32 SrcSize,
- VOID *DstBuffer,
- UINT32 *DstSize
- )
- ;
+ TianoCompress (
+ IN CONST VOID *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN VOID *DstBuffer,
+ IN OUT UINT32 *DstSize
+ );
EFI_STATUS
TianoCompressLegacy(
- CONST VOID *SrcBuffer,
- UINT32 SrcSize,
- VOID *DstBuffer,
- UINT32 *DstSize
- )
- ;
+ CONST VOID *SrcBuffer,
+ UINT32 SrcSize,
+ VOID *DstBuffer,
+ UINT32 *DstSize
+ );
/*++
Routine Description:
@@ -96,21 +94,20 @@ extern "C" {
--*/
EFI_STATUS
- EfiCompress(
- CONST VOID *SrcBuffer,
- UINT32 SrcSize,
- VOID *DstBuffer,
- UINT32 *DstSize
- )
- ;
+ EfiCompress (
+ IN CONST VOID *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN VOID *DstBuffer,
+ IN OUT UINT32 *DstSize
+ );
+
EFI_STATUS
EfiCompressLegacy(
- CONST VOID *SrcBuffer,
- UINT32 SrcSize,
- VOID *DstBuffer,
- UINT32 *DstSize
- )
- ;
+ CONST VOID *SrcBuffer,
+ UINT32 SrcSize,
+ VOID *DstBuffer,
+ UINT32 *DstSize
+ );
#ifdef __cplusplus
}
diff --git a/common/Tiano/EfiTianoDecompress.c b/common/Tiano/EfiTianoDecompress.c
index 156392c..2e58f64 100644
--- a/common/Tiano/EfiTianoDecompress.c
+++ b/common/Tiano/EfiTianoDecompress.c
@@ -79,12 +79,6 @@ typedef struct {
UINT8 mPBit;
} SCRATCH_DATA;
-STATIC
-VOID
-FillBuf(
-IN SCRATCH_DATA *Sd,
-IN UINT16 NumOfBits
-)
/*++
Routine Description:
@@ -99,11 +93,17 @@ NumOfBits - The number of bits to shift and read.
Returns: (VOID)
--*/
+STATIC
+VOID
+FillBuf (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ )
{
- Sd->mBitBuf = (UINT32)(Sd->mBitBuf << NumOfBits);
+ Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
while (NumOfBits > Sd->mBitCount) {
- Sd->mBitBuf |= (UINT32)(Sd->mSubBitBuf << (NumOfBits = (UINT16)(NumOfBits - Sd->mBitCount)));
+ Sd->mBitBuf |= (UINT32) (((UINT64)Sd->mSubBitBuf) << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
if (Sd->mCompSize > 0) {
//
@@ -127,12 +127,6 @@ Returns: (VOID)
Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
}
-STATIC
-UINT32
-GetBits(
-IN SCRATCH_DATA *Sd,
-IN UINT16 NumOfBits
-)
/*++
Routine Description:
@@ -151,6 +145,12 @@ Returns:
The bits that are popped out.
--*/
+STATIC
+UINT32
+GetBits (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ )
{
UINT32 OutBits;
@@ -161,15 +161,6 @@ The bits that are popped out.
return OutBits;
}
-STATIC
-UINT16
-MakeTable(
-IN SCRATCH_DATA *Sd,
-IN UINT16 NumOfChar,
-IN UINT8 *BitLen,
-IN UINT16 TableBits,
-OUT UINT16 *Table
-)
/*++
Routine Description:
@@ -190,6 +181,15 @@ Returns:
BAD_TABLE - The table is corrupted.
--*/
+STATIC
+UINT16
+MakeTable (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfChar,
+ IN UINT8 *BitLen,
+ IN UINT16 TableBits,
+ OUT UINT16 *Table
+)
{
UINT16 Count[17];
UINT16 Weight[17];
@@ -321,11 +321,6 @@ BAD_TABLE - The table is corrupted.
return 0;
}
-STATIC
-UINT32
-DecodeP(
-IN SCRATCH_DATA *Sd
-)
/*++
Routine Description:
@@ -341,6 +336,11 @@ Returns:
The position value decoded.
--*/
+STATIC
+UINT32
+DecodeP (
+ IN SCRATCH_DATA *Sd
+ )
{
UINT16 Val;
UINT32 Mask;
@@ -375,14 +375,6 @@ The position value decoded.
return Pos;
}
-STATIC
-UINT16
-ReadPTLen(
-IN SCRATCH_DATA *Sd,
-IN UINT16 nn,
-IN UINT16 nbit,
-IN UINT16 Special
-)
/*++
Routine Description:
@@ -402,6 +394,14 @@ Returns:
BAD_TABLE - Table is corrupted.
--*/
+STATIC
+UINT16
+ReadPTLen (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 nn,
+ IN UINT16 nbit,
+ IN UINT16 Special
+)
{
UINT16 Number;
UINT16 CharC;
@@ -469,11 +469,6 @@ BAD_TABLE - Table is corrupted.
return MakeTable(Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
}
-STATIC
-VOID
-ReadCLen(
-SCRATCH_DATA *Sd
-)
/*++
Routine Description:
@@ -487,6 +482,11 @@ Sd - the global scratch data
Returns: (VOID)
--*/
+STATIC
+VOID
+ReadCLen (
+ SCRATCH_DATA *Sd
+ )
{
UINT16 Number;
UINT16 CharC;
@@ -560,11 +560,6 @@ Returns: (VOID)
return;
}
-STATIC
-UINT16
-DecodeC(
-SCRATCH_DATA *Sd
-)
/*++
Routine Description:
@@ -580,6 +575,11 @@ Returns:
The value decoded.
--*/
+STATIC
+UINT16
+DecodeC (
+ SCRATCH_DATA *Sd
+ )
{
UINT16 Index2;
UINT32 Mask;
@@ -627,11 +627,6 @@ The value decoded.
return Index2;
}
-STATIC
-VOID
-Decode(
-SCRATCH_DATA *Sd
-)
/*++
Routine Description:
@@ -645,6 +640,11 @@ Sd - The global scratch data
Returns: (VOID)
--*/
+STATIC
+VOID
+Decode (
+ SCRATCH_DATA *Sd
+)
{
UINT16 BytesRemain;
UINT32 DataIdx;
@@ -700,13 +700,6 @@ Returns: (VOID)
}
}
-EFI_STATUS
-GetInfo(
-IN const VOID *Source,
-IN UINT32 SrcSize,
-OUT UINT32 *DstSize,
-OUT UINT32 *ScratchSize
-)
/*++
Routine Description:
@@ -726,6 +719,13 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
+EFI_STATUS
+GetInfo(
+ IN const VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+)
{
const UINT8 *Src;
@@ -740,16 +740,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
return EFI_SUCCESS;
}
-EFI_STATUS
-Decompress(
-IN const VOID *Source,
-IN UINT32 SrcSize,
-IN OUT VOID *Destination,
-IN UINT32 DstSize,
-IN OUT VOID *Scratch,
-IN UINT32 ScratchSize,
-IN UINT8 Version
-)
/*++
Routine Description:
@@ -774,6 +764,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
+EFI_STATUS
+Decompress (
+ IN CONST VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize,
+ IN UINT8 Version
+)
{
UINT32 Index;
UINT32 CompSize;
@@ -866,14 +866,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
return Status;
}
-EFI_STATUS
-EFIAPI
-EfiTianoGetInfo(
-IN const VOID *Source,
-IN UINT32 SrcSize,
-OUT UINT32 *DstSize,
-OUT UINT32 *ScratchSize
-)
/*++
Routine Description:
@@ -894,25 +886,18 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
-{
- return GetInfo(
- Source,
- SrcSize,
- DstSize,
- ScratchSize
- );
-}
-
EFI_STATUS
EFIAPI
-EfiDecompress(
-IN const VOID *Source,
-IN UINT32 SrcSize,
-IN OUT VOID *Destination,
-IN UINT32 DstSize,
-IN OUT VOID *Scratch,
-IN UINT32 ScratchSize
-)
+EfiTianoGetInfo(
+ IN CONST VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ )
+{
+ return GetInfo (Source, SrcSize, DstSize, ScratchSize);
+}
+
/*++
Routine Description:
@@ -935,11 +920,21 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
+EFI_STATUS
+EFIAPI
+EfiDecompress (
+ IN CONST VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ )
{
//
// For EFI 1.1 de/compression algorithm, the version is 1.
//
- return Decompress(
+ return Decompress (
Source,
SrcSize,
Destination,
@@ -950,16 +945,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
);
}
-EFI_STATUS
-EFIAPI
-TianoDecompress(
-IN const VOID *Source,
-IN UINT32 SrcSize,
-IN OUT VOID *Destination,
-IN UINT32 DstSize,
-IN OUT VOID *Scratch,
-IN UINT32 ScratchSize
-)
/*++
Routine Description:
@@ -982,11 +967,21 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
+EFI_STATUS
+EFIAPI
+TianoDecompress (
+ IN CONST VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+)
{
//
// For Tiano de/compression algorithm, the version is 2.
//
- return Decompress(
+ return Decompress (
Source,
SrcSize,
Destination,
diff --git a/common/Tiano/EfiTianoDecompress.h b/common/Tiano/EfiTianoDecompress.h
index f6efd6e..d2f747e 100644
--- a/common/Tiano/EfiTianoDecompress.h
+++ b/common/Tiano/EfiTianoDecompress.h
@@ -37,14 +37,6 @@ typedef struct EFI_TIANO_HEADER_ {
UINT32 OrigSize;
} EFI_TIANO_HEADER;
-EFI_STATUS
-EFIAPI
-EfiTianoGetInfo(
- const VOID *Source,
- UINT32 SrcSize,
- UINT32 *DstSize,
- UINT32 *ScratchSize
- )
/*++
Routine Description:
@@ -64,18 +56,16 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
-;
-
EFI_STATUS
EFIAPI
-EfiDecompress(
- const VOID *Source,
- UINT32 SrcSize,
- VOID *Destination,
- UINT32 DstSize,
- VOID *Scratch,
- UINT32 ScratchSize
- );
+EfiTianoGetInfo (
+ IN CONST VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ );
+
+
/*++
Routine Description:
@@ -97,18 +87,17 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
-;
-
EFI_STATUS
EFIAPI
-TianoDecompress(
- const VOID *Source,
- UINT32 SrcSize,
- VOID *Destination,
- UINT32 DstSize,
- VOID *Scratch,
- UINT32 ScratchSize
- )
+EfiDecompress(
+ IN CONST VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+);
+
/*++
Routine Description:
@@ -130,7 +119,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
-;
+EFI_STATUS
+EFIAPI
+TianoDecompress(
+ IN CONST VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ );
#ifdef __cplusplus
}
diff --git a/common/basetypes.h b/common/basetypes.h
index 51d4ee4..6afc5f8 100644
--- a/common/basetypes.h
+++ b/common/basetypes.h
@@ -16,8 +16,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include
#include
+#include
-typedef uint8_t USTATUS;
+typedef size_t USTATUS;
#define U_SUCCESS 0
#define U_INVALID_PARAMETER 1
#define U_BUFFER_TOO_SMALL 2
@@ -79,7 +80,7 @@ typedef int64_t INT64;
typedef uint64_t UINT64;
typedef char CHAR8;
typedef uint16_t CHAR16;
-typedef unsigned int UINTN;
+typedef size_t UINTN;
#define CONST const
#define VOID void
@@ -161,11 +162,11 @@ typedef struct EFI_TIME_ {
UINT8 Hour; // Hour: 0 - 23
UINT8 Minute; // Minute: 0 - 59
UINT8 Second; // Second: 0 - 59
- UINT8 : 8;
+ UINT8 Reserved0;
UINT32 Nanosecond; // Nanosecond: 0 - 999,999,999
INT16 TimeZone; // TimeZone: -1440 to 1440 or UNSPECIFIED (0x07FF)
UINT8 Daylight; // Daylight: ADJUST_DAYLIGHT (1) or IN_DAYLIGHT (2)
- UINT8 : 8;
+ UINT8 Reserved1;
} EFI_TIME;
// Align to 4 or 8 bytes
diff --git a/common/descriptor.cpp b/common/descriptor.cpp
index 578bd82..7f072b7 100644
--- a/common/descriptor.cpp
+++ b/common/descriptor.cpp
@@ -25,13 +25,13 @@ const UINT8* calculateAddress16(const UINT8* baseAddress, const UINT16 baseOrLim
return baseAddress + baseOrLimit * 0x1000;
}
-// Calculate offset of region using it's base
+// Calculate offset of region using its base
UINT32 calculateRegionOffset(const UINT16 base)
{
return base * 0x1000;
}
-//Calculate size of region using it's base and limit
+//Calculate size of region using its base and limit
UINT32 calculateRegionSize(const UINT16 base, const UINT16 limit)
{
if (limit)
@@ -114,6 +114,14 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1)
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");
+
// Atmel
case 0x1F4500: return UString("Atmel AT26DF081");
case 0x1F4501: return UString("Atmel AT26DF081A");
@@ -177,11 +185,15 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1)
case 0x374016: return UString("Amic A25L032A");
// PMC
- case 0x7F9D13: return UString("PMC Pm25LV080B");
- case 0x7F9D14: return UString("PMC Pm25LV016B");
- case 0x7F9D44: return UString("PMC Pm25LQ080C");
- case 0x7F9D45: return UString("PMC Pm25LQ016C");
- case 0x7F9D46: return UString("PMC Pm25LQ032C");
+ 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 0x9D6017: return UString("ISSI Ix25LP064");
diff --git a/common/descriptor.h b/common/descriptor.h
index edd324f..dfca7fc 100644
--- a/common/descriptor.h
+++ b/common/descriptor.h
@@ -34,6 +34,19 @@ typedef struct FLASH_DESCRIPTOR_HEADER_ {
// Maximum base value in descriptor map
#define FLASH_DESCRIPTOR_MAX_BASE 0xE0
+// Descriptor version was reserved in older firmware
+#define FLASH_DESCRIPTOR_VERSION_INVALID 0xFFFFFFFF
+// The only known version found in Coffee Lake
+#define FLASH_DESCRIPTOR_VERSION_MAJOR 1
+#define FLASH_DESCRIPTOR_VERSION_MINOR 0
+
+// Descriptor version present in Coffee Lake and newer
+typedef struct _FLASH_DESCRIPTOR_VERSION {
+ UINT32 Reserved : 14;
+ UINT32 Minor : 7;
+ UINT32 Major : 11;
+} FLASH_DESCRIPTOR_VERSION;
+
// Descriptor map
// Base fields are storing bits [11:4] of actual base addresses, all other bits are 0
typedef struct FLASH_DESCRIPTOR_MAP_ {
@@ -54,6 +67,8 @@ typedef struct FLASH_DESCRIPTOR_MAP_ {
UINT32 ProcStrapsBase : 8;
UINT32 NumberOfProcStraps : 8; // One-based number of UINT32s to read as processor straps, min=0, max=255 (1 Kb)
UINT32 : 16;
+ // FLMAP 3
+ UINT32 DescriptorVersion; // Reserved prior to Coffee Lake
} FLASH_DESCRIPTOR_MAP;
// Component section
diff --git a/common/ffsops.cpp b/common/ffsops.cpp
index 6f94039..4ef2b8b 100644
--- a/common/ffsops.cpp
+++ b/common/ffsops.cpp
@@ -21,10 +21,6 @@ USTATUS FfsOperations::extract(const UModelIndex & index, UString & name, UByteA
if (!index.isValid())
return U_INVALID_PARAMETER;
- // Construct a name for extracted data
- UString itemName = model->name(index);
- UString itemText = model->text(index);
-
// Default name
name = uniqueItemName(index);
@@ -77,10 +73,8 @@ USTATUS FfsOperations::replace(const UModelIndex & index, const UString & data,
else if (mode == REPLACE_MODE_BODY) {
return U_NOT_IMPLEMENTED;
}
- else
- return U_UNKNOWN_REPLACE_MODE;
- return U_NOT_IMPLEMENTED;
+ return U_UNKNOWN_REPLACE_MODE;
}
USTATUS FfsOperations::remove(const UModelIndex & index)
diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp
index 7b27b91..3170579 100644
--- a/common/ffsparser.cpp
+++ b/common/ffsparser.cpp
@@ -1,6 +1,6 @@
/* ffsparser.cpp
-Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
+Copyright (c) 2018, 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
@@ -10,11 +10,14 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHWARRANTIES 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 "ffsparser.h"
#include