You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
os.path.splitroot() splits "Global" and "GLOBALROOT" device paths incorrectly #103593
The "Global" qualifier would be consumed as part of the "\\.\" or "\\?\" device prefix. Using "Global" ensures that only system device names are found, bypassing local device names created in the current logon session via WinAPI DefineDosDeviceW() or NTAPI NtCreateSymbolicLinkObject(). Repeated "Global" qualifiers don't have to be supported.
"GlobalRoot" can be handled like the "UNC" device, by consuming up to two subsequent components, e.g "\\.\GlobalRoot\Device\HarddiskVolume2". An exception could be made to consume up to two more components if the path is on the multiple UNC device (MUP), e.g. "\\?\GlobalRoot\Device\Mup\server\share". Such a path might me returned by os.readlink() if the symlink is absolute (no relative flag) and directly targets "\Device\Mup" instead of "\??\UNC". Or maybe a script is manipulating NT paths from GetFinalPathNameByHandleW(), for example:
>>> h = CreateFile('//localhost/C$/Windows/py.exe', 0, 0, None, 3, 0, None)
>>> p = GetFinalPathNameByHandle(h, VOLUME_NAME_NT)
>>> p ='\\\\?\\GlobalRoot'+ p
>>> p
'\\\\?\\GlobalRoot\\Device\\Mup\\localhost\\C$\\Windows\\py.exe'
>>> h2 = CreateFile(p, 0, 0, None, 3, 0, None)
>>> GetFinalPathNameByHandle(h2, VOLUME_NAME_DOS)
'\\\\?\\UNC\\localhost\\C$\\Windows\\py.exe'
Activity
eryksun commentedon Apr 17, 2023
The "Global" qualifier would be consumed as part of the "\\.\" or "\\?\" device prefix. Using "Global" ensures that only system device names are found, bypassing local device names created in the current logon session via WinAPI
DefineDosDeviceW()or NTAPINtCreateSymbolicLinkObject(). Repeated "Global" qualifiers don't have to be supported."GlobalRoot" can be handled like the "UNC" device, by consuming up to two subsequent components, e.g "\\.\GlobalRoot\Device\HarddiskVolume2". An exception could be made to consume up to two more components if the path is on the multiple UNC device (MUP), e.g. "\\?\GlobalRoot\Device\Mup\server\share". Such a path might me returned by
os.readlink()if the symlink is absolute (no relative flag) and directly targets "\Device\Mup" instead of "\??\UNC". Or maybe a script is manipulating NT paths fromGetFinalPathNameByHandleW(), for example: