MiUpdatePerSessionProto

VOID __stdcall MiUpdatePerSessionProto(
        _CONTROL_AREA *ControlArea,
        _SUBSECTION *Subsection,
        _MI_PER_SESSION_PROTOS *Protos,
        UINT64 Insert){
  INT64 *p_ControlAreaLock; 
  int v5; 
  unsigned __int64 v8; 
  _RTL_BALANCED_NODE *Root; 
  BOOL v10; 
  _RTL_BALANCED_NODE *v11; 

  p_ControlAreaLock = (INT64 *)&ControlArea->ControlAreaLock;
  v5 = Insert;
  v8 = (unsigned __int8)ExAcquireSpinLockExclusive((INT64 *)&ControlArea->ControlAreaLock);
  if( !v5 )
  {
    RtlAvlRemoveNode((UINT64 *)&Subsection->24, (INT64 *)Protos);
    goto LABEL_9;
  }
  Root = Subsection->GlobalPerSessionHead.Root;
  v10 = 0;
  if( !Root )
    goto LABEL_8;
  while( Protos->SessionId < *(_DWORD *)&Root[2]._bf_0 )
  {
    v11 = Root->Children[0];
    if( !Root->Children[0] )
      goto LABEL_8;
LABEL_5:
    Root = v11;
  }
  v11 = Root->Children[1];
  if( v11 )
    goto LABEL_5;
  v10 = 1;
LABEL_8:
  RtlAvlInsertNodeEx(&Subsection->GlobalPerSessionHead.Root, (UINT64)Root, v10, &Protos->SessionProtoNode);
LABEL_9:
  ExReleaseSpinLockExclusiveFromDpcLevel(p_ControlAreaLock);
  __writecr8(v8);
}

Referenced by:

MiCreatePerSessionProtos
MiDereferenceSubsectionProtos