mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-29 11:28:22 +08:00
Fix recursion in UEFIReplace
This commit is contained in:
parent
b5961a7155
commit
dd90367387
@ -84,17 +84,18 @@ UINT8 UEFIReplace::replaceInFile(const QModelIndex & index, const QByteArray & g
|
|||||||
{
|
{
|
||||||
if (!model || !index.isValid())
|
if (!model || !index.isValid())
|
||||||
return ERR_INVALID_PARAMETER;
|
return ERR_INVALID_PARAMETER;
|
||||||
|
bool patched = false;
|
||||||
if (model->subtype(index) == sectionType) {
|
if (model->subtype(index) == sectionType) {
|
||||||
QModelIndex fileIndex = model->findParentOfType(index, Types::File);
|
QModelIndex fileIndex = model->findParentOfType(index, Types::File);
|
||||||
QByteArray fileGuid = model->header(fileIndex).left(sizeof(EFI_GUID));
|
QByteArray fileGuid = model->header(fileIndex).left(sizeof(EFI_GUID));
|
||||||
if (fileGuid == guid) {
|
if (fileGuid == guid && model->action(index) != Actions::Replace) {
|
||||||
UINT8 result = ffsEngine->replace(index, newData, REPLACE_MODE_BODY);
|
UINT8 result = ffsEngine->replace(index, newData, REPLACE_MODE_BODY);
|
||||||
if (replaceOnce || (result != ERR_SUCCESS && result != ERR_NOTHING_TO_PATCH))
|
if (replaceOnce || (result != ERR_SUCCESS && result != ERR_NOTHING_TO_PATCH))
|
||||||
return result;
|
return result;
|
||||||
|
patched = result == ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool patched = false;
|
|
||||||
if (model->rowCount(index) > 0) {
|
if (model->rowCount(index) > 0) {
|
||||||
for (int i = 0; i < model->rowCount(index); i++) {
|
for (int i = 0; i < model->rowCount(index); i++) {
|
||||||
UINT8 result = replaceInFile(index.child(i, 0), guid, sectionType, newData, replaceOnce);
|
UINT8 result = replaceInFile(index.child(i, 0), guid, sectionType, newData, replaceOnce);
|
||||||
|
Loading…
Reference in New Issue
Block a user