Index: src/libchcore/TLocalFilesystem.cpp =================================================================== diff -u -rcde3645c5041aedd6703b81b6fed42134c615917 -r751648800daaa5e2e42a48075aae11265cfd6564 --- src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision cde3645c5041aedd6703b81b6fed42134c615917) +++ src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision 751648800daaa5e2e42a48075aae11265cfd6564) @@ -190,7 +190,8 @@ THROW_CORE_EXCEPTION(eErr_InvalidArgument); WIN32_FIND_DATA wfd; - HANDLE hFind = FindFirstFile(PrependPathExtensionIfNeeded(pathFile).ToString(), &wfd); + + HANDLE hFind = FindFirstFileEx(PrependPathExtensionIfNeeded(pathFile).ToString(), FindExInfoBasic, &wfd, FindExSearchNameMatch, nullptr, FIND_FIRST_EX_LARGE_FETCH); if (hFind != INVALID_HANDLE_VALUE) { FindClose(hFind); @@ -235,10 +236,12 @@ TSmartPath TLocalFilesystem::PrependPathExtensionIfNeeded(const TSmartPath& pathInput) { - if (pathInput.GetLength() >= 248) - return PathFromString(_T("\\\\?\\")) + pathInput; - else - return pathInput; + const TSmartPath pathPrefix = PathFromString(L"\\\\?\\"); + + if (pathInput.GetLength() >= 248 && !pathInput.StartsWith(pathPrefix)) + return pathPrefix + pathInput; + + return pathInput; } TLocalFilesystem::EPathsRelation TLocalFilesystem::GetPathsRelation(const TSmartPath& pathFirst, const TSmartPath& pathSecond) Index: src/libchcore/TPath.cpp =================================================================== diff -u -r27c262eb9cae55720e10f4886af6b5a82cb94fe9 -r751648800daaa5e2e42a48075aae11265cfd6564 --- src/libchcore/TPath.cpp (.../TPath.cpp) (revision 27c262eb9cae55720e10f4886af6b5a82cb94fe9) +++ src/libchcore/TPath.cpp (.../TPath.cpp) (revision 751648800daaa5e2e42a48075aae11265cfd6564) @@ -891,7 +891,7 @@ return !HasDrive() && !HasServerName(); } - bool TSmartPath::StartsWith(const TSmartPath& rPath, bool bCaseSensitive) + bool TSmartPath::StartsWith(const TSmartPath& rPath, bool bCaseSensitive) const { if(bCaseSensitive) return m_strPath.StartsWith(rPath.m_strPath.c_str()); Index: src/libchcore/TPath.h =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r751648800daaa5e2e42a48075aae11265cfd6564 --- src/libchcore/TPath.h (.../TPath.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TPath.h (.../TPath.h) (revision 751648800daaa5e2e42a48075aae11265cfd6564) @@ -112,7 +112,7 @@ void PrependSeparatorIfDoesNotExist(); void StripSeparatorAtFront(); - bool StartsWith(const TSmartPath& rPath, bool bCaseSensitive = DefaultCaseSensitivity); + bool StartsWith(const TSmartPath& rPath, bool bCaseSensitive = DefaultCaseSensitivity) const; bool IsEmpty() const; size_t GetLength() const;