HalpInitGenericErrorSourceEntry

__int64 __fastcall HalpInitGenericErrorSourceEntry(__int64 a1, _QWORD *a2){
  unsigned int v4; 
  VOID **PoolWithTag; 
  VOID **v6; 
  size_t v7; 
  VOID **v8; 
  VOID *v9; 
  void *v10; 
  VOID **v11; 
  __int64 v12; 
  __int128 v13; 
  int Src[2]; 
  __int64 v16; 
  int v17; 
  int v18; 
  int v19; 
  int v20; 
  _NTSTRSAFE_PSTR pszDest[4]; 
  __int128 v22; 
  __int64 v23; 
  __int64 v24; 

  v4 = 0;
  PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x428ui64, 543973704i64);
  v6 = PoolWithTag;
  if( !PoolWithTag )
  {
LABEL_2:
    v4 = -1073741670;
    goto LABEL_13;
  }
  memset(PoolWithTag, 0i64, 0x428u);
  *((_DWORD *)v6 + 12) = *(_DWORD *)(a1 + 44);
  v6[5] = MmMapIoSpaceEx(*(_LARGE_INTEGER *)(a1 + 56), 8ui64, 0x204ui64);
  v23 = *(_QWORD *)(a1 + 56);
  v24 = *(unsigned int *)(a1 + 44);
  *(_OWORD *)pszDest = 0i64;
  v22 = 0i64;
  Src[0] = 1733060695;
  Src[1] = 1;
  v16 = 80i64;
  v18 = -2147483615;
  v17 = 1280201291;
  v19 = 2;
  v20 = 48;
  RtlStringCchCopyA((CHAR *)pszDest, 0x20ui64, (CHAR *)"Error_Status_block_register");
  WheaLogInternalEvent(Src);
  if( !v6[5] )
  {
LABEL_7:
    v10 = v6[3];
    if( v10 )
      ExFreePoolWithTag(v10, 0x206C6148u);
    ExFreePoolWithTag(v6, 0x206C6148u);
    v6 = 0i64;
    goto LABEL_2;
  }
  v7 = *(_DWORD *)(a1 + 16) + 80 + *((_DWORD *)v6 + 12);
  v8 = ExAllocatePoolWithTag(0x200ui64, v7, 543973704i64);
  v6[3] = v8;
  if( !v8 )
  {
    v9 = v6[5];
    if( v9 )
      MmUnmapIoSpace(v9, 8ui64);
    goto LABEL_7;
  }
  memset(v8, 0i64, v7);
  v11 = v6 + 11;
  v12 = 7i64;
  *(_DWORD *)v6[3] = 1095059543;
  *((_DWORD *)v6[3] + 1) = 3;
  *((_DWORD *)v6[3] + 2) = v7;
  *((_DWORD *)v6[3] + 4) = 6;
  *((_DWORD *)v6[3] + 6) = *(_DWORD *)(a1 + 28);
  *((_DWORD *)v6[3] + 7) = 5;
  *((GUID *)v6[3] + 2) = GENERIC_NOTIFY_TYPE_GUID;
  *((_DWORD *)v6[3] + 14) = 7;
  *((_DWORD *)v6[3] + 16) = 80;
  *((_DWORD *)v6[3] + 17) = *((_DWORD *)v6 + 12);
  do
  {
    *(_OWORD *)v11 = *(_OWORD *)a1;
    *((_OWORD *)v11 + 1) = *(_OWORD *)(a1 + 16);
    *((_OWORD *)v11 + 2) = *(_OWORD *)(a1 + 32);
    *((_OWORD *)v11 + 3) = *(_OWORD *)(a1 + 48);
    *((_OWORD *)v11 + 4) = *(_OWORD *)(a1 + 64);
    *((_OWORD *)v11 + 5) = *(_OWORD *)(a1 + 80);
    *((_OWORD *)v11 + 6) = *(_OWORD *)(a1 + 96);
    v11 += 16;
    v13 = *(_OWORD *)(a1 + 112);
    a1 += 128i64;
    *((_OWORD *)v11 - 1) = v13;
    --v12;
  }
  while( v12 );
  *(_OWORD *)v11 = *(_OWORD *)a1;
  *((_OWORD *)v11 + 1) = *(_OWORD *)(a1 + 16);
  *((_OWORD *)v11 + 2) = *(_OWORD *)(a1 + 32);
  *((_OWORD *)v11 + 3) = *(_OWORD *)(a1 + 48);
  v11[8] = *(VOID **)(a1 + 64);
  *((_DWORD *)v11 + 18) = *(_DWORD *)(a1 + 72);
LABEL_13:
  *a2 = v6;
  return v4;
}

Referenced by:

HalpInitializeGenericErrorSource