Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl_multibyte: support Windows paths longer than MAX_PATH #13522

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on May 3, 2024

  1. 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: curl#8361
    Ref: curl#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 #xxxx
    jay committed May 3, 2024
    Configuration menu
    Copy the full SHA
    f7e60b5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6a7ecfd View commit details
    Browse the repository at this point in the history
  3. fixup address feedback and fix \\?\ prepend logic

    - explain 32767 constant is "approximate" maximum path len, so says MS.
    
    - explain GetFullPathNameW returns a normalized full path and what it
      means to normalize.
    
    - fix `\\?\` logic to restrict the times when it is prepended, since it
      may already be prepended.
    
    - skip excessively long path input if it's already prefixed with `\\?\`
      (likely by the user)
    jay committed May 3, 2024
    Configuration menu
    Copy the full SHA
    5a37b66 View commit details
    Browse the repository at this point in the history
  4. fixup compiler warning

    jay committed May 3, 2024
    Configuration menu
    Copy the full SHA
    78bffc7 View commit details
    Browse the repository at this point in the history