#ifndef _NTRTL_H
NTSYSAPI
ULONG
NTAPI
RtlFindClearRuns(
_In_ PRTL_BITMAP BitMapHeader,
_Out_writes_to_(SizeOfRunArray, return) PRTL_BITMAP_RUN RunArray,
_In_range_(>, 0) ULONG SizeOfRunArray,
_In_ BOOLEAN LocateLongestRuns
);
View code on GitHub// wdm.h
NTSYSAPI ULONG RtlFindClearRuns(
[in] PRTL_BITMAP BitMapHeader,
[out] PRTL_BITMAP_RUN RunArray,
[in] ULONG SizeOfRunArray,
[in] BOOLEAN LocateLongestRuns
);
View the official Windows Driver Kit DDI referenceThis function is documented in Windows Driver Kit.
The RtlFindClearRuns routine finds the specified number of runs of clear bits within a given bitmap.
BitMapHeader [in]A pointer to the RTL_BITMAP structure that describes the bitmap. This structure must have been initialized by the RtlInitializeBitMap routine.
RunArray [out]Pointer to the first element in a caller-allocated array for the bit position and length of each clear run found in the given bitmap variable.
SizeOfRunArray [in]Specifies the maximum number of clear runs to satisfy this request.
LocateLongestRuns [in]If TRUE, specifies that the routine is to search the entire bitmap for the longest clear runs it can find. Otherwise, the routine stops searching when it has found the number of clear runs specified by SizeOfRunArray.
RtlFindClearRuns returns the number of clear runs found.
If LocateLongestRuns is TRUE, the clear runs indicated at RunArray are sorted from longest to shortest. A clear run can consist of a single bit.
Callers of RtlFindClearRuns 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, RtlFindClearRuns can be called at any IRQL.