MiLocateSubsectionNode

_SUBSECTION *__stdcall MiLocateSubsectionNode(
        _CONTROL_AREA *ControlArea,
        UINT64 FileOffset,
        UINT64 ControlAreaLockHeld){
  int v3; 
  KIRQL v6; 
  __int64 v7; 
  UINT64 v8; 
  unsigned __int64 v9; 
  UINT64 v10; 
  UINT64 v11; 
  _QWORD *v13; 
  unsigned __int16 v14; 
  unsigned __int64 v15; 
  unsigned __int64 v16; 
  unsigned __int64 v17; 
  _SUBSECTION *v18; 
  INT64 result[4]; 
  unsigned __int16 v20; 
  int v21; 
  v3 = ControlAreaLockHeld;
  memset((INT64)result, 0i64);
  if( FileOffset >= 0x3FFFFFFFFFF000i64 )
    return 0i64;
  if( v3 == 1 )
    v6 = 17;
  else
    v6 = ExAcquireSpinLockShared((PEX_SPIN_LOCK)ControlArea + 18);
  v7 = *((_QWORD *)ControlArea + 36);
  v8 = FileOffset >> 12;
  v9 = *(unsigned int *)(v7 + 36) | ((unsigned __int64)(*(_WORD *)(v7 + 32) & 0xFFC0) << 26);
  v10 = v9 + *(unsigned int *)(v7 + 40);
  if( *(_WORD *)(v7 + 34) < 0x10u )
    --v10;
  v11 = HIDWORD(v8);
  if( v8 >= v9 )
  {
    v11 = HIDWORD(v8);
    if( v8 <= v10 )
    {
      if( v6 != 17 )
      {
        ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)ControlArea + 18);
        __writecr8(v6);
      }
      return(_SUBSECTION *)v7;
    }
  }
  v13 = (_QWORD *)*((_QWORD *)ControlArea + 34);
  v14 = v20 & 0x3F | ((_WORD)v11 << 6);
  v21 = v8;
  v20 = v14;
  if( !v13 )
  {
LABEL_13:
    if( v6 != 17 )
    {
      ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)ControlArea + 18);
      __writecr8(v6);
    }
    return 0i64;
  }
  v15 = ((unsigned __int64)v14 << 26) ^ (unsigned int)v8 ^ (v14 << 26);
  while( 1 )
  {
    v16 = *((unsigned int *)v13 - 5) | ((unsigned __int64)(*(_WORD *)(v13 - 3) & 0xFFC0) << 26);
    v17 = v16 + *((unsigned int *)v13 - 4);
    if( *((_WORD *)v13 - 11) < 0x10u )
      --v17;
    if( v15 > v17 )
    {
      v13 = (_QWORD *)v13[1];
      goto LABEL_23;
    }
    if( v15 >= v16 )
      break;
    v13 = (_QWORD *)*v13;
LABEL_23:
    if( !v13 )
      goto LABEL_13;
  }
  v18 = (_SUBSECTION *)(v13 - 7);
  *((_QWORD *)ControlArea + 36) = v13 - 7;
  if( v6 != 17 )
  {
    ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)ControlArea + 18);
    __writecr8(v6);
  }
  return v18;
}

Referenced by:

MiAdvanceVadView
MiComputeDataFlushRange
MiDereferenceDataSubsections
MiGetProtoPteAddress
MiMapViewOfDataSection
MiPfPrepareReadList
MiReferenceDataSubsections
MiRemoveMappedPtes