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

> Any particular reason you did GetFileAttributesW(path) in the 
> non-FILE_TYPE_DISK case when we have the hFile around?

The point of getting the file attributes is to identify the root directory of 
the namedpipe and mailslot file systems. For example, os.listdir('//./pipe') 
works because we append "\\*.*" to the path.

GetFileInformationByHandle[Ex] forbids a pipe handle, for reasons that may no 
longer be relevant in Windows 10 (?). I remembered the restriction in the above 
case, but it seems I forgot about it when querying the tag. So the order of the 
GetFileInformationByHandleEx and GetFileType blocks actually needs to be 
flipped. That would be a net improvement anyway since there's no point in 
querying a reparse tag from a device that's not a file system (namedpipe and 
mailslot are 'file systems', but only at the most basic level).

I can't imagine there being a problem with querying FileBasicInfo to get the 
file attributes. I just checked that it works fine with "//./pipe/" and 
"//./mailslot/" -- at least in Windows 10. Anyway, GetFileAttributesW uses a 
query-only open that doesn't create a real file object or even require an IRP 
usually, so it's not adding much cost compared to querying FileBasicInfo using 
the handle.

----------

_______________________________________
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