ExpQueryNumaAvailableMemory
INT64 __fastcall ExpQueryNumaAvailableMemory(
VOID *SystemInformation,
UINT64 SystemInformationLength,
UINT64 *ReturnedLength){
unsigned int v4;
_DWORD *v5;
UINT16 ProcessPartitionId;
INT64 result;
unsigned int v8;
unsigned int v9;
__int64 i;
__int64 v11;
__int64 j;
UINT64 a4;
PVOID P;
__int64 v15;
UINT64 v16;
P = 0i64;
a4 = 0i64;
ProcessPartitionId = MmGetProcessPartitionId(*((_QWORD *)KeGetCurrentThread() + 23));
if( v4 >= 4 )
{
v8 = (unsigned __int16)KeNumberNodes;
v9 = (unsigned __int16)KeNumberNodes;
*(_DWORD *)SystemInformation = (unsigned __int16)KeNumberNodes - 1;
if( (v4 - 8) >> 3 <= v8 )
v9 = (v4 - 8) >> 3;
if( v4 >= 8 && v9 )
{
*v5 = 8 * v9 + 8;
if( (unsigned __int16)v8 <= 1u )
{
*((_QWORD *)SystemInformation + 1) = MmGetAvailablePages(ProcessPartitionId) << 12;
}
else
{
for( i = 0i64; (unsigned int)i < v9; i = (unsigned int)(i + 1) )
{
result = MmGetChannelInformation(ProcessPartitionId, (unsigned int)i, (UINT8 **)&P, &a4);
if( (int)result < 0 )
return result;
v11 = 0i64;
v15 = 0i64;
v16 = a4 / 0x28;
for( j = 0i64; (unsigned int)j < a4 / 0x28; j = (unsigned int)(j + 1) )
{
v11 += *((_QWORD *)P + 5 * j + 2) + *((_QWORD *)P + 5 * j + 3);
v15 = v11;
}
ExFreePoolWithTag(P, 0);
*((_QWORD *)SystemInformation + i + 1) = v11 << 12;
}
}
return 0i64;
}
else
{
*v5 = 4;
return 0i64;
}
}
else
{
if( v5 )
*v5 = 4;
return 3221225476i64;
}
}Referenced by:
ExpQuerySystemInformation