From 6982aace9b81ea24155a12d30c2cb7600ff7ed1c Mon Sep 17 00:00:00 2001 From: vit9696 Date: Thu, 2 Aug 2018 04:10:39 +0300 Subject: [PATCH] Remove UEFIDump --- .gitignore | 1 - UEFIDump/CMakeLists.txt | 61 -------------------------- UEFIDump/uefidump_main.cpp | 37 ---------------- UEFIExtract/CMakeLists.txt | 2 + {UEFIDump => UEFIExtract}/uefidump.cpp | 0 {UEFIDump => UEFIExtract}/uefidump.h | 0 UEFIExtract/uefiextract_main.cpp | 8 ++++ UEFIFind/CMakeLists.txt | 60 +++++++++++++++++++++++++ unixbuild.sh | 1 - 9 files changed, 70 insertions(+), 100 deletions(-) delete mode 100644 UEFIDump/CMakeLists.txt delete mode 100644 UEFIDump/uefidump_main.cpp rename {UEFIDump => UEFIExtract}/uefidump.cpp (100%) rename {UEFIDump => UEFIExtract}/uefidump.h (100%) create mode 100644 UEFIFind/CMakeLists.txt diff --git a/.gitignore b/.gitignore index d197107..1f3266f 100644 --- a/.gitignore +++ b/.gitignore @@ -244,5 +244,4 @@ cmake_install.cmake DerivedData *.xcodeproj compile_commands.json -CMakeLists.txt CMakeScripts diff --git a/UEFIDump/CMakeLists.txt b/UEFIDump/CMakeLists.txt deleted file mode 100644 index cf8d1ce..0000000 --- a/UEFIDump/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -PROJECT(UEFIDump) - -SET(PROJECT_SOURCES - uefidump_main.cpp - uefidump.cpp - ../common/guiddatabase.cpp - ../common/types.cpp - ../common/descriptor.cpp - ../common/ffs.cpp - ../common/nvram.cpp - ../common/nvramparser.cpp - ../common/ffsparser.cpp - ../common/ffsreport.cpp - ../common/peimage.cpp - ../common/treeitem.cpp - ../common/treemodel.cpp - ../common/utility.cpp - ../common/LZMA/LzmaDecompress.c - ../common/LZMA/SDK/C/LzmaDec.c - ../common/Tiano/EfiTianoDecompress.c - ../common/ustring.cpp - ../common/sha256.c - ../common/bstrlib/bstrlib.c - ../common/bstrlib/bstrwrap.cpp -) - -SET(PROJECT_HEADERS - uefidump.h - ../common/guiddatabase.h - ../common/basetypes.h - ../common/descriptor.h - ../common/gbe.h - ../common/me.h - ../common/ffs.h - ../common/fit.h - ../common/nvram.h - ../common/nvramparser.h - ../common/ffsparser.h - ../common/ffsreport.h - ../common/peimage.h - ../common/types.h - ../common/treeitem.h - ../common/treemodel.h - ../common/utility.h - ../common/LZMA/LzmaDecompress.h - ../common/Tiano/EfiTianoDecompress.h - ../common/ubytearray.h - ../common/ustring.h - ../common/bootguard.h - ../common/sha256.h - ../common/bstrlib/bstrlib.h - ../common/bstrlib/bstrwrap.h - ../common/filesystem.h - ../version.h -) - -ADD_DEFINITIONS(-DU_ENABLE_NVRAM_PARSING_SUPPORT) - -ADD_EXECUTABLE(UEFIDump ${PROJECT_SOURCES} ${PROJECT_HEADERS}) \ No newline at end of file diff --git a/UEFIDump/uefidump_main.cpp b/UEFIDump/uefidump_main.cpp deleted file mode 100644 index 3a61505..0000000 --- a/UEFIDump/uefidump_main.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* uefidump_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 - -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 -#include - -#include "../version.h" -#include "uefidump.h" - -int main(int argc, char *argv[]) -{ - - if (argc > 1) { - std::ifstream inputFile(argv[1], std::ios::in | std::ios::binary); - if (!inputFile) - return U_FILE_OPEN; - std::vector buffer(std::istreambuf_iterator(inputFile), - (std::istreambuf_iterator())); - inputFile.close(); - - UEFIDumper uefidumper; - return (uefidumper.dump(buffer, UString(argv[1])) != U_SUCCESS); - } - - std::cout << "UEFIDump " PROGRAM_VERSION << std::endl << std::endl - << "Usage: UEFIDump imagefile" << std::endl; - return 0; -} diff --git a/UEFIExtract/CMakeLists.txt b/UEFIExtract/CMakeLists.txt index 29f23ba..ad90da8 100644 --- a/UEFIExtract/CMakeLists.txt +++ b/UEFIExtract/CMakeLists.txt @@ -5,6 +5,7 @@ PROJECT(UEFIExtract) SET(PROJECT_SOURCES uefiextract_main.cpp ffsdumper.cpp + uefidump.cpp ../common/guiddatabase.cpp ../common/types.cpp ../common/descriptor.cpp @@ -28,6 +29,7 @@ SET(PROJECT_SOURCES SET(PROJECT_HEADERS ffsdumper.h + uefidump.h ../common/guiddatabase.h ../common/basetypes.h ../common/descriptor.h diff --git a/UEFIDump/uefidump.cpp b/UEFIExtract/uefidump.cpp similarity index 100% rename from UEFIDump/uefidump.cpp rename to UEFIExtract/uefidump.cpp diff --git a/UEFIDump/uefidump.h b/UEFIExtract/uefidump.h similarity index 100% rename from UEFIDump/uefidump.h rename to UEFIExtract/uefidump.h diff --git a/UEFIExtract/uefiextract_main.cpp b/UEFIExtract/uefiextract_main.cpp index 928f2a0..3ca8928 100644 --- a/UEFIExtract/uefiextract_main.cpp +++ b/UEFIExtract/uefiextract_main.cpp @@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "../common/ffsparser.h" #include "../common/ffsreport.h" #include "ffsdumper.h" +#include "uefidump.h" enum ReadType { READ_INPUT, @@ -44,6 +45,12 @@ int main(int argc, char *argv[]) (std::istreambuf_iterator())); inputFile.close(); + // Hack to support legacy UEFIDump mode. + if (argc == 3 && !std::strcmp(argv[2], "unpack")) { + UEFIDumper uefidumper; + return (uefidumper.dump(buffer, UString(argv[1])) != U_SUCCESS); + } + // Create model and ffsParser TreeModel model; FfsParser ffsParser(&model); @@ -174,6 +181,7 @@ int main(int argc, char *argv[]) std::cout << "UEFIExtract " PROGRAM_VERSION << 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 unpack - generate report and dump all tree items in one dir." << std::endl << " UEFIExtract imagefile dump - only generate dump, no report needed." << std::endl << " UEFIExtract imagefile report - only generate report, no dump needed." << std::endl << " UEFIExtract imagefile GUID_1 ... [ -o FILE_1 ... ] [ -m MODE_1 ... ] [ -t TYPE_1 ... ] -" << std::endl diff --git a/UEFIFind/CMakeLists.txt b/UEFIFind/CMakeLists.txt new file mode 100644 index 0000000..3d91312 --- /dev/null +++ b/UEFIFind/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.0) + +PROJECT(UEFIFind) + +SET(PROJECT_SOURCES + uefifind_main.cpp + uefifind.cpp + ../common/guiddatabase.cpp + ../common/types.cpp + ../common/descriptor.cpp + ../common/ffs.cpp + ../common/nvram.cpp + ../common/nvramparser.cpp + ../common/ffsparser.cpp + ../common/ffsreport.cpp + ../common/peimage.cpp + ../common/treeitem.cpp + ../common/treemodel.cpp + ../common/utility.cpp + ../common/LZMA/LzmaDecompress.c + ../common/LZMA/SDK/C/LzmaDec.c + ../common/Tiano/EfiTianoDecompress.c + ../common/ustring.cpp + ../common/sha256.c + ../common/bstrlib/bstrlib.c + ../common/bstrlib/bstrwrap.cpp +) + +SET(PROJECT_HEADERS + uefifind.h + ../common/guiddatabase.h + ../common/basetypes.h + ../common/descriptor.h + ../common/gbe.h + ../common/me.h + ../common/ffs.h + ../common/nvram.h + ../common/nvramparser.h + ../common/ffsparser.h + ../common/ffsreport.h + ../common/peimage.h + ../common/types.h + ../common/treeitem.h + ../common/treemodel.h + ../common/utility.h + ../common/LZMA/LzmaDecompress.h + ../common/Tiano/EfiTianoDecompress.h + ../common/ubytearray.h + ../common/ustring.h + ../common/bootguard.h + ../common/sha256.h + ../common/filesystem.h + ../common/bstrlib/bstrlib.h + ../common/bstrlib/bstrwrap.h + ../version.h +) + +ADD_DEFINITIONS(-DU_ENABLE_NVRAM_PARSING_SUPPORT) + +ADD_EXECUTABLE(UEFIFind ${PROJECT_SOURCES} ${PROJECT_HEADERS}) \ No newline at end of file diff --git a/unixbuild.sh b/unixbuild.sh index 9743473..2594f7d 100755 --- a/unixbuild.sh +++ b/unixbuild.sh @@ -113,7 +113,6 @@ rm -rf dist mkdir -p dist || exit 1 build_tool UEFITool "$UEFITOOL_VER" uefitool.pro -build_tool UEFIDump "$UEFITOOL_VER" "" build_tool UEFIExtract "$UEFITOOL_VER" "" build_tool UEFIFind "$UEFITOOL_VER" ""