Expand Minimize

RtlInitializeBitMap routine

The RtlInitializeBitMap routine initializes the header of a bitmap variable.

Syntax


VOID RtlInitializeBitMap(
  _Out_  PRTL_BITMAP BitMapHeader,
  _In_   PULONG BitMapBuffer,
  _In_   ULONG SizeOfBitMap
);

Parameters

BitMapHeader [out]

Pointer to an empty RTL_BITMAP structure.

BitMapBuffer [in]

Pointer to caller-allocated memory for the bitmap itself. The base address of this buffer must be ULONG-aligned. The size of the allocated buffer must be an integer multiple of sizeof(ULONG) bytes.

SizeOfBitMap [in]

Specifies the number of bits in the bitmap. This value can be any number of bits that will fit in the buffer allocated for the bitmap.

Return value

None

Remarks

A driver can use a bitmap variable as an economical way to keep track of a set of reusable items. For example, file systems use a bitmap variable to track which clusters/sectors on a disk have already been allocated to hold file data. The system-supplied SCSI port driver uses a bitmap variable to track which queue tags have been assigned to SCSI request blocks (SRBs).

RtlInitializeBitMap must be called before any other RtlXxx routine that operates on a bitmap variable. The BitMapHeader pointer is an input parameter in all subsequent RtlXxx calls that operate on the caller's bitmap variable at BitMapBuffer. The caller is responsible for synchronizing access to the bitmap variable.

RtlInitializeBitMap initializes the caller-supplied RTL_BITMAP structure by copying the caller-supplied BitMapBuffer and SizeOfBitMap values into it. Subsequently, the structure can be passed to other routines to manipulate the bitmap. RtlInitializeBitMap does not modify the contents of the bitmap.

Callers of RtlInitializeBitMap, and callers of other RtlXxx routines that operate on an initialized bitmap variable, must be running at IRQL <= APC_LEVEL if the memory that contains the bitmap variable is pageable or the memory at BitmapHeader is pageable. Otherwise, RtlInitializeBitMap can be called at any IRQL.

Requirements

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<= APC_LEVEL (see Remarks section)

See also

RtlAreBitsClear
RtlAreBitsSet
RTL_BITMAP
RtlCheckBit
RtlClearAllBits
RtlClearBits
RtlFindClearBits
RtlFindClearBitsAndSet
RtlFindClearRuns
RtlFindFirstRunClear
RtlFindLastBackwardRunClear
RtlFindLongestRunClear
RtlFindNextForwardRunClear
RtlFindSetBits
RtlFindSetBitsAndClear
RtlNumberOfClearBits
RtlNumberOfSetBits
RtlSetAllBits
RtlSetBits

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.