IoGetRelatedDeviceObject

NTSTATUS __fastcall IoGetRelatedDeviceObject(INT64 a1){
  __int64 v1; 
  __int64 v2; 
  __int64 v3; 
  _QWORD *v4; 
  __int64 v5; 
  _QWORD *v6; 

  v1 = *(_QWORD *)(a1 + 16);
  if( (!v1 || (v2 = *(_QWORD *)(v1 + 8)) == 0)
    && ((*(_DWORD *)(a1 + 80) & 0x800) != 0
     || (v5 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 56i64)) == 0
     || (v2 = *(_QWORD *)(v5 + 8)) == 0) )
  {
    v2 = *(_QWORD *)(a1 + 8);
  }
  v3 = *(_QWORD *)(v2 + 24);
  if( v3 )
  {
    v4 = *(_QWORD **)(a1 + 208);
    if( v4 && v4 != IopRevocationExtension && (v6 = (_QWORD *)v4[2]) != 0i64 && *v6 )
    {
      while( v2 != *v6 )
      {
        v2 = *(_QWORD *)(v2 + 24);
        if( !v2 )
          goto LABEL_5;
      }
      return *v6;
    }
    else
    {
      do
      {
LABEL_5:
        LODWORD(v2) = v3;
        v3 = *(_QWORD *)(v3 + 24);
      }
      while( v3 );
    }
  }
  return v2;
}

Referenced by:

BuildQueryDirectoryIrp
CcMdlReadComplete
CcMdlWriteComplete
CcSetValidData
CcZeroData
CmpFileFlushAndPurge
FsRtlAcquireFileExclusiveCommon
FsRtlAcquireFileForCcFlushEx
FsRtlAcquireFileForModWriteEx
FsRtlGetDirectImageOriginalBase
FsRtlGetFileExtents
FsRtlGetFileSize
FsRtlIssueFileNotificationFsctl
FsRtlKernelFsControlFile
FsRtlMdlRead
FsRtlMdlReadComplete
FsRtlMdlReadEx
FsRtlMdlWriteComplete
FsRtlPrepareMdlWrite
FsRtlPrepareMdlWriteEx
FsRtlQueryCachedVdl
FsRtlQueryInformationFile
FsRtlQueryKernelEaFile
FsRtlReleaseFile
FsRtlReleaseFileForCcFlush
FsRtlReleaseFileForModWrite
FsRtlSetFileSize
FsRtlSetKernelEaFile
IoAsynchronousPageWrite
IoAttachDevice
IoGetDeviceObjectPointer
IoSetInformation
IoSynchronousPageWriteEx
IopCloseFile
IopCopyOffloadCapable
IopDeleteFile
IopFreeBandwidthContract
IopGetBasicInformationFile
IopGetFileInformation
IopGetSetObjectId
IopGetSetSecurityObject
IopGetVolumeId
IopOpenLinkOrRenameTarget
IopParseDevice
IopParseFile
IopQueryXxxInformation
IopSetEaOrQuotaInformationFile
IopSetRemoteLink
IopXxxControlFile
MiCreatePagingFile
NtFlushBuffersFileEx
NtLockFile
NtNotifyChangeDirectoryFileEx
NtQueryEaFile
NtQueryInformationFile
NtQueryQuotaInformationFile
NtQueryVolumeInformationFile
NtReadFile
NtReadFileScatter
NtSetEaFile
NtSetInformationFile
NtSetVolumeInformationFile
NtUnlockFile
NtWriteFile
NtWriteFileGather
PiPagePathSetState
PnpGetRelatedTargetDevice
PopGetPolicyDeviceObject
RawSetInformation
SmKmIsVolumeIoPossible
SmKmSendUsageNotification
SmKmStoreFileOpenVolume
SmpUtilsGetControlDevice
VhdiMountVhdFile
WmipGetFilePDO