CmpFindNameInListCellWithStatus

INT64 __fastcall CmpFindNameInListCellWithStatus(
        _HHIVE *Hive,
        _CELL_DATA *List,
        UINT64 Count,
        _UNICODE_STRING *Name,
        UINT64 Flags,
        UINT64 *ChildIndex,
        UINT64 *CellIndex){
  unsigned int v9; 
  unsigned int v10; 
  _CELL_DATA *v11; 
  int v12; 
  _CELL_DATA *v13; 
  UINT64 v14; 
  wchar_t *v15; 
  unsigned __int16 v16; 
  wchar_t *Buffer; 
  UINT16 v18; 
  unsigned int v19; 
  int v20; 
  INT64 result; 
  int v22; 
  int v23; 
  __int16 v24; 
  __int16 v25; 
  UNICODE_STRING String2; 
  int Flagsa; 
  v25 = 0;
  v23 = -1;
  v9 = Count;
  v24 = 0;
  *(_DWORD *)(&String2.MaximumLength + 1) = 0;
  if( (_DWORD)Count )
  {
    v10 = 0;
    v11 = List;
    v12 = Flags & 0x10000;
    Flagsa = Flags & 0x10000;
    while( 1 )
    {
      v13 = Hive->GetCellRoutine(Hive, v11->u.KeyList[0], &v23);
      v14 = v13->u.KeyNode.Flags;
      v15 = v13->u.KeyValue.Name;
      LOBYTE(v13) = v13->u.KeyString[8];
      String2.Buffer = v15;
      String2.Length = v14;
      String2.MaximumLength = v14;
      if( ((unsigned __int8)v13 & 1) != 0 )
      {
        if( v12 )
        {
          v22 = CmpCompareTwoCompressedNames(Name->Buffer, Name->Length, v15, v14);
          goto LABEL_31;
        }
        v16 = Name->Length >> 1;
        Buffer = Name->Buffer;
        if( v16 )
        {
          while( (_WORD)v14 )
          {
            v18 = *Buffer++;
            v19 = *(unsigned __int8 *)v15;
            v15 = (wchar_t *)((char *)v15 + 1);
            if( v18 != (_WORD)v19 )
            {
              if( v18 >= 0x61u )
              {
                if( v18 > 0x7Au )
                  v18 = NLS_UPCASE(v18);
                else
                  v18 -= 32;
              }
              if( v19 >= 0x61 )
              {
                if( v19 > 0x7A )
                  LOWORD(v19) = NLS_UPCASE(v19);
                else
                  LOWORD(v19) = v19 - 32;
              }
              v20 = v18 - (unsigned __int16)v19;
              if( v20 )
                goto LABEL_13;
            }
            LOWORD(v14) = v14 - 1;
            if( !--v16 )
              break;
          }
        }
        v20 = v16 - (unsigned __int16)v14;
      }
      else
      {
        if( !v12 )
        {
          v22 = RtlCompareUnicodeString(Name, &String2, 1u);
LABEL_31:
          v20 = v22;
          goto LABEL_13;
        }
        v20 = -CmpCompareCompressedName(&String2, Name->Buffer, Name->Length, 0i64);
      }
LABEL_13:
      Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)&v23);
      if( !v20 )
      {
        result = 0i64;
        *(_DWORD *)CellIndex = List->u.KeyList[v10];
        if( ChildIndex )
          *(_DWORD *)ChildIndex = v10;
        return result;
      }
      v12 = Flagsa;
      ++v10;
      v11 = (_CELL_DATA *)((char *)v11 + 4);
      if( v10 >= v9 )
      {
        *(_DWORD *)CellIndex = -1;
        if( ChildIndex )
          *(_DWORD *)ChildIndex = v9;
        return 3221225524i64;
      }
    }
  }
  *(_DWORD *)CellIndex = -1;
  if( ChildIndex )
    *(_DWORD *)ChildIndex = 0;
  return 3221225524i64;
}

Referenced by:

CmpFindNameInListWithStatus
CmpValueEnumStackMatchingValueInUpperLayer