#ifndef _NTRTL_H
_Check_return_
FORCEINLINE
BOOLEAN
NTAPI_INLINE
RtlCheckBit(
_In_ PRTL_BITMAP BitMapHeader,
_In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitPosition
)
{
#ifdef _WIN64
return BitTest64((LONG64 const *)BitMapHeader->Buffer, (LONG64)BitPosition);
#else
return (((PLONG)BitMapHeader->Buffer)[BitPosition / 32] >> (BitPosition % 32)) & 0x1;
#endif // _WIN64
}
View code on GitHub// wdm.h
BOOLEAN RtlCheckBit(
[in] PRTL_BITMAP BitMapHeader,
[in] ULONG BitPosition
);
View the official Windows Driver Kit DDI referenceThis function is documented in Windows Driver Kit.
The RtlCheckBit routine determines whether a particular bit in a given bitmap variable is clear or set.
BitMapHeader [in]A pointer to the RTL_BITMAP structure that describes the bitmap. This structure must have been initialized by the RtlInitializeBitMap routine.
BitPosition [in]Specifies which bit to check. This is a zero-based value indicating the position of the bit to be tested.
RtlCheckBit returns zero if the given bit is clear, or one if the given bit is set.
Callers of RtlCheckBit 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, RtlCheckBit can be called at any IRQL.