PspBindProcessSessionToJob

NTSTATUS __stdcall PspBindProcessSessionToJob(_EJOB *Job, _EPROCESS *Process){
  __int64 v2; 
  signed __int32 SessionId; 
  int v4; 
  signed __int32 v6; 

  SessionId = MmGetSessionId(Process);
  if( v4 == SessionId )
    return 0;
  if( v4 == -1
    && ((v6 = _InterlockedCompareExchange((volatile signed __int32 *)(v2 + 480), SessionId, -1), v6 == -1)
     || v6 == SessionId) )
  {
    return 0;
  }
  else
  {
    return PspConvertJobToMixed((_EJOB *)v2);
  }
}

Referenced by:

NtSetInformationJobObject
PspEstablishJobHierarchy