mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
Make imagefile first arg of UEFIFind
This commit is contained in:
parent
4f6efe5195
commit
a5b2f00f9b
@ -27,34 +27,39 @@ int main(int argc, char *argv[])
|
|||||||
UINT8 result;
|
UINT8 result;
|
||||||
|
|
||||||
if (a.arguments().length() == 5) {
|
if (a.arguments().length() == 5) {
|
||||||
|
const QString &inputArg = a.arguments().at(1);
|
||||||
|
const QString &modeArg = a.arguments().at(2);
|
||||||
|
const QString &subModeArg = a.arguments().at(3);
|
||||||
|
const QString &patternArg = a.arguments().at(4);
|
||||||
|
|
||||||
// Get search mode
|
// Get search mode
|
||||||
UINT8 mode;
|
UINT8 mode;
|
||||||
if (a.arguments().at(1) == QString("header"))
|
if (modeArg == QString("header"))
|
||||||
mode = SEARCH_MODE_HEADER;
|
mode = SEARCH_MODE_HEADER;
|
||||||
else if (a.arguments().at(1) == QString("body"))
|
else if (modeArg == QString("body"))
|
||||||
mode = SEARCH_MODE_BODY;
|
mode = SEARCH_MODE_BODY;
|
||||||
else if (a.arguments().at(1) == QString("all"))
|
else if (modeArg == QString("all"))
|
||||||
mode = SEARCH_MODE_ALL;
|
mode = SEARCH_MODE_ALL;
|
||||||
else
|
else
|
||||||
return U_INVALID_PARAMETER;
|
return U_INVALID_PARAMETER;
|
||||||
|
|
||||||
// Get result type
|
// Get result type
|
||||||
bool count;
|
bool count;
|
||||||
if (a.arguments().at(2) == QString("list"))
|
if (subModeArg == QString("list"))
|
||||||
count = false;
|
count = false;
|
||||||
else if (a.arguments().at(2) == QString("count"))
|
else if (subModeArg == QString("count"))
|
||||||
count = true;
|
count = true;
|
||||||
else
|
else
|
||||||
return U_INVALID_PARAMETER;
|
return U_INVALID_PARAMETER;
|
||||||
|
|
||||||
// Parse input file
|
// Parse input file
|
||||||
result = w.init(a.arguments().at(4));
|
result = w.init(inputArg);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
// Go find the supplied pattern
|
// Go find the supplied pattern
|
||||||
QString found;
|
QString found;
|
||||||
result = w.find(mode, count, a.arguments().at(3), found);
|
result = w.find(mode, count, patternArg, found);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -67,22 +72,26 @@ int main(int argc, char *argv[])
|
|||||||
return U_SUCCESS;
|
return U_SUCCESS;
|
||||||
}
|
}
|
||||||
else if (a.arguments().length() == 4) {
|
else if (a.arguments().length() == 4) {
|
||||||
|
const QString &inputArg = a.arguments().at(1);
|
||||||
|
const QString &modeArg = a.arguments().at(2);
|
||||||
|
const QString &patternArg = a.arguments().at(3);
|
||||||
|
|
||||||
// Get search mode
|
// Get search mode
|
||||||
if (a.arguments().at(1) != QString("file"))
|
if (modeArg != QString("file"))
|
||||||
return U_INVALID_PARAMETER;
|
return U_INVALID_PARAMETER;
|
||||||
|
|
||||||
// Open patterns file
|
// Open patterns file
|
||||||
QFileInfo fileInfo(a.arguments().at(2));
|
QFileInfo fileInfo(patternArg);
|
||||||
if (!fileInfo.exists())
|
if (!fileInfo.exists())
|
||||||
return U_FILE_OPEN;
|
return U_FILE_OPEN;
|
||||||
|
|
||||||
QFile patternsFile;
|
QFile patternsFile;
|
||||||
patternsFile.setFileName(a.arguments().at(2));
|
patternsFile.setFileName(patternArg);
|
||||||
if (!patternsFile.open(QFile::ReadOnly))
|
if (!patternsFile.open(QFile::ReadOnly))
|
||||||
return U_FILE_OPEN;
|
return U_FILE_OPEN;
|
||||||
|
|
||||||
// Parse input file
|
// Parse input file
|
||||||
result = w.init(a.arguments().at(3));
|
result = w.init(inputArg);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -151,8 +160,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "UEFIFind " PROGRAM_VERSION << std::endl << std::endl <<
|
std::cout << "UEFIFind " PROGRAM_VERSION << std::endl << std::endl <<
|
||||||
"Usage: UEFIFind {header | body | all} {list | count} pattern imagefile" << std::endl <<
|
"Usage: UEFIFind imagefile {header | body | all} {list | count} pattern" << std::endl <<
|
||||||
" or UEFIFind file patternsfile imagefile" << std::endl;
|
" or UEFIFind imagefile file patternsfile" << std::endl;
|
||||||
return U_INVALID_PARAMETER;
|
return U_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user