public static RawSecurityDescriptor MarshalToManagedSecurityDescriptor(IntPtr ptrSecDesc)
        {
            if (ptrSecDesc == IntPtr.Zero)
            {
                return(null);
            }
            ControlFlags       controlFlags;
            SecurityIdentifier owner, group;
            RawAcl             sacl, dacl;

            unsafe
            {
                STRUCT_SECURITY_DESCRIPTOR *pSecDesc = (STRUCT_SECURITY_DESCRIPTOR *)ptrSecDesc.ToPointer();
                controlFlags = (ControlFlags)pSecDesc->Control;
                owner        = SID.MarshalToManagedSid(pSecDesc->Owner);
                group        = SID.MarshalToManagedSid(pSecDesc->Group);
                sacl         = ACL.MarshalToManagedAcl(pSecDesc->Sacl);
                dacl         = ACL.MarshalToManagedAcl(pSecDesc->Dacl);
            }
            return(new RawSecurityDescriptor(controlFlags, owner, group, sacl, dacl));
        }
Esempio n. 2
0
 public SecurityIdentifier MarshalPrincipalSelfSidToManaged() =>
 SID.MarshalToManagedSid(PrincipalSelfSid);
 public SecurityIdentifier MarshalSidToManaged() =>
 SID.MarshalToManagedSid(Sid);
 public unsafe SecurityIdentifier MarshalAppContainerSidToManagedSid() =>
 SID.MarshalToManagedSid(new IntPtr(AppContainerSid));
 public SecurityIdentifier MarshalTrustLevelSidToManaged() =>
 SID.MarshalToManagedSid(TrustLevelSid);
Esempio n. 6
0
 public SecurityIdentifier MarshalOwnerToManaged() =>
 SID.MarshalToManagedSid(Owner);
Esempio n. 7
0
 public SecurityIdentifier MarshalTokenAppContainerToManaged() =>
 SID.MarshalToManagedSid(TokenAppContainer);
Esempio n. 8
0
 public SecurityIdentifier MarshalPrimaryGroupToManaged() =>
 SID.MarshalToManagedSid(PrimaryGroup);