MmInitializeMemoryLimits
_PHYSICAL_MEMORY_DESCRIPTOR *__fastcall MmInitializeMemoryLimits(
_LOADER_PARAMETER_BLOCK *LoaderBlock,
UINT8 *IncludeType){
_LOADER_PARAMETER_BLOCK *v2;
unsigned int v3;
_LOADER_PARAMETER_BLOCK *v4;
unsigned int *v6;
unsigned int *v7;
unsigned int v8;
_LOADER_PARAMETER_BLOCK *v9;
__int64 v10;
__int64 v11;
__int64 v12;
__int64 v13;
unsigned int *v14;
_PHYSICAL_MEMORY_DESCRIPTOR *result;
__int64 v16;
__int64 v17;
__int64 v18;
__int64 v19;
v2 = (_LOADER_PARAMETER_BLOCK *)((char *)LoaderBlock + 32);
v3 = 0;
v4 = (_LOADER_PARAMETER_BLOCK *)*((_QWORD *)LoaderBlock + 4);
if( v4 == (_LOADER_PARAMETER_BLOCK *)((char *)LoaderBlock + 32) )
return 0i64;
do
{
v4 = *(_LOADER_PARAMETER_BLOCK **)v4;
++v3;
}
while( v4 != v2 );
if( !v3 )
return 0i64;
LODWORD(v6) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
v7 = v6;
if( !v6 )
return 0i64;
*v6 = v3;
v8 = 0;
v9 = *(_LOADER_PARAMETER_BLOCK **)v2;
v10 = 0i64;
v11 = -1i64;
if( *(_LOADER_PARAMETER_BLOCK **)v2 == v2 )
goto LABEL_19;
do
{
v12 = *((int *)v9 + 4);
if( (int)v12 < 41 && IncludeType[v12] )
{
v16 = *((_QWORD *)v9 + 4);
v17 = *((_QWORD *)v9 + 3);
v10 += v16;
if( v17 == v11 && v8 )
{
*(_QWORD *)&v7[4 * v8 + 2] += v16;
v11 += *((_QWORD *)v9 + 4);
}
else
{
v18 = 2i64 * v8++;
*(_QWORD *)&v7[2 * v18 + 4] = v17;
v19 = *((_QWORD *)v9 + 4);
*(_QWORD *)&v7[2 * v18 + 6] = v19;
v11 = v19 + v17;
}
}
v9 = *(_LOADER_PARAMETER_BLOCK **)v9;
}
while( v9 != v2 );
if( !v8 )
{
LABEL_19:
*((_QWORD *)v7 + 2) = 0i64;
*((_QWORD *)v7 + 3) = 0i64;
}
else if( v3 > v8 )
{
LODWORD(v13) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
v14 = (unsigned int *)v13;
if( v13 )
{
memmove((UINT8 *)(v13 + 16), (UINT8 *)v7 + 16, 16i64 * v8);
ExFreePoolWithTag(v7, 0);
v7 = v14;
}
}
*v7 = v8;
result = (_PHYSICAL_MEMORY_DESCRIPTOR *)v7;
*((_QWORD *)v7 + 1) = v10;
return result;
}Referenced by:
IopInitCrashDumpDuringSysInit
IopInitializeResourceMap
MiInitNucleus