Allow subguid matching for UEFIReplace

This commit is contained in:
vit9696 2018-05-19 23:53:21 +03:00
parent dd90367387
commit 65263f1000

View File

@ -88,7 +88,12 @@ UINT8 UEFIReplace::replaceInFile(const QModelIndex & index, const QByteArray & g
if (model->subtype(index) == sectionType) {
QModelIndex fileIndex = model->findParentOfType(index, Types::File);
QByteArray fileGuid = model->header(fileIndex).left(sizeof(EFI_GUID));
if (fileGuid == guid && model->action(index) != Actions::Replace) {
bool guidMatch = fileGuid == guid;
if (!guidMatch && sectionType == EFI_SECTION_FREEFORM_SUBTYPE_GUID) {
QByteArray subGuid = model->header(index).mid(sizeof(uint32_t), sizeof(EFI_GUID));
guidMatch = subGuid == guid;
}
if (guidMatch && model->action(index) != Actions::Replace) {
UINT8 result = ffsEngine->replace(index, newData, REPLACE_MODE_BODY);
if (replaceOnce || (result != ERR_SUCCESS && result != ERR_NOTHING_TO_PATCH))
return result;