WheaLogInternalEvent

NTSTATUS __stdcall WheaLogInternalEvent(PVOID Src){
  NTSTATUS *v2; 
  NTSTATUS result; 
  __int64 v4; 
  unsigned int v5; 
  UINT8 *v6; 
  UINT8 **v7; 
  __int64 v8; 
  LPCGUID ActivityId; 
  UINT64 UserDataCount; 
  __int64 InputBuffer[4]; 
  EVENT_DATA_DESCRIPTOR UserData; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  __int64 v16; 
  NTSTATUS *v17; 
  __int64 v18; 
  __int64 v19; 
  __int64 v20; 
  PVOID v21; 
  int v22; 
  int v23; 
  if( WheapEventingInitialized )
  {
    v2 = (NTSTATUS *)((char *)Src + 24);
    result = *v2;
    if( (*v2 & 2) != 0 )
    {
      v17 = v2;
      UserData.Ptr = (unsigned __int64)Src + 12;
      *(_QWORD *)&UserData.Size = 4i64;
      v13 = (__int64)Src + 16;
      v14 = 4i64;
      v15 = (__int64)Src + 20;
      v19 = (__int64)Src + 8;
      v22 = *((_DWORD *)Src + 2);
      LODWORD(UserDataCount) = 6;
      v16 = 4i64;
      v18 = 4i64;
      v20 = 4i64;
      v21 = Src;
      v23 = 0;
      EtwWriteEx(
        WheapEtwHandle,
        (EVENT_DESCRIPTOR *)&EVENT_WHEA_LOG_ENTRY,
        0i64,
        0i64,
        0i64,
        0i64,
        UserDataCount,
        &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(TraceApplicationPowerMessage|0x40, 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(&WheapDeferredInternalLogsEventLock, Executive, 0, 0, 0i64);
      v4 = *((unsigned int *)Src + 7);
      v5 = v4 + WheapDeferredEventTotalBytes + 48;
      if( v5 < 0x1000 )
      {
        v6 = (UINT8 *)WheapDeferredEventBuffer + (unsigned int)WheapDeferredEventTotalBytes;
        memmove(v6 + 16, (UINT8 *)Src, v4 + 32);
        v7 = (UINT8 **)qword_140C15DA8;
        WheapDeferredEventTotalBytes = v5;
        if( *(__int64 **)qword_140C15DA8 != &WheapDeferredInternalLogs )
          __fastfail(3u);
        *(_QWORD *)v6 = &WheapDeferredInternalLogs;
        *((_QWORD *)v6 + 1) = v7;
        *v7 = v6;
        qword_140C15DA8 = (__int64)v6;
      }
      return KeSetEvent(&WheapDeferredInternalLogsEventLock, 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