MiDereferenceControlAreaPfnList

VOID __stdcall MiDereferenceControlAreaPfnList(
        _CONTROL_AREA *ControlArea,
        _SUBSECTION *Subsection,
        UINT64 NumberOfReferences,
        UINT64 Flags){
  UINT64 v4; 
  void *Object; 
  char v6; 
  _SUBSECTION *v9; 
  unsigned int v10; 
  INT64 *p_ControlAreaLock; 
  INT64 *v12; 
  unsigned __int8 v13; 
  _MI_CROSS_PARTITION_CHARGES *v15; 
  UINT64 v16; 
  UINT64 v17; 

  v4 = 0i64;
  Object = ControlArea->FilePointer.Object;
  v6 = Flags;
  if( (ControlArea->u.LongFlags & 0x20) != 0 || !Object )
    v9 = 0i64;
  else
    v9 = Subsection;
  v10 = 0;
  p_ControlAreaLock = (INT64 *)&ControlArea->ControlAreaLock;
  if( Object )
    v10 = 1;
  v12 = (INT64 *)&ControlArea->ControlAreaLock;
  if( (Flags & 2) != 0 )
  {
    v13 = 17;
    ExpAcquireSpinLockExclusive(v12, 0xFFu);
  }
  else
  {
    v13 = ExAcquireSpinLockExclusive(v12);
  }
  if( v9 )
  {
    if( v9[1].u1.e1._bf_0-- == 1
      && !*(_QWORD *)&v9[1].NumberOfFullSectors
      && (Subsection->u.SubsectionFlags._bf_2 & 1) == 0
      && (v9->u.SubsectionFlags._bf_2 & 8) != 0 )
    {
      MiRemoveUnusedSubsection((_MSUBSECTION *)v9);
      LODWORD(v17) = MiInsertUnusedSubsection((_MSUBSECTION *)v9, v16);
      v4 = v17;
    }
  }
  --ControlArea->NumberOfPfnReferences;
  if( (v6 & 1) != 0 )
    MiCheckForControlAreaDeletion(ControlArea);
  if( v4 )
    v15 = *(_MI_CROSS_PARTITION_CHARGES **)(*(&stru_140C4DB30 + 267) + 8i64 * (ControlArea->u1.Flags._bf_0 & 0x3FF));
  else
    v15 = 0i64;
  if( v13 == 17 )
  {
    *(_DWORD *)p_ControlAreaLock = 0;
  }
  else
  {
    ExReleaseSpinLockExclusiveFromDpcLevel(p_ControlAreaLock);
    __writecr8(v13);
  }
  if( v4 )
    MiReturnCrossPartitionSectionCharges(v15, v10, v4);
}

Referenced by:

MiCopyDataPageToImagePage
MiDeleteTransitionPte
MiGatherMappedPages
MiPurgeImageSection
MiPurgeSubsection
MiReleaseInPageRefs
MiRestoreTransitionPte
MiSplitDirectMapPage