]> git.ipfire.org Git - thirdparty/curl.git/commit
curl_multibyte: support Windows paths longer than MAX_PATH 13522/head
authorJay Satiro <raysatiro@yahoo.com>
Fri, 3 May 2024 07:40:50 +0000 (03:40 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Sun, 22 Dec 2024 04:47:39 +0000 (23:47 -0500)
commit18650ea01166c0cbc332f574c533f1337642a7cf
tree6cd3b35e96fe4994daa31a054e71c7e37dc6c551
parent7cf47a7740f666ae3c06361781a341a7da403041
curl_multibyte: support Windows paths longer than MAX_PATH

- Add a helper function for the Windows file wrapper functions that will
  normalize a long path (or a filename in a long path) and add the
  prefix `\\?\` so that Windows will access the file.

Prior to this change if a filename (when normalized internally by
Windows to its full path) or a path was longer than MAX_PATH (260) then
Windows would not open the path, unless it was already normalized by the
user and had the `\\?\` prefix prepended.

The `\\?\` prefix could not be passed to file:// so for example
something like file://c:/foo/bar/filename255chars could not be opened
prior to this change.

There's some code in tool_doswin that will need to be modified as well
to further remove MAX_PATH (aka PATH_MAX) limitation.

Ref: https://github.com/curl/curl/issues/8361
Ref: https://github.com/curl/curl/pull/13512
Ref: https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats
Ref: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

Closes https://github.com/curl/curl/pull/13522
lib/curl_multibyte.c