PspSetJobMemoryPartition
INT64 __stdcall PspSetJobMemoryPartition(PVOID Job, PVOID a2){
VOID *v2;
char v4;
int v5;
volatile INT32 *v6;
struct _EJOB *v7;
char v8;
volatile signed __int32 *v9;
PVOID Object;
Object = 0i64;
v4 = 0;
v5 = PsReferencePartitionByHandle(v2, 1ui64, (INT8)a2, 0x624A7350ui64, &Object);
if( v5 < 0 )
goto LABEL_13;
if( _interlockedbittestandset((volatile signed __int32 *)Object + 30, 0) )
{
v5 = -1073741637;
LABEL_13:
v9 = (volatile signed __int32 *)Object;
goto LABEL_14;
}
v4 = 1;
ExAcquireResourceExclusiveLite((ERESOURCE *)((char *)Job + 56), 1u);
PsIsServerSilo((INT64)Job, v6);
if( v8 || *((_QWORD *)Job + 195) || *((PVOID *)Job + 132) != (char *)Job + 1056 || *((_DWORD *)Job + 54) )
{
v5 = -1073741637;
goto LABEL_12;
}
v5 = PspConvertJobToMixed(v7);
if( v5 < 0 )
{
LABEL_12:
ExReleaseResourceLite((PERESOURCE)((char *)Job + 56));
goto LABEL_13;
}
*((_QWORD *)Job + 195) = -1i64;
ExReleaseResourceLite((PERESOURCE)((char *)Job + 56));
v9 = (volatile signed __int32 *)Object;
v5 = PsAssignProcessToJobObject((ULONG_PTR)Job, *((PVOID *)Object + 13), 0i64);
if( v5 >= 0 )
{
ObfReferenceObjectWithTag((PVOID)v9, 0x624A7350u);
ExAcquireResourceExclusiveLite((ERESOURCE *)((char *)Job + 56), 1u);
*((_QWORD *)Job + 195) = v9;
*((_QWORD *)Job + 196) = Job;
ExReleaseResourceLite((PERESOURCE)((char *)Job + 56));
v4 = 0;
v5 = 0;
}
LABEL_14:
if( v9 )
{
if( *((_QWORD *)Job + 195) == -1i64 )
*((_QWORD *)Job + 195) = 0i64;
if( v4 )
{
_interlockedbittestandreset(v9 + 30, 0);
v9 = (volatile signed __int32 *)Object;
}
PsDereferencePartition((INT64)v9);
}
return(unsigned int)v5;
}Referenced by:
NtSetInformationJobObject