HalpInitGenericErrorSourceEntry

__int64 __fastcall HalpInitGenericErrorSourceEntry(__int64 a1, _QWORD *a2){
  unsigned int v4; 
  _DWORD *PoolWithTag; 
  _DWORD *v6; 
  __int64 v7; 
  unsigned int v8; 
  VOID *v9; 
  void *v10; 
  void *v11; 
  char *v12; 
  __int64 v13; 
  __int128 v14; 
  int Src[2]; 
  __int64 v17; 
  int v18; 
  int v19; 
  int v20; 
  int v21; 
  char pszDest[16]; 
  __int128 v23; 
  __int64 v24; 
  __int64 v25; 
  v4 = 0;
  PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x428ui64, 0x206C6148ui64);
  v6 = PoolWithTag;
  if( !PoolWithTag )
  {
LABEL_2:
    v4 = -1073741670;
    goto LABEL_13;
  }
  memset((INT64)PoolWithTag, 0i64);
  v6[12] = *(_DWORD *)(a1 + 44);
  MmMapIoSpaceEx(*(_LARGE_INTEGER *)(a1 + 56), 8ui64, 0x204ui64);
  *((_QWORD *)v6 + 5) = v7;
  v24 = *(_QWORD *)(a1 + 56);
  v25 = *(unsigned int *)(a1 + 44);
  *(_OWORD *)pszDest = 0i64;
  v23 = 0i64;
  Src[0] = 1733060695;
  Src[1] = 1;
  v17 = 80i64;
  v19 = -2147483615;
  v18 = 1280201291;
  v20 = 2;
  v21 = 48;
  RtlStringCchCopyA(pszDest, 0x20ui64, (PSTR)"Error_Status_block_register");
  WheaLogInternalEvent(Src);
  if( !*((_QWORD *)v6 + 5) )
  {
LABEL_7:
    v11 = (void *)*((_QWORD *)v6 + 3);
    if( v11 )
      ExFreePoolWithTag(v11, 0x206C6148u);
    ExFreePoolWithTag(v6, 0x206C6148u);
    v6 = 0i64;
    goto LABEL_2;
  }
  v8 = *(_DWORD *)(a1 + 16) + 80 + v6[12];
  v9 = ExAllocatePoolWithTag(NonPagedPoolNx, v8, 0x206C6148ui64);
  *((_QWORD *)v6 + 3) = v9;
  if( !v9 )
  {
    v10 = (void *)*((_QWORD *)v6 + 5);
    if( v10 )
      MmUnmapIoSpace(v10, 8ui64);
    goto LABEL_7;
  }
  memset((INT64)v9, 0i64);
  v12 = (char *)(v6 + 22);
  v13 = 7i64;
  **((_DWORD **)v6 + 3) = 1095059543;
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 4i64) = 3;
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 8i64) = v8;
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 16i64) = 6;
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 24i64) = *(_DWORD *)(a1 + 28);
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 28i64) = 5;
  *(GUID *)(*((_QWORD *)v6 + 3) + 32i64) = GENERIC_NOTIFY_TYPE_GUID;
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 56i64) = 7;
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 64i64) = 80;
  *(_DWORD *)(*((_QWORD *)v6 + 3) + 68i64) = v6[12];
  do
  {
    *(_OWORD *)v12 = *(_OWORD *)a1;
    *((_OWORD *)v12 + 1) = *(_OWORD *)(a1 + 16);
    *((_OWORD *)v12 + 2) = *(_OWORD *)(a1 + 32);
    *((_OWORD *)v12 + 3) = *(_OWORD *)(a1 + 48);
    *((_OWORD *)v12 + 4) = *(_OWORD *)(a1 + 64);
    *((_OWORD *)v12 + 5) = *(_OWORD *)(a1 + 80);
    *((_OWORD *)v12 + 6) = *(_OWORD *)(a1 + 96);
    v12 += 128;
    v14 = *(_OWORD *)(a1 + 112);
    a1 += 128i64;
    *((_OWORD *)v12 - 1) = v14;
    --v13;
  }
  while( v13 );
  *(_OWORD *)v12 = *(_OWORD *)a1;
  *((_OWORD *)v12 + 1) = *(_OWORD *)(a1 + 16);
  *((_OWORD *)v12 + 2) = *(_OWORD *)(a1 + 32);
  *((_OWORD *)v12 + 3) = *(_OWORD *)(a1 + 48);
  *((_QWORD *)v12 + 8) = *(_QWORD *)(a1 + 64);
  *((_DWORD *)v12 + 18) = *(_DWORD *)(a1 + 72);
LABEL_13:
  *a2 = v6;
  return v4;
}

Referenced by:

HalpInitializeGenericErrorSource