MiDereferenceSegmentThread

VOID __stdcall MiDereferenceSegmentThread(VOID *StartContext){
  _ETHREAD *CurrentThread; 
  UINT64 v3; 
  NTSTATUS v4; 
  int v5; 
  int v6; 
  int v7; 
  int v8; 
  int v9; 
  int v10; 
  UINT64 v11; 
  int v12; 
  int v13; 
  VOID *Object[8]; 
  _KWAIT_BLOCK WaitBlockArray; 

  *((_BYTE *)StartContext + 1681) = 1;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  KeSetPriorityThread(&CurrentThread->Tcb, 19);
  CurrentThread->SameThreadPassiveFlags |= 2u;
  Object[0] = (char *)StartContext + 104;
  Object[2] = (char *)StartContext + 1520;
  Object[1] = (char *)StartContext + 1376;
  Object[4] = (char *)StartContext + 1616;
  Object[3] = (char *)StartContext + 1400;
  Object[5] = (char *)StartContext + 1752;
  Object[6] = (char *)StartContext + 1808;
  Object[7] = (char *)&stru_140C4DB30 + 1432;
  while( 1 )
  {
    v4 = KeWaitForMultipleObjects(
           8 - (unsigned int)(&Irp != StartContext),
           Object,
           WaitAny,
           WrVirtualMemory,
           0,
           0,
           0i64,
           &WaitBlockArray);
    if( v4 != 1 )
      MiDeleteEmptySubsections((_MI_PARTITION *)StartContext);
    if( !v4 )
      break;
    v5 = v4 - 1;
    if( v5 )
    {
      v6 = v5 - 1;
      if( v6 )
      {
        v7 = v6 - 1;
        if( v7 )
        {
          v8 = v7 - 1;
          if( v8 )
          {
            v9 = v8 - 1;
            if( v9 )
            {
              v10 = v9 - 1;
              if( v10 )
              {
                if( v10 == 1 )
                {
                  KeResetEvent((_KEVENT *)((char *)&stru_140C4DB30 + 1432));
                  do
                    CcUnmapInactiveViews(0i64, v11, (VOID **)1);
                  while( v12 && *(&stru_140C4DB30 + 75) <= 0x8000000ui64 );
                }
              }
              else
              {
                KeResetEvent((_KEVENT *)((char *)StartContext + 1808));
                MiFreeClonePool();
              }
            }
            else
            {
              MiDeleteControlAreaList((_MI_PARTITION *)StartContext);
            }
          }
          else
          {
            MiProcessDeleteOnClose((_MI_PARTITION *)StartContext, v3);
          }
        }
        else
        {
          KeResetEvent((_KEVENT *)((char *)StartContext + 1400));
          MiRemoveUnusedSegments((_MI_PARTITION *)StartContext);
        }
      }
      else
      {
        MiProcessDereferenceList((_MI_PARTITION *)StartContext);
      }
    }
    else
    {
      KeResetEvent((_KEVENT *)((char *)StartContext + 1376));
      MiDeleteEmptySubsections((_MI_PARTITION *)StartContext);
    }
  }
  if( StartContext == &Irp )
  {
    do
    {
      if( *((VOID **)StartContext + 213) == (char *)StartContext + 1704 )
        break;
      MiDeleteCachedSegment((_MI_PARTITION *)StartContext);
    }
    while( v13 );
    *((_BYTE *)StartContext + 1680) = 1;
    MiProcessDeleteOnClose((_MI_PARTITION *)StartContext, v3);
    MiDeleteControlAreaList((_MI_PARTITION *)StartContext);
  }
}

Referenced by:

No references.