CmpWaitOnHiveWriteQueue

INT64 __fastcall CmpWaitOnHiveWriteQueue(_CMHIVE *CmHive, _HIVE_WRITE_WAIT_QUEUE *Queue, UINT64 Flags){
  UINT64 v5; 
  EVENT_DESCRIPTOR *v6; 
  void *v7; 
  void *v8; 
  EVENT_DESCRIPTOR *v9; 
  PVOID v10; 
  UINT64 v11; 
  struct _KEVENT Event; 
  __int64 v14; 
  _HIVE_WAIT_PACKET *WaitList; 
  EVENT_DESCRIPTOR EventDescriptor; 
  EVENT_DESCRIPTOR v17; 
  memset(&Event, 0, sizeof(Event));
  v14 = 0i64;
  KeInitializeEvent(&Event, SynchronizationEvent, 0);
  WaitList = Queue->WaitList;
  Queue->WaitList = (_HIVE_WAIT_PACKET *)&Event;
  if( (_InterlockedExchangeAdd64((volatile signed __int64 *)CmHive + 9, 0xFFFFFFFFFFFFFFFFui64) & 6) == 2 )
    ExfTryToWakePushLock((volatile INT64 *)CmHive + 9);
  KeAbPostRelease((char *)CmHive + 72);
  CmpUnlockRegistry();
  v5 = EtwpRegTraceHandle;
  EventDescriptor = (EVENT_DESCRIPTOR)REGISTRY_PERF_EVENT_HIVE_FLUSH_START_WAIT_FOR_ACTIVE;
  if( EtwEventEnabled(EtwpRegTraceHandle, &EventDescriptor, v6) )
    EtwWrite(v5, &EventDescriptor, 0i64, 0i64, 0i64);
  LODWORD(v7) = KeAbPreAcquire(Queue, 0i64, 0i64);
  v8 = v7;
  if( v7 )
    KeAbPreWait(v7);
  KeWaitForSingleObject(&Event, Executive, 0, 0, 0i64);
  if( v8 )
  {
    LODWORD(v10) = KeAbPreAcquire(Queue, v8, 0i64);
    KeAbPostReleaseEx(Queue, v10);
  }
  v11 = EtwpRegTraceHandle;
  v17 = (EVENT_DESCRIPTOR)REGISTRY_PERF_EVENT_HIVE_FLUSH_FINISH_WAIT_FOR_ACTIVE;
  if( EtwEventEnabled(EtwpRegTraceHandle, &v17, v9) )
    EtwWrite(v11, &v17, 0i64, 0i64, 0i64);
  return(unsigned int)v14;
}

Referenced by:

CmpBecomeActiveFlusherAndReconciler
CmpFlushHive
NtCompressKey