RtlpFilterSacl

VOID __stdcall RtlpFilterSacl(_ACL *pSourceSacl, _ACL *pDestSacl, UINT64 *Length, UINT64 SecurityInformation){
  _ACL *v4; 
  _ACL *v5; 
  unsigned int v6; 
  int v8; 
  _ACL *v9; 
  unsigned int AclRevision; 
  bool v11; 
  unsigned int v12; 
  _ACL *v13; 
  unsigned int v14; 
  unsigned int v15; 
  unsigned int v16; 
  char v17; 
  bool v18; 
  __int64 AclSize; 
  unsigned int v20; 
  unsigned int v21; 
  unsigned int v22; 
  unsigned int v23; 

  v4 = pSourceSacl + 1;
  v5 = pDestSacl;
  LODWORD(pDestSacl) = 0;
  v6 = SecurityInformation;
  v8 = 8;
  v9 = pSourceSacl + 1;
  if( pSourceSacl->AceCount )
  {
    for( pDestSacl = (_ACL *)pSourceSacl->AceCount; pDestSacl; pDestSacl = (_ACL *)((char *)pDestSacl - 1) )
    {
      AclRevision = v9->AclRevision;
      if( AclRevision > 0x12 )
      {
        v20 = AclRevision - 19;
        if( v20 )
        {
          v21 = v20 - 1;
          if( !v21 )
          {
            if( (SecurityInformation & 0x80u) == 0i64 )
              goto LABEL_13;
LABEL_12:
            v8 += v9->AclSize;
            goto LABEL_13;
          }
          if( v21 != 1 )
            goto LABEL_33;
          v11 = (SecurityInformation & 0x100) == 0;
        }
        else
        {
          v11 = (SecurityInformation & 0x40) == 0;
        }
      }
      else
      {
        if( AclRevision != 18 )
        {
          if( AclRevision > 3 && AclRevision > 6 && AclRevision > 8 && AclRevision > 0xC && AclRevision > 0x10 )
          {
            v11 = (SecurityInformation & 0x10) == 0;
            goto LABEL_11;
          }
LABEL_33:
          v11 = (SecurityInformation & 8) == 0;
          goto LABEL_11;
        }
        v11 = (SecurityInformation & 0x20) == 0;
      }
LABEL_11:
      if( !v11 )
        goto LABEL_12;
LABEL_13:
      v9 = (_ACL *)((char *)v9 + v9->AclSize);
    }
  }
  v12 = (v8 + 3) & 0xFFFFFFFC;
  if( *(_DWORD *)Length < v12 )
  {
    *(_DWORD *)Length = v12;
    return;
  }
  v13 = v5 + 1;
  *v5 = *pSourceSacl;
  v14 = (unsigned int)pDestSacl;
  for( *(_DWORD *)&v5->AclSize = 8; v14 < pSourceSacl->AceCount; v4 = (_ACL *)((char *)v4 + (unsigned __int16)AclSize) )
  {
    v15 = v4->AclRevision;
    if( v15 > 0x12 )
    {
      v22 = v15 - 19;
      if( !v22 )
      {
        if( (v6 & 0x40) == 0 )
        {
LABEL_39:
          LOWORD(AclSize) = v4->AclSize;
          goto LABEL_31;
        }
        v17 = 1;
        goto LABEL_28;
      }
      v23 = v22 - 1;
      if( !v23 )
      {
        v16 = v6 >> 7;
        goto LABEL_27;
      }
      if( v23 == 1 )
      {
        v16 = v6 >> 8;
        goto LABEL_27;
      }
    }
    else
    {
      if( v15 == 18 )
      {
        v16 = v6 >> 5;
        goto LABEL_27;
      }
      if( v15 >= 2 )
      {
        if( v15 <= 3 )
          goto LABEL_38;
        if( v15 > 6 )
        {
          if( v15 <= 8 )
            goto LABEL_38;
          if( v15 > 0xC )
          {
            if( v15 <= 0x10 )
LABEL_38:
              v16 = v6 >> 3;
            else
              v16 = v6 >> 4;
LABEL_27:
            v17 = v16 & 1;
LABEL_28:
            v18 = v17 == 0;
            goto LABEL_29;
          }
        }
      }
    }
    v18 = (v6 & 8) == 0;
LABEL_29:
    if( v18 )
      goto LABEL_39;
    memmove(v13, v4, v4->AclSize);
    ++v5->AceCount;
    v5->AclSize += v4->AclSize;
    AclSize = v4->AclSize;
    v13 = (_ACL *)((char *)v13 + AclSize);
LABEL_31:
    ++v14;
  }
}

Referenced by:

SeQuerySecurityDescriptorInfo