KiUpdateThreadPriority

VOID __stdcall KiUpdateThreadPriority(_KPRCB *Prcb, _ETHREAD *Thread, INT64 NewPriority, UINT8 UpdateMatrix){
  _KPRCB *CurrentPrcb; 
  char v7; 
  volatile INT32 *v9; 
  char v10; 
  bool v11; 
  char v12; 
  _QWORD *v13; 
  _QWORD *v14; 
  INT64 v15; 
  CurrentPrcb = KeGetCurrentPrcb();
  v7 = NewPriority;
  if( (char)NewPriority > *((char *)Thread + 195) )
  {
    if( *((_BYTE *)Thread + 793) )
    {
      v13 = (_QWORD *)((char *)Thread + 808);
      if( *v13 == 1i64 )
      {
        v14 = (_QWORD *)((char *)CurrentPrcb + 34680);
        if( CurrentPrcb != (_KPRCB *)-34680i64 )
        {
          *v13 = *v14;
          *v14 = v13;
          _InterlockedIncrement16((volatile signed __int16 *)Thread + 434);
          KiAbQueueAutoBoostDpc(CurrentPrcb);
        }
      }
    }
  }
  *((_BYTE *)Thread + 195) = v7;
  if( UpdateMatrix )
  {
    if( (*((_BYTE *)Thread + 2) & 4) != 0 )
    {
      KiIsThreadRankNonZero(Thread, Prcb);
      v11 = v10 == 0;
      v12 = 1;
      if( v11 )
        v12 = *((_BYTE *)Thread + 195);
      v7 = v12;
    }
    **((_BYTE **)Prcb + 7) = v7;
    v9 = (volatile INT32 *)*((_QWORD *)Prcb + 4247);
    if( v9 )
    {
      v15 = (unsigned int)KiVpThreadSystemWorkPriority;
      if( Thread != *((_ETHREAD **)Prcb + 3) )
        v15 = (unsigned int)v7;
      KiSetSchedulerAssistPriority(v9, v15, 0);
    }
  }
  if( (*((_DWORD *)Thread + 30) & 0x400000) != 0 )
    KiSetSchedulerAssistPriority(*((volatile INT32 **)Thread + 121), (unsigned int)*((char *)Thread + 195), 1);
}

Referenced by:

KeSetActualBasePriorityThread
KeStartThread
KeTransitionProcessorParkState
KeYieldExecution
KiApplyForegroundBoostThread
KiCompleteKernelInit
KiDeferredReadySingleThread
KiDirectSwitchThread
KiQuantumEnd
KiQueueReadyThread
KiSetPriorityBoost
KiSetPriorityThread
KiUpdateVPBackingThreadPriority