From 2cbd78fb9e45b5f8bb11b8d0baa74e85c3fb4cc2 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Fri, 8 Mar 2019 03:07:58 +0300 Subject: [PATCH] Fix directory creation error in UEFIExtract default mode --- UEFIExtract/ffsdumper.cpp | 7 ++++++- common/nvramparser.cpp | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/UEFIExtract/ffsdumper.cpp b/UEFIExtract/ffsdumper.cpp index 9b6096b..addbc61 100644 --- a/UEFIExtract/ffsdumper.cpp +++ b/UEFIExtract/ffsdumper.cpp @@ -165,6 +165,7 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path } USTATUS result; + for (int i = 0; i < model->rowCount(index); i++) { UModelIndex childIndex = index.child(i, 0); bool useText = FALSE; @@ -172,9 +173,13 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path useText = !model->text(childIndex).isEmpty(); UString childPath = path; - if (dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT) + if (dumpMode == DUMP_ALL || dumpMode == DUMP_CURRENT) { + if (!changeDirectory(path) && !makeDirectory(path)) + return U_DIR_CREATE; + childPath = usprintf("%s/%d %s", path.toLocal8Bit(), i, (useText ? model->text(childIndex) : model->name(childIndex)).toLocal8Bit()); + } result = recursiveDump(childIndex, childPath, dumpMode, sectionType, guid); if (result) return result; diff --git a/common/nvramparser.cpp b/common/nvramparser.cpp index 0d90b29..abaf6d7 100644 --- a/common/nvramparser.cpp +++ b/common/nvramparser.cpp @@ -233,8 +233,8 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index) nvarIndex = index.child(i, 0); if (model->hasEmptyParsingData(nvarIndex) == false) { UByteArray nvarData = model->parsingData(nvarIndex); - const NVAR_ENTRY_PARSING_DATA* nvarPdata = (const NVAR_ENTRY_PARSING_DATA*)nvarData.constData(); - if (nvarPdata->isValid && nvarPdata->next + model->offset(nvarIndex) - localOffset == offset) { // Previous link is present and valid + const NVAR_ENTRY_PARSING_DATA nvarPdata = readUnaligned((const NVAR_ENTRY_PARSING_DATA*)nvarData.constData()); + if (nvarPdata.isValid && nvarPdata.next + model->offset(nvarIndex) - localOffset == offset) { // Previous link is present and valid isInvalidLink = false; break; }