MiReplaceSystemProtoPtesNode

INT64 __stdcall MiReplaceSystemProtoPtesNode(RTL_BALANCED_NODE *Node, RTL_BALANCED_NODE *a2){
  unsigned __int64 v4; 
  unsigned __int64 v5; 
  bool v6; 
  _QWORD *v7; 
  _QWORD *v8; 
  INT64 result; 
  __int64 a2a; 
  __int64 v11; 
  a2a = 0i64;
  v4 = MiObtainProtoBaseFromNode(Node, &a2a);
  v5 = ExAcquireSpinLockExclusive(&dword_140C4C880);
  RtlAvlRemoveNode((unsigned __int64 *)&qword_140C4C878, (__int64 *)Node);
  Node[1].Children[0] = (_RTL_BALANCED_NODE *)((unsigned __int64)Node[1].Children[0] & ~8ui64);
  v6 = 0;
  v7 = qword_140C4C878;
  if( qword_140C4C878 )
  {
    while( 1 )
    {
      v11 = 0i64;
      if( v4 < MiObtainProtoBaseFromNode(v7, &v11) )
      {
        v8 = (_QWORD *)*v7;
        if( !*v7 )
        {
          v6 = 0;
          break;
        }
      }
      else
      {
        v8 = (_QWORD *)v7[1];
        if( !v8 )
        {
          v6 = 1;
          break;
        }
      }
      v7 = v8;
    }
  }
  RtlAvlInsertNodeEx((unsigned __int64 *)&qword_140C4C878, (__int64)v7, v6, a2);
  a2[1].Children[0] = (_RTL_BALANCED_NODE *)((unsigned __int64)a2[1].Children[0] | 8);
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&dword_140C4C880);
  result = (unsigned int)KiIrqlFlags;
  __writecr8(v5);
  return result;
}

Referenced by:

MiAllocateFileExtents