HalpInitGenericErrorSourceEntryV2

__int64 __fastcall HalpInitGenericErrorSourceEntryV2(__int64 a1, _QWORD *a2){
  unsigned int v4; 
  VOID **PoolWithTag; 
  VOID **v6; 
  char v7; 
  VOID **v8; 
  size_t v9; 
  VOID **v10; 
  __int64 v11; 
  VOID **v12; 
  __int128 v13; 
  VOID *v14; 
  void *v15; 
  void *v16; 
  int Src[2]; 
  __int64 v19; 
  int v20; 
  int v21; 
  int v22; 
  int v23; 
  _NTSTRSAFE_PSTR pszDest[4]; 
  __int128 v25; 
  __int64 v26; 
  __int64 v27; 

  v4 = 0;
  PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x428ui64, 543973704i64);
  v6 = PoolWithTag;
  if( !PoolWithTag )
  {
LABEL_21:
    v4 = -1073741670;
    goto LABEL_22;
  }
  memset(PoolWithTag, 0i64, 0x428u);
  *((_DWORD *)v6 + 12) = *(_DWORD *)(a1 + 44);
  v6[5] = MmMapIoSpaceEx(*(_LARGE_INTEGER *)(a1 + 56), 8ui64, 0x204ui64);
  v26 = *(_QWORD *)(a1 + 56);
  v27 = *(unsigned int *)(a1 + 44);
  *(_OWORD *)pszDest = 0i64;
  v25 = 0i64;
  Src[0] = 1733060695;
  Src[1] = 1;
  v19 = 80i64;
  v21 = -2147483615;
  v20 = 1280201291;
  v22 = 2;
  v23 = 48;
  RtlStringCchCopyA((CHAR *)pszDest, 0x20ui64, (CHAR *)"Error_Status_block_register");
  WheaLogInternalEvent(Src);
  if( !v6[5] )
    goto LABEL_14;
  v7 = *(_BYTE *)(a1 + 95);
  if( v7 == 3 )
  {
    if( *(_BYTE *)(a1 + 93) == 32 )
      *((_DWORD *)v6 + 18) = 4;
  }
  else if( v7 == 4 && *(_BYTE *)(a1 + 93) == 64 )
  {
    *((_DWORD *)v6 + 18) = 8;
  }
  v8 = ExAllocatePoolWithTag(0x200ui64, 8ui64, 543973704i64);
  v6[8] = v8;
  if( !v8
    || (*v8 = *(VOID **)(a1 + 96),
        v9 = *(_DWORD *)(a1 + 16) + 80 + *((_DWORD *)v6 + 12),
        v10 = ExAllocatePoolWithTag(0x200ui64, v9, 543973704i64),
        (v6[3] = v10) == 0i64) )
  {
LABEL_14:
    v14 = v6[5];
    if( v14 )
      MmUnmapIoSpace(v14, 8ui64);
    v15 = v6[8];
    if( v15 )
      ExFreePoolWithTag(v15, 0x206C6148u);
    v16 = v6[3];
    if( v16 )
      ExFreePoolWithTag(v16, 0x206C6148u);
    ExFreePoolWithTag(v6, 0x206C6148u);
    v6 = 0i64;
    goto LABEL_21;
  }
  memset(v10, 0i64, v9);
  v11 = 7i64;
  *(_DWORD *)v6[3] = 1095059543;
  *((_DWORD *)v6[3] + 1) = 3;
  *((_DWORD *)v6[3] + 2) = v9;
  *((_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);
  v12 = v6 + 11;
  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 += 16;
    v13 = *(_OWORD *)(a1 + 112);
    a1 += 128i64;
    *((_OWORD *)v12 - 1) = v13;
    --v11;
  }
  while( v11 );
  *(_OWORD *)v12 = *(_OWORD *)a1;
  *((_OWORD *)v12 + 1) = *(_OWORD *)(a1 + 16);
  *((_OWORD *)v12 + 2) = *(_OWORD *)(a1 + 32);
  *((_OWORD *)v12 + 3) = *(_OWORD *)(a1 + 48);
  v12[8] = *(VOID **)(a1 + 64);
  *((_DWORD *)v12 + 18) = *(_DWORD *)(a1 + 72);
LABEL_22:
  *a2 = v6;
  return v4;
}

Referenced by:

HalpInitializeGenericErrorSource