MiFlowThroughInsertNode

VOID __stdcall MiFlowThroughInsertNode(_MMINPAGE_SUPPORT *InPageSupport, _MMPFN *TransitionPfn){
  unsigned __int16 Long; 
  _LIST_ENTRY *ListHead; 
  __int64 v6; 
  _LIST_ENTRY *v7; 
  unsigned int PagingFileOffset; 
  unsigned __int64 v9; 
  unsigned __int8 v10; 
  _RTL_BALANCED_NODE *v11; 
  _RTL_BALANCED_NODE *p_Node; 
  BOOL v13; 
  unsigned __int64 v14; 
  unsigned __int64 v15; 
  _RTL_BALANCED_NODE *v16; 
  _MMPTE PointerPte; 

  PointerPte.u.Long = TransitionPfn->OriginalPte.u.Long;
  Long = PointerPte.u.Long;
  if( (PointerPte.u.Long & 0x400) != 0 )
  {
    InPageSupport->Page[2] = 0i64;
    goto LABEL_3;
  }
  PagingFileOffset = MiGetPagingFileOffset(&PointerPte);
  v9 = *(_QWORD *)(*(_QWORD *)(*(&stru_140C4DB30 + 267) + 8
                                                        * (((unsigned __int64)TransitionPfn->u4._bf_0 >> 39) & 0x3FF))
                 + 8i64 * (Long >> 12)
                 + 6944);
  InPageSupport->Page[2] = v9;
  InPageSupport->Page[3] = PagingFileOffset;
  v10 = ExAcquireSpinLockExclusive((INT64 *)(v9 + 232));
  v11 = *(_RTL_BALANCED_NODE **)(v9 + 240);
  p_Node = &InPageSupport->FlowThrough.Node;
  v13 = 0;
  v14 = v10;
  if( !v11 )
    goto LABEL_11;
  v15 = InPageSupport->Page[3];
  while( v15 <= v11[-1].ParentValue && (v15 < v11[-1].ParentValue || p_Node <= v11) )
  {
    v16 = v11->Children[0];
    if( !v11->Children[0] )
      goto LABEL_11;
LABEL_14:
    v11 = v16;
  }
  v16 = v11->Children[1];
  if( v16 )
    goto LABEL_14;
  v13 = 1;
LABEL_11:
  RtlAvlInsertNodeEx((_RTL_BALANCED_NODE **)(v9 + 240), (UINT64)v11, v13, p_Node);
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v9 + 232));
  __writecr8(v14);
LABEL_3:
  InPageSupport->u1.e1._bf_0 |= 0x10u;
  ListHead = InPageSupport->ListHead;
  v6 = TransitionPfn->u1.$976DF529DAC3D73085C9E386D94B91E6::$E228DCF3D8940E384DBC5EFCA756D8B6::_bf_0 - 32;
  v7 = *(_LIST_ENTRY **)(v6 + 24);
  if( v7->Flink != (_LIST_ENTRY *)(v6 + 16) )
    __fastfail(3u);
  ListHead->Flink = (_LIST_ENTRY *)(v6 + 16);
  InPageSupport->ListHead[0].Blink = v7;
  v7->Flink = ListHead;
  *(_QWORD *)(v6 + 24) = ListHead;
  InPageSupport->Page[1] = v6;
}

Referenced by:

MiCopyFileOnlyGlobalSubsectionPage
MiCopyImageExtentContents
MiFinishMdlForMappedFileFault
MiResolvePageFileFault