IoGetRelatedTargetDevice

NTSTATUS __stdcall IoGetRelatedTargetDevice(_FILE_OBJECT *FileObject, _DEVICE_OBJECT **DeviceObject){
  INT64 v2; 
  NTSTATUS result; 
  __int64 v5; 

  v5 = 0i64;
  result = PnpGetRelatedTargetDevice(FileObject, &v5, v2);
  if( result >= 0 )
  {
    if( v5 )
      *DeviceObject = *(_DEVICE_OBJECT **)(v5 + 32);
  }
  return result;
}

Referenced by:

FsRtlNotifyVolumeEventEx
NtGetDevicePowerState
NtSetVolumeInformationFile
PiPagePathSetState