PspGetMemoryPartitionFromJobList

INT64 __fastcall PspGetMemoryPartitionFromJobList(INT64 a1, UINT64 a2, PVOID *a3){
  _ETHREAD *CurrentThread; 
  int v7; 
  UINT64 i; 
  __int64 v9; 
  PVOID v10; 
  PVOID v11; 
  *a3 = 0i64;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --*((_WORD *)CurrentThread + 243);
  v7 = 0;
  for( i = 0i64; i < a2; ++i )
  {
    v9 = *(_QWORD *)(a1 + 8 * i);
    ExAcquireResourceExclusiveLite((ERESOURCE *)(v9 + 56), 1u);
    v10 = *(PVOID *)(v9 + 1560);
    if( v10 == (PVOID)-1i64 )
    {
      v7 = -1073740682;
    }
    else
    {
      v11 = *a3;
      if( v10 )
      {
        if( v11 )
        {
          if( v10 != v11 )
            v7 = -1073741637;
        }
        else
        {
          ObfReferenceObjectWithTag(*(PVOID *)(v9 + 1560), 0x624A7350u);
          *a3 = *(PVOID *)(v9 + 1560);
        }
      }
    }
    ExReleaseResourceLite((PERESOURCE)(v9 + 56));
    if( v7 < 0 )
      break;
  }
  if( (*((_DWORD *)CurrentThread + 324) & 1) != 0 )
    v7 = -1073741749;
  if( v7 < 0 && *a3 )
  {
    ObfDereferenceObjectWithTag(*a3, 0x624A7350ui64);
    *a3 = 0i64;
  }
  KiLeaveGuardedRegionUnsafe((__int64)CurrentThread);
  return(unsigned int)v7;
}

Referenced by:

PspGetMemoryPartitionContext