Geoff Chappell, Software Analyst
This function charges a process for its use of memory from either type of pool.
NTSTATUS PsChargeProcessPoolQuota ( EPROCESS *Process, POOL_TYPE PoolType, SIZE_T Amount);
The Process argument is the address of the process that is to be charged.
The PoolType is either NonPagedPool (0) or PagedPool (1), to denote the type of pool usage to charge the process for. Or so seems to be the intention nowadays. See notes below.
The Amount argument is the amount, in bytes, to charge.
The function returns STATUS_SUCCESS if successful, else a negative error code.
The PsChargeProcessPoolQuota function is exported by name from the kernel in version 5.1 and higher.
The PsChargeProcessPoolQuota function is not documented. It is, however, declared in the NTIFS.H header from the Windows Driver Kit (WDK).
The PsChargeProcessPoolQuota function is essentially the ancient PsChargePoolQuota function except for returning an error code instead of raising an exception.
Interpretation of PoolType as selecting non-paged or paged pool is sound in version 6.0 and higher. Even today, 17th October 2017, Microsoft’s documentation (of PsChargePoolQuota) states explicitly that some other values of POOL_TYPE are meaningful for the PoolType (and some others are obsolete), but the reality in version 6.0 and higher is that all values other than PagedPool are treated as NonPagedPool.
In versions 5.1 and 5.2 the PoolType might better be thought of as a quota type from the PS_QUOTA_TYPE enumeration. This is compatible with POOL_TYPE for the values 0 and 1 to charge against the quota for non-paged and paged pool. The value 2 selects the paging file quota. Higher values are not defended and can cause undefined behaviour.