예제 #1
0
        protected void SetCap(string sharePath, _SID?capId)
        {
            _ACL sacl;

            if (capId != null)
            {
                _SYSTEM_SCOPED_POLICY_ID_ACE ace = DtypUtility.CreateSystemScopedPolicyIdAce(capId.Value);
                sacl = DtypUtility.CreateAcl(false, ace);
            }
            else
            {
                sacl = DtypUtility.CreateAcl(false);
            }

            _SECURITY_DESCRIPTOR sd = DtypUtility.CreateSecurityDescriptor(
                SECURITY_DESCRIPTOR_Control.SACLAutoInherited | SECURITY_DESCRIPTOR_Control.SACLInheritanceRequired |
                SECURITY_DESCRIPTOR_Control.SACLPresent | SECURITY_DESCRIPTOR_Control.SelfRelative,
                null,
                null,
                sacl,
                null);

            if (sharePath != null)
            {
                SetSecurityDescriptor(sharePath, null, sd, SET_INFO_Request_AdditionalInformation_Values.SCOPE_SECURITY_INFORMATION);
            }
        }