Long path cannot be handle with GetFullPathName

Sundeep KOKKONDA 1 Reputation point
2022-01-19T14:59:13.803+00:00

I am trying to get an absolute path from the GetFullPathName API by passing the relative path as argument to the function. But, the GetFullPathName API is not working for long paths (may be not working if length >260 characters). How to get this API work for long paths? Or any other API is available to deal with long paths?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,617 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 45,571 Reputation points
    2022-01-19T15:16:49.927+00:00

    According to maximum-file-path-limitation GetFullPathNameW will not have the MAX_PATH restriction if you have opted into long path behavior. If you have not opted in you can prepend the path with "\?\"

    By the way, you must call GetFullPathNameW for long path support. GetFullPathNameA is limited to MAX_PATH.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.