CmpValueEnumStackMatchingValueInUpperLayer

INT64 __fastcall CmpValueEnumStackMatchingValueInUpperLayer(INT64 a1, INT16 a2, UINT16 *a3, CHAR *a4){
  UINT16 v8; 
  unsigned int Flags; 
  CHAR v10; 
  INT64 EntryAtLayerHeight; 
  INT64 result; 
  _UNICODE_STRING Name; 
  unsigned int CellIndex; 

  Name = 0i64;
  RtlInitUnicodeString(&Name, 0i64);
  v8 = a3[8];
  Name.Buffer = a3 + 10;
  Flags = (v8 & 1) << 16;
  Name.Length = a3[1];
  v10 = 0;
  Name.MaximumLength = Name.Length;
  while( ++a2 <= *(__int16 *)(a1 + 12) )
  {
    EntryAtLayerHeight = CmpValueEnumStackGetEntryAtLayerHeight(a1, a2);
    result = CmpFindNameInListCellWithStatus(
               *(_HHIVE **)EntryAtLayerHeight,
               *(_CELL_DATA **)(EntryAtLayerHeight + 8),
               *(_DWORD *)(EntryAtLayerHeight + 24),
               &Name,
               Flags,
               0i64,
               &CellIndex);
    if( (int)result >= 0 )
    {
      v10 = 1;
      break;
    }
    if( (_DWORD)result != -1073741772 )
      return result;
  }
  *a4 = v10;
  return 0i64;
}

Referenced by:

CmpValueEnumStackAdvance