开发者

How to create directories with names that are differing in case? (a case-sensitive CreateDirectory function)

开发者 https://www.devze.com 2023-04-04 00:49 出处:网络
Is there a way to do this? I use CreateFile with the FILE_FLAG_POSIX_SEMANTICS flag to create files with case-sensitive names. Now I need something 开发者_StackOverflowlike that for directories too.

Is there a way to do this? I use CreateFile with the FILE_FLAG_POSIX_SEMANTICS flag to create files with case-sensitive names. Now I need something 开发者_StackOverflowlike that for directories too.

Example:

CreateDirectory("aaa", NULL);

and

CreateDirectory("AAA", NULL);

would result it 2 different directories. :)


You can use the native API like David suggested (case-sensitivity is determined by the parameters to InitializeObjectAttributes())

Alternatively, you can use CreateFile and specify FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_POSIX_SEMANTICS | FILE_ATTRIBUTE_DIRECTORY for dwFlagsAndAttributes and CREATE_NEW for dwCreationDisposition.


I think you need to resort to the native API and call NtCreateFile(). I'm afraid I can't help you call the rather frightening API, but I don't believe there is anything else that could possibly allow this.

0

精彩评论

暂无评论...
验证码 换一张
取 消