RtlFindClearBitsAndSet - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

_Success_(return != -1)
NTSYSAPI
ULONG
NTAPI
RtlFindClearBitsAndSet(
    _In_ PRTL_BITMAP BitMapHeader,
    _In_ ULONG NumberToFind,
    _In_ ULONG HintIndex
    );

#endif

View code on GitHub
// wdm.h

NTSYSAPI ULONG RtlFindClearBitsAndSet(
  [in] PRTL_BITMAP BitMapHeader,
  [in] ULONG       NumberToFind,
  [in] ULONG       HintIndex
);
View the official Windows Driver Kit DDI reference

NtDoc

This function is documented in Windows Driver Kit.

Windows Driver Kit DDI reference (nf-wdm-rtlfindclearbitsandset)

RtlFindClearBitsAndSet function

Description

The RtlFindClearBitsAndSet routine searches for a range of clear bits of a requested size within a bitmap and sets all bits in the range when it has been located.

Parameters

BitMapHeader [in]

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

NumberToFind [in]

Specifies how many contiguous clear bits will satisfy this request.

HintIndex [in]

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

Return value

RtlFindClearBitsAndSet either returns the zero-based starting bit index for a clear bit range of the requested size that it set, 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, RtlFindClearBitsAndSet searches the whole bitmap to locate a clear bit range of the requested size. However, it starts searching for the requested range from HintIndex, so callers can have such a range reset more quickly when they can supply appropriate hints about where to start looking.

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

See also

RTL_BITMAP

RtlAreBitsClear

RtlFindClearBits

RtlFindClearRuns

RtlFindFirstRunClear

RtlFindLastBackwardRunClear

RtlFindLongestRunClear

RtlFindNextForwardRunClear

RtlInitializeBitMap

RtlNumberOfClearBits

RtlSetAllBits

RtlSetBits