#ifndef _NTRTL_H
_Success_(return != -1)
_Check_return_
NTSYSAPI
ULONG
NTAPI
RtlFindSetBits(
_In_ PRTL_BITMAP BitMapHeader,
_In_ ULONG NumberToFind,
_In_ ULONG HintIndex
);
View code on GitHub// wdm.h
NTSYSAPI ULONG RtlFindSetBits(
[in] PRTL_BITMAP BitMapHeader,
[in] ULONG NumberToFind,
[in] ULONG HintIndex
);
View the official Windows Driver Kit DDI referenceThis function is documented in Windows Driver Kit.
The RtlFindSetBits routine searches for a range of set bits of a requested size within a bitmap.
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 set bits will satisfy this request.
HintIndex [in]Specifies a zero-based bit position around which to start looking for a set bit range of the given size.
RtlFindSetBits either returns the zero-based starting bit index for a set bit range of the requested size, or it returns 0xFFFFFFFF if it cannot find such a range within the given bitmap variable.
For a successful call, the returned bit position is not necessarily equivalent to the given HintIndex. If necessary, RtlFindSetBits 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 find such a range more quickly when they can supply appropriate hints about where to start looking.
Callers of RtlFindSetBits 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, RtlFindSetBits can be called at any IRQL.