mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-20 10:15:21 -04:00
Remove Qt deps from UEFIFind and fix issues
This commit is contained in:
parent
7d16c1d48d
commit
4d50d581fa
21 changed files with 275 additions and 225 deletions
|
@ -1,3 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
PROJECT(UEFIExtract)
|
||||
|
||||
SET(PROJECT_SOURCES
|
||||
|
|
|
@ -53,11 +53,11 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||
if (!model->header(index).isEmpty() && (sectionType == IgnoreSectionType || model->subtype(index) == sectionType)) {
|
||||
UString filename;
|
||||
if (counterHeader == 0)
|
||||
filename = usprintf("%s/header.bin", (const char *)path.toLocal8Bit());
|
||||
filename = usprintf("%s/header.bin", path.toLocal8Bit());
|
||||
else
|
||||
filename = usprintf("%s/header_%d.bin", (const char *)path.toLocal8Bit(), counterHeader);
|
||||
filename = usprintf("%s/header_%d.bin", path.toLocal8Bit(), counterHeader);
|
||||
counterHeader++;
|
||||
file.open((const char *)filename.toLocal8Bit(), std::ofstream::binary);
|
||||
file.open(filename.toLocal8Bit(), std::ofstream::binary);
|
||||
const UByteArray &data = model->header(index);
|
||||
file.write(data.constData(), data.size());
|
||||
file.close();
|
||||
|
@ -68,11 +68,11 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||
if (!model->body(index).isEmpty() && (sectionType == IgnoreSectionType || model->subtype(index) == sectionType)) {
|
||||
UString filename;
|
||||
if (counterBody == 0)
|
||||
filename = usprintf("%s/body.bin", (const char *)path.toLocal8Bit());
|
||||
filename = usprintf("%s/body.bin", path.toLocal8Bit());
|
||||
else
|
||||
filename = usprintf("%s/body_%d.bin", (const char *)path.toLocal8Bit(), counterBody);
|
||||
filename = usprintf("%s/body_%d.bin", path.toLocal8Bit(), counterBody);
|
||||
counterBody++;
|
||||
file.open((const char *)filename.toLocal8Bit(), std::ofstream::binary);
|
||||
file.open(filename.toLocal8Bit(), std::ofstream::binary);
|
||||
const UByteArray &data = model->body(index);
|
||||
file.write(data.constData(), data.size());
|
||||
file.close();
|
||||
|
@ -85,11 +85,11 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||
fileIndex = index;
|
||||
UString filename;
|
||||
if (counterRaw == 0)
|
||||
filename = usprintf("%s/file.ffs", (const char *)path.toLocal8Bit());
|
||||
filename = usprintf("%s/file.ffs", path.toLocal8Bit());
|
||||
else
|
||||
filename = usprintf("%s/file_%d.bin", (const char *)path.toLocal8Bit(), counterRaw);
|
||||
filename = usprintf("%s/file_%d.bin", path.toLocal8Bit(), counterRaw);
|
||||
counterRaw++;
|
||||
file.open((const char *)filename.toLocal8Bit(), std::ofstream::binary);
|
||||
file.open(filename.toLocal8Bit(), std::ofstream::binary);
|
||||
const UByteArray &headerData = model->header(index);
|
||||
const UByteArray &bodyData = model->body(index);
|
||||
const UByteArray &tailData = model->tail(index);
|
||||
|
@ -104,19 +104,19 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||
if ((dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT || dumpMode == DUMP_INFO)
|
||||
&& (sectionType == IgnoreSectionType || model->subtype(index) == sectionType)) {
|
||||
UString info = usprintf("Type: %s\nSubtype: %s\n%s%s\n",
|
||||
(const char *)itemTypeToUString(model->type(index)).toLocal8Bit(),
|
||||
(const char *)itemSubtypeToUString(model->type(index), model->subtype(index)).toLocal8Bit(),
|
||||
(const char *)(model->text(index).isEmpty() ? UString("") :
|
||||
usprintf("Text: %s\n", (const char *)model->text(index).toLocal8Bit())).toLocal8Bit(),
|
||||
(const char *)model->info(index).toLocal8Bit());
|
||||
itemTypeToUString(model->type(index)).toLocal8Bit(),
|
||||
itemSubtypeToUString(model->type(index), model->subtype(index)).toLocal8Bit(),
|
||||
(model->text(index).isEmpty() ? UString("") :
|
||||
usprintf("Text: %s\n", model->text(index).toLocal8Bit())).toLocal8Bit(),
|
||||
model->info(index).toLocal8Bit());
|
||||
UString filename;
|
||||
if (counterInfo == 0)
|
||||
filename = usprintf("%s/info.txt", (const char *)path.toLocal8Bit());
|
||||
filename = usprintf("%s/info.txt", path.toLocal8Bit());
|
||||
else
|
||||
filename = usprintf("%s/info_%d.txt", (const char *)path.toLocal8Bit(), counterInfo);
|
||||
filename = usprintf("%s/info_%d.txt", path.toLocal8Bit(), counterInfo);
|
||||
counterInfo++;
|
||||
file.open((const char *)filename.toLocal8Bit());
|
||||
file << (const char *)info.toLocal8Bit();
|
||||
file.open(filename.toLocal8Bit());
|
||||
file << info.toLocal8Bit();
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
@ -132,8 +132,8 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
|||
|
||||
UString childPath = path;
|
||||
if (dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT)
|
||||
childPath = usprintf("%s/%d %s", (const char *)path.toLocal8Bit(), i,
|
||||
(const char *)(useText ? model->text(childIndex) : model->name(childIndex)).toLocal8Bit());
|
||||
childPath = usprintf("%s/%d %s", path.toLocal8Bit(), i,
|
||||
(useText ? model->text(childIndex) : model->name(childIndex)).toLocal8Bit());
|
||||
result = recursiveDump(childIndex, childPath, dumpMode, sectionType, guid);
|
||||
if (result)
|
||||
return result;
|
||||
|
|
|
@ -37,8 +37,9 @@ int main(int argc, char *argv[])
|
|||
return U_FILE_OPEN;
|
||||
|
||||
// Open the input file
|
||||
std::ifstream inputFile;
|
||||
inputFile.open(argv[1], std::ios::in | std::ios::binary);
|
||||
std::ifstream inputFile(argv[1], std::ios::in | std::ios::binary);
|
||||
if (!inputFile)
|
||||
return U_FILE_OPEN;
|
||||
std::vector<char> buffer(std::istreambuf_iterator<char>(inputFile),
|
||||
(std::istreambuf_iterator<char>()));
|
||||
inputFile.close();
|
||||
|
@ -54,7 +55,7 @@ int main(int argc, char *argv[])
|
|||
// Show ffsParser's messages
|
||||
std::vector<std::pair<UString, UModelIndex> > messages = ffsParser.getMessages();
|
||||
for (size_t i = 0; i < messages.size(); i++) {
|
||||
std::cout << (const char *)messages[i].first.toLocal8Bit() << std::endl;
|
||||
std::cout << messages[i].first.toLocal8Bit() << std::endl;
|
||||
}
|
||||
|
||||
// Get last VTF
|
||||
|
@ -64,12 +65,12 @@ int main(int argc, char *argv[])
|
|||
std::cout << " Address | Size | Ver | CS | Type / Info " << std::endl;
|
||||
std::cout << "---------------------------------------------------------------------------" << std::endl;
|
||||
for (size_t i = 0; i < fitTable.size(); i++) {
|
||||
std::cout << (const char *)fitTable[i].first[0].toLocal8Bit() << " | "
|
||||
<< (const char *)fitTable[i].first[1].toLocal8Bit() << " | "
|
||||
<< (const char *)fitTable[i].first[2].toLocal8Bit() << " | "
|
||||
<< (const char *)fitTable[i].first[3].toLocal8Bit() << " | "
|
||||
<< (const char *)fitTable[i].first[4].toLocal8Bit() << " | "
|
||||
<< (const char *)fitTable[i].first[5].toLocal8Bit() << std::endl;
|
||||
std::cout << fitTable[i].first[0].toLocal8Bit() << " | "
|
||||
<< fitTable[i].first[1].toLocal8Bit() << " | "
|
||||
<< fitTable[i].first[2].toLocal8Bit() << " | "
|
||||
<< fitTable[i].first[3].toLocal8Bit() << " | "
|
||||
<< fitTable[i].first[4].toLocal8Bit() << " | "
|
||||
<< fitTable[i].first[5].toLocal8Bit() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +141,7 @@ int main(int argc, char *argv[])
|
|||
UINT8 type = sectionTypes.empty() ? FfsDumper::IgnoreSectionType : sectionTypes[i];
|
||||
result = ffsDumper.dump(model.index(0, 0), outPath, mode, type, inputs[i]);
|
||||
if (result) {
|
||||
std::cout << "Guid " << (const char *)inputs[i].toLocal8Bit() << " failed with " << result << " code!" << std::endl;
|
||||
std::cout << "Guid " << inputs[i].toLocal8Bit() << " failed with " << result << " code!" << std::endl;
|
||||
lastError = result;
|
||||
}
|
||||
}
|
||||
|
@ -153,9 +154,9 @@ int main(int argc, char *argv[])
|
|||
std::vector<UString> report = ffsReport.generate();
|
||||
if (report.size()) {
|
||||
std::ofstream file;
|
||||
file.open((const char *)(path + UString(".report.txt")).toLocal8Bit());
|
||||
file.open((path + UString(".report.txt")).toLocal8Bit());
|
||||
for (size_t i = 0; i < report.size(); i++)
|
||||
file << (const char *)report[i].toLocal8Bit() << '\n';
|
||||
file << report[i].toLocal8Bit() << '\n';
|
||||
}
|
||||
|
||||
// Dump all non-leaf elements, with report, default
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue