RtlFindAceByType

VOID *__stdcall RtlFindAceByType(_ACL *pAcl, UINT64 AceType, UINT64 *pIndex){
  _ACL *v4; 
  unsigned int v5; 

  if( !pAcl )
    return 0i64;
  v4 = pAcl + 1;
  v5 = 0;
  if( !pAcl->AceCount )
    return 0i64;
  while( !pIndex )
  {
    if( v4->AclRevision == (_DWORD)AceType )
      return v4;
LABEL_9:
    ++v5;
    v4 = (_ACL *)((char *)v4 + v4->AclSize);
    if( v5 >= pAcl->AceCount )
      return 0i64;
  }
  if( v5 < *(_DWORD *)pIndex || v4->AclRevision != (_DWORD)AceType )
    goto LABEL_9;
  *(_DWORD *)pIndex = v5;
  return v4;
}

Referenced by:

AdtpBuildContextFromSecurityDescriptor
RtlIsUntrustedObject
RtlpCopyAces
RtlpGenerateInheritAcl
RtlpNewSecurityObject
RtlpSetSecurityObject
RtlpValidFilterAclSubjectContext
SeComputeAutoInheritByObjectTypeEx
SeQueryMandatoryLabel
SepGetScopedPolicySid
SepMandatorySubProcessToken
SepSDContainsAttributeACE
SepVerifyDesktopAppxPackageName