MiCreateRetpolineRelocationInformation

__int64 __fastcall MiCreateRetpolineRelocationInformation(__int64 a1, int a2, unsigned int a3, _QWORD *a4){
  unsigned int v6; 
  unsigned int v8; 
  _QWORD *Pool; 
  unsigned int v11; 
  CHAR *v12; 
  NTSTATUS RetpolineRelocationInformation; 
  int v14; 
  UINT64 v16; 
  UINT64 v17; 

  v6 = a3 >> 12;
  v8 = 8 * (a3 >> 12);
  Pool = MiAllocatePool(256i64, v8 + 56, 0x7252694Dui64);
  if( Pool )
  {
    v11 = 4 * (*(_DWORD *)(a1 + 4) + 3 * v6);
    v12 = (CHAR *)MiAllocatePool(256i64, v11, 0x7252694Dui64);
    Pool[6] = v12;
    if( v12 )
    {
      LODWORD(v17) = v8;
      LODWORD(v16) = v11;
      RetpolineRelocationInformation = RtlCreateRetpolineRelocationInformation(
                                         a3,
                                         *(unsigned int *)(a1 + 4),
                                         *(_QWORD *)(a1 + 8),
                                         *(_QWORD *)(a1 + 16),
                                         *(_QWORD *)(a1 + 24),
                                         v12,
                                         v16,
                                         (INT64)(Pool + 7),
                                         v17);
      if( RetpolineRelocationInformation >= 0 )
      {
        *((_DWORD *)Pool + 2) = *(_DWORD *)a1;
        v14 = dword_140C4C9F0 + 4095;
        *((_DWORD *)Pool + 1) = a2;
        *(_DWORD *)Pool = ((a3 + 4095) & 0xFFFFF000) + (v14 & 0xFFFFF000);
        *a4 = Pool;
        Pool = 0i64;
        RetpolineRelocationInformation = 0;
      }
    }
    else
    {
      RetpolineRelocationInformation = -1073741670;
    }
    if( Pool )
      MiFreeRetpolineRelocationInformation(Pool);
  }
  else
  {
    return(unsigned int)-1073741670;
  }
  return(unsigned int)RetpolineRelocationInformation;
}

Referenced by:

MiCaptureBootDriverRetpolineInfo
MiParseImageLoadConfig