MiPartitionObjectToPartition

NTSTATUS __stdcall MiPartitionObjectToPartition(PVOID BugCheckParameter2){
  char v1; 
  _BYTE *v2; 
  ULONG_PTR BugCheckParameter4; 
  _BYTE *v4; 
  char v5; 
  int v6; 
  ULONG_PTR *v7; 
  ULONG_PTR v9; 
  LOBYTE(BugCheckParameter4) = 0;
  v4 = v2;
  v5 = v1;
  v6 = 0;
  if( BugCheckParameter2 )
  {
    if( BugCheckParameter2 == (PVOID)-1i64 )
    {
      v7 = *(ULONG_PTR **)(qword_140C4E388
                         + 8i64 * *(unsigned __int16 *)(*((_QWORD *)KeGetCurrentThread() + 23) + 1838i64));
    }
    else
    {
      v7 = *(ULONG_PTR **)BugCheckParameter2;
      v6 = 1;
    }
  }
  else
  {
    v7 = &MiSystemPartition;
  }
  if( *((_DWORD *)v7 + 2) != 305535296 )
    goto LABEL_15;
  if( v6 != 1 )
    goto LABEL_5;
  if( (PVOID)v7[22] != BugCheckParameter2 )
LABEL_15:
    KeBugCheckEx(0x1Au, 0x41001ui64, (ULONG_PTR)BugCheckParameter2, (ULONG_PTR)v7, 0i64);
  if( PsReferencePartitionSafe((INT64)BugCheckParameter2) )
  {
    LOBYTE(BugCheckParameter4) = 1;
  }
  else
  {
    if( v5 )
      KeBugCheckEx(0x1Au, 0x41002ui64, v9, (ULONG_PTR)v7, BugCheckParameter4);
    LODWORD(v7) = BugCheckParameter4;
  }
LABEL_5:
  *v4 = BugCheckParameter4;
  return(int)v7;
}

Referenced by:

MmAllocateNonChargedSecurePages
MmAllocatePartitionNodePagesForMdlEx
MmAllocateSecureKernelPages
MmBuildLargePages
MmFreeNonChargedSecurePages
MmGetNodeFastLargePageCounts
MmGetPageFileInformation
MmGetPhysicalMemoryRangesEx2