Windows NTFS and case sensitivity

孤街醉人 提交于 2019-12-30 10:04:41

问题


According to Wikipedia NTFS allows two similar names with different case (like Readme.txt vs. readme.txt) and it is only prevented by the windows file API.

Current Windows file systems, like NTFS, are case-sensitive; that is a readme.txt and a Readme.txt can exist in the same directory. However, the API for file access in Windows applications is case-insensitive, which makes filenames case-insensitive from the application's point of view. Therefore, applications only have access to one of the files whose filenames only differ in case, and some commands may fail if the filename provided is ambiguous

Comming from Linux I ask myself what are the possibilities that both files exist and one can only access one of the files making it an ideal problem for security. What is meant by "Windows API". Is there another way to access those duplicated files? Can one access the file system directly using the disk driver (format driver)?


回答1:


NTFS is a case sensitive file system and treats files with the same name, but different case, as different files.

The Windows API presents an abstraction of NTFS that makes it appear as a case preserving file system, and it does this via the CreateFile API that almost all file creation and opening requests are routed through.

Namely, the case sensitivity of file opening or creation is mediated by the FILE_FLAG_POSIX_SEMANTICS flag passed to CreateFile.




回答2:


As Chris Becke said:

NTFS is a case sensitive file system and treats files with the same name, but different case, as different files.

Luckily, if you now want to have upper and lower case files, the new Windows 10 developers update allows you to enable that feature in certain folders, for development purposes. I just warn you that you shouldn't rely on that feature because older windows versions wouldn't support it and I don't know what could happen. Check out how to do it here: https://www.howtogeek.com/354220/how-to-enable-case-sensitive-folders-on-windows-10/



来源:https://stackoverflow.com/questions/33998669/windows-ntfs-and-case-sensitivity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!