Eryk Sun <eryk...@gmail.com> added the comment:

> Replacing "\??\" with "\\?\" in place is trivial though, as we start 
> with a mutable buffer. I'm just not clear that it's as simple as that, 
> though.

If the path starts with "\\??\\" we can just change the first question mark to 
a backslash. For a symlink, fail at this step if Flags includes 
SYMLINK_FLAG_RELATIVE, which would be inconsistent data. 

"\\??\\" is the NT prefix for the caller's local (logon session) device 
directory. This implicitly shadows the global device directory, "\\Global??". 
We don't use NT's real "\\Device" directory in Windows, but it's available as 
"//?/GlobalRoot/Device" or "//?/Global/GlobalRoot/Device". 

"\\??\\" shouldn't be used directly in Windows programming, since 
GetFullPathNameW (often implicitly called) doesn't recognize it, but some API 
functions will pass it along, even though they should really fail the call. It 
will work until it doesn't, and by then we could have a right mess.

If a path starts with exactly "\\\\?\\" (backslash only), Windows simply copies 
it verbatim, except for changing the prefix to "\\??\\". Other Windows device 
prefixes where the domain is "." or "?" can use any mix of forward slash and 
backslash because they get normalized first (e.g. "//?\\" -> "\\\\?\\"). Only 
an initial "\\\\?\\" bypasses the normalization step.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37834>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to