mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 09:28:22 +08:00
UEFIDump 0.1.1
- ported after engine refactoring, no new features
This commit is contained in:
parent
59a6f298ee
commit
5b43099d78
@ -27,7 +27,8 @@ SET(PROJECT_HEADERS
|
|||||||
../common/descriptor.h
|
../common/descriptor.h
|
||||||
../common/gbe.h
|
../common/gbe.h
|
||||||
../common/me.h
|
../common/me.h
|
||||||
../common/ffs.h
|
../common/ffs.h
|
||||||
|
../common/fit.h
|
||||||
../common/nvram.h
|
../common/nvram.h
|
||||||
../common/ffsparser.h
|
../common/ffsparser.h
|
||||||
../common/ffsreport.h
|
../common/ffsreport.h
|
||||||
|
@ -76,34 +76,18 @@ USTATUS UEFIDumper::dump(const UByteArray & buffer, const UString & inPath, cons
|
|||||||
std::cout << messages[i].first << std::endl;
|
std::cout << messages[i].first << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get last VTF
|
// Show FIT table
|
||||||
UModelIndex lastVtf = ffsParser.getLastVtf();
|
std::vector<std::vector<UString> > fitTable = ffsParser.getFitTable();
|
||||||
if (lastVtf.isValid()) {
|
if (fitTable.size()) {
|
||||||
// Create fitParser
|
std::cout << "-------------------------------------------------------------------" << std::endl;
|
||||||
FitParser fitParser(&model);
|
std::cout << " Address | Size | Ver | CS | Type " << std::endl;
|
||||||
// Find and parse FIT table
|
std::cout << "-------------------------------------------------------------------" << std::endl;
|
||||||
result = fitParser.parse(model.index(0, 0), lastVtf);
|
for (size_t i = 0; i < fitTable.size(); i++) {
|
||||||
if (U_SUCCESS == result) {
|
std::cout << (const char*)fitTable[i][0].toLocal8Bit() << " | "
|
||||||
// Show fitParser's messages
|
<< (const char*)fitTable[i][1].toLocal8Bit() << " | "
|
||||||
std::vector<std::pair<UString, UModelIndex> > fitMessages = fitParser.getMessages();
|
<< (const char*)fitTable[i][2].toLocal8Bit() << " | "
|
||||||
for (size_t i = 0; i < fitMessages.size(); i++) {
|
<< (const char*)fitTable[i][3].toLocal8Bit() << " | "
|
||||||
std::cout << (const char*)fitMessages[i].first.toLocal8Bit() << std::endl;
|
<< (const char*)fitTable[i][4].toLocal8Bit() << std::endl;
|
||||||
}
|
|
||||||
|
|
||||||
// Show FIT table
|
|
||||||
std::vector<std::vector<UString> > fitTable = fitParser.getFitTable();
|
|
||||||
if (fitTable.size()) {
|
|
||||||
std::cout << "-------------------------------------------------------------------" << std::endl;
|
|
||||||
std::cout << " Address | Size | Ver | Type | CS " << std::endl;
|
|
||||||
std::cout << "-------------------------------------------------------------------" << std::endl;
|
|
||||||
for (size_t i = 0; i < fitTable.size(); i++) {
|
|
||||||
std::cout << (const char*)fitTable[i][0].toLocal8Bit() << " | "
|
|
||||||
<< (const char*)fitTable[i][1].toLocal8Bit() << " | "
|
|
||||||
<< (const char*)fitTable[i][2].toLocal8Bit() << " | "
|
|
||||||
<< (const char*)fitTable[i][3].toLocal8Bit() << " | "
|
|
||||||
<< (const char*)fitTable[i][4].toLocal8Bit() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,13 +19,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include "../common/treemodel.h"
|
#include "../common/treemodel.h"
|
||||||
#include "../common/ffsparser.h"
|
#include "../common/ffsparser.h"
|
||||||
#include "../common/ffsreport.h"
|
#include "../common/ffsreport.h"
|
||||||
#include "../common/fitparser.h"
|
|
||||||
|
|
||||||
|
|
||||||
class UEFIDumper
|
class UEFIDumper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit UEFIDumper() : model(), ffsParser(&model), ffsReport(&model), fitParser(&model), currentBuffer(), initialized(false), dumped(false) {}
|
explicit UEFIDumper() : model(), ffsParser(&model), ffsReport(&model), currentBuffer(), initialized(false), dumped(false) {}
|
||||||
~UEFIDumper() {}
|
~UEFIDumper() {}
|
||||||
|
|
||||||
USTATUS dump(const UByteArray & buffer, const UString & path, const UString & guid = UString());
|
USTATUS dump(const UByteArray & buffer, const UString & path, const UString & guid = UString());
|
||||||
@ -36,7 +34,6 @@ private:
|
|||||||
TreeModel model;
|
TreeModel model;
|
||||||
FfsParser ffsParser;
|
FfsParser ffsParser;
|
||||||
FfsReport ffsReport;
|
FfsReport ffsReport;
|
||||||
FitParser fitParser;
|
|
||||||
|
|
||||||
UByteArray currentBuffer;
|
UByteArray currentBuffer;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
@ -17,12 +17,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc > 32) {
|
|
||||||
std::cout << "Too many arguments" << std::endl;
|
if (argc > 1) {
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc > 1) {
|
|
||||||
std::ifstream inputFile;
|
std::ifstream inputFile;
|
||||||
inputFile.open(argv[1], std::ios::in | std::ios::binary);
|
inputFile.open(argv[1], std::ios::in | std::ios::binary);
|
||||||
std::vector<char> buffer(std::istreambuf_iterator<char>(inputFile),
|
std::vector<char> buffer(std::istreambuf_iterator<char>(inputFile),
|
||||||
@ -32,11 +28,8 @@ int main(int argc, char *argv[])
|
|||||||
UEFIDumper uefidumper;
|
UEFIDumper uefidumper;
|
||||||
return (uefidumper.dump(buffer, UString(argv[1])) != U_SUCCESS);
|
return (uefidumper.dump(buffer, UString(argv[1])) != U_SUCCESS);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
std::cout << "UEFIDump 0.1.0" << std::endl << std::endl
|
|
||||||
<< "Usage: UEFIDump imagefile" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
std::cout << "UEFIDump 0.1.1" << std::endl << std::endl
|
||||||
|
<< "Usage: UEFIDump imagefile" << std::endl;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user