On 28/05/2020 14:51, Eryk Sun wrote: > On 5/27/20, Chris Angelico <ros...@gmail.com> wrote: >> On Thu, May 28, 2020 at 7:07 AM BlindAnagram <blindanag...@nowhere.com> >> wrote: >>> You can define a path however you want but it won't change the fact that >>> on Windows a path that ends in '\\' is inherently a path to a directory. >> >> Citation needed. > > See [MS-FSA] 2.1.5.1 Server Requests an Open of a File [1]. Here are > the relevant statements: > > The operation MUST be failed with STATUS_OBJECT_NAME_INVALID under > any of the following conditions: > .... > * If PathName contains a trailing backslash and > CreateOptions.FILE_NON_DIRECTORY_FILE is TRUE. > > .... > If PathName contains a trailing backslash: > * If StreamTypeToOpen is DataStream or > CreateOptions.FILE_NON_DIRECTORY_FILE is TRUE, the operation MUST > be failed with STATUS_OBJECT_NAME_INVALID > > Internally, WinAPI CreateFileW calls NTAPI NtCreateFile with the > create option FILE_NON_DIRECTORY_FILE (i.e. only open or create a data > file stream), unless backup semantics are requested in order to be > able to open a directory (i.e. an index stream), in which case the > call uses neither FILE_NON_DIRECTORY_FILE nor FILE_DIRECTORY_FILE and > leaves it up to the path name. In other words, with backup semantics, > if you need to ensure that only a directory is opened, add a trailing > slash. > > NTAPI STATUS_OBJECT_NAME_INVALID translates to WinAPI > ERROR_INVALID_NAME (123), which translates to C EINVAL (22). > > [1]: > https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fsa/8ada5fbe-db4e-49fd-aef6-20d54b748e40 > Thank you for making the effort to answer a number of issues raaised in this thread. I much appreciate your input.
-- https://mail.python.org/mailman/listinfo/python-list