EmPowerPagingEnabled

VOID __stdcall EmPowerPagingEnabled(UINT8 PagingEnabled){
  char v2; 
  char v3; 
  struct _KEVENT Event; 
  v2 = 0;
  memset(&Event, 0, sizeof(Event));
  ExAcquirePushLockExclusiveEx((UINT64)&EmpPagingLock, 0i64);
  if( PagingEnabled )
  {
    dword_140C47698 |= 0x80000000;
  }
  else
  {
    dword_140C47698 &= ~0x80000000;
    if( dword_140C47698 )
    {
      v2 = 1;
      KeInitializeEvent(&Event, SynchronizationEvent, 0);
      EmpPagingStatus = &Event;
    }
  }
  v3 = _InterlockedExchangeAdd64((volatile signed __int64 *)&EmpPagingLock, 0xFFFFFFFFFFFFFFFFui64);
  if( (v3 & 2) != 0 && (v3 & 4) == 0 )
    ExfTryToWakePushLock((volatile INT64 *)&EmpPagingLock);
  KeAbPostRelease(&EmpPagingLock);
  if( v2 )
  {
    KeWaitForSingleObject(&Event, Executive, 0, 0, 0i64);
    ExAcquirePushLockExclusiveEx((UINT64)&EmpPagingLock, 0i64);
    EmpPagingStatus = 0i64;
    if( (_InterlockedExchangeAdd64((volatile signed __int64 *)&EmpPagingLock, 0xFFFFFFFFFFFFFFFFui64) & 6) == 2 )
      ExfTryToWakePushLock((volatile INT64 *)&EmpPagingLock);
    KeAbPostRelease(&EmpPagingLock);
  }
}

Referenced by:

PoBroadcastSystemState