On 8/10/19, eryk sun <eryksun@gmail.com> wrote:
The per-logon directory is located at "\\Sessions\\0\\DosDevices\\<Logon Session ID>". In the Windows API, it's accessible as "//?/" or "//./", or with any mix of forward slashes or backslashes, but only the all-backslash form is special-cased to bypass the normalization step.
Correction: I slipped up in that last sentence. Only the all-backslash form that's in the "?" namespace bypasses normalization, as most Windows users should at least have seen in passing. These special device paths pop up here and there. For example, r'\\?\C:\Temp\spam. . .' allows creating or opening a file named "spam. . .", which the Windows API would normalize as "spam". But I don't recommend sidestepping the normal rules -- except for the path length limit because there are ways to make long paths conveniently accessible (e.g. symbolic links, bind-like mountpoints, and subst drives). Sometimes people also come across "\\??\\" paths and come to the mistaken conclusion that these can be used in Windows API programs. No, they're for NT. The runtime library mangles them, e.g. nt._getfullpathname(r'\??\C:') == 'C:\\??\\C:'.