WheaInitializeProcessor

INT64 __fastcall WheaInitializeProcessor(__int64 a1, unsigned int a2){
  INT64 result; 
  _QWORD *PoolWithTag; 
  _QWORD *v6; 
  INT64 i; 
  result = 0i64;
  if( a2 )
  {
    for( i = qword_140CDAE68; (INT64 *)i != &qword_140CDAE68; i = *(_QWORD *)i )
    {
      if( *(_DWORD *)(i + 108) == 1 )
      {
        *(_DWORD *)(i + 108) = 2;
        result = WheapCallErrorSourceInitialize(i, a2);
        if( (int)result < 0 )
        {
          *(_DWORD *)(i + 108) = 1;
          return result;
        }
      }
    }
  }
  else
  {
    PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x18ui64, 0x61656857ui64);
    v6 = PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag[1] = &WheapErrorSourceTable;
      *(_DWORD *)PoolWithTag = dword_140CDAE5C;
      PoolWithTag[2] = &WheapWorkQueue;
      result = 0i64;
      *(_QWORD *)(a1 + 33568) = v6;
    }
    else
    {
      LODWORD(WheapStatus) = WheapStatus + 1;
      result = 3221225626i64;
      HIDWORD(WheapStatus) |= 0x10u;
    }
  }
  return result;
}

Referenced by:

KiStartDynamicProcessor