Add support for long paths in Windows 10+

This commit is contained in:
Nikolaj Schlej 2023-06-19 18:01:25 -07:00
parent 031bd4f734
commit b6cdc9f484
14 changed files with 108 additions and 51 deletions

View file

@ -69,7 +69,7 @@ ADD_DEFINITIONS(
-DU_ENABLE_GUID_DATABASE_SUPPORT
)
ADD_EXECUTABLE(UEFIExtract ${PROJECT_SOURCES})
ADD_EXECUTABLE(UEFIExtract ${PROJECT_SOURCES} uefiextract.manifest)
IF(UNIX)
SET_TARGET_PROPERTIES(UEFIExtract PROPERTIES OUTPUT_NAME uefiextract)

View file

@ -33,8 +33,9 @@ USTATUS FfsDumper::dump(const UModelIndex & root, const UString & path, const Du
printf("Error %zu returned from recursiveDump (directory \"%s\").\n", result, (const char*)path.toLocal8Bit());
return result;
} else if (!dumped) {
removeDirectory(path);
printf("Removed directory \"%s\" since nothing was dumped.\n", (const char*)path.toLocal8Bit());
if (removeDirectory(path)) {
printf("Removed directory \"%s\" since nothing was dumped.\n", (const char*)path.toLocal8Bit());
}
return U_ITEM_NOT_FOUND;
}

View file

@ -0,0 +1,8 @@
<assembly xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv1:assemblyIdentity type='win32' name='me.coderush.UEFIExtract' version='1.0.0.0' />
<asmv3:application>
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

View file

@ -72,9 +72,8 @@ int main(int argc, char *argv[])
USTATUS result;
UByteArray buffer;
UString path = getAbsPath(argv[1]);
result = readFileIntoBuffer(path, buffer);
if (result)
return result;
if (false == readFileIntoBuffer(path, buffer))
return U_FILE_OPEN;
// Hack to support legacy UEFIDump mode
if (argc == 3 && !std::strcmp(argv[2], "unpack")) {