Jump to content

exceeding max_path (path length > 260 characters)


Recommended Posts

Posted (edited)

Hello,

as you are probably aware, Windows has problems with long paths (total length > 260 characters).

---

In old Windows versions there is the "\\?\"-trick, which helps in a few situations:

Quote

The "\\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send ... it straight to the file system. For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs.

... it turns off automatic expansion of the path string ... but not all file I/O APIs support "\\?\" ... Unicode APIs should be used ...

---

Starting with Windows 10, it is possible to allow specific applications to use longer paths.

According to the documentation, Microsoft modified specific functions of the API to allow using longer paths for specific applications in Windows 10. So the list of functions is rather interesting. And here it is:

  • CopyFileW
  • CopyFile2
  • CopyFileExW
  • CreateDirectoryW
  • CreateDirectoryExW
  • CreateFileW
  • CreateFile2
  • CreateHardLinkW
  • CreateSymbolicLinkW
  • DeleteFileW
  • FindFirstFileNameW
  • FindFirstFileW
  • FindFirstFileExW
  • FindFirstStreamW
  • FindNextFileNameW
  • FindNextFileW
  • FindNextStreamW
  • GetCompressedFileSizeW
  • GetCurrentDirectoryW
  • GetFileAttributesW
  • GetFileAttributesExW
  • GetFinalPathNameByHandleW
  • SetFileAttributesW
  • GetFullPathNameW
  • GetLongPathNameW
  • MoveFileW
  • MoveFileExW
  • MoveFileWithProgressW
  • RemoveDirectoryW
  • ReplaceFileW
  • SearchPathW
  • SetCurrentDirectoryW

---

Is anyone aware of any pioneer work that has been done to improve the situation with Windows versions older than Windows 10?

Edited by Start Me Up

Posted

For FAT and NTFS drives, API wrappers could walk the path string and shorten each long folder or file name as needed. Network shares to other file systems could be a problem.  Temporary environment variables and drive mappings might also be possible.

I've considered these possibilities for KernelEx should the need arise, but haven't done any tests. For years I have been successfully using a function I wrote to walk a path string and lengthen each short folder or file name. Doing the opposite should be easy.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...