PspSetProcessPriorityClass

__int64 __fastcall PspSetProcessPriorityClass(__int64 a1, unsigned __int8 a2, unsigned __int64 a3, KPROCESSOR_MODE a4){
  unsigned __int8 v4; 
  __int64 v6; 
  _ETHREAD *CurrentThread; 
  char v9; 
  v4 = a2;
  if( a2 > 6u )
    return 3221225485i64;
  if( a2 == 4 && *(_BYTE *)(a1 + 1463) != 4 )
  {
    v9 = a3 ? SeCheckPrivilegedObject(*(_LUID *)SeIncreaseBasePriorityPrivilege, (void *)a3, 0x200u, a4) : SeSinglePrivilegeCheck(*(INT64 *)SeIncreaseBasePriorityPrivilege, a4);
    if( !v9 )
      return 3221225569i64;
  }
  v6 = *(_QWORD *)(a1 + 1296);
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  if( v6 )
  {
    --*((_WORD *)CurrentThread + 242);
    ExAcquireResourceSharedLite((PERESOURCE)(v6 + 56), 1);
    if( (*(_DWORD *)(v6 + 848) & 0x20) != 0 )
      v4 = *(_BYTE *)(v6 + 872);
    ExReleaseResourceLite((PERESOURCE)(v6 + 56));
    KeLeaveCriticalRegionThread((__int64)CurrentThread);
  }
  *(_BYTE *)(a1 + 1463) = v4;
  return 0i64;
}

Referenced by:

NtSetInformationProcess
PspAllocateProcess
PspApplyIFEOPerfOptions