IoGetRelatedTargetDevice

NTSTATUS __stdcall IoGetRelatedTargetDevice(FILE_OBJECT *FileObject, DEVICE_OBJECT **DeviceObject){
  NTSTATUS result; 
  __int64 v4; 
  v4 = 0i64;
  result = PnpGetRelatedTargetDevice(FileObject, &v4);
  if( result >= 0 )
  {
    if( v4 )
      *DeviceObject = *(DEVICE_OBJECT **)(v4 + 32);
  }
  return result;
}

Referenced by:

FsRtlNotifyVolumeEventEx
NtGetDevicePowerState
NtSetVolumeInformationFile
PiPagePathSetState