RtlFindSetBitsAndClear function (wdm.h)

The RtlFindSetBitsAndClear routine searches for a range of set bits of a requested size within a bitmap and clears all bits in the range when it has been located.

Syntax

NTSYSAPI ULONG RtlFindSetBitsAndClear(
  [in] PRTL_BITMAP BitMapHeader,
  [in] ULONG       NumberToFind,
  [in] ULONG       HintIndex
);

Parameters

[in] BitMapHeader

A pointer to the RTL_BITMAP structure that describes the bitmap. This structure must have been initialized by the RtlInitializeBitMap routine.

[in] NumberToFind

Specifies how many contiguous set bits will satisfy this request.

[in] HintIndex

Specifies a zero-based bit position around which to start looking for a set bit range of the given size.

Return value

RtlFindSetBitsAndClear either returns the zero-based starting bit index for a set bit range of the requested size that it cleared, or it returns 0xFFFFFFFF if it cannot find such a range within the given bitmap variable.

Remarks

For a successful call, the returned bit position is not necessarily equivalent to the given HintIndex. If necessary, RtlFindSetBitsAndClear searches the whole bitmap to locate a set bit range of the requested size. However, it starts searching for the requested range near HintIndex, so callers can clear such a range more quickly when they can supply appropriate hints about where to start looking.

Callers of RtlFindSetBitsAndClear 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, RtlFindSetBitsAndClear can be called at any IRQL.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= APC_LEVEL (See Remarks section)

See also

RTL_BITMAP

RtlAreBitsSet

RtlClearAllBits

RtlClearBits

RtlFindSetBits

RtlInitializeBitMap

RtlNumberOfSetBits