WheaLogInternalEvent

NTSTATUS __stdcall WheaLogInternalEvent(VOID *Src){
  NTSTATUS *v2; 
  NTSTATUS result; 
  int v4; 
  unsigned int v5; 
  _QWORD *v6; 
  _QWORD *v7; 
  __int64 v8; 
  LPCGUID ActivityId; 
  __int64 InputBuffer[4]; 
  _EVENT_DATA_DESCRIPTOR UserData; 
  __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  NTSTATUS *v16; 
  __int64 v17; 
  __int64 v18; 
  __int64 v19; 
  VOID *v20; 
  int v21; 
  int v22; 

  if( *(&WheapDeferredInternalLogsEventLock + 6) )
  {
    v2 = (NTSTATUS *)((char *)Src + 24);
    result = *v2;
    if( (*v2 & 2) != 0 )
    {
      v16 = v2;
      UserData.Ptr = (unsigned __int64)Src + 12;
      *(_QWORD *)&UserData.Size = 4i64;
      v12 = (__int64)Src + 16;
      v13 = 4i64;
      v14 = (__int64)Src + 20;
      v18 = (__int64)Src + 8;
      v21 = *((_DWORD *)Src + 2);
      v15 = 4i64;
      v17 = 4i64;
      v19 = 4i64;
      v20 = Src;
      v22 = 0;
      EtwWriteEx(*(&SbiVmbusArrivalEvent + 383), &EVENT_WHEA_LOG_ENTRY, 0i64, 0, 0, 0, 6u, &UserData);
      result = *((_DWORD *)Src + 6);
    }
    if( (result & 4) != 0 )
    {
      v8 = *((unsigned int *)Src + 2);
      InputBuffer[2] = 0i64;
      InputBuffer[3] = 15i64;
      InputBuffer[0] = (__int64)Src;
      InputBuffer[1] = v8;
      LODWORD(ActivityId) = 0;
      NtPowerInformation(
        PowerInformationLevelMaximum|SystemPowerCapabilities,
        InputBuffer,
        0x20ui64,
        0i64,
        (UINT64)ActivityId);
      result = *((_DWORD *)Src + 6);
    }
    if( (result & 8) != 0 )
      return WheaSelLogEvent(Src);
  }
  else
  {
    result = KeGetCurrentIrql();
    if( (unsigned __int8)result < 2u )
    {
      KeWaitForSingleObject((UINT64)&WheapDeferredInternalLogsEventLock, 0, 0, 0, 0i64);
      v4 = *((_DWORD *)Src + 7);
      v5 = v4 + WheapDeferredEventTotalBytes + 48;
      if( v5 < 0x1000 )
      {
        v6 = (_QWORD *)((char *)&SbiVmbusArrivalEvent + (unsigned int)WheapDeferredEventTotalBytes + 7168);
        memmove(v6 + 2, Src, v4 + 32);
        v7 = (_QWORD *)qword_140C15DA8;
        WheapDeferredEventTotalBytes = v5;
        if( *(__int64 **)qword_140C15DA8 != &WheapDeferredInternalLogs )
          __fastfail(3u);
        *v6 = &WheapDeferredInternalLogs;
        v6[1] = v7;
        *v7 = v6;
        qword_140C15DA8 = (__int64)v6;
      }
      return KeSetEvent((PRKEVENT)&WheapDeferredInternalLogsEventLock, 0, 0);
    }
  }
  return result;
}

Referenced by:

HalpCmcLogPollingTimeoutEvent
HalpCmcWorkerRoutine
HalpCmciHandler
HalpInitGenericErrorSourceEntry
HalpInitGenericErrorSourceEntryV2
IoSaveBugCheckProgress
IoSaveBugCheckRecoveryStatus
IopWriteBugCheckSelEntries
WheaAddErrorSource
WheaRemoveErrorSource
WheaRemoveErrorSourceDeviceDriver
WheaReportHwError
WheapAttemptPhysicalPageOffline
WheapClearPoison
WheapCreateRecordFromGenericErrorData
WheapEtwEnableCallback
WheapGenerateETWEvents
WheapInitErrorReportDeviceDriver
WheapLogInitEvent
WheapLogPolicyTelemetry
WheapPfaLogPageMonitorRemoval