MiAllocateVirtualMemoryCommon
INT64 __fastcall MiAllocateVirtualMemoryCommon(
VOID *a1,
INT64 *a2,
UINT64 r8_0,
UINT64 *a4,
INT64 arg20,
INT64 arg28,
INT64 a7,
CHAR a3,
INT64 arg40,
INT64 arg48,
INT64 a11){
unsigned __int64 v13;
int VirtualMemoryPrepare;
VOID *v15;
int v16;
NTSTATUS v18;
INT64 a5;
INT64 a6;
INT64 a9;
INT64 a10;
unsigned __int64 v23;
INT64 v24;
PVOID Object[2];
INT64 result[7];
int v27;
int v28;
unsigned __int64 *v29;
memset((INT64)result, 0i64);
v13 = 0i64;
v24 = 0i64;
Object[0] = 0i64;
LODWORD(a10) = arg48;
LODWORD(a9) = arg40;
LODWORD(a6) = arg28;
v23 = 0i64;
LODWORD(a5) = arg20;
VirtualMemoryPrepare = MiAllocateVirtualMemoryPrepare(
a1,
*a2,
r8_0,
*a4,
a5,
a6,
a7,
a3,
a9,
a10,
a11,
(INT64)result,
(INT64)Object);
if( VirtualMemoryPrepare < 0 )
goto LABEL_19;
v15 = *(VOID **)(a7 + 24);
if( v15 )
{
if( v15 == (VOID *)-3i64 )
{
v13 = 1i64;
}
else
{
v18 = PsReferencePartitionByHandle(v15, 2ui64, a3, 0x61566D4Dui64, &v23);
v13 = v23;
VirtualMemoryPrepare = v18;
if( v18 < 0 )
goto LABEL_19;
}
}
if( *(_BYTE *)(a7 + 48) != 1 || (arg20 & 0x20400000) == 0x400000 )
{
if( (int)arg40 >= 0 )
{
VirtualMemoryPrepare = MiAllocateVirtualMemory((__int64)result, (__int64 *)v13, &v24);
}
else
{
v23 = 0i64;
if( (v27 & 0x40000000) != 0 )
{
v28 = 536870913;
v29 = &v23;
}
v16 = MiAllocateVirtualMemory((__int64)result, 0i64, &v24);
v29 = 0i64;
VirtualMemoryPrepare = v16;
v28 = 0;
if( v16 >= 0 )
VirtualMemoryPrepare = 0;
}
if( VirtualMemoryPrepare >= 0 )
{
*a2 = v24;
*a4 = result[3];
goto LABEL_11;
}
}
else
{
VirtualMemoryPrepare = -1073741811;
}
LABEL_19:
if( result[0] )
++dword_140C4E52C;
else
++dword_140C4E528;
LABEL_11:
if( v13 >= 2 )
PsDereferencePartition(v13);
if( Object[0] )
ObfDereferenceObjectWithTag(Object[0], 0x6D566D4Dui64);
return(unsigned int)VirtualMemoryPrepare;
}Referenced by:
MmAllocateUserStack