[NTOS:PS] Implement PS_QUOTA_TYPE and let the quota code use it (#3389)

This will replace the PoolIndex variable and as such we'll only be using the PS_QUOTA_TYPE enumeration, as Windows does. Both QuotaEntry, QuotaUsage and QuotaPeak depend explicitly or implicitly on this enumeration. Further details about this enum can be found in the following articles.
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ps/psquota/type.htm?tx=68,143
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ps/psquota/block.htm?tx=68,142,143
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/ps/eprocess/index.htm (see QuotaPeak and QuotaUsage)
This commit is contained in:
George Bișoc 2021-03-02 20:09:58 +01:00 committed by GitHub
parent 9536f44c81
commit 6170b574f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 43 deletions

View file

@ -972,6 +972,23 @@ typedef struct _JOB_SET_ARRAY
ULONG Flags;
} JOB_SET_ARRAY, *PJOB_SET_ARRAY;
//
// Process Quota Type
//
typedef enum _PS_QUOTA_TYPE
{
PsNonPagedPool = 0,
PsPagedPool,
PsPageFile,
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
PsWorkingSet,
#endif
#if (NTDDI_VERSION == NTDDI_LONGHORN)
PsCpuRate,
#endif
PsQuotaTypes
} PS_QUOTA_TYPE;
//
// EPROCESS Quota Structures
//
@ -985,7 +1002,7 @@ typedef struct _EPROCESS_QUOTA_ENTRY
typedef struct _EPROCESS_QUOTA_BLOCK
{
EPROCESS_QUOTA_ENTRY QuotaEntry[3];
EPROCESS_QUOTA_ENTRY QuotaEntry[PsQuotaTypes];
LIST_ENTRY QuotaList;
ULONG ReferenceCount;
ULONG ProcessCount;
@ -1208,8 +1225,8 @@ typedef struct _EPROCESS
EX_RUNDOWN_REF RundownProtect;
HANDLE UniqueProcessId;
LIST_ENTRY ActiveProcessLinks;
SIZE_T QuotaUsage[3]; /* 0=PagedPool, 1=NonPagedPool, 2=Pagefile */
SIZE_T QuotaPeak[3]; /* ditto */
SIZE_T QuotaUsage[PsQuotaTypes];
SIZE_T QuotaPeak[PsQuotaTypes];
SIZE_T CommitCharge;
SIZE_T PeakVirtualSize;
SIZE_T VirtualSize;