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

Case-sensitive file access is potentially possible with 
FILE_FLAG_POSIX_SEMANTICS (CreateFileW) and FIND_FIRST_EX_CASE_SENSITIVE 
(FindFirstFileExW). These flags make the API omit the object-manager flag 
OBJ_CASE_INSENSITIVE in the NtCreateFile or NtOpenFile system call. That said, 
since Windows XP these API flags are usually ignored because the kernel object 
manager has a default-enabled global flag that makes it always use 
OBJ_CASE_INSENSITIVE for object types that are registered as case-insensitive, 
such as device objects. The global flag is configured as the value 
"obcaseinsensitive" in "HKLM\SYSTEM\CurrentControlSet\Control\Session 
Manager\kernel".

A filesystem may elect to ignore the OBJ_CASE_INSENSITIVE flag, though it's not 
particularly elegant. In Windows 10, NTFS ignores the OBJ_CASE_INSENSITIVE flag 
if the parent directory is flagged as case-sensitive via NtSetInformationFile: 
FileCaseSensitiveInformation [1], which can be set by WSL or fsutil.exe. This 
setting should be avoided for directories that are used by Windows programs. An 
example issue is the way shells use the PATHEXT environment variable to find a 
file when the extension is omitted. Typically each extension in PATHEXT gets 
appended to the base name and checked via FindFirstFileW or GetFileAttributesW. 
But, for example, checking for "spam.BAT" will fail in a case-sensitive 
directory if the extension is actually ".bat", ".Bat", etc.

---

[1] 
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_case_sensitive_information

----------

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

Reply via email to