MiResetVirtualMemory

INT64 __fastcall MiResetVirtualMemory(
        _EPROCESS *RequestingProcess,
        VOID *StartingAddress,
        VOID *EndingAddress,
        _MMVAD *Vad,
        UINT64 AllocationType){
  unsigned int v5; 
  INT64 result; 
  char v11; 
  v5 = *((_DWORD *)Vad + 12);
  if( (v5 & 0x100000) != 0 )
  {
    if( (v5 & 8) != 0
      && ((v5 >> 7) & 4) == 0
      && (int)MiCheckSecuredVad(
                (ULONG_PTR)Vad,
                (unsigned __int64)StartingAddress,
                (_BYTE *)EndingAddress - (_BYTE *)StartingAddress + 1,
                4u,
                v11) < 0 )
    {
      return 3221225550i64;
    }
  }
  else
  {
    if( *(_QWORD *)(**((_QWORD **)Vad + 9) + 64i64) )
      return 3221226051i64;
    if( ((v5 >> 7) & 4) == 0 )
      return 3221225550i64;
  }
  if( (*((_DWORD *)RequestingProcess + 628) & 0x100) == 0
    || (*((_DWORD *)KeGetCurrentThread() + 324) & 0x40000) != 0
    || (result = MiAllowProtectionChange(
                   *((_EPROCESS **)KeGetCurrentThread() + 23),
                   RequestingProcess,
                   Vad,
                   4ui64,
                   StartingAddress,
                   EndingAddress),
        (int)result >= 0) )
  {
    result = MiWalkVaRange(
               (UINT64)StartingAddress,
               (UINT64)EndingAddress,
               (INT64)Vad,
               (_DWORD)AllocationType != 0x80000,
               0i64);
    if( (_DWORD)AllocationType == 0x80000 )
      return 0i64;
  }
  return result;
}

Referenced by:

MiAllocateVirtualMemory