MmLinkJobProcess
VOID __stdcall MmLinkJobProcess(_EJOB *NewJob, _EPROCESS *Process){
int inserted;
_EJOB *v4;
volatile INT64 *v5;
char *v6;
char *v7;
__int64 v8;
_QWORD *v9;
__int64 **v10;
__int64 **v11;
_LIST_ENTRY *Blink;
_LIST_ENTRY *v13;
__int64 *v14;
__int64 v15;
__int64 *v16;
_QWORD *v17;
__int64 *v19;
__int64 v20;
char *i;
__int64 *v22;
__int64 **v23;
_ETHREAD *CurrentThread;
inserted = 0;
v23 = &v22;
v22 = (__int64 *)&v22;
v4 = NewJob;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--*((_WORD *)CurrentThread + 243);
v5 = (volatile INT64 *)((char *)Process + 2352);
ExAcquirePushLockExclusiveEx((UINT64)Process + 2352, 0i64);
if( (*((_DWORD *)Process + 543) & 0x10) == 0 )
{
v6 = (char *)Process + 2360;
v7 = (char *)*((_QWORD *)Process + 295);
if( v7 != (char *)Process + 2360 )
{
while( 1 )
{
v8 = *((_QWORD *)v7 + 2);
LODWORD(v9) = MiAllocatePool((struct _SLIST_ENTRY *)0x100);
if( !v9 )
break;
v9[7] = v8;
v9[4] = *((_QWORD *)v7 - 1);
v10 = (__int64 **)(v9 + 5);
v11 = v23;
if( *v23 != (__int64 *)&v22 )
goto LABEL_35;
v10[1] = (__int64 *)v23;
*v10 = (__int64 *)&v22;
*v11 = (__int64 *)v10;
v23 = v10;
v7 = *(char **)v7;
if( v7 == v6 )
goto LABEL_6;
}
inserted = -1073741670;
LABEL_6:
v4 = NewJob;
}
while( *(char **)v6 != v6 )
MiRemoveSharedCommitNode(*(_QWORD *)(*(_QWORD *)v6 + 16i64), Process, 1i64);
if( inserted < 0 )
{
while( 1 )
{
v19 = v22;
if( v22 == (__int64 *)&v22 )
break;
if( (__int64 **)v22[1] != &v22 )
goto LABEL_35;
v20 = *v22;
if( *(__int64 **)(*v22 + 8) != v22 )
goto LABEL_35;
v22 = (__int64 *)*v22;
*(_QWORD *)(v20 + 8) = &v22;
ExFreePoolWithTag(v19 - 5, 0);
}
}
else if( (*((_DWORD *)Process + 543) & 8) == 0 )
{
_InterlockedOr((volatile signed __int32 *)Process + 543, 8u);
}
}
Blink = v4->ProcessListHead.Blink;
v13 = (_LIST_ENTRY *)((char *)Process + 1480);
if( Blink->Flink != &v4->ProcessListHead )
LABEL_35:
__fastfail(3u);
v13->Flink = &v4->ProcessListHead;
*((_QWORD *)Process + 186) = Blink;
Blink->Flink = v13;
v4->ProcessListHead.Blink = v13;
*((_QWORD *)Process + 162) = v4;
while( 1 )
{
v14 = v22;
if( v22 == (__int64 *)&v22 )
break;
if( (__int64 **)v22[1] != &v22 )
goto LABEL_35;
v15 = *v22;
if( *(__int64 **)(*v22 + 8) != v22 )
goto LABEL_35;
v22 = (__int64 *)*v22;
*(_QWORD *)(v15 + 8) = &v22;
v16 = v14 - 5;
if( inserted >= 0 )
{
v17 = (_QWORD *)v16[7];
if( v16[4] )
{
do
{
inserted = MiInsertSharedCommitNode(v17, (unsigned __int64)Process, 1);
if( inserted < 0 )
break;
}
while( v16[4]-- != 1 );
}
}
ExFreePoolWithTag(v16, 0);
}
if( inserted < 0 )
{
for( i = (char *)Process + 2360;
*(char **)i != i;
MiRemoveSharedCommitNode(*(_QWORD *)(*(_QWORD *)i + 16i64), Process, 1i64) )
{
;
}
_InterlockedAnd((volatile signed __int32 *)Process + 543, 0xFFFFFFF7);
_InterlockedOr((volatile signed __int32 *)Process + 543, 0x10u);
}
if( (_InterlockedExchangeAdd64(v5, 0xFFFFFFFFFFFFFFFFui64) & 6) == 2 )
ExfTryToWakePushLock(v5);
KeAbPostRelease((PVOID)v5);
KiLeaveGuardedRegionUnsafe((__int64)CurrentThread);
}Referenced by:
PspEstablishJobHierarchy