mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
Fix #144
This commit is contained in:
parent
021da9df4c
commit
bc3193420c
@ -24,10 +24,13 @@ USTATUS FfsDumper::dump(const UModelIndex & root, const UString & path, const Du
|
||||
return U_DIR_ALREADY_EXIST;
|
||||
|
||||
USTATUS result = recursiveDump(root, path, dumpMode, sectionType, guid);
|
||||
if (result)
|
||||
if (result) {
|
||||
return result;
|
||||
else if (!dumped)
|
||||
} else if (!dumped) {
|
||||
removeDirectory(path);
|
||||
return U_ITEM_NOT_FOUND;
|
||||
}
|
||||
|
||||
return U_SUCCESS;
|
||||
}
|
||||
|
||||
@ -61,6 +64,8 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
||||
return U_FILE_OPEN;
|
||||
const UByteArray &data = model->header(index);
|
||||
file.write(data.constData(), data.size());
|
||||
|
||||
dumped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +82,8 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
||||
return U_FILE_OPEN;
|
||||
const UByteArray &data = model->body(index);
|
||||
file.write(data.constData(), data.size());
|
||||
|
||||
dumped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,6 +106,8 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
||||
file.write(headerData.constData(), headerData.size());
|
||||
file.write(bodyData.constData(), bodyData.size());
|
||||
file.write(tailData.constData(), tailData.size());
|
||||
|
||||
dumped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,9 +130,9 @@ USTATUS FfsDumper::recursiveDump(const UModelIndex & index, const UString & path
|
||||
if (!file)
|
||||
return U_FILE_OPEN;
|
||||
file << info.toLocal8Bit();
|
||||
}
|
||||
|
||||
dumped = true;
|
||||
dumped = true;
|
||||
}
|
||||
}
|
||||
|
||||
USTATUS result;
|
||||
|
@ -2516,7 +2516,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index)
|
||||
if (model->hasEmptyParsingData(index) == false) {
|
||||
UByteArray data = model->parsingData(index);
|
||||
const GUIDED_SECTION_PARSING_DATA* pdata = (const GUIDED_SECTION_PARSING_DATA*)data.constData();
|
||||
guid = pdata->guid;
|
||||
guid = readMisaligned(pdata).guid;
|
||||
}
|
||||
|
||||
// Check if section requires processing
|
||||
@ -3008,8 +3008,8 @@ USTATUS FfsParser::addMemoryAddressesRecursive(const UModelIndex & index)
|
||||
if (model->hasEmptyParsingData(index) == false) {
|
||||
UByteArray data = model->parsingData(index);
|
||||
const TE_IMAGE_SECTION_PARSING_DATA* pdata = (const TE_IMAGE_SECTION_PARSING_DATA*)data.constData();
|
||||
originalImageBase = pdata->imageBase;
|
||||
adjustedImageBase = pdata->adjustedImageBase;
|
||||
originalImageBase = readMisaligned(pdata).imageBase;
|
||||
adjustedImageBase = readMisaligned(pdata).adjustedImageBase;
|
||||
}
|
||||
|
||||
if (imageBase != 0) {
|
||||
|
@ -36,6 +36,10 @@ static inline bool changeDirectory(const UString & dir) {
|
||||
return (_chdir(dir.toLocal8Bit()) == 0);
|
||||
}
|
||||
|
||||
static inline void removeDirectory(const UString & dir) {
|
||||
_rmdir(dir.toLocal8Bit());
|
||||
}
|
||||
|
||||
static inline UString getAbsPath(const UString & path) {
|
||||
char abs[1024] = {};
|
||||
if (_fullpath(abs, path.toLocal8Bit(), sizeof(abs)))
|
||||
@ -54,6 +58,10 @@ static inline bool makeDirectory(const UString & dir) {
|
||||
return (mkdir(dir.toLocal8Bit(), ACCESSPERMS) == 0);
|
||||
}
|
||||
|
||||
static inline void removeDirectory(const UString & dir) {
|
||||
rmdir(dir.toLocal8Bit());
|
||||
}
|
||||
|
||||
static inline bool changeDirectory(const UString & dir) {
|
||||
return (chdir(dir.toLocal8Bit()) == 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user