MiReservePoolMemory

VOID *__fastcall MiReservePoolMemory(unsigned __int64 a1, int a2, unsigned __int64 a3, UINT64 a4){
  unsigned __int64 v4; 
  __int64 v5; 
  VOID *v6; 
  char *v8; 
  INT64 v9; 

  v4 = a3 >> 21;
  if( a3 >> 21 < 0x100000000i64 )
  {
    switch( a2 )
    {
      case 5:
        LODWORD(v5) = MiObtainDynamicVa(
                        (_MI_DYNAMIC_BITMAP *)(*(&stru_140C4DB30 + 22) + 176i64 * (unsigned int)a4 + 64),
                        (unsigned int)v4,
                        MiVaNonPagedPool,
                        a4);
        return(VOID *)v5;
      case 6:
        return MiObtainSystemVa((unsigned int)v4, MiVaPagedPool);
      case 1:
        v6 = MiObtainSessionVa((unsigned int)v4);
        if( v6 )
          _InterlockedExchangeAdd((volatile signed __int32 *)KeGetCurrentThread()->ApcState.Process->Session + 217, v4);
        return v6;
      case 15:
        v8 = (char *)MmGetPdeBase() + ((a1 >> 18) & 0x3FFFFFF8);
        LODWORD(v9) = 1;
        return(VOID *)(a1 & -(__int64)(MiMarkSystemVaAllocated(0xFui64, (INT64)v8, (INT64)&v8[8 * v4], 1i64, v9) != 0));
    }
  }
  return 0i64;
}

Referenced by:

MmAllocatePoolMemory
MmAllocateSecurePoolMemory