MiAweViewInserter

VOID __stdcall MiAweViewInserter(_EPROCESS *Process, _MI_PHYSICAL_VIEW *PhysicalView){
  _ETHREAD *CurrentThread; 
  _MMWSL_INSTANCE *VmWorkingSetList; 
  BOOL v5; 
  _MMPTE *NextPteToTrim; 
  unsigned __int64 v7; 
  union {unsigned __int64 Long;volatile unsigned __int64 VolatileLong;_MMPTE_HARDWARE Hard;_MMPTE_PROTOTYPE Proto;_MMPTE_SOFTWARE Soft;_MMPTE_TIMESTAMP TimeStamp;_MMPTE_TRANSITION Trans;_MMPTE_SUBSECTION Subsect;_MMPTE_LIST List;} v8; 
  _MMPTE *Long; 

  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  VmWorkingSetList = Process->Vm.Instance.VmWorkingSetList;
  MiLockAweVadsExclusive((INT64)CurrentThread);
  v5 = 0;
  NextPteToTrim = VmWorkingSetList[10].NextPteToTrim;
  v7 = PhysicalView->Vad->StartingVpn | ((unsigned __int64)PhysicalView->Vad->StartingVpnHigh << 32);
  if( NextPteToTrim )
  {
    while( 1 )
    {
      v8.Long = (unsigned __int64)NextPteToTrim[3].u;
      if( v7 > (*(unsigned int *)(v8.Long + 28) | ((unsigned __int64)*(unsigned __int8 *)(v8.Long + 33) << 32))
        || v7 >= (*(unsigned int *)(v8.Long + 24) | ((unsigned __int64)*(unsigned __int8 *)(v8.Long + 32) << 32)) )
      {
        Long = (_MMPTE *)NextPteToTrim[1].u.Long;
        if( !Long )
        {
          v5 = 1;
          break;
        }
      }
      else
      {
        Long = (_MMPTE *)NextPteToTrim->u.Long;
        if( !NextPteToTrim->u.Long )
          break;
      }
      NextPteToTrim = Long;
    }
  }
  RtlAvlInsertNodeEx(
    (_RTL_BALANCED_NODE **)&VmWorkingSetList[10],
    (UINT64)NextPteToTrim,
    v5,
    &PhysicalView->PhysicalNode);
  MiUnlockAweVadsExclusive(&CurrentThread->Tcb);
}

Referenced by:

MiInsertVad