As specified here it is possible to use absolute paths on Windows without the MAX_PATH
length limitation.
However I noticed paths starting with \\?\
don't work in certain older versions of Windows.
Which version do I need to detect (e.g. with one of the functions described here) to help my software decide on using \\?\
paths?
CodePudding user response:
if you use \\?\
prefix in unicode path - the long paths is always supported in any version of windows (even win2000 and xp). question about support long paths - only affect another path types, which not begin with \\?\
, such as c:\*
from Maximum Path Length Limitation
The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. ... To specify an extended-length path, use the
"\\?\"
prefix. For example,"\\?\D:\very long path"
.
usual on any individual function documentation direct stated about \\?\
prefix too (if it supported by this api - File I/O functions always support this prefix, when shell api - never)
for instance from GetFileAttributesW
To extend this limit to 32,767 wide characters, call the Unicode version of the function (GetFileAttributesW), and prepend
"\\?\"
to the path.
the same on CreateFileW
and so on..
To extend this limit to 32,767 wide characters, use this Unicode version of the function and prepend
"\\?\"
to the path.