HalpGenericErrorSourceRecovery

INT64 __fastcall HalpGenericErrorSourceRecovery(INT64 a1, _DWORD *a2){
  unsigned int *v2; 
  INT64 *v5; 
  _DWORD *v6; 
  unsigned int v7; 
  int v8; 
  _DWORD *v9; 
  __int64 v10; 
  unsigned int v11; 
  __int64 v12; 
  v2 = (unsigned int *)(a1 + 128);
  v5 = 0i64;
  v6 = 0i64;
  v7 = -1073741637;
  v8 = 0;
  if( *(_WORD *)(a1 + 10) )
  {
    v9 = (_DWORD *)(a1 + 144);
    while( 1 )
    {
      if( (unsigned int)(v9[8] - 2) <= 1 )
        goto LABEL_18;
      if( RtlCompareMemory(v9, (VOID *)&MEMORY_ERROR_SECTION_GUID, 0x10ui64) == 16 )
        break;
      if( RtlCompareMemory(v9, PMEM_ERROR_SECTION_GUID, 0x10ui64) == 16 )
      {
        v12 = *v2;
        if( *(_DWORD *)(a1 + 20) >= (unsigned int)(v12 + *(v9 - 3)) )
          v6 = (_DWORD *)(a1 + v12);
        if( !v6 || !v6[21] )
        {
          v7 = -1073741637;
          goto LABEL_16;
        }
        v11 = HalpPmemErrorDeferredRecovery(v6);
        goto LABEL_14;
      }
LABEL_16:
      if( (v7 & 0x80000000) == 0 )
      {
        *a2 = 2;
        return v7;
      }
      v2 += 18;
      v9 += 18;
LABEL_18:
      if( ++v8 >= (unsigned int)*(unsigned __int16 *)(a1 + 10) )
        return v7;
    }
    v10 = *v2;
    if( *(_DWORD *)(a1 + 20) >= (unsigned int)(v10 + *(v9 - 3)) )
      v5 = (INT64 *)(a1 + v10);
    v11 = HalpGhesMemoryErrorHandler(v5);
LABEL_14:
    v7 = v11;
    goto LABEL_16;
  }
  return v7;
}

Referenced by:

HalpRequestGenericErrorRecovery