MiAddMappedPtes
NTSTATUS __stdcall MiAddMappedPtes(
_MMPTE *FirstPte,
UINT64 NumberOfPtes,
_CONTROL_AREA *ControlArea,
_LARGE_INTEGER *SectionOffset,
UINT64 SessionId){
int v5;
_CONTROL_AREA *v6;
_MMPTE *v7;
_MMPTE *v8;
INT64 DemandZeroPte;
_SUBSECTION *v10;
__int64 v11;
unsigned __int16 v12;
__int64 v13;
unsigned __int64 v14;
unsigned __int64 v15;
UINT64 PrototypePteDirect;
__int16 v18;
int v19;
__int64 SubsectionDriverProtos;
unsigned int v21;
unsigned int v22;
unsigned __int64 i;
UINT64 PteOffset;
unsigned __int64 v25;
_CONTROL_AREA *v26;
int v27;
v26 = ControlArea;
v5 = 0;
v6 = ControlArea;
v7 = FirstPte;
PteOffset = 0i64;
if( (MiFlags & 0x10000) == 0 || (MiFlags & 0x8000) == 0 || (*((_DWORD *)ControlArea + 14) & 0x20) == 0 )
v27 = 0;
v8 = (_MMPTE *)((char *)FirstPte + 8 * NumberOfPtes);
v25 = 0i64;
DemandZeroPte = 0i64;
v10 = MiOffsetToProtos(ControlArea, SectionOffset->QuadPart, &PteOffset);
v11 = (__int64)v10;
if( v10 )
{
v12 = 1;
if( (*((_BYTE *)v10 + 34) & 2) != 0 && (*((_DWORD *)v6 + 14) & 0x4000000) != 0 )
goto LABEL_21;
if( (*((_DWORD *)v6 + 14) & 0x20) != 0 )
{
SubsectionDriverProtos = MiGetSubsectionDriverProtos(v10);
if( SubsectionDriverProtos )
goto LABEL_22;
}
v13 = *(_QWORD *)(v11 + 8);
v14 = v13 + 8 * PteOffset;
v15 = v13 + 8i64 * *(unsigned int *)(v11 + 44);
while( 1 )
{
if( v7 >= v8 )
return 0;
if( v14 < v15 )
goto LABEL_9;
v11 = *(_QWORD *)(v11 + 16);
if( !v11 )
{
for( i = *((_QWORD *)v6 + 17)
+ 8
* (*(unsigned int *)(*(_QWORD *)v6 + 8i64) | ((unsigned __int64)(*(_WORD *)(*(_QWORD *)v6 + 12i64) & 0x3FF) << 32));
v14 < i;
v14 += 8i64 )
{
*(_QWORD *)v7 = MiMakePrototypePteDirect(v14);
v7 = (_MMPTE *)((char *)v7 + 8);
if( v7 >= v8 )
break;
}
return 0;
}
v18 = *(_WORD *)(v11 + 34);
v19 = *((_DWORD *)v6 + 14);
v14 = *(_QWORD *)(v11 + 8);
if( (((v19 & 0x4000000) != 0) & _bittest16(&v18, v12)) != 0 )
{
LABEL_21:
SubsectionDriverProtos = (__int64)MiGetSharedProtos((__int64)v6, SessionId, v11);
}
else
{
if( (v19 & 0x20) == 0 )
goto LABEL_17;
SubsectionDriverProtos = MiGetSubsectionDriverProtos((_QWORD *)v11);
if( !SubsectionDriverProtos )
goto LABEL_17;
}
LABEL_22:
v14 = *(_QWORD *)(SubsectionDriverProtos + 72);
LABEL_17:
v5 = 0;
v15 = v14 + 8i64 * *(unsigned int *)(v11 + 44);
if( !v27 || (v21 = *(unsigned __int16 *)(v11 + 32), (v21 & 4) == 0) )
{
LABEL_10:
PrototypePteDirect = MiMakePrototypePteDirect(v14);
goto LABEL_11;
}
v22 = (*(unsigned __int16 *)(v11 + 34) >> 4) + (*(_DWORD *)(v11 + 40) << 9);
v25 = v14 + 8i64 * ((v22 >> 12) + ((v22 & 0xFFF) != 0));
v5 = ((__int64)(v15 - v25) >> 3) - (*(_DWORD *)(v11 + 52) & 0x3FFFFFFF);
DemandZeroPte = MiMakeDemandZeroPte((v21 >> 1) & 0x1F);
LABEL_9:
if( !v5 || v14 < v25 )
goto LABEL_10;
PrototypePteDirect = DemandZeroPte;
--v5;
LABEL_11:
*(_QWORD *)v7 = PrototypePteDirect;
v6 = v26;
v7 = (_MMPTE *)((char *)v7 + 8);
v14 += 8i64;
v12 = 1;
}
}
return -1073741793;
}Referenced by:
MiInsertInSystemSpace
MiMapSystemImage