KeClearSystemPriority
NTSTATUS __stdcall KeClearSystemPriority(PVOID BugCheckParameter1){
UINT8 CurrentIrql;
struct _KPRCB *CurrentPrcb;
__int64 v4;
char v5;
char v6;
unsigned int v7;
char v8;
char v9;
NTSTATUS result;
_DWORD *SchedulerAssist;
UINT64 SpinCount;
_SINGLE_LIST_ENTRY a2;
a2.Next = 0i64;
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
CurrentPrcb = KeGetCurrentPrcb();
LODWORD(SpinCount) = 0;
while( _interlockedbittestandset64((volatile signed __int32 *)BugCheckParameter1 + 16, 0i64) )
{
do
KeYieldProcessorEx(&SpinCount);
while( *((_QWORD *)BugCheckParameter1 + 8) );
SchedulerAssist = CurrentPrcb->SchedulerAssist;
if( SchedulerAssist && CurrentPrcb->NestingLevel <= 1u )
++SchedulerAssist[6];
}
v4 = *((char *)BugCheckParameter1 + 795);
v5 = *((_BYTE *)BugCheckParameter1 + v4 + 824);
if( !v5 )
KeBugCheckEx(0x157u, BugCheckParameter1, (PVOID)*((char *)BugCheckParameter1 + 795), (PVOID)2, 0i64);
v6 = v5 - 1;
*((_BYTE *)BugCheckParameter1 + v4 + 824) = v6;
if( !v6 )
{
v7 = *((_DWORD *)BugCheckParameter1 + 214) ^ (1 << v4);
*((_DWORD *)BugCheckParameter1 + 214) = v7;
if( v7 < 1 << v4 )
{
v8 = *((_BYTE *)BugCheckParameter1 + 195);
if( v8 < 16 )
{
v9 = *((_BYTE *)BugCheckParameter1 + 563)
+ (*((_BYTE *)BugCheckParameter1 + 564) & 0xF)
+ (*((_BYTE *)BugCheckParameter1 + 564) >> 4);
if( v9 < v8 )
KiSetPriorityThread((_KTHREAD *)BugCheckParameter1, &a2, (unsigned int)v9);
}
}
}
*((_BYTE *)BugCheckParameter1 + 795) = 0;
*((_QWORD *)BugCheckParameter1 + 8) = 0i64;
KiProcessDeferredReadyList(KeGetCurrentPrcb(), &a2, CurrentIrql);
return result;
}Referenced by:
PspRevertContainerImpersonation