mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 09:28:22 +08:00
4c290c5204
- solved a crash during handling of a malformed DEPEX section
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
/* uefiextract_main.cpp
|
|
|
|
Copyright (c) 2015, Nikolaj Schlej. 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 <QCoreApplication>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <iostream>
|
|
#include "uefiextract.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication a(argc, argv);
|
|
a.setOrganizationName("CodeRush");
|
|
a.setOrganizationDomain("coderush.me");
|
|
a.setApplicationName("UEFIExtract");
|
|
|
|
UEFIExtract w;
|
|
UINT8 result = ERR_SUCCESS;
|
|
UINT32 returned = 0;
|
|
|
|
if (a.arguments().length() > 32) {
|
|
std::cout << "Too many arguments" << std::endl;
|
|
return 1;
|
|
}
|
|
|
|
if (a.arguments().length() > 1 ) {
|
|
if (w.init(a.arguments().at(1)))
|
|
return 1;
|
|
|
|
if (a.arguments().length() == 2) {
|
|
result = w.extract();
|
|
if (result)
|
|
return 2;
|
|
}
|
|
else {
|
|
for (int i = 2; i < a.arguments().length(); i++) {
|
|
result = w.extract(a.arguments().at(i));
|
|
if (result)
|
|
returned |= (1 << (i - 1));
|
|
}
|
|
return returned;
|
|
}
|
|
|
|
}
|
|
else {
|
|
std::cout << "UEFIExtract 0.4.4" << std::endl << std::endl <<
|
|
"Usage: uefiextract imagefile [FileGUID_1 FileGUID_2 ... FileGUID_31]" << std::endl <<
|
|
"Returned value is a bit mask where 0 on position N meant File with GUID_N was found and unpacked, 1 otherwise" << std::endl;
|
|
return 1;
|
|
}
|
|
}
|