MiQueuePageFileExtension

VOID __stdcall MiQueuePageFileExtension(_MMPAGE_FILE_EXPANSION *PageExtend, UINT64 SemaphoreFlags){
  unsigned __int8 v2; 
  _MI_PARTITION *Partition; 
  unsigned __int8 v4; 
  int v5; 
  _LIST_ENTRY *p_DereferenceList; 
  _LIST_ENTRY *v8; 
  _LIST_ENTRY *v9; 
  VOID *v10; 
  UINT64 Flags; 

  Partition = PageExtend->Partition;
  v4 = v2;
  v5 = SemaphoreFlags;
  if( v2 == 17 )
    v4 = ExAcquireSpinLockExclusive((INT64 *)&Partition->Segments.SegmentListLock);
  p_DereferenceList = &PageExtend->DereferenceList;
  if( (PageExtend->u1.Flags._bf_3 & 8) != 0 )
  {
    v8 = *(_LIST_ENTRY **)&Partition->Segments.gapB0[56];
    if( (_BYTE *)v8->Flink == &Partition->Segments.gapB0[48] )
    {
      p_DereferenceList->Flink = (_LIST_ENTRY *)&Partition->Segments.gapB0[48];
      PageExtend->DereferenceList.Blink = v8;
      v8->Flink = p_DereferenceList;
      *(_QWORD *)&Partition->Segments.gapB0[56] = p_DereferenceList;
      goto LABEL_10;
    }
LABEL_7:
    __fastfail(3u);
  }
  v9 = *(_LIST_ENTRY **)&Partition->Segments.gapB0[72];
  if( (_BYTE *)v9->Flink != &Partition->Segments.gapB0[64] )
    goto LABEL_7;
  p_DereferenceList->Flink = (_LIST_ENTRY *)&Partition->Segments.gapB0[64];
  PageExtend->DereferenceList.Blink = v9;
  v9->Flink = p_DereferenceList;
  *(_QWORD *)&Partition->Segments.gapB0[72] = p_DereferenceList;
  if( PageExtend->RequestedExpansionSize != -1i64 )
    ++Partition->Segments.PagefileExtensionRequests;
LABEL_10:
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)&Partition->Segments.SegmentListLock);
  __writecr8(v4);
  LODWORD(Flags) = v5;
  KeReleaseSemaphoreEx((_KSEMAPHORE *)Partition->Segments.gapB0, 0i64, 1i64, v10, Flags);
}

Referenced by:

MiContractPagingFiles
MiContractWsSwapPageFileWorker
MiIssuePageExtendRequest