CompareUnicodeStrings

_COMPARISON __stdcall CompareUnicodeStrings(
        const _UNICODE_STRING *Prefix,
        const _UNICODE_STRING *Name,
        UINT64 CaseInsensitiveIndex){
  __int64 v4; 
  unsigned int v6; 
  unsigned int v7; 
  UINT16 v8; 
  UINT16 v9; 
  unsigned int v10; 
  UINT16 *v11; 
  wchar_t *v12; 
  UINT16 v13; 
  wchar_t *Buffer; 

  v4 = Prefix->Length >> 1;
  v6 = Name->Length >> 1;
  if( (_DWORD)v4 == 1 && *Prefix->Buffer == 92 && v6 > 1 && *Name->Buffer == 92 )
    return 1;
  v7 = Prefix->Length >> 1;
  if( (unsigned int)v4 >= v6 )
    v7 = Name->Length >> 1;
  if( (unsigned int)CaseInsensitiveIndex > v7 )
    LODWORD(CaseInsensitiveIndex) = v7;
  v8 = 0;
  v9 = 0;
  v10 = 0;
  if( (_DWORD)CaseInsensitiveIndex )
  {
    Buffer = Prefix->Buffer;
    do
    {
      v8 = Buffer[v10];
      v9 = Name->Buffer[v10];
      if( v8 != v9 )
        break;
      ++v10;
    }
    while( v10 < (unsigned int)CaseInsensitiveIndex );
  }
  if( v10 == (_DWORD)CaseInsensitiveIndex )
  {
    v11 = &Prefix->Buffer[v10];
    v12 = &Name->Buffer[v10];
    if( v10 >= v7 )
      goto LABEL_19;
    do
    {
      v8 = *v11++;
      v9 = *v12++;
      if( v8 != v9 )
      {
        NLS_UPCASE(v8);
        v9 = NLS_UPCASE(v13);
        if( v8 != v9 )
          break;
      }
      ++v10;
    }
    while( v10 < v7 );
  }
  if( v10 < v7 )
  {
    if( v8 == 92 )
      return 0;
    if( v9 == 92 )
      return 3;
    if( v8 < v9 )
      return 0;
    if( v8 > v9 )
      return 3;
  }
LABEL_19:
  if( (unsigned int)v4 < v6 )
    return Name->Buffer[v4] == 92;
  if( (unsigned int)v4 > v6 )
    return 3;
  return 2;
}

Referenced by:

RtlFindUnicodePrefix
RtlInsertUnicodePrefix