PspGetMemoryPartitionImplicit

INT64 __stdcall PspGetMemoryPartitionImplicit(_EJOB *Silo, INT64 a2){
  _QWORD *v2; 
  _QWORD *v3; 
  __int16 v4; 
  unsigned int v5; 
  _ETHREAD *CurrentThread; 
  _EJOB *EffectiveServerSilo; 
  void *PartitionObject; 
  v3 = v2;
  v4 = a2;
  v5 = 0;
  *v2 = 0i64;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  PspLockJobChain((__int64)Silo, (__int64)CurrentThread, 0);
  if( (v4 & 0x400) != 0 )
  {
    EffectiveServerSilo = PsGetEffectiveServerSilo(Silo);
  }
  else
  {
    for( EffectiveServerSilo = Silo; EffectiveServerSilo; EffectiveServerSilo = EffectiveServerSilo->ParentJob )
    {
      if( (EffectiveServerSilo->LimitFlags & 0x1000) == 0
        && ((EffectiveServerSilo->LimitFlags & 0x800) == 0 || (v4 & 1) == 0) )
      {
        break;
      }
    }
    if( (v4 & 1) != 0 && EffectiveServerSilo == Silo && (EffectiveServerSilo->JobFlags & 0x40000000) == 0 )
    {
      v5 = -1073741790;
      goto LABEL_11;
    }
  }
  if( EffectiveServerSilo )
  {
    PartitionObject = EffectiveServerSilo->PartitionObject;
    if( PartitionObject == (void *)-1i64 )
    {
      v5 = -1073740682;
    }
    else
    {
      if( PartitionObject )
      {
        ObfReferenceObjectWithTag(EffectiveServerSilo->PartitionObject, 0x624A7350u);
        PartitionObject = EffectiveServerSilo->PartitionObject;
      }
      *v3 = PartitionObject;
    }
  }
LABEL_11:
  PspUnlockJobChain((__int64)Silo, (__int64)CurrentThread, 0);
  return v5;
}

Referenced by:

PspGetMemoryPartitionContext