RtlSelfRelativeToAbsoluteSD

NTSTATUS __fastcall RtlSelfRelativeToAbsoluteSD(
        VOID *SelfRelativeSecurityDescriptor,
        VOID *AbsoluteSecurityDescriptor,
        UINT64 *AbsoluteSecurityDescriptorSize,
        _ACL *Dacl,
        UINT64 *DaclSize,
        _ACL *Sacl,
        UINT64 *SaclSize,
        VOID *Owner,
        UINT64 *OwnerSize,
        VOID *PrimaryGroup,
        UINT64 *PrimaryGroupSize){
  const VOID *v14; 
  UINT64 *v15; 
  UINT64 *v16; 
  UINT64 *v17; 
  UINT64 *v18; 
  int v19; 
  int v20; 
  int v21; 
  int v22; 
  unsigned __int8 *v23; 
  VOID *v24; 
  VOID *v25; 
  NTSTATUS result; 
  _ACL *v27; 
  UINT64 v28; 
  VOID *v29; 
  VOID *Src; 
  VOID *v31; 
  VOID *v32; 
  UINT64 v33; 
  UINT64 v34; 

  LODWORD(v33) = 0;
  LODWORD(v34) = 0;
  v28 = 0i64;
  v29 = 0i64;
  Src = 0i64;
  v32 = 0i64;
  v31 = 0i64;
  if( *((__int16 *)SelfRelativeSecurityDescriptor + 1) >= 0 )
    return -1073741593;
  RtlpQuerySecurityDescriptor(
    (_SECURITY_DESCRIPTOR *)SelfRelativeSecurityDescriptor,
    &v29,
    &v28,
    &Src,
    (UINT64 *)((char *)&v28 + 4),
    (_ACL **)&v32,
    &v33,
    (_ACL **)&v31,
    &v34);
  v15 = PrimaryGroupSize;
  v16 = OwnerSize;
  v17 = SaclSize;
  v18 = DaclSize;
  v19 = v33;
  v20 = v34;
  v21 = v28;
  v22 = HIDWORD(v28);
  if( AbsoluteSecurityDescriptor
    && *(_DWORD *)AbsoluteSecurityDescriptorSize >= 0x28u
    && (unsigned int)v28 <= *(_DWORD *)OwnerSize
    && (unsigned int)v33 <= *(_DWORD *)DaclSize
    && (unsigned int)v34 <= *(_DWORD *)SaclSize
    && HIDWORD(v28) <= *(_DWORD *)PrimaryGroupSize )
  {
    memmove(AbsoluteSecurityDescriptor, v14, 0x14u);
    v23 = (unsigned __int8 *)v29;
    *((_WORD *)AbsoluteSecurityDescriptor + 1) &= ~0x8000u;
    *((_QWORD *)AbsoluteSecurityDescriptor + 1) = 0i64;
    *((_QWORD *)AbsoluteSecurityDescriptor + 2) = 0i64;
    *((_QWORD *)AbsoluteSecurityDescriptor + 3) = 0i64;
    *((_QWORD *)AbsoluteSecurityDescriptor + 4) = 0i64;
    if( v23 )
    {
      v24 = Owner;
      memmove(Owner, v23, 4 * v23[1] + 8);
      *((_QWORD *)AbsoluteSecurityDescriptor + 1) = v24;
    }
    if( Src )
    {
      v25 = PrimaryGroup;
      memmove(PrimaryGroup, Src, 4 * *((unsigned __int8 *)Src + 1) + 8);
      *((_QWORD *)AbsoluteSecurityDescriptor + 2) = v25;
    }
    if( v31 )
    {
      v27 = Sacl;
      memmove(Sacl, v31, *((unsigned __int16 *)v31 + 1));
      *((_QWORD *)AbsoluteSecurityDescriptor + 3) = v27;
    }
    if( v32 )
    {
      memmove(Dacl, v32, *((unsigned __int16 *)v32 + 1));
      *((_QWORD *)AbsoluteSecurityDescriptor + 4) = Dacl;
    }
    return 0;
  }
  else
  {
    *(_DWORD *)AbsoluteSecurityDescriptorSize = 40;
    *(_DWORD *)v15 = v22;
    result = -1073741789;
    *(_DWORD *)v16 = v21;
    *(_DWORD *)v17 = v20;
    *(_DWORD *)v18 = v19;
  }
  return result;
}

Referenced by:

No references.