ExAllocatePoolWithQuotaTag

PVOID
ExAllocatePoolWithQuotaTag(

IN POOL_TYPE PoolType,
IN ULONG NumberOfBytes,
IN ULONG
Tag
);

ExAllocatePoolWithQuotaTag allocates pool memory, charging the quota against the current thread. A call to this routine is equivalent to calling ExAllocatePoolWithQuota, except it inserts a caller-supplied tag before the allocation. This tag appears in any crash dump of the system that occurs.

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.

Tag

Is a string, delimited by single quote marks, with up to four characters, usually specified in reversed order.

Return Value

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

ExAllocatePoolWithQuotaTag 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

During driver development on a checked build of the system, this routine can be useful for crash debugging. Calling this routine, rather than ExAllocatePoolWithQuota, inserts the caller-supplied tag into a crash dump of pool memory.

The Tag passed to this routine is more readable if its bytes are reversed when this routine is called. For example, if a caller passes 'Fred' as a Tag, it would appear as 'derF' if pool is dumped or when tracking pool usage in the debugger.

Callers of ExAllocatePoolWithQuotaTag, like callers of ExAllocatePoolWithQuota, must be running at IRQL < DISPATCH_LEVEL.

See Also

ExAllocatePoolWithQuota, ExFreePool