为.Net下的低完整性进程添加写访问权限

时间:2010-07-12 08:30:24

标签: c# .net windows security acl

我正在为文件创建创建一个FileSecurity,它也应该具有低完整性进程的写访问权。

FileSecurity fileAcl = new FileSecurity();

// add everyone
IdentityReference sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
FileSystemAccessRule rule = new FileSystemAccessRule(sid, FileSystemRights.FullControl, AccessControlType.Allow);
fileAcl.AddAccessRule(rule);

// add restricted
sid = new SecurityIdentifier(WellKnownSidType.RestrictedCodeSid, null);
rule = new FileSystemAccessRule(sid, FileSystemRights.FullControl, AccessControlType.Allow);
fileAcl.AddAccessRule(rule);

// add low integrity level rights

// ???

如果有人知道怎么做而不调用C API我会很感激,否则我将不得不重新使用它。

提前致谢

1 个答案:

答案 0 :(得分:0)

我不知道它们是否在.NET中公开,而是integrity levels themselves are also well-known SIDs。您还应该阅读Mandatory Integrity Control documentation以了解如何使用它们。