使用SE_LMSHARE调用Get / Set [Named] SecurityInfo时,ACE中的类型特定访问权限是如何解释的?
我猜我应该使用File Access Rights Constants的目录版本,但这在任何地方都有记录吗?
答案 0 :(得分:2)
为了其他任何人的利益,像我一样,试图设置Windows共享的权限,并在这个老问题上遇到困难,我将以下内容整合在一起:
[Flags]
public enum ACCESS_MASK : uint
{
READ_FILE = 0x000001,
WRITE_FILE = 0x000002,
CREATE_SUBDIR = 0x000004,
READ_EXT_ATTR = 0x000008,
WRITE_EXT_ATTR = 0x000010,
EXECUTE = 0x000020,
DELETE_DIR = 0x000040,
READ_FILE_ATTR = 0x000080,
WRITE_FILE_ATTR = 0x000100,
DELETE = 0x010000,
READ_SD = 0x020000,
WRITE_DACL = 0x040000,
WRITE_OWNER = 0x080000,
SYNCHRONIZE = 0x100000,
// These combinations of the above flags correspond to the preset control levels in the relevant Windows dialogs.
SHARE_READ = READ_FILE | READ_EXT_ATTR | EXECUTE | READ_FILE_ATTR | READ_SD | SYNCHRONIZE,
SHARE_CHANGE = SHARE_READ | WRITE_FILE | CREATE_SUBDIR | WRITE_EXT_ATTR | WRITE_FILE_ATTR | DELETE,
SHARE_FULL = SHARE_CHANGE | DELETE_DIR | WRITE_DACL | WRITE_OWNER
}
请注意,这不是一个详尽的列表 - 它包含为共享权限提供三个Windows预设所需的最小标志子集(即上面的最后三个成员)。