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)); }
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);
public SecurityIdentifier MarshalOwnerToManaged() => SID.MarshalToManagedSid(Owner);
public SecurityIdentifier MarshalTokenAppContainerToManaged() => SID.MarshalToManagedSid(TokenAppContainer);
public SecurityIdentifier MarshalPrimaryGroupToManaged() => SID.MarshalToManagedSid(PrimaryGroup);