MiResizeAweBitMap
NTSTATUS __fastcall MiResizeAweBitMap(INT64 a1){
_ETHREAD *CurrentThread;
_EPROCESS *Process;
_RTL_BITMAP_EX v4;
__int128 v5;
__int128 v6;
__int128 v7;
NTSTATUS result;
__int128 *v9;
_RTL_BITMAP_EX *p_Destination;
_RTL_BITMAP_EX v11;
_EX_CALLBACK_ROUTINE_BLOCK CallBackBlock[4];
_RTL_BITMAP_EX Destination;
__int128 v14;
__int128 v15;
__int128 v16;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
if( (*(_DWORD *)a1 & 1) != 0 )
Process = CurrentThread->Tcb.ApcState.Process;
else
Process = 0i64;
v4 = *(_RTL_BITMAP_EX *)(a1 + 16);
*(_OWORD *)CallBackBlock = *(_OWORD *)a1;
v5 = *(_OWORD *)(a1 + 32);
Destination = v4;
v6 = *(_OWORD *)(a1 + 48);
v14 = v5;
v7 = *(_OWORD *)(a1 + 64);
v15 = v6;
v16 = v7;
result = MiCreateAweInfoBitMap(CallBackBlock);
if( result >= 0 )
{
v9 = (__int128 *)(a1 + 16);
if( Process )
{
LOCK_ADDRESS_SPACE(CurrentThread, Process);
if( (Process->Flags & 0x20) != 0 )
{
UNLOCK_ADDRESS_SPACE(CurrentThread, Process);
MiDeleteAweBitMap(Process, &Destination);
return -1073741558;
}
}
MiLockAwePagesExclusive(a1, (INT64)CurrentThread);
if( Destination.SizeOfBitMap > *(_QWORD *)v9 )
{
RtlCopyBitMapEx((_RTL_BITMAP_EX *)(a1 + 16), &Destination, 0i64);
v11 = (_RTL_BITMAP_EX)*v9;
*v9 = (__int128)Destination;
MiUnlockAwePagesExclusive(a1, (INT64)CurrentThread);
if( Process )
UNLOCK_ADDRESS_SPACE(CurrentThread, Process);
if( !v11.Buffer )
return 0;
p_Destination = &v11;
}
else
{
MiUnlockAwePagesExclusive(a1, (INT64)CurrentThread);
if( Process )
UNLOCK_ADDRESS_SPACE(CurrentThread, Process);
p_Destination = &Destination;
}
MiDeleteAweBitMap(Process, p_Destination);
return 0;
}
return result;
}Referenced by:
MiAllocateUserPhysicalPages