mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-01-22 12:49:03 +08:00
Add file extraction mode to UEFIExtract
This commit is contained in:
parent
d23c1a682a
commit
c70d448056
@ -76,6 +76,23 @@ USTATUS FfsDumper::recursiveDump(const QModelIndex & index, const QString & path
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (dumpMode == DUMP_FILE && (sectionType == IgnoreSectionType || model->subtype(index) == sectionType)) {
|
||||
UModelIndex fileIndex = model->findParentOfType(index, Types::File);
|
||||
if (!fileIndex.isValid())
|
||||
fileIndex = index;
|
||||
if (counter == 0)
|
||||
file.setFileName(QObject::tr("%1/file.ffs").arg(path));
|
||||
else
|
||||
file.setFileName(QObject::tr("%1/file_%2.ffs").arg(path).arg(counter));
|
||||
counter++;
|
||||
if (!file.open(QFile::WriteOnly))
|
||||
return U_FILE_OPEN;
|
||||
file.write(model->header(fileIndex));
|
||||
file.write(model->body(fileIndex));
|
||||
file.write(model->tail(fileIndex));
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Always dump info unless explicitly prohibited
|
||||
|
@ -32,7 +32,8 @@ public:
|
||||
DUMP_ALL,
|
||||
DUMP_BODY,
|
||||
DUMP_HEADER,
|
||||
DUMP_INFO
|
||||
DUMP_INFO,
|
||||
DUMP_FILE
|
||||
};
|
||||
|
||||
static const UINT8 IgnoreSectionType = 0xFF;
|
||||
|
@ -122,6 +122,8 @@ int main(int argc, char *argv[])
|
||||
modes.push_back(FfsDumper::DUMP_HEADER);
|
||||
else if (arg == QString("info"))
|
||||
modes.push_back(FfsDumper::DUMP_INFO);
|
||||
else if (arg == QString("file"))
|
||||
modes.push_back(FfsDumper::DUMP_FILE);
|
||||
else
|
||||
return U_INVALID_PARAMETER;
|
||||
} else if (readType == READ_SECTION) {
|
||||
@ -185,7 +187,7 @@ int main(int argc, char *argv[])
|
||||
<< " 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
|
||||
<< " Dump only FFS file(s) with specific GUID(s), without report." << std::endl
|
||||
<< " Type is section type or FF to ignore. Mode is one of: all, body, header, info." << std::endl
|
||||
<< " Type is section type or FF to ignore. Mode is one of: all, body, header, info, file." << 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user