CmpTryToLockHashEntryExclusive

UINT8 __stdcall CmpTryToLockHashEntryExclusive(_CMHIVE *Hive, _CM_PATH_HASH PathHash){
  ULONG_PTR BugCheckParameter4; 
  UINT8 v4; 
  _QWORD *v5; 
  _BYTE *v6; 
  BugCheckParameter4 = PathHash.Hash;
  v4 = 1;
  v5 = (_QWORD *)(*((_QWORD *)Hive + 205)
                + 24
                * ((unsigned int)(*((_DWORD *)Hive + 412) - 1) & ((101027 * (PathHash.Hash ^ (PathHash.Hash >> 9))) ^ ((unsigned __int64)(101027 * (PathHash.Hash ^ (PathHash.Hash >> 9))) >> 9))));
  LODWORD(v6) = KeAbPreAcquire(v5, 0i64, 1ui64);
  if( _interlockedbittestandset64((volatile signed __int32 *)v5, 0i64) )
  {
    if( v6 )
      KeAbPostReleaseEx(v5, v6);
    return 0;
  }
  else
  {
    if( v6 )
      v6[26] |= 1u;
    v5[1] = KeGetCurrentThread();
    if( !CmpReferenceHive(Hive) )
      KeBugCheckEx(0x51u, 0x17ui64, (ULONG_PTR)Hive, 0xDui64, BugCheckParameter4);
  }
  return v4;
}

Referenced by:

CmpDoParseKey