WheaInitializeProcessor

NTSTATUS __stdcall WheaInitializeProcessor(_KPRCB *Prcb, UINT64 Phase, WORD **a3){
  NTSTATUS result; 
  unsigned int v4; 
  VOID **PoolWithTag; 
  VOID **v7; 
  INT64 i; 

  result = 0;
  v4 = Phase;
  if( (_DWORD)Phase )
  {
    for( i = *(&WheapErrorSourceTable + 2);
          (_UNKNOWN *)i != (_UNKNOWN *)((char *)&WheapErrorSourceTable + 16);
          i = *(_QWORD *)i )
    {
      if( *(_DWORD *)(i + 108) == 1 )
      {
        *(_DWORD *)(i + 108) = 2;
        result = WheapCallErrorSourceInitialize(i, v4);
        if( result < 0 )
        {
          *(_DWORD *)(i + 108) = 1;
          return result;
        }
      }
    }
  }
  else
  {
    PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x18ui64, 1634035799i64);
    v7 = PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag[1] = &WheapErrorSourceTable;
      *(_DWORD *)PoolWithTag = *(&WheapErrorSourceTable + 1);
      PoolWithTag[2] = (char *)&WheapDeferredInternalLogsEventLock + 224;
      result = 0;
      Prcb->WheaInfo = v7;
    }
    else
    {
      ++*(&WheapDeferredInternalLogsEventLock + 92);
      result = -1073741670;
      *(&WheapDeferredInternalLogsEventLock + 93) |= 0x10u;
    }
  }
  return result;
}

Referenced by:

KiStartDynamicProcessor