Expand Minimize

FsRtlAllocatePoolWithTag routine

The FsRtlAllocatePoolWithTag routine allocates pool memory.

Syntax


PVOID FsRtlAllocatePoolWithTag(
  _In_  POOL_TYPE PoolType,
  _In_  ULONG NumberOfBytes,
  _In_  ULONG Tag
);

Parameters

PoolType [in]

Type of pool to allocate. One of the following:

  • NonPagedPool
  • PagedPool
  • NonPagedPoolCacheAligned
  • PagedPoolCacheAligned

Note   The NonPagedPoolMustSucceed and NonPagedPoolCacheAlignedMustS pool types are obsolete and should no longer be used.

NumberOfBytes [in]

Number of bytes to allocate. This parameter is required and cannot be zero.

Tag [in]

Specifies the pool tag for the allocated memory. Drivers normally specify the pool tag as a string of one to four 7-bit ASCII characters, delimited by single quotation marks (for example, 'abcd'). This parameter is required and cannot be zero.

Return value

FsRtlAllocatePoolWithTag returns a non-NULL pointer to the newly allocated pool.

Remarks

If a pool allocation failure occurs, FsRtlAllocatePoolWithTag raises a STATUS_INSUFFICIENT_RESOURCES exception. To gain control if this pool allocation failure occurs, the driver should wrap the call to FsRtlAllocatePoolWithTag in a try-except or try-finally statement.

The system associates the pool tag specified by the Tag parameter with the allocated buffer. Programming tools, such as the Windows Debugger (WinDbg), can display the pool tag associated with each allocated buffer. The value of the pool tag is normally displayed in reversed order. For example, if a caller passes 'Fred' as the value of the Tag parameter, this value would appear as 'derF' if pool is dumped or when tracking pool usage in the debugger.

For more information about memory management, see Memory Management.

Callers of FsRtlAllocatePoolWithTag must be running at IRQL <= DISPATCH_LEVEL. A caller at DISPATCH_LEVEL must specify a NonPagedXxxPoolType. Otherwise, the caller must be running at IRQL <= APC_LEVEL.

Requirements

Header

Ntifs.h (include Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<= DISPATCH_LEVEL (see Remarks section)

See also

ExAllocatePoolWithTag
ExFreePool

 

 

Send comments about this topic to Microsoft

顯示:
© 2014 Microsoft