예제 #1
0
        public static void RemoveAccessRule(Win32Share directory, string user, FileSystemRights right, AccessControlType controlType)
        {
            FileSecurity fsec = File.GetAccessControl(directory.Path);

            fsec.RemoveAccessRule(new FileSystemAccessRule(user, right, controlType));
            File.SetAccessControl(directory.Path, fsec);
        }
예제 #2
0
        public Win32Share[] GetShares()
        {
            ManagementObjectCollection shares = _shareClass.GetInstances();

            List <Win32Share> win32Shares = new List <Win32Share>();

            foreach (ManagementObject single in shares)
            {
                Win32Share s = new Win32Share(single);

                //s.InstallDate = (DateTime)single["InstallDate"];
                //s.AccessMask = (uint)single["AccessMask"];
                win32Shares.Add(s);
            }
            return(win32Shares.ToArray());
        }