c++winapiunicodefilenamesmax-path

On Windows, when should you use the "\\\\?\\" filename prefix?


I came across a c library for opening files given a Unicode filename. Before opening the file, it first converts the filename to a path by prepending "\\?\". Is there any reason to do this other than to increase the maximum number of characters allowed in the path, per this msdn article?

It looks like these "\\?\" paths require the Unicode versions of the Windows API and standard library.


Solution

  • Yes, it's just for that purpose. However, you will likely see compatibility problems if you decide to creating paths over MAX_PATH length. For example, the explorer shell and the command prompt (at least on XP, I don't know about Vista) can't handle paths over that length and will return errors.