コード例 #1
0
        private void SetSecurityDescriptorOnDynamicallyConfigurableShare(object ace)
        {
            _SECURITY_DESCRIPTOR sd = DtypUtility.DecodeSecurityDescriptor(originalShareInfo.Value.shi502_security_descriptor);

            _ACL dacl = sd.Dacl.Value;

            DtypUtility.AddAceToAcl(ref dacl, true, ace);
            sd.Dacl = dacl;

            DtypUtility.UpdateSecurityDescriptor(ref sd);

            SHARE_INFO_502_I newShareInfo = originalShareInfo.Value;

            newShareInfo.shi502_security_descriptor = DtypUtility.EncodeSecurityDescriptor(sd);
            newShareInfo.shi502_reserved            = (uint)newShareInfo.shi502_security_descriptor.Length;
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Set Security Descriptor on the share ({0}): {1}.",
                                 Smb2Utility.GetUncPath(TestConfig.SutComputerName, dynamicallyConfigurableShareName), DtypUtility.ToSddlString(sd));
            SetShareInfo(dynamicallyConfigurableShareName, newShareInfo);
        }