我正在使用Install Shield Limited Edition,安装程序会将名为INTERACTIVE的新用户添加到只具有读取权限的文件夹位置。
有没有办法删除这个新用户或修改它以使其具有完全权限?
答案 0 :(得分:0)
Directory.SetAccessControl将DirectorySecurity对象描述的访问控制列表(ACL)条目应用于指定目录。
public static void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
{
// Create a new DirectoryInfo object.
DirectoryInfo dInfo = new DirectoryInfo(FileName);
// Get a DirectorySecurity object that represents the
// current security settings.
DirectorySecurity dSecurity = dInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
dSecurity.AddAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));
// Set the new access settings.
dInfo.SetAccessControl(dSecurity);
}