ExAllocatePoolWithQuota

PVOID
    ExAllocatePoolWithQuota(

        IN POOL_TYPE  PoolType,
        IN ULONG  NumberOfBytes
        );

ExAllocatePoolWithQuota allocates pool memory, charging quota against the current thread.

Parameters

PoolType
Specifies the type of pool to allocate, which can be one of the following:

NonPagedPool
NonPagedPoolMustSucceed
NonPagedPoolCacheAligned
NonPagedPoolCacheAlignedMustS
PagedPool
PagedPoolCacheAligned

NumberOfBytes
Specifies the number of bytes to allocate.

Return Value

If the PoolType is one of the XxxMustS(ucceed) values, this call succeeds if the system has any available memory, and ExAllocatePoolWithQuota returns a pointer to the allocated pool.

ExAllocatePoolWithQuota returns a NULL pointer when the PoolType is not one of the XxxMustS(ucceed) values and not enough pool can be allocated to satisfy the request.

Comments

This routine is called by highest-level drivers that allocate memory to satisfy a request in the context of the thread that originally made the I/O request. Lower-level drivers call ExAllocatePool instead.

If the NumberOfBytes requested is >= PAGE_SIZE, a page-aligned buffer is allocated. Callers requesting any PoolType except an XxxMustS(ucceed) must check the return value for NULL and should return STATUS_INSUFFICIENT_RESOURCES when their pool allocation requests fail.

Memory requests for < PAGE_SIZE are allocated within a page and do not cross page boundaries. Memory requests for < PAGE_SIZE are not necessarily page-aligned but are aligned on an 8-byte boundary.

Callers of ExAllocatePoolWithQuota must be running at IRQL < DISPATCH_LEVEL.

See Also

ExAllocatePool, ExAllocatePoolWithQuotaTag, ExFreePool