MmStoreRegister
__int64 __fastcall MmStoreRegister(__int64 a1, __int64 a2, __int64 a3, int a4){
__int64 v6;
__int64 StartContext;
NTSTATUS v8;
RTL_BITMAP *v9;
RTL_BITMAP *v10;
unsigned __int64 v11;
__int64 *v12;
__int64 v13;
__int64 v14;
unsigned __int64 v15;
unsigned __int64 v16;
__int64 v17;
struct _UNICODE_STRING *Pagefile;
struct _UNICODE_STRING *v19;
int v20;
int v21;
HANDLE Handle;
PVOID Object;
Handle = 0i64;
dword_140C50F4C = 1;
if( !(unsigned int)MmStoreCheckPagefiles() )
return 3221225799i64;
LODWORD(v6) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
StartContext = v6;
if( !v6 )
return 3221225626i64;
*(_QWORD *)v6 = &MiSystemPartition;
KeInitializeEvent((_KEVENT *)(v6 + 8), NotificationEvent, 0);
*(_DWORD *)(StartContext + 32) = 0;
v8 = PsCreateSystemThreadEx(
&Handle,
0x1FFFFFui64,
0i64,
0i64,
0i64,
MiStoreEvictThread,
(PVOID)StartContext,
0i64,
0i64);
if( v8 < 0 )
{
ExFreePoolWithTag((PVOID)StartContext, 0);
}
else
{
LODWORD(v9) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
v10 = v9;
if( v9 )
{
v9->SizeOfBitMap = dword_140CFA18C;
v9->Buffer = &v9[1].SizeOfBitMap;
RtlClearAllBits(v9);
v11 = 0i64;
if( Count )
{
v12 = qword_140C525E0;
v13 = Count;
do
{
v14 = *v12;
v15 = v11;
++v12;
v11 = *(_QWORD *)(v14 + 8);
if( v15 >= v11 )
v11 = v15;
--v13;
}
while( v13 );
}
v16 = qword_140C525D0 + v11;
v17 = 0xFFFFFFFi64;
if( v16 <= 0xFFFFFFF )
v17 = v16;
Pagefile = (struct _UNICODE_STRING *)MiCreatePagefile(
(unsigned int)&MiSystemPartition,
0,
0,
v17,
v17,
0i64,
0,
2);
v19 = Pagefile;
if( Pagefile )
{
MiInsertPageFileInList(Pagefile);
v8 = v20;
if( v20 < 0 )
{
*(_DWORD *)(StartContext + 32) = 1;
}
else
{
Object = 0i64;
qword_140C50FB8 = (__int64)v10;
dword_140C50F4C = 254;
v21 = WORD2(v19[12].Buffer) & 0xF;
qword_140C50FC0 = a3;
dword_140C50F44 = v21;
ObReferenceObjectByHandle(Handle, 0x1FFFFFu, (POBJECT_TYPE)PsThreadType, 0, &Object, 0i64);
v10 = 0i64;
v19 = 0i64;
qword_140C50F68 = (__int64)Object;
dword_140C50FC8 = a4;
v8 = 0;
dword_140C50F48 = 1;
}
}
else
{
*(_DWORD *)(StartContext + 32) = 1;
v8 = -1073741670;
}
if( v10 )
ExFreePoolWithTag(v10, 0);
if( v19 )
MiDeletePagefile(v19, 1);
}
else
{
*(_DWORD *)(StartContext + 32) = 1;
v8 = -1073741670;
}
KeSetEvent((PRKEVENT)(StartContext + 8), 0);
ObCloseHandle(Handle, 0);
}
return(unsigned int)v8;
}Referenced by:
SmFirstTimeInit