RtlFindNextAlignedForwardRunClear
NTSTATUS __fastcall RtlFindNextAlignedForwardRunClear(
_RTL_BITMAP *BitMapHeader,
UINT64 HintIndex,
UINT64 NumberToFind,
UINT64 RequiredBitAlignment){
unsigned int SizeOfBitMap;
unsigned int v5;
int v6;
unsigned int v8;
int v9;
unsigned int *v10;
unsigned int *i;
char v12;
int v13;
unsigned int v14;
int v15;
unsigned int v17;
SizeOfBitMap = BitMapHeader->SizeOfBitMap;
v5 = 0;
v6 = NumberToFind;
v8 = 1;
v9 = 1;
do
v9 |= 1 << v8++;
while( v8 < 0x20 );
v10 = &BitMapHeader->Buffer[(unsigned __int64)(SizeOfBitMap - 1) >> 5];
LABEL_4:
for( i = &BitMapHeader->Buffer[(unsigned __int64)v5 >> 5]; i <= v10; ++i )
{
v12 = v5;
v5 &= 0xFFFFFFE0;
v13 = *i | *((_DWORD *)qword_140011CE0 + (v12 & 0x1F));
if( (v13 & v9) != v9 )
{
v14 = 0;
while( 1 )
{
if( !_bittest(&v13, v14) )
{
v15 = 0;
if( v5 < SizeOfBitMap )
{
do
{
if( _bittest64((const signed __int64 *)BitMapHeader->Buffer, v5) )
break;
++v5;
if( ++v15 == v6 )
return v5 - v15;
}
while( v5 < SizeOfBitMap );
if( v15 )
{
v17 = v15 + v14 + 1;
if( v17 >= 0x20 )
{
++v5;
goto LABEL_4;
}
v14 = v17 - 1;
}
}
}
++v14;
++v5;
if( v14 >= 0x20 )
goto LABEL_10;
}
}
v5 += 32;
LABEL_10:
;
}
return -1;
}Referenced by:
EtwpFindUserBufferSpace