PsReferencePartitionByHandle

NTSTATUS __fastcall PsReferencePartitionByHandle(VOID *a1, UINT64 a2, INT8 a3, UINT64 a4, _QWORD *a5){
  NTSTATUS v5; 
  unsigned int v6; 
  NTSTATUS result; 
  PVOID v9; 
  void *v10; 
  INT64 v11; 
  v5 = 0;
  v6 = a4;
  v11 = 0i64;
  if( a1 == (VOID *)-1i64 )
  {
    v9 = *(PVOID *)(*((_QWORD *)KeGetCurrentThread() + 23) + 2520i64);
  }
  else if( a1 == (VOID *)-2i64 )
  {
    v9 = PspSystemPartition;
  }
  else
  {
    result = ObpReferenceObjectByHandleWithTag(
               (ULONG_PTR)a1,
               a2,
               (__int64)PsPartitionType,
               a3,
               a4,
               (__int64)&v11,
               0i64,
               0i64);
    if( result < 0 )
      return result;
    v9 = (PVOID)v11;
  }
  if( PsReferencePartitionSafe((INT64)v9) )
    *a5 = v10;
  else
    v5 = -1073740640;
  if( (unsigned __int64)a1 <= 0xFFFFFFFFFFFFFFFDui64 )
    ObfDereferenceObjectWithTag(v10, v6);
  return v5;
}

Referenced by:

EtwpSetPartitionContext
IopSetFileMemoryPartitionInformation
MiAllocateVirtualMemoryCommon
MiInitializeCreateSectionPacket
MmAllocateVirtualMemory
NtAllocateVirtualMemory
NtCreatePartition
NtManagePartition
PspSetJobMemoryPartition