示例#1
0
            protected override bool InternalReleaseHandle()
            {
                BoundaryDescriptorHandle h = handle;

                DeleteBoundaryDescriptor(h);
                return(true);
            }
示例#2
0
        public static SafeNamespaceHandle OpenPrivateNamespace(BoundaryDescriptorHandle lpBoundaryDescriptor, string lpAliasPrefix)
        {
            var h = OpenPrivateNamespaceInternal(lpBoundaryDescriptor, lpAliasPrefix);

            h.flag = 0;
            return(h);
        }
示例#3
0
        public void AddToBoundaryTest()
        {
            var bdh = CreateBoundaryDescriptor(Path.GetRandomFileName());

            Assert.That(bdh.IsInvalid, Is.False);
            BoundaryDescriptorHandle h = bdh;

            try
            {
                var b = AddSIDToBoundaryDescriptor(ref h, SafePSID.Current);
                if (!b)
                {
                    TestContext.WriteLine($"ERR: AddSid={Win32Error.GetLastError()}");
                }
                Assert.That(b, Is.True);

                //var plsid = SafePSID.Init(KnownSIDAuthority.SECURITY_MANDATORY_LABEL_AUTHORITY, MandatoryIntegrityLevelSIDRelativeID.SECURITY_MANDATORY_MEDIUM_RID);
                //b = AddIntegrityLabelToBoundaryDescriptor(ref h, plsid);
                //if (!b) TestContext.WriteLine($"ERR: AddSid={Win32Error.GetLastError()}");
                //Assert.That(b, Is.True);
            }
            finally
            {
                //DeleteBoundaryDescriptor(h);
                bdh.Close();
            }
        }
示例#4
0
            /// <summary>Adds a security identifier (SID) to the boundary descriptor.</summary>
            /// <param name="pSid">A pointer to a <c>SID</c> structure.</param>
            /// <returns>
            /// <para>If the function succeeds, the return value is nonzero.</para>
            /// <para>If the function fails, the return value is zero. To get extended error information, call <c>GetLastError</c>.</para>
            /// </returns>
            public bool AddSid(PSID pSid)
            {
                BoundaryDescriptorHandle h = handle;

                if (Marshal.ReadByte(pSid.DangerousGetHandle(), 7) == 16)
                {
                    return(AddIntegrityLabelToBoundaryDescriptor(ref h, pSid));
                }
                return(AddSIDToBoundaryDescriptor(ref h, pSid));
            }
示例#5
0
 public static extern bool AddSIDToBoundaryDescriptor(ref BoundaryDescriptorHandle BoundaryDescriptor, IntPtr RequiredSid);
示例#6
0
 public static extern bool AddIntegrityLabelToBoundaryDescriptor(ref BoundaryDescriptorHandle BoundaryDescriptor, IntPtr IntegrityLabel);
示例#7
0
 public static extern NamespaceHandle OpenPrivateNamespace(BoundaryDescriptorHandle lpBoundaryDescriptor, string lpAliasPrefix);
示例#8
0
 public static extern void DeleteBoundaryDescriptor(BoundaryDescriptorHandle BoundaryDescriptor);
示例#9
0
 public static extern SafeNamespaceHandle CreatePrivateNamespace(SECURITY_ATTRIBUTES lpPrivateNamespaceAttributes, BoundaryDescriptorHandle lpBoundaryDescriptor, string lpAliasPrefix);
示例#10
0
 private static extern SafeNamespaceHandle OpenPrivateNamespaceInternal(BoundaryDescriptorHandle lpBoundaryDescriptor, string lpAliasPrefix);