WheaAddHwErrorReportSectionDeviceDriver

__int64 __fastcall WheaAddHwErrorReportSectionDeviceDriver(_DWORD *a1, unsigned int a2, __int64 a3){
  __int64 v4; 
  __int64 v5; 
  unsigned int v6; 
  INT64 *ErrorSource; 
  __int64 v8; 
  __int64 v9; 
  v4 = a2;
  if( WheapErrorHandleIsValid(a1) )
  {
    ErrorSource = WheapGetErrorSource((INT64)&WheapErrorSourceTable, *(unsigned int *)(v5 + 12));
    if( ((unsigned __int64)(ErrorSource + 12) & ((unsigned __int128)-(__int128)(unsigned __int64)ErrorSource >> 64)) != 0 )
    {
      if( *(_DWORD *)(v8 + 4) >= *(_DWORD *)(((unsigned __int64)(ErrorSource + 12) & ((unsigned __int128)-(__int128)(unsigned __int64)ErrorSource >> 64))
                                            + 0x8C)
        || (unsigned int)v4 > *(_DWORD *)(((unsigned __int64)(ErrorSource + 12) & ((unsigned __int128)-(__int128)(unsigned __int64)ErrorSource >> 64))
                                        + 0x88)
        || (unsigned int)(v4 + *(_DWORD *)(v8 + 8)) > *(_DWORD *)(((unsigned __int64)(ErrorSource + 12) & ((unsigned __int128)-(__int128)(unsigned __int64)ErrorSource >> 64))
                                                                + 0x10) )
      {
        return(unsigned int)-1073741670;
      }
      else
      {
        **(_DWORD **)(v8 + 16) ^= ((unsigned __int16)**(_DWORD **)(v8 + 16) ^ (unsigned __int16)(**(_DWORD **)(v8 + 16)
                                                                                               + 16)) & 0x3FF0;
        v9 = *(_QWORD *)(v8 + 24);
        *(_DWORD *)(v9 + 16) = *(_DWORD *)(v8 + 52);
        *(_DWORD *)(v9 + 24) = v4;
        *(_WORD *)(v9 + 20) = 768;
        *(_QWORD *)(a3 + 24) = v9 + 44;
        *(_QWORD *)(a3 + 16) = v9;
        *(_BYTE *)(v9 + 22) |= 2u;
        ++*(_DWORD *)(v8 + 4);
        *(_QWORD *)(a3 + 32) = v9 + 23;
        *(_QWORD *)(a3 + 4) = v9 + 72;
        *(_DWORD *)(a3 + 12) = v4;
        *(_QWORD *)(v8 + 24) = v9 + 72 + v4;
        *(_DWORD *)(v8 + 8) += v4 + 72;
        *(_DWORD *)a3 = 1;
      }
    }
    else
    {
      return(unsigned int)-1073741130;
    }
  }
  else
  {
    return(unsigned int)-1073741816;
  }
  return v6;
}

Referenced by:

WheaReportFatalHwErrorDeviceDriverEx
WheaReportHwErrorDeviceDriverEx