SddlFilterSacl

VOID __stdcall SddlFilterSacl(_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; 
  unsigned int v13; 
  unsigned int v14; 
  _ACL *v15; 
  unsigned int v16; 
  unsigned int v17; 
  unsigned int v18; 
  char v19; 
  unsigned int v20; 
  unsigned int v21; 
  bool v22; 
  __int64 AclSize; 

  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 )
      {
        v12 = AclRevision - 19;
        if( v12 )
        {
          v13 = v12 - 1;
          if( !v13 )
          {
            if( (SecurityInformation & 0x80u) != 0i64 )
              goto LABEL_22;
            goto LABEL_23;
          }
          if( v13 != 1 )
            goto LABEL_12;
          v11 = (SecurityInformation & 0x100) == 0;
        }
        else
        {
          v11 = (SecurityInformation & 0x40) == 0;
        }
      }
      else
      {
        if( AclRevision != 18 )
        {
          if( AclRevision >= 2
            && AclRevision > 3
            && AclRevision > 6
            && AclRevision > 8
            && AclRevision > 0xC
            && AclRevision > 0x10 )
          {
            v11 = (SecurityInformation & 0x10) == 0;
            goto LABEL_21;
          }
LABEL_12:
          v11 = (SecurityInformation & 8) == 0;
          goto LABEL_21;
        }
        v11 = (SecurityInformation & 0x20) == 0;
      }
LABEL_21:
      if( !v11 )
LABEL_22:
        v8 += v9->AclSize;
LABEL_23:
      v9 = (_ACL *)((char *)v9 + v9->AclSize);
    }
  }
  v14 = (v8 + 3) & 0xFFFFFFFC;
  if( *(_DWORD *)Length < v14 )
  {
    *(_DWORD *)Length = v14;
    return;
  }
  v15 = v5 + 1;
  *v5 = *pSourceSacl;
  v16 = (unsigned int)pDestSacl;
  for( *(_DWORD *)&v5->AclSize = 8; v16 < pSourceSacl->AceCount; v4 = (_ACL *)((char *)v4 + (unsigned __int16)AclSize) )
  {
    v17 = v4->AclRevision;
    if( v17 > 0x12 )
    {
      v20 = v17 - 19;
      if( !v20 )
      {
        if( (v6 & 0x40) == 0 )
          goto LABEL_50;
        v19 = 1;
        goto LABEL_47;
      }
      v21 = v20 - 1;
      if( v21 )
      {
        if( v21 != 1 )
        {
LABEL_42:
          v22 = (v6 & 8) == 0;
          goto LABEL_48;
        }
        v18 = v6 >> 8;
      }
      else
      {
        v18 = v6 >> 7;
      }
    }
    else if( v17 == 18 )
    {
      v18 = v6 >> 5;
    }
    else
    {
      if( v17 < 2 )
        goto LABEL_42;
      if( v17 <= 3 )
        goto LABEL_36;
      if( v17 <= 6 )
        goto LABEL_42;
      if( v17 <= 8 )
        goto LABEL_36;
      if( v17 <= 0xC )
        goto LABEL_42;
      if( v17 <= 0x10 )
LABEL_36:
        v18 = v6 >> 3;
      else
        v18 = v6 >> 4;
    }
    v19 = v18 & 1;
LABEL_47:
    v22 = v19 == 0;
LABEL_48:
    if( v22 )
    {
LABEL_50:
      LOWORD(AclSize) = v4->AclSize;
      goto LABEL_51;
    }
    memmove(v15, v4, v4->AclSize);
    ++v5->AceCount;
    v5->AclSize += v4->AclSize;
    AclSize = v4->AclSize;
    v15 = (_ACL *)((char *)v15 + AclSize);
LABEL_51:
    ++v16;
  }
}

Referenced by:

LocalConvertSDToStringSD_Rev1