PsQueryCpuQuotaInformation
NTSTATUS __stdcall PsQueryCpuQuotaInformation(
VOID *SystemInformation,
UINT64 SystemInformationLength,
INT8 PreviousMode,
UINT64 *ReturnLength){
INT64 v6;
unsigned int v9;
__int64 v10;
_EPROCESS *i;
_EPROCESS *NextSession;
_EPROCESS *v13;
_EPROCESS *v14;
_KSCHEDULING_GROUP *SessionSchedulingGroupByProcess;
v6 = (unsigned int)SystemInformationLength;
if( !PsCpuFairShareEnabled )
return -1073741399;
if( PreviousMode && !SeSinglePrivilegeCheck(*(_QWORD *)&SeIncreaseQuotaPrivilege, PreviousMode) )
return -1073741727;
if( (_DWORD)v6 )
{
if( (((_BYTE)v6 - 4) & 7) != 0 || (unsigned int)v6 < 4 )
return -1073741820;
v9 = (unsigned int)(v6 - 4) >> 3;
if( PreviousMode == 1 )
ProbeForWrite((UINT64)SystemInformation, v6, 4i64);
}
else
{
v9 = 0;
SystemInformation = 0i64;
}
v10 = 0i64;
for( i = 0i64; ; i = v13 )
{
NextSession = (_EPROCESS *)MiGetNextSession(i, SystemInformationLength);
v13 = NextSession;
if( !NextSession )
break;
SessionSchedulingGroupByProcess = MmGetSessionSchedulingGroupByProcess(NextSession);
if( SessionSchedulingGroupByProcess )
{
if( (unsigned int)v10 < v9 )
{
*((_DWORD *)SystemInformation + 2 * v10 + 1) = MmGetSessionIdEx(v14);
*((_DWORD *)SystemInformation + 2 * v10 + 2) = SessionSchedulingGroupByProcess->Policy.Weight;
}
v10 = (unsigned int)(v10 + 1);
}
}
if( SystemInformation )
*(_DWORD *)SystemInformation = v10;
*(_DWORD *)ReturnLength = 8 * v10 + 4;
return v9 < (unsigned int)v10 ? 0xC0000023 : 0;
}Referenced by:
ExpQuerySystemInformation