开发者

Does opening a file with Share-Delete allow others to write?

The FileShare enumeration offers various flags such as Read, Write,开发者_StackOverflow社区 Delete, ... . Normally I'd think that sharing a file for deletion only allows deletion but nothing else (like reading).

However, I remotely recall that Windows only differentiates between read-only and full access to files, so actually sharing for deletion allows writing to the file as well. Sadly this is from many years back and I neither found the original source nor any related info. Is there a reliable spec on the actual behavior? Is it dependent on the OS or the FS?


Take a look at the documentation for the CreateFile Function.

FILE_SHARE_DELETE: Enables subsequent open operations on a file or device to request delete access. Otherwise, other processes cannot open the file or device if they request delete access. If this flag is not specified, but the file or device has been opened for delete access, the function fails. Note Delete access allows both delete and rename operations.

The documentation doesn't mention that read access is allowed, too.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜