MmGetSessionMappedViewInformation
INT64 __stdcall MmGetSessionMappedViewInformation(
VOID *SystemInformation,
UINT64 SystemInformationLength,
UINT64 *Length,
UINT64 *SessionId){
char *v4;
UINT64 *v5;
unsigned int v6;
INT64 result;
__int64 v8;
int v9;
char *v10;
struct _DMA_ADAPTER *i;
__int64 v12;
struct _DMA_ADAPTER *v13;
int v14;
unsigned int v15;
__int64 v16;
int v17;
VOID *LockedBuffer;
__int64 a2;
UINT64 a3;
UINT64 *v21;
PVOID P;
UINT64 *v23;
KAPC_STATE ApcState;
v4 = 0i64;
v21 = SessionId;
P = 0i64;
a3 = 0i64;
v5 = Length;
a2 = 0i64;
v6 = SystemInformationLength;
v23 = Length;
LockedBuffer = 0i64;
memset(&ApcState, 0, sizeof(ApcState));
if( (_DWORD)SystemInformationLength )
{
result = ExLockUserBuffer(
SystemInformation,
SystemInformationLength,
*((_BYTE *)KeGetCurrentThread() + 562),
IoWriteAccess,
&LockedBuffer,
&P);
if( (int)result < 0 )
return result;
v4 = (char *)LockedBuffer;
}
LABEL_4:
*(_DWORD *)v5 = 0;
LODWORD(v8) = 0;
v9 = 0;
v10 = 0i64;
for( i = 0i64; ; i = v13 )
{
LODWORD(v12) = MmGetNextSession(i);
v13 = (struct _DMA_ADAPTER *)v12;
if( !v12 )
break;
v10 = &v4[(unsigned int)v8];
v14 = MmGetSessionId(v12);
if( *(_DWORD *)v21 == -1 || v14 == *(_DWORD *)v21 )
{
if( MmAttachSession(v13, &ApcState) >= 0 )
{
v15 = v8 + 32;
if( (int)v8 + 32 < (unsigned int)v8 )
{
MmDetachSession(v13, &ApcState);
HalPutDmaAdapter(v13);
v5 = v23;
goto LABEL_4;
}
v8 = v15;
if( v15 <= v6 )
{
v16 = *(_QWORD *)(*((_QWORD *)KeGetCurrentThread() + 23) + 1368i64);
MiGetSystemPteStatistics(v16 + 880, &a2, &a3);
*((_QWORD *)v10 + 2) = a2 << 12;
*((_QWORD *)v10 + 3) = a3 << 12;
*((_DWORD *)v10 + 2) = v14;
v17 = *(_DWORD *)(v16 + 220);
v4 = (char *)LockedBuffer;
*((_DWORD *)v10 + 3) = v17;
*(_QWORD *)v10 = v8;
}
else
{
v9 = -1073741820;
}
MmDetachSession(v13, &ApcState);
}
if( *(_DWORD *)v21 != -1 )
{
HalPutDmaAdapter(v13);
break;
}
}
}
if( v9 >= 0 && v10 )
*(_QWORD *)v10 = 0i64;
if( v4 )
ExUnlockUserBuffer(P);
*(_DWORD *)v23 = v8;
return(unsigned int)v9;
}Referenced by:
ExpQuerySystemInformation