MiFindClearVadBitsAligned
NTSTATUS __stdcall MiFindClearVadBitsAligned(_RTL_BITMAP *BitMap, UINT64 Alignment, UINT64 BitsNeeded, UINT64 Hint){
UINT64 v4;
UINT64 v6;
UINT64 v7;
UINT64 v8;
unsigned int *Buffer;
unsigned int *v10;
UINT64 i;
v4 = *(_QWORD *)&BitMap->SizeOfBitMap;
v6 = Alignment >> 16;
if( BitsNeeded >= *(_QWORD *)&BitMap->SizeOfBitMap )
return -1;
v7 = v6;
v8 = v4 - BitsNeeded;
if( Hint > v6 && Hint < v4 )
v7 = ~(v6 - 1) & (v6 + Hint - 1);
if( v7 > v8 )
return -1;
Buffer = BitMap->Buffer;
while( 1 )
{
v10 = &Buffer[v7 >> 5];
for( i = 0i64; i < BitsNeeded; i += 32i64 )
{
if( *v10 )
break;
++v10;
}
if( i == BitsNeeded )
break;
v7 = v6 + (~(v6 - 1) & (i + v7));
if( v7 > v8 )
return -1;
}
return v7;
}Referenced by:
MiFindEmptyAddressRange