RtlFindUnicodePrefix

_UNICODE_PREFIX_TABLE_ENTRY *__stdcall RtlFindUnicodePrefix(
        _UNICODE_PREFIX_TABLE *PrefixTable,
        const _UNICODE_STRING *FullName,
        UINT64 CaseInsensitiveIndex){
  PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree; 
  _UNICODE_PREFIX_TABLE *v4; 
  unsigned int v5; 
  CSHORT v7; 
  _RTL_SPLAY_LINKS *i; 
  _UNICODE_PREFIX_TABLE_ENTRY *v10; 
  _COMPARISON v11; 
  struct _UNICODE_PREFIX_TABLE_ENTRY *v12; 
  _UNICODE_PREFIX_TABLE_ENTRY *v13; 

  NextPrefixTree = PrefixTable->NextPrefixTree;
  v4 = PrefixTable;
  v5 = CaseInsensitiveIndex;
  v7 = ComputeUnicodeNameLength((_UNICODE_STRING *)FullName);
  while( NextPrefixTree->NameLength > v7 )
  {
    v4 = (_UNICODE_PREFIX_TABLE *)NextPrefixTree;
    NextPrefixTree = NextPrefixTree->NextPrefixTree;
  }
LABEL_4:
  if( NextPrefixTree->NameLength <= 0 )
    return 0i64;
  for( i = &NextPrefixTree->Links; ; i = i->RightChild )
  {
    while( 1 )
    {
      if( !i )
      {
LABEL_16:
        v4 = (_UNICODE_PREFIX_TABLE *)NextPrefixTree;
        NextPrefixTree = NextPrefixTree->NextPrefixTree;
        goto LABEL_4;
      }
      v10 = (_UNICODE_PREFIX_TABLE_ENTRY *)&i[-1];
      v11 = CompareUnicodeStrings((const _UNICODE_STRING *)i[1].Parent, FullName, 0i64);
      if( v11 != IsGreaterThan )
        break;
      i = i->LeftChild;
    }
    if( v11 )
      break;
  }
  if( v5 )
  {
    v13 = (_UNICODE_PREFIX_TABLE_ENTRY *)&i[-1];
    while( (unsigned int)(CompareUnicodeStrings(v13->Prefix, FullName, v5) - 1) > 1 )
    {
      v13 = v13->CaseMatch;
      if( v13 == v10 )
        goto LABEL_16;
    }
    return v13;
  }
  else
  {
    if( v10->NodeTypeCode == 2050 )
    {
      v12 = NextPrefixTree->NextPrefixTree;
      NextPrefixTree->NextPrefixTree = 0i64;
      NextPrefixTree->NodeTypeCode = 2050;
      v10 = (_UNICODE_PREFIX_TABLE_ENTRY *)&RtlSplay(i)[-1];
      v10->NodeTypeCode = 2049;
      v4->NextPrefixTree = v10;
      v10->NextPrefixTree = v12;
    }
    return v10;
  }
}

Referenced by:

No references.