[PATCH] D67166: Win: handle \\?\UNC\ prefix in realPathFromHandle (PR43204)

Adrian McCarthy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 13:22:05 PDT 2019


amccarth accepted this revision.
amccarth added a comment.

The `\\?\` prefix tells the Windows API layer not to parse the path strings and just pass it along to the file system.  Ramifications:

1. You can no longer use `.` or `..` as a path component.  Those are treated as special in the API layer rather than as part of the file system.
2. Many Windows APIs that take a path will accept `/` and treat it as `\`.  If you use `\\?\`, the entire path must use `\` throughout.
3. The prefix also lets you use long path names (> MAX_PATH), but only if you use them with the W versions of the APIs (e.g., CreateFileW rather than CreateFileA).  [On Windows 10, there are other ways to get long path names, but I don't think that's relevant here.]

I suspect the desire to ever strip the prefix stems from some of these ramifications.

The decision to include or strip this prefix can have all sorts of impact that we may not be able to anticipate.

But I don't see anything wrong with the code in this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67166/new/

https://reviews.llvm.org/D67166





More information about the llvm-commits mailing list