CmpWaitForHiveMount

UINT8 __stdcall CmpWaitForHiveMount(_UNICODE_STRING *Path, UINT64 ParentLevel, UINT8 Wait, UINT64 *IndexToWaitOn){
  _UNICODE_STRING v4; 
  UINT8 v5; 
  unsigned __int16 v7; 
  wchar_t *Buffer; 
  unsigned __int16 v9; 
  unsigned int v10; 
  int v11; 
  unsigned __int16 v12; 
  __int64 v13; 
  __int64 v15; 
  __int64 v16; 
  bool v17; 
  UNICODE_STRING Component; 
  v4 = *Path;
  v5 = 0;
  v7 = _mm_cvtsi128_si32(*(__m128i *)Path);
  Component = v4;
  Component.Length = v7;
  if( !v7 )
    goto LABEL_18;
  Buffer = Component.Buffer;
  do
  {
    if( *Buffer != 92 )
      break;
    ++Buffer;
    v17 = v7 == 2;
    v7 -= 2;
    Component.Length = v7;
  }
  while( !v17 );
  Component.Buffer = Buffer;
  if( v7 )
  {
    v9 = 0;
    v10 = 1;
    do
    {
      if( Buffer[v9] == 92 )
        break;
      ++v9;
      v7 -= 2;
    }
    while( v7 );
    Component.Length = 2 * v9;
    v11 = CmpHashUnicodeComponent(&Component);
    v12 = 0;
    while( 1 )
    {
      v13 = 3i64 * v12;
      if( dword_140C0154C[6 * v12] == v11 )
        break;
      if( ++v12 >= 8u )
      {
        _interlockedbittestandset(dword_140C01550, 2u);
        return 0;
      }
    }
    _interlockedbittestandset(&dword_140C01550[6 * v12], 3u);
    _InterlockedAdd(&dword_140C01554[6 * v12], 1u);
    v15 = 3i64 * v12;
    KeSetEvent((struct _KEVENT *)((char *)&stru_140C00F40 + 200 * (unsigned int)dword_140C01548[6 * v12]), 0);
    v16 = (unsigned int)dword_140C01548[2 * v15];
    if( !HIDWORD(qword_140C00F70[25 * v16]) )
    {
      v5 = 1;
      *(_DWORD *)IndexToWaitOn = v16;
      v10 = 5;
    }
    _interlockedbittestandset(&dword_140C01550[2 * v13], v10);
    return v5;
  }
  else
  {
LABEL_18:
    _interlockedbittestandset(dword_140C01550, 0);
    return 0;
  }
}

Referenced by:

CmpDoParseKey
CmpPerformCompleteKcbCacheLookup