PspWritePebAffinityInfo
void __fastcall PspWritePebAffinityInfo(__int64 a1, struct _EX_RUNDOWN_REF *a2){
unsigned int v3;
unsigned __int64 Count;
__int64 v5;
__int64 *v6;
__int64 v7;
unsigned int v8;
__int64 v9;
unsigned __int64 v10;
__int64 v11;
int v12;
int v13;
int v14[8];
unsigned int v15;
unsigned int v16;
unsigned int v17;
unsigned int v18;
unsigned __int64 v19;
unsigned __int64 v20;
__int64 v21;
struct _EX_RUNDOWN_REF *v22;
_KAPC_STATE ApcState;
v22 = a2;
memset(&ApcState, 0, sizeof(ApcState));
v3 = 0;
v15 = 0;
v16 = 0;
Count = a2[170].Count;
v20 = Count;
if( !Count )
return;
if( a2[136].Count )
{
if( a2 == *(struct _EX_RUNDOWN_REF **)(a1 + 184) )
{
if( a2 != *(struct _EX_RUNDOWN_REF **)(a1 + 544) )
v3 = 2;
v15 = v3;
if( v3 < 2 )
{
LABEL_19:
if( (v3 & 1) != 0 )
KiStackAttachProcess((_KPROCESS *)a2, 0i64, &ApcState);
goto LABEL_3;
}
}
else
{
v3 = 3;
v15 = 3;
}
if( !ExAcquireRundownProtection(a2 + 139) )
return;
goto LABEL_19;
}
LABEL_3:
v18 = v3;
v5 = 0i64;
v6 = (__int64 *)a2[176].Count;
if( v6 )
v5 = *v6;
v21 = v5;
do
{
do
{
KeQueryGroupMaskProcess((_EPROCESS *)a2);
v17 = v8;
_BitScanForward((unsigned int *)&v9, v8);
v16 = v9;
v10 = a2[v9 + 11].Count;
v19 = v10;
}
while( !v10 );
*(_QWORD *)(Count + 312) = v10;
if( v7 )
*(_DWORD *)(v7 + 192) = v10 | HIDWORD(v10);
_InterlockedOr(v14, 0);
KeQueryGroupMaskProcess((_EPROCESS *)a2);
}
while( v13 != v12 || v11 != a2[v16 + 11].Count );
if( v3 )
{
if( (v3 & 1) != 0 )
KiUnstackDetachProcess(&ApcState, 0i64);
ExReleaseRundownProtection(a2 + 139);
}
}Referenced by:
NtSetInformationProcess
PspAllocateProcess
PspApplyJobLimitsToProcess
PspSetupUserProcessAddressSpace
PspUpdateSingleProcessAffinity