ReactOS  0.4.12-dev-914-g71f84a3
phys_lib.cpp File Reference
#include "phys_lib.h"
Include dependency graph for phys_lib.cpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Vcb   ((PVCB)_Vcb)
 
#define fms   FALSE
 
#define TempMSF   toc->SessionData[index].Params.StartPositionOfLeadOut.MSF
 
#define TempMSF   toc->SessionData[index].Params.StartPositionOfTrack.MSF
 
#define TempMSF   toc->SessionData[index].Params.StartPositionOfTrack.MSF
 
#define TempMSF   toc->SessionData[index].Params.StartPositionOfNextProgramArea.MaxLeadOut_MSF
 
#define fms   FALSE
 
#define TempMSF   toc->TrackData[TocEntry].LBA
 
#define fms   FALSE
 
#define fms   FALSE
 
#define cap   ((PGET_CAPABILITIES_3_USER_OUT)ioBuf)
 

Functions

OSSTATUS UDFSetSpeeds (IN PVCB Vcb)
 
NTSTATUS UDFSetCaching (IN PVCB Vcb)
 
OSSTATUS UDFRecoverFromError (IN PVCB Vcb, IN BOOLEAN WriteOp, IN OSSTATUS status, IN uint32 Lba, IN uint32 BCount, IN OUT uint32 *retry)
 
NTSTATUS UDFSyncCache (IN PVCB Vcb)
 
OSSTATUS UDFReallocTrackMap (IN PVCB Vcb, IN uint32 TrackNum)
 
OSSTATUS UDFTWrite (IN void *_Vcb, IN void *Buffer, IN uint32 Length, IN uint32 LBA, OUT uint32 *WrittenBytes, IN uint32 Flags)
 
OSSTATUS UDFTRead (IN void *_Vcb, IN void *Buffer, IN uint32 Length, IN uint32 LBA, OUT uint32 *ReadBytes, IN uint32 Flags)
 
NTSTATUS UDFSetMRWMode (IN PVCB Vcb)
 
OSSTATUS UDFDoOPC (IN PVCB Vcb)
 
OSSTATUS UDFPrepareForWriteOperation (IN PVCB Vcb, IN uint32 Lba, IN uint32 BCount)
 
OSSTATUS UDFReadDiscTrackInfo (PDEVICE_OBJECT DeviceObject, PVCB Vcb)
 
OSSTATUS UDFReadAndProcessFullToc (PDEVICE_OBJECT DeviceObject, PVCB Vcb)
 
OSSTATUS UDFUseStandard (PDEVICE_OBJECT DeviceObject, PVCB Vcb)
 
OSSTATUS UDFGetBlockSize (IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
 
OSSTATUS UDFGetDiskInfo (IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
 
OSSTATUS UDFPrepareForReadOperation (IN PVCB Vcb, IN uint32 Lba, IN uint32 BCount)
 
void UDFUpdateNWA (PVCB Vcb, uint32 LBA, uint32 BCount, OSSTATUS RC)
 
OSSTATUS UDFWriteSectors (IN PVCB Vcb, IN BOOLEAN Translate, IN uint32 Lba, IN uint32 BCount, IN BOOLEAN Direct, IN int8 *Buffer, OUT uint32 *WrittenBytes)
 
OSSTATUS UDFWriteInSector (IN PVCB Vcb, IN BOOLEAN Translate, IN uint32 Lba, IN uint32 i, IN uint32 l, IN BOOLEAN Direct, OUT int8 *Buffer, OUT uint32 *WrittenBytes)
 
OSSTATUS UDFWriteData (IN PVCB Vcb, IN BOOLEAN Translate, IN int64 Offset, IN uint32 Length, IN BOOLEAN Direct, IN int8 *Buffer, OUT uint32 *WrittenBytes)
 
OSSTATUS UDFResetDeviceDriver (IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
 

Variables

static const char Signature [16] = {CDRW_SIGNATURE_v1}
 

Macro Definition Documentation

◆ cap

GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum cap   ((PGET_CAPABILITIES_3_USER_OUT)ioBuf)

◆ fms [1/4]

#define fms   FALSE

◆ fms [2/4]

#define fms   FALSE

◆ fms [3/4]

#define fms   FALSE

◆ fms [4/4]

#define fms   FALSE

◆ TempMSF [1/5]

#define TempMSF   toc->SessionData[index].Params.StartPositionOfLeadOut.MSF

◆ TempMSF [2/5]

#define TempMSF   toc->SessionData[index].Params.StartPositionOfTrack.MSF

◆ TempMSF [3/5]

#define TempMSF   toc->SessionData[index].Params.StartPositionOfTrack.MSF

◆ TempMSF [4/5]

#define TempMSF   toc->SessionData[index].Params.StartPositionOfNextProgramArea.MaxLeadOut_MSF

◆ TempMSF [5/5]

#define TempMSF   toc->TrackData[TocEntry].LBA

◆ Vcb

IN PVCB Vcb   ((PVCB)_Vcb)

Definition at line 1425 of file cdprocs.h.

Referenced by __brelse(), _Dispatch_type_(), _Function_class_(), _NavigateToLeafNode(), _Requires_lock_held_(), _Requires_lock_not_held_(), _Success_(), add_balance_item(), add_calc_job(), add_checksum_entry(), add_children_to_move_list(), add_data_reloc(), add_data_reloc_extent_item(), add_delete_inode_extref(), add_device(), add_ext_holes(), add_metadata_reloc(), add_metadata_reloc_extent_item(), add_metadata_reloc_parent(), add_parents(), add_partial_stripe(), add_root_item_to_cache(), add_root_ref(), add_thread_job(), add_to_bootstrap(), add_trim_entry_avoid_sb(), add_volume_device(), AddBitmap(), AddFixupArray(), AddIndexAllocation(), AddIndexRoot(), AddRun(), alloc_chunk(), allocate_cache(), allocate_cache_chunk(), allocate_tree_extents(), allow_extended_dasd_io(), balance_data_chunk(), balance_metadata_chunk(), bmap(), BrowseIndexEntries(), BrowseSubNodeIndexEntries(), calc_csum(), CdCreateInternalStream(), CdDeleteFcb(), CdDeleteVcb(), CdFindActiveVolDescriptor(), CdFinishBuffers(), CdGetNextFcb(), CdInitializeVcb(), CdLookupFcbTable(), CdMarkDevForVerifyIfVcbMounted(), CdQueryFsAttributeInfo(), CdQueryFsDeviceInfo(), CdQueryFsSectorSizeInfo(), CdQueryFsSizeInfo(), CdRemoveClose(), CdUnlockVolumeInternal(), CdUpdateVcbFromVolDescriptor(), CdVerifyFcbOperation(), CdVerifyVcb(), check_csum(), clean_space_cache(), clean_space_cache_chunk(), clear_batch_list(), clear_free_space_cache(), commit_batch_list(), commit_batch_list_root(), construct_extent_item(), convert_old_extent(), create_chunk(), create_directory_fcb(), create_snapshot(), create_subvol(), CreateBTreeFromIndex(), CreateBTreeNodeFromIndexNode(), data_reloc_add_tree_edr(), decrease_extent_refcount(), decrease_extent_refcount_data(), decrease_extent_refcount_tree(), delete_root_ref(), delete_tree_item(), delete_xattr(), dismount_volume(), do_calc(), do_create_snapshot(), do_flush(), do_load_tree(), do_rollback(), do_splits(), do_tree_writes(), do_unlock_volume(), do_write(), do_write2(), do_write_job(), drop_chunk(), drop_root(), drop_roots(), duplicate_extents(), duplicate_fcb(), Ex2ProcessUserPerfStat(), excise_extents(), Ext2AddBlockExtent(), Ext2AddEntry(), Ext2AddVcbExtent(), Ext2AllocateFcb(), Ext2AllocateInode(), Ext2AllocateMcb(), Ext2AllowExtendedDasdIo(), Ext2bhReaperThread(), Ext2BlockMap(), Ext2BuildEntry(), Ext2BuildExtents(), Ext2CheckBitmapConsistency(), Ext2CheckDismount(), Ext2CheckFileAccess(), Ext2CheckInodeAccess(), Ext2CheckJournal(), Ext2CheckSetBlock(), Ext2Cleanup(), Ext2CleanupAllMcbs(), Ext2ClearInode(), Ext2Close(), Ext2DeleteFile(), Ext2DeleteReparsePoint(), Ext2DestroyInode(), Ext2DestroyVcb(), Ext2DeviceControlNormal(), Ext2DiskShutDown(), Ext2DismountVolume(), Ext2DoExtentExpand(), Ext2DropBH(), Ext2DropGroupBH(), Ext2ExceptionFilter(), Ext2ExceptionHandler(), Ext2ExpandBlock(), Ext2ExpandExtent(), Ext2ExpandFile(), Ext2ExpandIndirect(), Ext2ExpandLast(), Ext2FastIoQueryStandardInfo(), Ext2FcbReaperThread(), Ext2FillEntry(), Ext2FirstUnusedMcb(), Ext2FloppyFlush(), Ext2Flush(), Ext2FlushFiles(), Ext2FlushRange(), Ext2FlushVcb(), Ext2FlushVolume(), Ext2FreeBlock(), Ext2FreeCcb(), Ext2FreeFcb(), Ext2FreeInode(), Ext2GetBlock(), Ext2GetInodeLba(), Ext2GetReparsePoint(), Ext2GetRetrievalPointerBase(), Ext2GetRetrievalPointers(), Ext2InitializeLabel(), Ext2InitializeVcb(), Ext2InitializeZone(), Ext2InsertFcb(), Ext2InsertMcb(), Ext2InsertVcb(), Ext2InvalidateVolumes(), Ext2IsFileRemovable(), Ext2IsHandleCountZero(), Ext2IsVolumeMounted(), Ext2IsWearingCloak(), Ext2LinkHeadMcb(), Ext2LinkTailMcb(), Ext2LoadBlock(), Ext2LoadBuffer(), Ext2LoadGroup(), Ext2LoadGroupBH(), Ext2LoadInode(), Ext2LoadInodeXattr(), Ext2LoadInternalJournal(), Ext2LoadSuper(), Ext2LockVcb(), Ext2LockVolume(), Ext2LookupBlockExtent(), Ext2LookupVcbExtent(), Ext2MapExtent(), Ext2MapIndirect(), Ext2McbReaperThread(), Ext2MediaEjectControl(), Ext2MountVolume(), Ext2NewBlock(), Ext2NewInode(), Ext2NotifyChangeDirectory(), Ext2NotifyReportChange(), Ext2OEMToUnicode(), Ext2OEMToUnicodeSize(), Ext2OplockRequest(), Ext2PerformRegistryVolumeParams(), Ext2ProcessEntry(), Ext2ProcessUserProperty(), Ext2ProcessVolumeProperty(), Ext2PurgeVolume(), Ext2PutGroup(), Ext2QueryDirectory(), Ext2QueryEa(), Ext2QueryExtentMappings(), Ext2QueryFileInformation(), Ext2QueryRetrievalPointers(), Ext2QueryUnusedBH(), Ext2QueryUnusedFcb(), Ext2QueryVolumeInformation(), Ext2QueryVolumeParams(), Ext2Read(), Ext2ReadDisk(), Ext2ReadFile(), Ext2ReadInode(), Ext2ReadSymlink(), Ext2ReadSync(), Ext2ReadVolume(), Ext2ReadWriteBlocks(), Ext2RecoverJournal(), Ext2RefreshSuper(), Ext2ReleaseFcb(), Ext2RemoveBlockExtent(), Ext2RemoveMcb(), Ext2RemoveVcb(), Ext2RemoveVcbExtent(), Ext2SaveBlock(), Ext2SaveBuffer(), Ext2SaveGroup(), Ext2SaveInode(), Ext2SaveInodeXattr(), Ext2SaveSuper(), Ext2SearchMcb(), Ext2SetDispositionInfo(), Ext2SetEa(), Ext2SetFileInformation(), Ext2SetLinkInfo(), Ext2SetParentEntry(), Ext2SetRenameInfo(), Ext2SetReparsePoint(), Ext2SetVolumeInformation(), Ext2ShutDown(), Ext2StartFloppyFlushDpc(), Ext2TearDownStream(), Ext2TotalBlocks(), Ext2TruncateBlock(), Ext2TruncateExtent(), Ext2TruncateFile(), Ext2TruncateIndirect(), Ext2TruncateIndirectFast(), Ext2TruncateSymlink(), Ext2UnicodeToOEM(), Ext2UnicodeToOEMSize(), Ext2UnlinkFcb(), Ext2UnlinkMcb(), Ext2UnlockVcb(), Ext2UnlockVolume(), Ext2UpdateGroupDirStat(), Ext2UpdateVcbStat(), Ext2VerifyVcb(), Ext2VerifyVolume(), Ext2Write(), Ext2WriteFile(), Ext2WriteInode(), Ext2WriteSymlink(), Ext2WriteVolume(), Ext2ZeroBuffer(), ext3_inode_blocks(), ext3_inode_blocks_set(), ext4_check_descriptors(), ext4_inode_to_goal_block(), FatAddMcbEntry(), FatAllocateCloseContext(), FatAllowExtendedDasdIo(), FatAutoUnlock(), FatCheckDirtyBit(), FatCleanVolumeDpc(), FatCloseEaFile(), FatCommonQueryEa(), FatCommonSetEa(), FatComputeMoveFileSplicePoints(), FatCreateDcb(), FatCreateFcb(), FatCreateIrpContext(), FatDecodeFileObject(), FatDeferredCleanVolume(), FatDeferredFlush(), FatDeleteVcb(), FatExamineFatEntries(), FatFlushFat(), FatFlushFatEntries(), FatFspDispatch(), FatFspMarkVolumeDirtyWithRecover(), FatGetStatistics(), FatInterpretClusterType(), FatIsHandleCountZero(), FatIsVolumeDirty(), FatIsVolumeMounted(), FatLookupFatEntry(), FatMarkDevForVerifyIfVcbMounted(), FatMultipleAsync(), FatPagingFileErrorHandler(), FatPerformVerifyDiskRead(), FatPnpAdjustVpbRefCount(), FatPreallocateCloseContext(), FatQueryBpb(), FatQueryFsAttributeInfo(), FatQueryFsDeviceInfo(), FatQueryFsFullSizeInfo(), FatQueryFsSectorSizeInfo(), FatQueryFsSizeInfo(), FatQueryFsVolumeInfo(), FatQuickVerifyVcb(), FatReadEaSet(), FatReadVolumeFile(), FatSelectBestWindow(), FatSetFatRun(), FatSetFsLabelInfo(), FatSetRenameInfo(), FatSetupAllocationSupport(), FatSetZeroOnDeallocate(), FatSingleAsync(), FatSingleNonAlignedSync(), FatSwapVpb(), FatTearDownAllocationSupport(), FatTearDownVcb(), FatToggleMediaEjectDisable(), FatUnlockVolume(), FatUnlockVolumeInternal(), FatVerifyLookupFatEntry(), FatVerifyVcb(), FatZeroData(), FFSAddEntry(), FFSAddMcbEntry(), FFSAddMcbNode(), FFSAllocateMcb(), FFSAllowExtendedDasdIo(), FFSCheckBitmapConsistency(), FFSCheckDismount(), FFSCheckSetBlock(), FFSCleanup(), FFSClose(), FFSCreateFcbFromMcb(), FFSDataBlocks(), FFSDeleteFile(), FFSDeviceControlNormal(), FFSDiskShutDown(), FFSDismountVolume(), FFSExpandBlock(), FFSExpandFile(), FFSExpandInode(), FFSFastIoQueryBasicInfo(), FFSFastIoQueryNetworkOpenInfo(), FFSFastIoQueryStandardInfo(), FFSFloppyFlush(), FFSFlush(), FFSFlushFiles(), FFSFlushVolume(), FFSFreeBlock(), FFSFreeFcb(), FFSFreeInode(), FFSFreeVcb(), FFSInitializeVcb(), FFSInsertVcb(), FFSInvalidateVolumes(), FFSIsDirectoryEmpty(), FFSIsHandleCountZero(), FFSLoadDiskLabel(), FFSLoadSuper(), FFSLockVcb(), FFSLockVolume(), FFSLookupMcbEntry(), FFSMediaEjectControl(), FFSMountVolume(), FFSNewBlock(), FFSNewInode(), FFSNotifyChangeDirectory(), FFSNotifyReportChange(), FFSProcessDirEntry(), FFSPurgeVolume(), FFSQueryDirectory(), FFSQueryInformation(), FFSQueryVolumeInformation(), FFSRead(), FFSReadDisk(), FFSReadFile(), FFSReadSync(), FFSReadVolume(), FFSReadWriteBlocks(), FFSRefreshMcb(), FFSRemoveEntry(), FFSRemoveMcbEntry(), FFSRemoveVcb(), FFSSaveBlock(), FFSSaveBuffer(), FFSSaveSuper(), FFSSearchMcb(), FFSSearchMcbTree(), FFSSetDispositionInfo(), FFSSetInformation(), FFSSetParentEntry(), FFSSetRenameInfo(), FFSSetVolumeInformation(), FFSShutDown(), FFSStartFloppyFlushDpc(), FFSTotalBlocks(), FFSTruncateBlock(), FFSTruncateFile(), FFSTruncateInode(), FFSUnlockVcb(), FFSUnlockVolume(), FFSv1AllocateFcb(), FFSv1BlockMap(), FFSv1BuildBDL(), FFSv1GetBlock(), FFSv1GetInodeLba(), FFSv1LoadBlock(), FFSv1LoadInode(), FFSv1ReadInode(), FFSv1SaveInode(), FFSv1WriteInode(), FFSv2AllocateFcb(), FFSv2BlockMap(), FFSv2BuildBDL(), FFSv2GetBlock(), FFSv2GetInodeLba(), FFSv2LoadBlock(), FFSv2LoadInode(), FFSv2ReadInode(), FFSVerifyVolume(), FFSWrite(), FFSWriteFile(), FFSWriteVolume(), find_extent_data_refcount(), find_extent_shared_data_refcount(), find_extent_shared_tree_refcount(), find_item(), find_item_in_tree(), find_item_to_level(), find_metadata_address_in_chunk(), find_new_chunk_address(), find_new_dup_stripes(), find_new_stripe(), find_next_item(), find_prev_item(), find_subvol(), FindAttribute(), FindFirstAttribute(), finish_removing_device(), FixupUpdateSequenceArray(), flush_changed_dev_stats(), flush_changed_extent(), flush_disk_caches(), flush_fcb_caches(), flush_partial_stripe(), flush_subvol(), free_trees(), free_trees_root(), FreeClusters(), fsctl_get_xattrs(), fsctl_set_xattr(), get_block_bh_mdl(), get_block_bh_pin(), get_chunk_from_address(), get_devices(), get_ea_len(), get_extent_flags(), get_extent_refcount(), get_integrity_information(), get_object_id(), get_reparse_tag(), get_subvol_path(), get_tree_new_address(), get_usage(), GetBestFileNameFromRecord(), GetFileNameFromRecord(), GetStandardInformationFromRecord(), handle_batch_collision(), if(), increase_extent_refcount(), increase_extent_refcount_data(), IncreaseMftSize(), insert_extent(), insert_tree_extent(), insert_tree_extent_skinny(), insert_tree_item(), insert_tree_item_batch(), invalidate_volumes(), is_device_part_of_mounted_btrfs_raid(), is_extent_unique(), is_tree_unique(), is_volume_dirty(), is_volume_mounted(), is_writable(), load_cache_chunk(), load_free_space_bitmap(), load_free_space_cache(), load_stored_free_space_cache(), load_stored_free_space_tree(), load_tree(), lock_volume(), log_error(), log_file_checksum_error(), log_file_checksum_error_shared(), log_tree_checksum_error(), log_tree_checksum_error_shared(), log_unrecoverable_error(), look_for_balance_item(), main(), mark_subvol_dirty(), mknod(), mountdev_query_stable_guid(), MupCleanupVcb(), MupCloseVcb(), MupDereferenceVcb(), MupInitializeVcb(), my_open(), my_retrieve_vol_type(), NavigateToLeafNode(), next_item2(), notify_change_directory(), NtfsAddFCBToTable(), NtfsAttachFCBToFileObject(), NtfsCreateFCB(), NtfsDirFindFile(), NtfsDumpFileAttributes(), NtfsDumpFileRecord(), NtfsFCBInitializeCache(), NtfsFindFileAt(), NtfsFindMftRecord(), NtfsGetFCBForFile(), NtfsGrabFCB(), NtfsGrabFCBFromTable(), NtfsLookupFile(), NtfsLookupFileAt(), NtfsMakeFCBFromDirEntry(), NtfsMakeRootFCB(), NtfsMountVolume(), NtfsOpenRootFCB(), NtfsReadFCBAttribute(), NtfsReleaseFCB(), open_fileref_by_inode(), OpenMupFileSystem(), partial_stripe_read(), pause_balance(), pause_scrub(), pnp_cancel_remove_device(), pnp_query_remove_device(), pnp_remove_device(), pnp_surprise_removal(), prepare_raid5_write(), prepare_raid6_write(), print_open_trees(), PrintAllVCNs(), query_balance(), query_directory(), query_filesystems(), query_info(), query_scrub(), query_uuid(), RawCheckForDismount(), RawCleanup(), RawClose(), RawCreate(), RawDispatch(), RawFileSystemControl(), RawInitializeVcb(), RawQueryFsAttributeInfo(), RawQueryFsDeviceInfo(), RawQueryFsSizeInfo(), RawQueryFsVolumeInfo(), RawQueryInformation(), RawQueryVolumeInformation(), RawReadWriteDeviceControl(), RawSetInformation(), RawUserFsCtrl(), read_data(), read_data_dup(), read_data_raid0(), read_data_raid10(), read_data_raid5(), read_data_raid6(), read_send_buffer(), ReadAttribute(), ReadFileRecord(), ReadLCN(), recvd_subvol(), reduce_tree_extent(), regen_bootstrap(), regenerate_space_list(), registry_load_volume_options(), remove_balance_item(), remove_device(), remove_free_space_inode(), remove_from_bootstrap(), remove_root_extents(), remove_volume_child(), reserve_subvol(), reset_stats(), resize_device(), resume_balance(), resume_scrub(), RfsdAddMcbNode(), RfsdAllocateAndLoadBlock(), RfsdAllocateFcb(), RfsdAllocateMcb(), RfsdAllowExtendedDasdIo(), RfsdBuildBDL2(), RfsdCheckBitmapConsistency(), RfsdCheckDismount(), RfsdCheckSetBlock(), RfsdCleanup(), RfsdClose(), RfsdCreateFcbFromMcb(), RfsdDeleteFile(), RfsdDeviceControlNormal(), RfsdDiskShutDown(), RfsdDismountVolume(), RfsdExpandFile(), RfsdFastIoQueryStandardInfo(), RfsdFloppyFlush(), RfsdFlush(), RfsdFlushFiles(), RfsdFlushVolume(), RfsdFreeFcb(), RfsdFreeVcb(), RfsdInitializeVcb(), RfsdInsertVcb(), RfsdInvalidateVolumes(), RfsdIsDirectoryEmpty(), RfsdIsHandleCountZero(), RfsdLoadBlock(), RfsdLoadInode(), RfsdLoadItem(), RfsdLoadSuper(), RfsdLockVcb(), RfsdLockVolume(), RfsdMediaEjectControl(), RfsdMountVolume(), RfsdNotifyChangeDirectory(), RfsdNotifyReportChange(), RfsdParseFilesystemTree(), RfsdProcessDirEntry(), RfsdPurgeVolume(), RfsdQueryDirectory(), RfsdQueryInformation(), RfsdQueryVolumeInformation(), RfsdRead(), RfsdReadDisk(), RfsdReadFile(), RfsdReadInode(), RfsdReadSync(), RfsdReadVolume(), RfsdReadWriteBlocks(), RfsdRefreshMcb(), RfsdRemoveVcb(), RfsdSearchMcb(), RfsdSearchMcbTree(), RfsdSetDispositionInfo(), RfsdSetInformation(), RfsdSetRenameInfo(), RfsdSetVolumeInformation(), RfsdShutDown(), RfsdStartFloppyFlushDpc(), RfsdTruncateFile(), RfsdUnlockVcb(), RfsdUnlockVolume(), RfsdVerifyVolume(), RfsdWrite(), RfsdWriteFile(), RfsdWriteInode(), RfsdWriteVolume(), scrub_chunk(), scrub_chunk_raid56(), scrub_chunk_raid56_stripe_run(), scrub_data_extent(), scrub_extent(), scrub_extent_dup(), scrub_extent_raid0(), scrub_extent_raid10(), scrub_raid5_stripe(), scrub_raid6_stripe(), send_disks_pnp_message(), send_subvol(), set_basic_information(), set_disposition_information(), set_end_of_file_information(), set_file_security(), set_link_information(), set_rename_information(), set_sparse(), set_valid_data_length_information(), set_xattr(), set_zero_data(), SetNonResidentAttributeDataLength(), SetResidentAttributeDataLength(), shared_tree_is_unique(), should_balance_chunk(), skip_to_difference(), snapshot_tree_copy(), split_tree(), split_tree_at(), start_balance(), start_scrub(), stop_balance(), stop_scrub(), stream_set_end_of_file_information(), submit_bh_mdl(), submit_bh_pin(), sync_blockdev(), test_not_full(), trees_consistent(), trim_unalloc_space(), try_consolidation(), try_extend_data(), try_tree_amalgamate(), UDFAcquireDloc(), UDFAddXSpaceBitmap(), UDFAllocateFESpace(), UDFAllocFreeExtent_(), UDFAreSectorsRelocated(), UDFAssignAcl(), UDFAssingNewFUID(), UDFBlankMount(), UDFBuildAllocDescs(), UDFBuildFileEntry(), UDFBuildFreeSpaceBitmap(), UDFBuildHashEntry(), UDFBuildLongAllocDescs(), UDFBuildShortAllocDescs(), UDFBuildTreeItemsList(), UDFChangeFileCounter(), UDFCheckArea(), UDFCheckForDismount(), UDFCleanUpFcbChain(), UDFCleanUpFile__(), UDFCleanupVCB(), UDFCloseAllDelayed(), UDFCloseAllXXXDelayedInDir(), UDFCloseFile__(), UDFCloseFileInfoChain(), UDFCloseResidual(), UDFClrModified(), UDFCommonCleanup(), UDFCommonClose(), UDFCommonCreate(), UDFCommonDeviceControl(), UDFCommonDirControl(), UDFCommonDispatch(), UDFCommonFileInfo(), UDFCommonFlush(), UDFCommonPnp(), UDFCommonQueryVolInfo(), UDFCommonRead(), UDFCommonSetVolInfo(), UDFCommonShutdown(), UDFCommonWrite(), UDFCompleteMount(), UDFConvertFEToExtended(), UDFConvertFEToNonInICB(), UDFCreateFile__(), UDFCreateRootFile__(), UDFCreateStreamDir__(), UDFDiscardFESpace(), UDFDismountVcb(), UDFDismountVolume(), UDFDoDismountSequence(), UDFDoOPC(), UDFDOSName(), UDFEjectReqWaiter(), UDFExtAllocDescToMapping(), UDFExtentOffsetToLba(), UDFFileDirInfoToNT(), UDFFindAnchor(), UDFFindDloc(), UDFFindDlocInMem(), UDFFindFile(), UDFFindFile__(), UDFFindFileId(), UDFFindFreeDloc(), UDFFindFreeFileId(), UDFFindLastFileSet(), UDFFindMinSuitableExtent(), UDFFindNextMatch(), UDFFindVRS(), UDFFirstOpenFile(), UDFFlushADirectory(), UDFFlushAllCachedAllocations(), UDFFlushFE(), UDFFlushFESpace(), UDFFlushFI(), UDFFlushFile__(), UDFFlushIsBreaking(), UDFFlushLogicalVolume(), UDFFlushTryBreak(), UDFFreeDloc(), UDFFreeFESpace(), UDFFreeFileAllocation(), UDFGetBlockSize(), UDFGetCachedAllocation(), UDFGetCfgParameter(), UDFGetDiskInfo(), UDFGetDiskInfoAndVerify(), UDFGetFileStreamInformation(), UDFGetFreeSpace(), UDFGetInternalInformation(), UDFGetMediaClass(), UDFGetOpenParamsByFileId(), UDFGetPartFreeSpace(), UDFGetPartNumByPhysLba(), UDFGetRegParameter(), UDFGetRetrievalPointers(), UDFGetStatistics(), UDFGetTotalSpace(), UDFGetVolumeBitmap(), UDFHardLink(), UDFHardLinkFile__(), UDFIndexDirectory(), UDFInitAllocationCache(), UDFInitializeFCB(), UDFInitializeVCB(), UDFInvalidateVolumes(), UDFIsCachedBadSequence(), UDFIsExtentCached(), UDFIsNameInExpression(), UDFIsVolumeDirty(), UDFLoadBogusLogicalVol(), UDFLoadExtInfo(), UDFLoadFileset(), UDFLoadLogicalVol(), UDFLoadLogicalVolInt(), UDFLoadPartDesc(), UDFLoadPartition(), UDFLoadPVolDesc(), UDFLoadSparingTable(), UDFLoadVAT(), UDFLocateLbaInExtent(), UDFLockVolume(), UDFLongAllocDescToMapping(), UDFLookUpAcl(), UDFMarkAllocatedAsNotXXX(), UDFMarkAllocatedAsRecorded(), UDFMarkBadSpaceAsUsed(), UDFMarkNotAllocatedAsAllocated(), UDFMarkSpaceAsXXX_(), UDFMarkSpaceAsXXXNoProtect_(), UDFMarkStreamsForDeletion(), UDFMountVolume(), UDFNotifyChangeDirectory(), UDFOpenFile(), UDFOpenFile__(), UDFOpenRootFile__(), UDFOpenStreamDir__(), UDFPackDirectory__(), UDFPackMapping(), UDFPadLastSector(), UDFPartEnd(), UDFPartLbaToPhys(), UDFPartLen(), UDFPartStart(), UDFPerformVerify(), UDFPhReadSynchronous(), UDFPhWriteSynchronous(), UDFPhysLbaToPart(), UDFPnpQueryRemove(), UDFPnpRemove(), UDFPnpSurpriseRemove(), UDFPostRequest(), UDFPreClrModified(), UDFPrepareForReadOperation(), UDFPrepareForRenameMoveLink(), UDFPrepareForWriteOperation(), UDFPrepareXSpaceBitmap(), UDFProcessSequence(), UDFPurgeCacheEx_(), UDFQueryDirectory(), UDFQueryFsAttributeInfo(), UDFQueryFsDeviceInfo(), UDFQueryFsFullSizeInfo(), UDFQueryFsSizeInfo(), UDFQueryFsVolumeInfo(), UDFReadAndProcessFullToc(), UDFReadDiscTrackInfo(), UDFReadEntityID_Domain(), UDFReadExtent(), UDFReadExtentLocation(), UDFReadFile__(), UDFReadFileEntry(), UDFReadFileLocation__(), UDFReadMappingFromXEntry(), UDFReadRegKeys(), UDFReadSecurity(), UDFReadTagged(), UDFReadVDS(), UDFReallocTrackMap(), UDFRecordDirectory__(), UDFRecordVAT(), UDFRecoverFromError(), UDFReleaseDloc(), UDFReleaseDlocList(), UDFReleaseFileIdCache(), UDFReleaseVCB(), UDFRelocateDloc(), UDFRelocateSector(), UDFRelocateSectors(), UDFRemapPacket(), UDFRememberBadSequence(), UDFRemoveDloc(), UDFRemoveFileId(), UDFRename(), UDFRenameMoveFile__(), UDFResetDeviceDriver(), UDFResizeExtent(), UDFResizeFile__(), UDFReTagDirectory(), UDFScanForDismountedVcb(), UDFSetAllocationInformation(), UDFSetAllocDescLen(), UDFSetCaching(), UDFSetDispositionInformation(), UDFSetEOF(), UDFSetFileAllocModeFromICB(), UDFSetFileUID(), UDFSetLabelInfo(), UDFSetModified(), UDFSetMRWMode(), UDFSetSpeeds(), UDFSetUpTag(), UDFShortAllocDescToMapping(), UDFSparseFile__(), UDFStartEjectWaiter(), UDFStopEjectWaiter(), UDFStoreCachedAllocation(), UDFStoreDloc(), UDFStoreFileId(), UDFSyncCache(), UDFTRead(), UDFTSendIOCTL(), UDFTWrite(), UDFUmount__(), UDFUnlinkAllFilesInDir(), UDFUnlinkDloc(), UDFUnlinkFile__(), UDFUnlockVolume(), UDFUnmapRange(), UDFUnPackMapping(), UDFUpdateCompatOption(), UDFUpdateLogicalVol(), UDFUpdateLogicalVolInt(), UDFUpdateNonAllocated(), UDFUpdateNWA(), UDFUpdatePartDesc(), UDFUpdateSparingTable(), UDFUpdateVAT(), UDFUpdateVDS(), UDFUpdateVolIdent(), UDFUpdateXSpaceBitmaps(), UDFUseStandard(), UDFVerifyFreeSpaceBitmap(), UDFVerifyPartDesc(), UDFVerifySequence(), UDFVerifyVcb(), UDFVerifyVolume(), UDFVerifyXSpaceBitmap(), UDFVFlush(), UDFVForget(), UDFVInit(), UDFVIsStored(), UDFVRead(), UDFVRelease(), UDFVStoreBlock(), UDFVUpdateBlock(), UDFVVerify(), UDFVWorkItem(), UDFVWrite(), UDFWriteData(), UDFWriteExtent(), UDFWriteFile__(), UDFWriteInSector(), UDFWriteSectors(), UDFWriteSecurity(), UDFZeroExtent(), UDFZeroFile__(), unlock_volume(), update_backup_superblock(), update_changed_extent_ref(), update_chunk_cache(), update_chunk_cache_tree(), update_chunk_caches(), update_chunk_caches_tree(), update_chunk_usage(), update_chunks(), update_dev_item(), update_extent_flags(), update_extent_level(), update_root_backref(), update_root_root(), update_tree_extents(), update_tree_extents_recursive(), update_volumes(), UpdateFileNameRecord(), UpdateFileRecord(), UpdateIndexEntryFileNameSize(), UpdateMftMirror(), VfatCloseWorker(), VfatDiskShutDown(), vfatInitFCBFromDirEntry(), VfatPnp(), vol_close(), write(), write_data(), write_data_complete(), write_file(), write_file2(), write_metadata_items(), write_superblock(), write_superblocks(), write_trees(), WriteAttribute(), zero_data(), zlib_write_compressed_bit(), and zstd_write_compressed_bit().

Function Documentation

◆ UDFDoOPC()

OSSTATUS UDFDoOPC ( IN PVCB  Vcb)

Definition at line 850 of file phys_lib.cpp.

853 {
854  OSSTATUS RC;
855  if(Vcb->OPCNum && !Vcb->OPCDone) {
856  UDFPrint(("UDFDoOPC\n"));
857  if(!Vcb->OPCh) {
858  Vcb->OPCh =
861  }
862  if(!Vcb->OPCh)
864  Vcb->OPCh->DoOpc = TRUE;
865  Vcb->OPCh->OpcBlocksNumber = 0;
866  RC = UDFPhSendIOCTL(IOCTL_CDRW_SEND_OPC_INFO, Vcb->TargetDeviceObject,
867  (void*)(Vcb->OPCh),sizeof(SEND_OPC_INFO_HEADER_USER_IN),
868  NULL,0,
869  FALSE, NULL);
870  if(!OS_SUCCESS(RC)) {
871  UDFPrint(("UDFDoOPC failed\n"));
872  Vcb->OPCNum = 0;
873 // Vcb->VCBFlags |= UDF_VCB_FLAGS_OPC_FAILED;
874  }
875  Vcb->OPCDone = TRUE;
876  }
877  return RC;
878 } // end UDFDoOPC()
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define OSSTATUS
Definition: env_spec_w32.h:57
smooth NULL
Definition: ftsmooth.c:416
struct _SEND_OPC_INFO_HEADER_USER_IN * PSEND_OPC_INFO_HEADER_USER_IN
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define Vcb
Definition: cdprocs.h:1425
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define IOCTL_CDRW_SEND_OPC_INFO
Definition: cdrw_usr.h:109

Referenced by UDFPrepareForWriteOperation().

◆ UDFGetBlockSize()

OSSTATUS UDFGetBlockSize ( IN PDEVICE_OBJECT  DeviceObject,
IN PVCB  Vcb 
)

Definition at line 2687 of file phys_lib.cpp.

2691 {
2692  OSSTATUS RC = STATUS_SUCCESS;
2695 #ifdef UDF_FORMAT_MEDIA
2696  PUDFFmtState fms = Vcb->fms;
2697 #else
2698  #define fms FALSE
2699 #endif //UDF_FORMAT_MEDIA
2700 
2701  if(!DiskGeometry || !PartitionInfo)
2703 
2704 #ifdef _BROWSE_UDF_
2705 
2706 #ifdef UDF_HDD_SUPPORT
2707  if(!fms) {
2709  UDFPrint(("UDFGetBlockSize: HDD\n"));
2711  0,NULL,
2712  DiskGeometry,sizeof(DISK_GEOMETRY),
2713  TRUE,NULL );
2714  Vcb->BlockSize = (OS_SUCCESS(RC)) ? DiskGeometry->BytesPerSector : 512;
2715  if(!NT_SUCCESS(RC))
2716  try_return(RC);
2718  0,NULL,
2720  TRUE,NULL );
2721  if(!NT_SUCCESS(RC)) {
2722  UDFPrint(("UDFGetBlockSize: IOCTL_DISK_GET_PARTITION_INFO failed\n"));
2723  if(RC == STATUS_INVALID_DEVICE_REQUEST) /* ReactOS Code Change (was =) */
2725  try_return(RC);
2726  }
2727  if(PartitionInfo->PartitionType != PARTITION_IFS) {
2728  UDFPrint(("UDFGetBlockSize: PartitionInfo->PartitionType != PARTITION_IFS\n"));
2730  }
2731  } else {
2732 #endif //UDF_HDD_SUPPORT
2734  DiskGeometry,sizeof(DISK_GEOMETRY),
2735  DiskGeometry,sizeof(DISK_GEOMETRY),
2736  TRUE,NULL );
2737 
2738  if(RC == STATUS_DEVICE_NOT_READY) {
2739  // probably, the device is really busy, may be by CD/DVD recording
2740  UserPrint((" busy (0)\n"));
2741  try_return(RC);
2742  }
2743 
2744  Vcb->BlockSize = (OS_SUCCESS(RC)) ? DiskGeometry->BytesPerSector : 2048;
2745 #ifdef UDF_HDD_SUPPORT
2746  }
2747  }
2748 #endif //UDF_HDD_SUPPORT
2749 
2750 #endif //_BROWSE_UDF_
2751 
2752 #ifdef UDF_FORMAT_MEDIA
2753  if(fms) {
2755  DiskGeometry,sizeof(DISK_GEOMETRY),
2756  DiskGeometry,sizeof(DISK_GEOMETRY),
2757  FALSE, NULL );
2758 
2759  if(!NT_SUCCESS(RC)) {
2761  DiskGeometry,sizeof(DISK_GEOMETRY),
2762  DiskGeometry,sizeof(DISK_GEOMETRY),
2763  FALSE, NULL );
2764  if(NT_SUCCESS(RC)) {
2765  fms->opt_media = MT_HD;
2767  NULL,0,
2769  FALSE, NULL );
2770  if(!NT_SUCCESS(RC)) {
2771  LONG HiOffs=0;
2772  RC = SetFilePointer(DeviceObject->h,0,&HiOffs,FILE_END);
2773  }
2774  }
2775  }
2776 
2777  if(RC == STATUS_DEVICE_NOT_READY) {
2778  // probably, the device is really busy, may be by CD/DVD recording
2779  UserPrint((" busy\n"));
2780  try_return(RC );
2781  }
2782 
2783  Vcb->BlockSize = (NT_SUCCESS(RC)) ? DiskGeometry->BytesPerSector : 2048;
2784  }
2785 #endif //UDF_FORMAT_MEDIA
2786 
2787  // Block size must be an even multiple of 512
2788  switch (Vcb->BlockSize) {
2789  case 2048: Vcb->BlockSizeBits = 11; break;
2790 #ifdef UDF_HDD_SUPPORT
2791  case 512: Vcb->BlockSizeBits = 9; break;
2792  case 1024: Vcb->BlockSizeBits = 10; break;
2793  case 4096: Vcb->BlockSizeBits = 12; break;
2794  case 8192: Vcb->BlockSizeBits = 13; break;
2795 #endif //UDF_HDD_SUPPORT
2796  default:
2797  {
2798  UserPrint(("UDF: Bad block size (%ld)\n", Vcb->BlockSize));
2800  }
2801  }
2802 
2803 #ifdef UDF_HDD_SUPPORT
2804  if(
2805 #ifdef _BROWSE_UDF_
2807  ||
2808 #endif //_BROWSE_UDF_
2809 #ifdef UDF_FORMAT_MEDIA
2810  (fms && fms->opt_media == MT_HD)
2811  ||
2812 #endif //UDF_FORMAT_MEDIA
2813  FALSE ) {
2814 
2815 #ifdef UDF_FORMAT_MEDIA
2816  if(fms && !NT_SUCCESS(RC))
2818 #endif //UDF_FORMAT_MEDIA
2819 
2820  Vcb->FirstLBA=0;//(ULONG)(PartitionInfo->StartingOffset.QuadPart >> Vcb->BlockSizeBits);
2821  Vcb->LastPossibleLBA =
2822  Vcb->LastLBA = (uint32)(PartitionInfo->PartitionLength.QuadPart >> Vcb->BlockSizeBits)/* + Vcb->FirstLBA*/ - 1;
2823  } else {
2824 #endif //UDF_HDD_SUPPORT
2825  Vcb->FirstLBA=0;
2826  if(OS_SUCCESS(RC)) {
2827  Vcb->LastLBA = (uint32)(DiskGeometry->Cylinders.QuadPart *
2828  DiskGeometry->TracksPerCylinder *
2829  DiskGeometry->SectorsPerTrack - 1);
2830  if(Vcb->LastLBA == 0x7fffffff) {
2832  }
2833  } else {
2835  }
2836  Vcb->LastPossibleLBA = Vcb->LastLBA;
2837 #ifdef UDF_HDD_SUPPORT
2838  }
2839 #endif //UDF_HDD_SUPPORT
2840 
2841 #ifdef _BROWSE_UDF_
2842 // if(UDFGetDevType(DeviceObject) == FILE_DEVICE_DISK) {
2843  Vcb->WriteBlockSize = PACKETSIZE_UDF*Vcb->BlockSize;
2844 // } else {
2845 // Vcb->WriteBlockSize = PACKETSIZE_UDF*Vcb->BlockSize;
2846 // }
2847 #else //_BROWSE_UDF_
2848  if(fms->opt_media == MT_HD) {
2849  Vcb->WriteBlockSize = Vcb->BlockSize;
2850  } else {
2851  Vcb->WriteBlockSize = PACKETSIZE_UDF*Vcb->BlockSize;
2852  }
2853 #endif //_BROWSE_UDF_
2854 
2855  RC = STATUS_SUCCESS;
2856 
2857 try_exit: NOTHING;
2858 
2859  UDFPrint(("UDFGetBlockSize:\nBlock size is %x, Block size bits %x, Last LBA is %x\n",
2860  Vcb->BlockSize, Vcb->BlockSizeBits, Vcb->LastLBA));
2861 
2863  MyFreePool__(DiskGeometry);
2864  return RC;
2865 
2866 } // end UDFGetBlockSize()
#define FILE_DEVICE_DISK
Definition: winioctl.h:112
ULONG UDFGetDevType(PDEVICE_OBJECT DeviceObject)
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define UDF_HDD_SUPPORT
Definition: udffs.h:45
unsigned int uint32
Definition: types.h:32
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
ULONG BytesPerSector
Definition: ntdddisk.h:376
ULONG TracksPerCylinder
Definition: ntdddisk.h:374
#define UDFIsDvdMedia(Vcb)
Definition: udf_common.h:524
#define UserPrint(x)
Definition: env_spec_w32.h:202
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define DEFAULT_LAST_LBA_FP_CD
Definition: cdrw_usr.h:1820
long LONG
Definition: pedump.c:60
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
#define OSSTATUS
Definition: env_spec_w32.h:57
smooth NULL
Definition: ftsmooth.c:416
#define PARTITION_IFS
Definition: disk.h:93
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define FILE_END
Definition: winbase.h:114
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define _BROWSE_UDF_
Definition: struct.h:330
#define try_return(S)
Definition: cdprocs.h:2189
#define IOCTL_CDROM_GET_DRIVE_GEOMETRY
Definition: ntddcdrm.h:46
LARGE_INTEGER Cylinders
Definition: ntdddisk.h:372
ULONG SectorsPerTrack
Definition: ntdddisk.h:375
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define PACKETSIZE_UDF
Definition: cdrw_usr.h:1753
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2101
#define fms
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
struct _DISK_GEOMETRY * PDISK_GEOMETRY
#define IOCTL_DISK_GET_PARTITION_INFO
Definition: ntdddisk.h:88
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define NOTHING
Definition: env_spec_w32.h:461
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
struct _PARTITION_INFORMATION * PPARTITION_INFORMATION
#define DEFAULT_LAST_LBA_DVD
Definition: cdrw_usr.h:1821
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
Definition: cdrw_usr.h:169
LONGLONG QuadPart
Definition: typedefs.h:112
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:65

Referenced by UDFGetDiskInfo().

◆ UDFGetDiskInfo()

OSSTATUS UDFGetDiskInfo ( IN PDEVICE_OBJECT  DeviceObject,
IN PVCB  Vcb 
)

Definition at line 3050 of file phys_lib.cpp.

3054 {
3056  int8* ioBuf = (int8*)MyAllocatePool__(NonPagedPool,4096);
3057  uint8 MediaType;
3058  PLUN_WRITE_PERF_DESC_USER WPerfDesc;
3059  uint32 i;
3060 // BOOLEAN MRW_problem = FALSE;
3061  uint32 SavedFeatures = 0;
3062 #ifdef UDF_FORMAT_MEDIA
3063  PUDFFmtState fms = Vcb->fms;
3064 #else
3065  #define fms FALSE
3066 #endif //UDF_FORMAT_MEDIA
3067 
3068  UDFPrint(("UDFGetDiskInfo\n"));
3069 
3070  if(!ioBuf) {
3072  }
3073 
3074  _SEH2_TRY {
3076  if(!OS_SUCCESS(RC)) try_return(RC);
3077 
3078 
3079  // Get lower driver signature
3081  ioBuf,sizeof(GET_SIGNATURE_USER_OUT),
3082  ioBuf,sizeof(GET_SIGNATURE_USER_OUT),
3083  TRUE,NULL);
3084 
3085  if(!OS_SUCCESS(RC)) {
3086 
3088 #ifdef _BROWSE_UDF_
3089  if(!NT_SUCCESS(RC) || fms)
3090  try_return(RC);
3091 
3092  // assume Device Recordable for now
3093  goto GetSignatureFailed;
3094 #endif //_BROWSE_UDF_
3095  }
3096 
3097  UDFPrint(("UDF: Signature of low driver is : %s \n",
3098  ((PGET_SIGNATURE_USER_OUT)(ioBuf))->VendorId));
3099 
3100  if(!strncmp( (const char *)(&( ((PGET_SIGNATURE_USER_OUT)(ioBuf))->VendorId[0]) ),
3101  Signature,strlen(Signature) )) {
3102  UDFPrint(("UDF: *****************************************\n"));
3103  UDFPrint(("UDF: ********* Our Device Driver Found ******\n"));
3104  UDFPrint(("UDF: *****************************************\n"));
3105 
3106  (Vcb->VCBFlags) |= UDF_VCB_FLAGS_OUR_DEVICE_DRIVER;
3107 #ifndef _BROWSE_UDF_
3108  // reset driver
3109 #ifdef UDF_FORMAT_MEDIA
3110  if(!fms->opt_probe) {
3111 #endif //UDF_FORMAT_MEDIA
3112  UDFResetDeviceDriver(Vcb, Vcb->TargetDeviceObject, FALSE);
3113  // lock it
3114  ((PPREVENT_MEDIA_REMOVAL_USER_IN)(ioBuf))->PreventMediaRemoval = TRUE;
3116  DeviceObject,
3117  ioBuf,sizeof(PREVENT_MEDIA_REMOVAL_USER_IN),
3118  NULL,0,
3119  FALSE, NULL);
3120 #ifdef UDF_FORMAT_MEDIA
3121  }
3122 #endif //UDF_FORMAT_MEDIA
3123 #endif //_BROWSE_UDF_
3124 //#else //_BROWSE_UDF_
3125  // get device features
3127  DeviceObject,
3128  NULL,0,
3129  ioBuf,sizeof(GET_DEVICE_INFO_USER_OUT),
3130  FALSE,NULL);
3131 
3132  Vcb->SavedFeatures =
3133  SavedFeatures = ((PGET_DEVICE_INFO_USER_OUT)ioBuf)->Features;
3134  if(!(SavedFeatures & CDRW_FEATURE_SYNC_ON_WRITE)) {
3135  UDFPrint(("UDFGetDiskInfo: UDF_VCB_IC_NO_SYNCCACHE_AFTER_WRITE\n"));
3136  Vcb->CompatFlags |= UDF_VCB_IC_NO_SYNCCACHE_AFTER_WRITE;
3137  }
3138  if(!(SavedFeatures & CDRW_FEATURE_FORCE_SYNC_BEFORE_READ)) {
3139  UDFPrint(("UDFGetDiskInfo: UDF_VCB_IC_SYNCCACHE_BEFORE_READ\n"));
3140  Vcb->CompatFlags |= UDF_VCB_IC_SYNCCACHE_BEFORE_READ;
3141  }
3142  if(SavedFeatures & CDRW_FEATURE_BAD_RW_SEEK) {
3143  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_BAD_RW_SEEK\n"));
3144  Vcb->CompatFlags |= UDF_VCB_IC_BAD_RW_SEEK;
3145  }
3146  // we must check if this is FP-formatted disk in old devices
3147  // independently of MediaType they report
3148  if(SavedFeatures & CDRW_FEATURE_FP_ADDRESSING_PROBLEM) {
3149  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_FP_ADDRESSING_PROBLEM ?\n"));
3150  Vcb->CompatFlags |= UDF_VCB_IC_FP_ADDR_PROBLEM;
3151  }
3152  if(SavedFeatures & CDRW_FEATURE_MRW_ADDRESSING_PROBLEM) {
3153  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_MRW_ADDRESSING_PROBLEM ?\n"));
3154  }
3155  if(SavedFeatures & CDRW_FEATURE_FORCE_SYNC_ON_WRITE) {
3156  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_FORCE_SYNC_ON_WRITE\n"));
3157  Vcb->VCBFlags |= UDF_VCB_FLAGS_FORCE_SYNC_CACHE;
3158  }
3159  if(SavedFeatures & CDRW_FEATURE_BAD_DVD_LAST_LBA) {
3160  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_BAD_DVD_LAST_LBA\n"));
3161  Vcb->CompatFlags |= UDF_VCB_IC_BAD_DVD_LAST_LBA;
3162  }
3163  if(SavedFeatures & CDRW_FEATURE_STREAMING) {
3164  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_STREAMING\n"));
3165  }
3166  if(SavedFeatures & CDRW_FEATURE_OPC) {
3167  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_OPC -> assume OPCNum=1\n"));
3168  Vcb->OPCNum = 1;
3169  }
3170 #ifdef UDF_FORMAT_MEDIA
3171  if(SavedFeatures & CDRW_FEATURE_FULL_BLANK_ON_FORMAT) {
3172  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_FULL_BLANK_ON_FORMAT\n"));
3173  if((fms->opt_probe || fms->opt_smart_f)/* &&
3174  (fms->format_media && fms->blank_media*/) {
3175  UDFPrint(("UDFGetDiskInfo: force Full Erase\n"));
3176  fms->opt_qblank = FALSE;
3177  }
3178  }
3179 #endif //UDF_FORMAT_MEDIA
3180 #ifdef _BROWSE_UDF_
3181  // get device buffer size
3183  DeviceObject,
3184  NULL,0,
3185  ioBuf,sizeof(BUFFER_CAPACITY_BLOCK_USER_OUT),
3186  FALSE,NULL);
3187  if(NT_SUCCESS(RC)) {
3188  Vcb->CdrwBufferSize = ((PBUFFER_CAPACITY_BLOCK_USER_OUT)ioBuf)->BufferLength;
3189  } else {
3190  Vcb->CdrwBufferSize = 0;
3191  }
3192  UDFPrint(("UDFGetDiskInfo: CdrwBufferSize = %dKb\n", Vcb->CdrwBufferSize / 1024));
3193  Vcb->CdrwBufferSizeCounter = 0;
3194 #endif //_BROWSE_UDF_
3195  // get media type
3197  NULL,0,ioBuf,sizeof(GET_MEDIA_TYPE_USER_OUT),
3198  FALSE, NULL);
3199  if(!OS_SUCCESS(RC)) goto Try_FullToc;
3200  Vcb->MediaType =
3201  MediaType = ((PGET_MEDIA_TYPE_USER_OUT)ioBuf)->MediaType;
3202  UDFPrint(("UDFGetDiskInfo: MediaType %x\n", MediaType));
3203 
3204 #ifndef UDF_FORMAT_MEDIA
3205  // we shall ignore audio-disks
3206  switch(MediaType) {
3213 // case :
3214  UDFPrint(("UDFGetDiskInfo: we shall ignore audio-disks...\n"));
3216  }
3217 #endif //UDF_FORMAT_MEDIA
3218 
3219  UDFPrint(("UDFGetDiskInfo: Check DVD-disks...\n"));
3221  NULL,0,ioBuf,sizeof(GET_MEDIA_TYPE_EX_USER_OUT),
3222  FALSE, NULL);
3223  if(!OS_SUCCESS(RC)) goto Try_FullToc;
3224  Vcb->MediaClassEx =
3225  MediaType = (((PGET_MEDIA_TYPE_EX_USER_OUT)ioBuf)->MediaClass);
3226  UDFPrint(("UDFGetDiskInfo: MediaClassEx %x\n", MediaType));
3227 
3228 #ifdef _BROWSE_UDF_
3229  if(!fms) {
3230 
3231  switch(MediaType) {
3232 
3233  case CdMediaClass_CDR:
3234  case CdMediaClass_DVDR:
3235  case CdMediaClass_DVDpR:
3236  case CdMediaClass_HD_DVDR:
3237  case CdMediaClass_BDR:
3238  UDFPrint(("UDFGetDiskInfo: MediaClass R\n"));
3239  Vcb->MediaType = MediaType_UnknownSize_CDR;
3240  break;
3241  case CdMediaClass_CDRW:
3242 
3243  if(SavedFeatures & CDRW_FEATURE_MRW_ADDRESSING_PROBLEM) {
3244  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_MRW_ADDRESSING_PROBLEM on CD-RW\n"));
3245  Vcb->CompatFlags |= UDF_VCB_IC_MRW_ADDR_PROBLEM;
3246  }
3247 
3248  case CdMediaClass_DVDRW:
3249  case CdMediaClass_DVDpRW:
3250  case CdMediaClass_DVDRAM:
3251  case CdMediaClass_HD_DVDRW:
3253  case CdMediaClass_BDRE:
3254  UDFPrint(("UDFGetDiskInfo: MediaClass RW\n"));
3255  Vcb->MediaType = MediaType_UnknownSize_CDRW;
3256  break;
3257  case CdMediaClass_CDROM:
3258  case CdMediaClass_DVDROM:
3260  case CdMediaClass_BDROM:
3261  UDFPrint(("UDFGetDiskInfo: MediaClass ROM\n"));
3262  Vcb->MediaType = MediaType_Unknown;
3263  // Vcb->MediaType = MediaType_UnknownSize_CDROM;
3264  break;
3265  default:
3266  UDFPrint(("UDFGetDiskInfo: MediaClass Unknown\n"));
3267  Vcb->MediaType = MediaType_Unknown;
3268  break;
3269  }
3270  MediaType = Vcb->MediaType;
3271 
3272  }
3273 #endif //_BROWSE_UDF_
3274 
3275 #ifdef UDF_FORMAT_MEDIA
3276 
3277  if(fms) {
3278 
3279  switch(MediaType) {
3280  case CdMediaClass_CDR:
3281  UDFPrint(("CdMediaClass_CDR\n"));
3282  MediaType = MediaType_UnknownSize_CDR;
3283  if(fms->opt_media == MT_AUTO)
3284  fms->opt_media = MT_CDR;
3285  break;
3286  case CdMediaClass_DVDR:
3287  UDFPrint(("CdMediaClass_DVDR -> MediaType_UnknownSize_CDR\n"));
3288  MediaType = MediaType_UnknownSize_CDR;
3289  if(fms->opt_media == MT_AUTO)
3290  fms->opt_media = MT_DVDR;
3291  break;
3292  case CdMediaClass_DVDpR:
3293  UDFPrint(("CdMediaClass_DVDpR -> MediaType_UnknownSize_CDR\n"));
3294  MediaType = MediaType_UnknownSize_CDR;
3295  if(fms->opt_media == MT_AUTO)
3296  fms->opt_media = MT_DVDpR;
3297  break;
3298  case CdMediaClass_HD_DVDR:
3299  UDFPrint(("CdMediaClass_HD_DVDR -> MediaType_UnknownSize_CDR\n"));
3300  MediaType = MediaType_UnknownSize_CDR;
3301  if(fms->opt_media == MT_AUTO)
3302  fms->opt_media = MT_DVDR;
3303  break;
3304  case CdMediaClass_BDR:
3305  UDFPrint(("CdMediaClass_BDR -> MediaType_UnknownSize_CDR\n"));
3306  MediaType = MediaType_UnknownSize_CDR;
3307  if(fms->opt_media == MT_AUTO)
3308  fms->opt_media = MT_DVDR;
3309  break;
3310  case CdMediaClass_CDRW:
3311  UDFPrint(("CdMediaClass_CDRW\n"));
3312  MediaType = MediaType_UnknownSize_CDRW;
3313  if(fms->opt_media == MT_AUTO)
3314  fms->opt_media = MT_CDRW;
3315  if(SavedFeatures & CDRW_FEATURE_MRW_ADDRESSING_PROBLEM) {
3316  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_MRW_ADDRESSING_PROBLEM on CD-RW\n"));
3317  Vcb->CompatFlags |= UDF_VCB_IC_MRW_ADDR_PROBLEM;
3318  }
3319  break;
3320  case CdMediaClass_DVDRW:
3321  UDFPrint((" CdMediaClass_DVDRW -> MediaType_UnknownSize_CDRW\n"));
3322  if(fms->opt_media == MT_AUTO)
3323  fms->opt_media = MT_DVDRW;
3324  MediaType = MediaType_UnknownSize_CDRW;
3325  break;
3326  case CdMediaClass_DVDpRW:
3327  UDFPrint((" CdMediaClass_DVDpRW -> MediaType_UnknownSize_CDRW\n"));
3328  if(fms->opt_media == MT_AUTO)
3329  fms->opt_media = MT_DVDpRW;
3330  MediaType = MediaType_UnknownSize_CDRW;
3331  break;
3332  case CdMediaClass_DVDRAM:
3333  UDFPrint((" CdMediaClass_DVDRAM -> MediaType_UnknownSize_CDRW\n"));
3334  if(fms->opt_media == MT_AUTO)
3335  fms->opt_media = MT_DVDRAM;
3336  MediaType = MediaType_UnknownSize_CDRW;
3337  break;
3338  case CdMediaClass_HD_DVDRW:
3339  UDFPrint((" CdMediaClass_HD_DVDRW -> MediaType_UnknownSize_CDRW\n"));
3340  if(fms->opt_media == MT_AUTO)
3341  fms->opt_media = MT_DVDRW;
3342  MediaType = MediaType_UnknownSize_CDRW;
3343  break;
3345  UDFPrint((" CdMediaClass_HD_DVDRAM -> MediaType_UnknownSize_CDRW\n"));
3346  if(fms->opt_media == MT_AUTO)
3347  fms->opt_media = MT_DVDRAM;
3348  MediaType = MediaType_UnknownSize_CDRW;
3349  break;
3350  case CdMediaClass_BDRE:
3351  UDFPrint((" CdMediaClass_BDRE -> MediaType_UnknownSize_CDRW\n"));
3352  if(fms->opt_media == MT_AUTO)
3353  fms->opt_media = MT_DVDRW;
3354  MediaType = MediaType_UnknownSize_CDRW;
3355  break;
3357  UDFPrint((" CdMediaClass_NoDiscPresent -> MediaType_NoDiscPresent\n"));
3358  MediaType = MediaType_NoDiscPresent;
3359  fms->opt_media = MT_none;
3360  break;
3361  case CdMediaClass_DoorOpen:
3362  UDFPrint((" CdMediaClass_DoorOpen -> MediaType_DoorOpen\n"));
3363  MediaType = MediaType_DoorOpen;
3364  fms->opt_media = MT_none;
3365  break;
3366  default:
3367  UDFPrint((" MediaType_Unknown\n"));
3368  MediaType = MediaType_Unknown;
3369  break;
3370  }
3371  if(!apply_force_r(fms)) {
3373  }
3374  }
3375 
3376 #endif //UDF_FORMAT_MEDIA
3377 
3378  Vcb->DVD_Mode = (((PGET_MEDIA_TYPE_EX_USER_OUT)ioBuf)->MediaClassEx == CdMediaClassEx_DVD);
3379  Vcb->PhMediaCapFlags = ((PGET_MEDIA_TYPE_EX_USER_OUT)ioBuf)->CapFlags;
3380  Vcb->WriteParamsReq = (Vcb->PhMediaCapFlags & CdCapFlags_WriteParamsReq) ? TRUE : FALSE;
3381  if(Vcb->DVD_Mode &&
3382  !(Vcb->PhMediaCapFlags & CdCapFlags_RandomWritable)) {
3383  UDFPrint(("UDFGetDiskInfo: DVD && !CdCapFlags_RandomWritable\n"));
3384  UDFPrint((" Read-only volume\n"));
3385 // BrutePoint();
3386 #ifndef UDF_CDRW_EMULATION_ON_ROM
3387  Vcb->VCBFlags |= UDF_VCB_FLAGS_VOLUME_READ_ONLY;
3388 #endif
3389  }
3390 #ifdef UDF_FORMAT_MEDIA
3391  if(fms) {
3392  if((MediaType == MediaType_NoDiscPresent) ||
3393  (MediaType == MediaType_DoorOpen)) {
3394  UserPrint(("No media in device\n"));
3396  }
3397  }
3398 #endif //UDF_FORMAT_MEDIA
3399  if(!Vcb->WriteParamsReq) {
3400  UDFPrint(("UDFGetDiskInfo: do not use WriteParams\n"));
3401  }
3402  if(Vcb->PhMediaCapFlags & CdCapFlags_Cav) {
3403  UDFPrint(("UDFGetDiskInfo: Use CAV (1)\n"));
3404  Vcb->VCBFlags |= UDF_VCB_FLAGS_USE_CAV;
3405  }
3406 
3407 #ifdef _BROWSE_UDF_
3408  if(!fms) {
3409  // check if this device is capable to write on such media
3410  if(UDFIsDvdMedia(Vcb)) {
3411  //RC =
3412  UDFPrint(("UDFGetDiskInfo: update defaulted LastLBA\n"));
3414  //if(!OS_SUCCESS(RC)) goto Try_FullToc;
3415  } else {
3416  if((SavedFeatures & CDRW_FEATURE_MRW_ADDRESSING_PROBLEM) &&
3417  (SavedFeatures & UDF_VCB_IC_FP_ADDR_PROBLEM)) {
3418  UDFPrint(("UDFGetDiskInfo: CDRW_FEATURE_MRW_ADDRESSING_PROBLEM on old CD-ROM\n"));
3419  Vcb->CompatFlags |= UDF_VCB_IC_MRW_ADDR_PROBLEM;
3420  }
3421  }
3422  }
3423 #endif //_BROWSE_UDF_
3424 
3425 /*#ifdef UDF_FORMAT_MEDIA
3426  if(fms) {
3427  if(MediaType == CdMediaClass_DVDRW) {
3428  UserPrint(("Not empty media. Erase required.\n"));
3429  my_exit(fms, MKUDF_BLANK_FORMAT_REQUIRED);
3430  }
3431  }
3432 #endif //UDF_FORMAT_MEDIA*/
3433 
3434 #define cap ((PGET_CAPABILITIES_3_USER_OUT)ioBuf)
3435  // get device capabilities
3437  NULL,0,ioBuf,sizeof(GET_CAPABILITIES_3_USER_OUT),
3438  FALSE, NULL);
3439  if(!OS_SUCCESS(RC)) goto Try_FullToc;
3440 
3441  // check if this device is capable to write on such media
3443  NULL,0,NULL,0,FALSE, NULL);
3444  if(RC != STATUS_SUCCESS) {
3445  UDFPrint(("IS_WRITABLE - false, doing additional check...\n"));
3446  if( ((MediaType >= MediaType_UnknownSize_CDRW) && !(cap->WriteCap & DevCap_write_cd_rw)) ||
3447  ((MediaType >= MediaType_UnknownSize_CDR) && !(cap->WriteCap & DevCap_write_cd_r)) ||
3448  (MediaType < MediaType_UnknownSize_CDR) ) {
3449  UserPrint(("Hardware Read-only volume\n"));
3450 #ifndef UDF_CDRW_EMULATION_ON_ROM
3451  Vcb->VCBFlags |= UDF_VCB_FLAGS_VOLUME_READ_ONLY;
3452 #endif //UDF_CDRW_EMULATION_ON_ROM
3453 #ifdef UDF_FORMAT_MEDIA
3454  if(fms && !fms->opt_read_iso)
3455  my_exit(fms, MKUDF_HW_READ_ONLY);
3456 #endif //UDF_FORMAT_MEDIA
3457  }
3458  } else {
3459  UDFPrint(("Writable disk\n"));
3460  }
3461  Vcb->MaxWriteSpeed = cap->MaximumWriteSpeedSupported;
3462  Vcb->MaxReadSpeed = cap->MaximumSpeedSupported;
3463  if(cap->PageLength >= (sizeof(GET_CAPABILITIES_3_USER_OUT)-2)) {
3464  Vcb->CurSpeed = max(cap->CurrentSpeed, cap->CurrentWriteSpeed3);
3465  if(cap->LunWPerfDescriptorCount && cap->LunWPerfDescriptorCount != 0xffff) {
3466  ULONG n;
3467  UDFPrint(("Write performance descriptor(s) found: %x\n", cap->LunWPerfDescriptorCount));
3468  n = (4096 - sizeof(GET_CAPABILITIES_3_USER_OUT)) / sizeof(LUN_WRITE_PERF_DESC_USER);
3469  n = min(n, cap->LunWPerfDescriptorCount);
3470  // get device capabilities
3474  TRUE,NULL);
3475  if(OS_SUCCESS(RC)) {
3476  WPerfDesc = (PLUN_WRITE_PERF_DESC_USER)(ioBuf + sizeof(GET_CAPABILITIES_3_USER_OUT));
3477  n = FALSE;
3478  for(i = 0; i<n; i++) {
3479  if((WPerfDesc[i].RotationControl & LunWPerf_RotCtrl_Mask) == LunWPerf_RotCtrl_CAV) {
3480  Vcb->VCBFlags |= UDF_VCB_FLAGS_USE_CAV;
3481  if(!n) {
3482  Vcb->CurSpeed = WPerfDesc[i].WriteSpeedSupported;
3483  n = TRUE;
3484  UDFPrint(("Use CAV\n"));
3485  } else {
3486  Vcb->CurSpeed = max(WPerfDesc[i].WriteSpeedSupported, Vcb->CurSpeed);
3487  }
3488  UDFPrint(("supports speed %dX\n", Vcb->CurSpeed/176));
3489  //break;
3490  }
3491  }
3492  if(n) {
3493  UDFPrint(("Set r/w speeds to %dX\n", Vcb->CurSpeed/176));
3494  Vcb->MaxWriteSpeed =
3495  Vcb->MaxReadSpeed = Vcb->CurSpeed;
3496  }
3497  }
3498  }
3499  } else {
3500  Vcb->CurSpeed = max(cap->CurrentSpeed, cap->CurrentWriteSpeed);
3501  }
3502  UDFPrint((" Speeds r/w %dX/%dX\n", Vcb->CurSpeed/176, cap->CurrentWriteSpeed/176));
3503 
3504  if(Vcb->VCBFlags & UDF_VCB_FLAGS_USE_CAV) {
3505  // limit both read & write speed to last write speed for CAV mode
3506  // some drives damage data when speed is adjusted during recording process
3507  // even in packet mode
3508  UDFSetSpeeds(Vcb);
3509  }
3510  UDFSetCaching(Vcb);
3511 
3512 #undef cap
3513 #ifdef UDF_FORMAT_MEDIA
3514  if(fms) {
3515  if( (fms->auto_media || (fms->opt_media == MT_AUTO)) &&
3516  (fms->opt_media < MT_DVDR) ) {
3517  if(MediaType < MediaType_UnknownSize_CDRW) {
3518  fms->opt_media = MT_CDR;
3519  } else {
3520  fms->opt_media = MT_CDRW;
3521  }
3522  }
3523  if(!apply_force_r(fms)) {
3525  }
3526  }
3527 #endif //UDF_FORMAT_MEDIA
3529 
3530  if(!OS_SUCCESS(RC)) {
3531  // may be we have a CD-ROM device
3532 Try_FullToc:
3533  UDFPrint(("Hardware Read-only volume (2)\n"));
3534 // BrutePoint();
3535 #ifndef UDF_CDRW_EMULATION_ON_ROM
3536  Vcb->VCBFlags |= UDF_VCB_FLAGS_VOLUME_READ_ONLY;
3537 #endif
3538 
3540 
3541  if(!OS_SUCCESS(RC)) {
3543  if(!OS_SUCCESS(RC)) try_return(RC);
3544  }
3545 
3546  }
3547  } else {
3548 #ifdef _BROWSE_UDF_
3549 GetSignatureFailed:
3550 #endif
3552  if(!OS_SUCCESS(RC)) try_return(RC);
3553  }
3554 
3555 try_exit: NOTHING;
3556 
3557  } _SEH2_FINALLY {
3558 
3559  if(ioBuf) MyFreePool__(ioBuf);
3560 
3561  if(UDFIsDvdMedia(Vcb) &&
3562  (Vcb->CompatFlags & UDF_VCB_IC_BAD_DVD_LAST_LBA) &&
3563  (Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_READ_ONLY) &&
3564  Vcb->LastLBA &&
3565  (Vcb->LastLBA < DEFAULT_LAST_LBA_DVD)) {
3566  UDFPrint(("UDF: Bad DVD last LBA %x, fixup!\n", Vcb->LastLBA));
3567  Vcb->LastLBA = DEFAULT_LAST_LBA_DVD;
3568  Vcb->NWA = 0;
3569  }
3570 
3571 
3572  if(UDFIsDvdMedia(Vcb) && !Vcb->FirstLBA && !Vcb->LastPossibleLBA) {
3573  UDFPrint(("UDF: Empty DVD. Use bogus values for now\n"));
3574  Vcb->LastPossibleLBA = DEFAULT_LAST_LBA_DVD;
3575  Vcb->LastLBA = 0;
3576  }
3577 
3578  if((Vcb->LastPossibleLBA & 0x80000000) || (Vcb->LastPossibleLBA < Vcb->LastLBA)) {
3579  UDFPrint(("UDF: bad LastPossibleLBA %x -> %x\n", Vcb->LastPossibleLBA, Vcb->LastLBA));
3580  Vcb->LastPossibleLBA = Vcb->LastLBA;
3581  }
3582  if(!Vcb->WriteBlockSize)
3583  Vcb->WriteBlockSize = PACKETSIZE_UDF*Vcb->BlockSize;
3584 
3585 #ifdef _BROWSE_UDF_
3586  if(Vcb->TrackMap) {
3587  if(Vcb->TrackMap[Vcb->LastTrackNum].LastLba > Vcb->NWA) {
3588  if(Vcb->NWA) {
3589  if(Vcb->TrackMap[Vcb->LastTrackNum].DataParam & TrkInfo_FP) {
3590  Vcb->LastLBA = Vcb->NWA-1;
3591  } else {
3592  Vcb->LastLBA = Vcb->NWA-7-1;
3593  }
3594  }
3595  } else {
3596  if((Vcb->LastTrackNum > 1) &&
3597  (Vcb->TrackMap[Vcb->LastTrackNum-1].FirstLba >= Vcb->TrackMap[Vcb->LastTrackNum-1].LastLba)) {
3598  Vcb->LastLBA = Vcb->TrackMap[Vcb->LastTrackNum-1].LastLba;
3599  }
3600  }
3601  }
3602 
3603  for(i=0; i<32; i++) {
3604  if(!(Vcb->LastPossibleLBA >> i))
3605  break;
3606  }
3607  if(i > 20) {
3608  Vcb->WCacheBlocksPerFrameSh = max(Vcb->WCacheBlocksPerFrameSh, (2*i)/5+2);
3609  Vcb->WCacheBlocksPerFrameSh = min(Vcb->WCacheBlocksPerFrameSh, 16);
3610  }
3611 
3612  if(Vcb->CompatFlags & UDF_VCB_IC_FP_ADDR_PROBLEM) {
3613  // Check first 0x200 blocks
3614  UDFCheckTrackFPAddressing(Vcb, Vcb->FirstTrackNum);
3615  // if we really have such a problem, fix LastLBA
3616  if(Vcb->CompatFlags & UDF_VCB_IC_FP_ADDR_PROBLEM) {
3617  UDFPrint(("UDF: Fix LastLBA: %x -> %x\n", Vcb->LastLBA, (Vcb->LastLBA*32) / 39));
3618  Vcb->LastLBA = (Vcb->LastLBA*32) / 39;
3619  }
3620  }
3621 #endif //_BROWSE_UDF_
3622 
3623  if(Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_READ_ONLY) {
3624  if(!Vcb->BlankCD && Vcb->MediaType != MediaType_UnknownSize_CDRW) {
3625  UDFPrint(("UDFGetDiskInfo: R/O+!Blank+!RW -> !RAW\n"));
3626  Vcb->VCBFlags &= ~UDF_VCB_FLAGS_RAW_DISK;
3627  } else {
3628  UDFPrint(("UDFGetDiskInfo: Blank or RW\n"));
3629  }
3630  }
3631 
3632  UDFPrint(("UDF: ------------------------------------------\n"));
3633  UDFPrint(("UDF: Media characteristics\n"));
3634  UDFPrint(("UDF: Last session: %d\n",Vcb->LastSession));
3635  UDFPrint(("UDF: First track in first session: %d\n",Vcb->FirstTrackNum));
3636  UDFPrint(("UDF: First track in last session: %d\n",Vcb->FirstTrackNumLastSes));
3637  UDFPrint(("UDF: Last track in last session: %d\n",Vcb->LastTrackNum));
3638  UDFPrint(("UDF: First LBA in first session: %x\n",Vcb->FirstLBA));
3639  UDFPrint(("UDF: First LBA in last session: %x\n",Vcb->FirstLBALastSes));
3640  UDFPrint(("UDF: Last LBA in last session: %x\n",Vcb->LastLBA));
3641  UDFPrint(("UDF: First writable LBA (NWA) in last session: %x\n",Vcb->NWA));
3642  UDFPrint(("UDF: Last available LBA beyond end of last session: %x\n",Vcb->LastPossibleLBA));
3643  UDFPrint(("UDF: blocks per frame: %x\n",1 << Vcb->WCacheBlocksPerFrameSh));
3644  UDFPrint(("UDF: Flags: %s%s\n",
3645  Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK ? "RAW " : "",
3646  Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_READ_ONLY ? "R/O " : "WR "
3647  ));
3648  UDFPrint(("UDF: ------------------------------------------\n"));
3649 
3650 #ifdef UDF_FORMAT_MEDIA
3651  if(fms && fms->opt_disk_info) {
3652  UserPrint(("------------------------------------------\n"));
3653  UserPrint(("Media characteristics:\n"));
3654  UserPrint((" First writable LBA (NWA) in last session: %x\n",Vcb->NWA));
3655  UserPrint((" Last available LBA beyond end of last session: %x\n",Vcb->LastPossibleLBA));
3656  UserPrint(("------------------------------------------\n"));
3657  }
3658 #endif //UDF_FORMAT_MEDIA
3659 
3660  } _SEH2_END;
3661 
3662  UDFPrint(("UDFGetDiskInfo: %x\n", RC));
3663  return(RC);
3664 
3665 } // end UDFGetDiskInfo()
OSSTATUS UDFSetSpeeds(IN PVCB Vcb)
Definition: phys_lib.cpp:4234
#define MediaType_120mm_CDRW_AudioOnly
Definition: cdrw_hw.h:2487
#define CdMediaClass_BDROM
Definition: cdrw_usr.h:755
#define CdMediaClass_DVDRAM
Definition: cdrw_usr.h:747
#define max(a, b)
Definition: svc.c:63
#define UDF_VCB_IC_SYNCCACHE_BEFORE_READ
Definition: udf_common.h:512
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
#define TrkInfo_FP
Definition: cdrw_hw.h:2417
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define CdMediaClass_DVDpR
Definition: cdrw_usr.h:750
#define MediaType_80mm_CDRW_AudioOnly
Definition: cdrw_hw.h:2491
#define CDRW_FEATURE_BAD_DVD_LAST_LBA
Definition: cdrw_usr.h:1492
#define CdMediaClass_DVDR
Definition: cdrw_usr.h:748
#define IOCTL_STORAGE_MEDIA_REMOVAL
Definition: ntddstor.h:93
#define MediaType_UnknownSize_CDRW
Definition: cdrw_hw.h:2485
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CDRW_FEATURE_MRW_ADDRESSING_PROBLEM
Definition: cdrw_usr.h:1490
#define MediaType_120mm_CDR_AudioOnly
Definition: cdrw_hw.h:2477
unsigned int uint32
Definition: types.h:32
OSSTATUS UDFReadAndProcessFullToc(PDEVICE_OBJECT DeviceObject, PVCB Vcb)
Definition: phys_lib.cpp:2243
#define CDRW_FEATURE_STREAMING
Definition: cdrw_usr.h:1494
#define IOCTL_CDRW_BUFFER_CAPACITY
Definition: cdrw_usr.h:94
#define MKUDF_CANT_APPLY_R
Definition: udferr_usr.h:79
#define CdMediaClass_DVDRW
Definition: cdrw_usr.h:749
#define IOCTL_CDRW_GET_MEDIA_TYPE
Definition: cdrw_usr.h:84
struct _LUN_WRITE_PERF_DESC_USER LUN_WRITE_PERF_DESC_USER
GLdouble n
Definition: glext.h:7729
#define MKUDF_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:56
#define IOCTL_DISK_IS_WRITABLE
Definition: cdrw_usr.h:172
#define CdCapFlags_WriteParamsReq
Definition: cdrw_usr.h:795
#define CDRW_FEATURE_FULL_BLANK_ON_FORMAT
Definition: cdrw_usr.h:1493
#define IOCTL_CDRW_GET_MEDIA_TYPE_EX
Definition: cdrw_usr.h:123
#define UDFIsDvdMedia(Vcb)
Definition: udf_common.h:524
#define UserPrint(x)
Definition: env_spec_w32.h:202
struct _PREVENT_MEDIA_REMOVAL_USER_IN * PPREVENT_MEDIA_REMOVAL_USER_IN
struct _GET_MEDIA_TYPE_EX_USER_OUT * PGET_MEDIA_TYPE_EX_USER_OUT
#define MediaType_DoorOpen
Definition: cdrw_hw.h:2500
#define CDRW_FEATURE_FORCE_SYNC_ON_WRITE
Definition: cdrw_usr.h:1491
_SEH2_TRY
Definition: create.c:4250
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
Definition: udf_common.h:463
void my_exit(int rc)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UDF_VCB_FLAGS_USE_CAV
Definition: udf_common.h:487
GLenum cap
Definition: glext.h:9639
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
static const char Signature[16]
Definition: phys_lib.cpp:18
#define OSSTATUS
Definition: env_spec_w32.h:57
#define CdMediaClass_DVDROM
Definition: cdrw_usr.h:746
smooth NULL
Definition: ftsmooth.c:416
struct _BUFFER_CAPACITY_BLOCK_USER_OUT * PBUFFER_CAPACITY_BLOCK_USER_OUT
#define MediaType_UnknownSize_CDR
Definition: cdrw_hw.h:2475
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define CdMediaClass_HD_DVDROM
Definition: cdrw_usr.h:758
#define UDF_VCB_IC_BAD_DVD_LAST_LBA
Definition: udf_common.h:511
#define CdMediaClass_CDRW
Definition: cdrw_usr.h:745
#define CdMediaClass_DoorOpen
Definition: cdrw_usr.h:763
#define MediaType_120mm_CDROM_AudioOnly
Definition: cdrw_hw.h:2467
#define CdMediaClass_HD_DVDRAM
Definition: cdrw_usr.h:759
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define try_return(S)
Definition: cdprocs.h:2189
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
Definition: udf_common.h:466
#define UDF_VCB_IC_MRW_ADDR_PROBLEM
Definition: udf_common.h:510
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define PACKETSIZE_UDF
Definition: cdrw_usr.h:1753
#define fms
unsigned char uint8
Definition: types.h:28
#define DevCap_write_cd_r
Definition: cdrw_hw.h:3013
struct _GET_MEDIA_TYPE_USER_OUT * PGET_MEDIA_TYPE_USER_OUT
#define CdMediaClass_CDR
Definition: cdrw_usr.h:744
#define CDRW_FEATURE_BAD_RW_SEEK
Definition: cdrw_usr.h:1485
#define UDF_VCB_IC_NO_SYNCCACHE_AFTER_WRITE
Definition: udf_common.h:507
#define IOCTL_CDRW_GET_DEVICE_INFO
Definition: cdrw_usr.h:119
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define IOCTL_CDRW_GET_CAPABILITIES
Definition: cdrw_usr.h:82
#define NOTHING
Definition: env_spec_w32.h:461
#define CDRW_FEATURE_OPC
Definition: cdrw_usr.h:1480
#define CDRW_FEATURE_FP_ADDRESSING_PROBLEM
Definition: cdrw_usr.h:1489
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
Definition: phys_lib.cpp:4199
#define UDF_VCB_IC_BAD_RW_SEEK
Definition: udf_common.h:508
struct _LUN_WRITE_PERF_DESC_USER * PLUN_WRITE_PERF_DESC_USER
#define UDF_VCB_FLAGS_FORCE_SYNC_CACHE
Definition: udf_common.h:485
#define LunWPerf_RotCtrl_Mask
Definition: cdrw_hw.h:3140
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define UDF_VCB_IC_FP_ADDR_PROBLEM
Definition: udf_common.h:509
_SEH2_END
Definition: create.c:4424
#define CdMediaClass_HD_DVDR
Definition: cdrw_usr.h:760
struct _GET_DEVICE_INFO_USER_OUT * PGET_DEVICE_INFO_USER_OUT
#define LunWPerf_RotCtrl_CAV
Definition: cdrw_hw.h:3142
NTSTATUS UDFSetCaching(IN PVCB Vcb)
Definition: phys_lib.cpp:4263
#define CdCapFlags_RandomWritable
Definition: cdrw_usr.h:796
#define CdMediaClassEx_DVD
Definition: cdrw_usr.h:780
#define CdMediaClass_CDROM
Definition: cdrw_usr.h:743
_SEH2_FINALLY
Definition: create.c:4395
#define IOCTL_CDRW_GET_SIGNATURE
Definition: cdrw_usr.h:95
#define min(a, b)
Definition: monoChain.cc:55
#define CdMediaClass_BDR
Definition: cdrw_usr.h:757
OSSTATUS UDFUseStandard(PDEVICE_OBJECT DeviceObject, PVCB Vcb)
Definition: phys_lib.cpp:2386
#define CdMediaClass_BDRE
Definition: cdrw_usr.h:756
#define DevCap_write_cd_rw
Definition: cdrw_hw.h:3014
#define CdMediaClass_DVDpRW
Definition: cdrw_usr.h:751
#define CdMediaClass_NoDiscPresent
Definition: cdrw_usr.h:762
#define CDRW_FEATURE_SYNC_ON_WRITE
Definition: cdrw_usr.h:1484
#define MediaType_80mm_CDROM_AudioOnly
Definition: cdrw_hw.h:2471
unsigned int ULONG
Definition: retypes.h:1
#define DEFAULT_LAST_LBA_DVD
Definition: cdrw_usr.h:1821
#define MediaType_Unknown
Definition: cdrw_hw.h:2465
OSSTATUS UDFReadDiscTrackInfo(PDEVICE_OBJECT DeviceObject, PVCB Vcb)
Definition: phys_lib.cpp:1635
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define CdCapFlags_Cav
Definition: cdrw_usr.h:797
#define MediaType_NoDiscPresent
Definition: cdrw_hw.h:2499
struct _GET_CAPABILITIES_3_USER_OUT GET_CAPABILITIES_3_USER_OUT
#define CDRW_FEATURE_FORCE_SYNC_BEFORE_READ
Definition: cdrw_usr.h:1495
OSSTATUS UDFGetBlockSize(IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
Definition: phys_lib.cpp:2687
#define CdMediaClass_HD_DVDRW
Definition: cdrw_usr.h:761
char int8
Definition: platform.h:10
#define MediaType_80mm_CDR_AudioOnly
Definition: cdrw_hw.h:2481

Referenced by UDFMountVolume(), and UDFVerifyVolume().

◆ UDFPrepareForReadOperation()

OSSTATUS UDFPrepareForReadOperation ( IN PVCB  Vcb,
IN uint32  Lba,
IN uint32  BCount 
)

Definition at line 3670 of file phys_lib.cpp.

3675 {
3676  if( (Vcb->FsDeviceType != FILE_DEVICE_CD_ROM_FILE_SYSTEM) ) {
3677  Vcb->VCBFlags &= ~UDF_VCB_LAST_WRITE;
3678  return STATUS_SUCCESS;
3679  }
3680  uint32 i = Vcb->LastReadTrack;
3681  BOOLEAN speed_changed = FALSE;
3682 #ifdef _BROWSE_UDF_
3683  PUCHAR tmp;
3684  OSSTATUS RC;
3685  ULONG ReadBytes;
3686 #endif //_BROWSE_UDF_
3687 
3688 #ifdef _UDF_STRUCTURES_H_
3689  if(Vcb->BSBM_Bitmap) {
3690  ULONG i;
3691  for(i=0; i<BCount; i++) {
3692  if(UDFGetBit((uint32*)(Vcb->BSBM_Bitmap), Lba+i)) {
3693  UDFPrint(("R: Known BB @ %#x\n", Lba));
3694  //return STATUS_FT_WRITE_RECOVERY; // this shall not be treated as error and
3695  // we shall get IO request to BAD block
3696  return STATUS_DEVICE_DATA_ERROR;
3697  }
3698  }
3699  }
3700 #endif //_UDF_STRUCTURES_H_
3701 
3702  if(!UDFIsDvdMedia(Vcb) &&
3703  (Vcb->VCBFlags & UDF_VCB_LAST_WRITE) &&
3704  !(Vcb->VCBFlags & UDF_VCB_FLAGS_NO_SYNC_CACHE) &&
3705  !(Vcb->CompatFlags & UDF_VCB_IC_NO_SYNCCACHE_AFTER_WRITE)){
3706 
3707 // OSSTATUS RC;
3708 
3709  RC = UDFSyncCache(Vcb);
3710  }
3711  if( (Vcb->VCBFlags & UDF_VCB_LAST_WRITE) &&
3712  !(Vcb->VCBFlags & UDF_VCB_FLAGS_NO_SYNC_CACHE) &&
3713 #ifndef UDF_FORMAT_MEDIA
3714  (Vcb->CompatFlags & UDF_VCB_IC_SYNCCACHE_BEFORE_READ) &&
3715 #endif //UDF_FORMAT_MEDIA
3716  TRUE)
3717  {
3718 // OSSTATUS RC;
3719  UDFSyncCache(Vcb);
3720  }
3721 
3722 #ifdef _BROWSE_UDF_
3723  if(!UDFIsDvdMedia(Vcb)) {
3724  // limit read speed after write operation
3725  // to avoid performance degrade durring speed-up/down
3726  // on read/write mode switching
3727  if(Vcb->VCBFlags & UDF_VCB_FLAGS_USE_CAV) {
3728  // limit both read & write speed to last write speed for CAV mode
3729  // some drives damage data when speed is adjusted during recording process
3730  // even in packet mode
3731  if(Vcb->CurSpeed != Vcb->MaxWriteSpeed ||
3732  Vcb->CurSpeed != Vcb->MaxReadSpeed) {
3733  Vcb->CurSpeed = Vcb->MaxWriteSpeed;
3734  speed_changed = TRUE;
3735  }
3736  } else
3737  if(Vcb->VCBFlags & UDF_VCB_LAST_WRITE) {
3738  // limit read speed to last write speed
3739  if(Vcb->CurSpeed > Vcb->MaxWriteSpeed) {
3740  Vcb->CurSpeed = Vcb->MaxWriteSpeed;
3741  speed_changed = TRUE;
3742  }
3743  } else
3744  if(Vcb->CurSpeed < Vcb->MaxReadSpeed ) {
3745  // increment read speed (+1X)
3746  Vcb->CurSpeed += 176/1;
3747  speed_changed = TRUE;
3748  }
3749 
3750  if(Vcb->CurSpeed > Vcb->MaxReadSpeed) {
3751  Vcb->CurSpeed = Vcb->MaxReadSpeed;
3752  }
3753  // send speed limits to drive
3754  if(speed_changed) {
3755  RtlZeroMemory(&(Vcb->SpeedBuf), sizeof(SET_CD_SPEED_EX_USER_IN));
3756  Vcb->SpeedBuf.ReadSpeed = Vcb->CurSpeed;
3757  Vcb->SpeedBuf.WriteSpeed = Vcb->MaxWriteSpeed;
3758  if(Vcb->VCBFlags & UDF_VCB_FLAGS_USE_CAV) {
3759  Vcb->SpeedBuf.RotCtrl = CdSpeed_RotCtrl_CAV;
3760  }
3761  UDFPrint((" UDFPrepareForReadOperation: set speed to %s %dX/%dX\n",
3762  (Vcb->VCBFlags & UDF_VCB_FLAGS_USE_CAV) ? "CAV" : "CLV",
3763  Vcb->SpeedBuf.ReadSpeed,
3764  Vcb->SpeedBuf.WriteSpeed));
3766  Vcb->TargetDeviceObject,
3767  &(Vcb->SpeedBuf),sizeof(SET_CD_SPEED_EX_USER_IN),
3768  NULL,0,TRUE,NULL);
3769  }
3770  }
3771 
3772  if(UDFIsDvdMedia(Vcb))
3773  return STATUS_SUCCESS;
3774 
3775  if(Vcb->LastReadTrack &&
3776  ((Vcb->TrackMap[i].FirstLba <= Lba) || (Vcb->TrackMap[i].FirstLba & 0x80000000)) &&
3777  (Vcb->TrackMap[i].LastLba >= Lba)) {
3778 check_for_data_track:
3779  // check track mode (Mode1/XA)
3780  switch((Vcb->TrackMap[i].DataParam & TrkInfo_Dat_Mask)) {
3781  case TrkInfo_Dat_Mode1: // Mode1
3782  case TrkInfo_Dat_XA: // XA Mode2
3783  case TrkInfo_Dat_Unknown: // for some stupid irons
3784  UDFSetMRWMode(Vcb);
3785  break;
3786  default:
3787  Vcb->IncrementalSeekState = INCREMENTAL_SEEK_NONE;
3788  return STATUS_INVALID_PARAMETER;
3789  }
3790  } else {
3791  for(i=Vcb->FirstTrackNum; i<=Vcb->LastTrackNum; i++) {
3792  if(((Vcb->TrackMap[i].FirstLba > Lba) && !(Vcb->TrackMap[i].FirstLba & 0x80000000)) ||
3793  (Vcb->TrackMap[i].LastLba < Lba))
3794  continue;
3795  Vcb->LastReadTrack = i;
3796  goto check_for_data_track;
3797  }
3798  Vcb->LastReadTrack = 0;
3799  }
3800  if(Vcb->IncrementalSeekState != INCREMENTAL_SEEK_WORKAROUND) {
3801  Vcb->IncrementalSeekState = INCREMENTAL_SEEK_NONE;
3802  return STATUS_SUCCESS;
3803  }
3804  UDFPrint((" UDFPrepareForReadOperation: seek workaround...\n"));
3805  Vcb->IncrementalSeekState = INCREMENTAL_SEEK_DONE;
3806 
3807  tmp = (PUCHAR)DbgAllocatePoolWithTag(NonPagedPool, Vcb->BlockSize, 'bNWD');
3808  if(!tmp) {
3809  Vcb->IncrementalSeekState = INCREMENTAL_SEEK_NONE;
3811  }
3812  for(i=0x1000; i<=Lba; i+=0x1000) {
3813  RC = UDFPhReadSynchronous(Vcb->TargetDeviceObject, tmp, Vcb->BlockSize,
3814  ((uint64)UDFFixFPAddress(Vcb,i)) << Vcb->BlockSizeBits, &ReadBytes, 0);
3815  UDFPrint((" seek workaround, LBA %x, status %x\n", i, RC));
3816  }
3817  DbgFreePool(tmp);
3818 #endif //_BROWSE_UDF_
3819 
3820  return STATUS_SUCCESS;
3821 } // end UDFPrepareForReadOperation()
unsigned long long uint64
Definition: platform.h:18
#define IOCTL_CDRW_SET_SPEED
Definition: cdrw_usr.h:80
#define INCREMENTAL_SEEK_DONE
Definition: udf_common.h:303
#define UDF_VCB_IC_SYNCCACHE_BEFORE_READ
Definition: udf_common.h:512
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define DbgAllocatePoolWithTag(a, b, c)
Definition: env_spec_w32.h:333
#define INCREMENTAL_SEEK_WORKAROUND
Definition: udf_common.h:302
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned int uint32
Definition: types.h:32
unsigned char * PUCHAR
Definition: retypes.h:3
NTSTATUS NTAPI UDFPhReadSynchronous(PDEVICE_OBJECT DeviceObject, PVOID Buffer, ULONG Length, LONGLONG Offset, PULONG ReadBytes, ULONG Flags)
Definition: env_spec.cpp:130
#define UDFIsDvdMedia(Vcb)
Definition: udf_common.h:524
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UDF_VCB_FLAGS_USE_CAV
Definition: udf_common.h:487
#define OSSTATUS
Definition: env_spec_w32.h:57
#define INCREMENTAL_SEEK_NONE
Definition: udf_common.h:301
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static NTSTATUS ReadBytes(IN PDEVICE_OBJECT LowerDevice, OUT PUCHAR Buffer, IN ULONG BufferSize, OUT PULONG_PTR FilledBytes)
Definition: detect.c:67
#define DbgFreePool
Definition: env_spec_w32.h:334
#define TrkInfo_Dat_Mask
Definition: cdrw_hw.h:2410
#define Vcb
Definition: cdprocs.h:1425
#define TrkInfo_Dat_Mode1
Definition: cdrw_hw.h:2411
#define UDF_VCB_IC_NO_SYNCCACHE_AFTER_WRITE
Definition: udf_common.h:507
#define CdSpeed_RotCtrl_CAV
Definition: cdrw_hw.h:594
NTSTATUS UDFSetMRWMode(IN PVCB Vcb)
Definition: phys_lib.cpp:811
#define UDF_VCB_LAST_WRITE
Definition: udf_common.h:472
#define TrkInfo_Dat_XA
Definition: cdrw_hw.h:2413
NTSTATUS UDFSyncCache(IN PVCB Vcb)
Definition: phys_lib.cpp:52
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:108
unsigned int ULONG
Definition: retypes.h:1
#define UDF_VCB_FLAGS_NO_SYNC_CACHE
Definition: udf_common.h:467
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define TrkInfo_Dat_Unknown
Definition: cdrw_hw.h:2416
#define UDFGetBit(arr, bit)
Definition: udf_info.h:1180
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159

Referenced by UDFTRead().

◆ UDFPrepareForWriteOperation()

OSSTATUS UDFPrepareForWriteOperation ( IN PVCB  Vcb,
IN uint32  Lba,
IN uint32  BCount 
)

Definition at line 893 of file phys_lib.cpp.

898 {
899 #ifndef UDF_READ_ONLY_BUILD
900 #ifdef UDF_FORMAT_MEDIA
901  PUDFFmtState fms = Vcb->fms;
902 #else
903  #define fms FALSE
904 #endif //UDF_FORMAT_MEDIA
905 
906 #ifdef _UDF_STRUCTURES_H_
907  if(Vcb->BSBM_Bitmap) {
908  ULONG i;
909  for(i=0; i<BCount; i++) {
910  if(UDFGetBit((uint32*)(Vcb->BSBM_Bitmap), Lba+i)) {
911  UDFPrint(("W: Known BB @ %#x\n", Lba));
912  //return STATUS_FT_WRITE_RECOVERY; // this shall not be treated as error and
913  // we shall get IO request to BAD block
915  }
916  }
917  }
918 #endif //_UDF_STRUCTURES_H_
919 
920  Vcb->VCBFlags |= UDF_VCB_LAST_WRITE;
921 
922  if(
923 #ifdef _BROWSE_UDF_
924  (((Vcb->FsDeviceType != FILE_DEVICE_CD_ROM_FILE_SYSTEM) ||
925  !(Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_MOUNTED) ||
926  (Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK))
927  && !fms
928  ) ||
929 #endif //_BROWSE_UDF_
930 #ifdef UDF_FORMAT_MEDIA
931  (fms && fms->SkipPrepareW) ||
932 #endif //UDF_FORMAT_MEDIA
933  !(Vcb->VCBFlags & UDF_VCB_FLAGS_OUR_DEVICE_DRIVER)
934  ) {
935  UDFPrint(("Skip prepare for Write @%x\n", Lba));
936  return STATUS_SUCCESS;
937  }
938 
939  // check if the device requires OPC before each write operation
940  UDFDoOPC(Vcb);
941 
942  if(Vcb->SyncCacheState == SYNC_CACHE_RECOVERY_ATTEMPT) {
943  Vcb->SyncCacheState = SYNC_CACHE_RECOVERY_RETRY;
944  } else {
945  Vcb->SyncCacheState = SYNC_CACHE_RECOVERY_NONE;
946  }
947  if(Vcb->LastModifiedTrack &&
948  (Vcb->TrackMap[Vcb->LastModifiedTrack].FirstLba <= Lba) &&
949  (Vcb->TrackMap[Vcb->LastModifiedTrack].LastLba >= Lba) &&
950  !( (Vcb->MediaClassEx == CdMediaClass_DVDRW ||
951  Vcb->MediaClassEx == CdMediaClass_DVDpRW ||
952  Vcb->MediaClassEx == CdMediaClass_DVDRAM ||
953  Vcb->MRWStatus == DiscInfo_BGF_Interrupted ||
954  Vcb->MRWStatus == DiscInfo_BGF_InProgress) && (Lba > Vcb->LastLBA))
955  ) {
956  // Ok, we needn't change Write Parameters
957 // if(Vcb->TrackMap[Vcb->LastModifiedTrack].Flags & TrackMap_Try_variation)
958 // Vcb->TrackMap[Vcb->LastModifiedTrack].Flags |= TrackMap_Use_variation;
959  UDFPrint(("Skip prepare for Write (2) @%x\n", Lba));
960  return STATUS_SUCCESS;
961  }
962 
964 
965  if(!UDFIsWriteParamsReq(Vcb)) {
966 #ifdef UDF_FORMAT_MEDIA
967  if(fms) {
968  return STATUS_SUCCESS;
969  }
970 #endif //UDF_FORMAT_MEDIA
971  }
972 
973  for(uint32 i=Vcb->FirstTrackNum; i<=Vcb->LastTrackNum; i++) {
974  if((Vcb->TrackMap[i].FirstLba > Lba) ||
975  (Vcb->TrackMap[i].LastLba < Lba)) {
976  //UDFPrint(("not in track %d\n"));
977  continue;
978  }
979  OSSTATUS RC;
980  PGET_WRITE_MODE_USER_OUT WParams;
981 
982  if(!UDFIsWriteParamsReq(Vcb)) {
983  RC = STATUS_SUCCESS;
984  goto check_dvd_bg_format;
985  }
986 
987  if(!Vcb->WParams) {
988  Vcb->WParams =
990  }
991  if(!(WParams = Vcb->WParams)) {
992  UDFPrint(("!WParams\n"));
994  }
995 
996  RC = UDFPhSendIOCTL(IOCTL_CDRW_GET_WRITE_MODE, Vcb->TargetDeviceObject,
997  NULL,0,
998  (void*)(Vcb->WParams),sizeof(GET_WRITE_MODE_USER_OUT),
999  FALSE, NULL);
1000  if(!OS_SUCCESS(RC)) {
1001 #ifdef UDF_FORMAT_MEDIA
1002  if(fms) {
1003  fms->SkipPrepareW = 1;
1004  MyFreePool__(WParams);
1005  return STATUS_SUCCESS;
1006  }
1007 #endif //UDF_FORMAT_MEDIA
1008  UDFPrint(("!get WParams\n"));
1009  return RC;
1010  }
1011  // clear unnecassary flags
1012  WParams->Byte2.Flags &= ~WParam_TestWrite;
1013  WParams->Byte2.Flags &= ~WParam_WType_Mask;
1014  // select packet writing
1015  WParams->Byte2.Flags |= WParam_WType_Packet;
1016 
1017  WParams->Byte3.Flags &= ~(WParam_TrkMode_Mask |
1019  WParam_Copy);
1020  WParams->Byte3.Flags |= Vcb->TrackMap[i].TrackParam &
1023  WParam_Copy);
1024 
1025  // set packet type (VP/FP)
1026 // if(opt_partition == PT_VAT15 ||
1027 // opt_blank_vat15)
1028  if(WParams->Byte2.Flags & WParam_LS_V) {
1029  WParams->LinkSize = 7;
1030  }
1031 
1032  if(Vcb->TrackMap[i].DataParam & TrkInfo_Packet) {
1033  if((Vcb->TrackMap[i].DataParam & TrkInfo_FP) &&
1034  !Vcb->CDR_Mode) {
1035  WParams->Byte3.Flags |= WParam_FP;
1036  } else {
1037  WParams->Byte3.Flags &= ~WParam_FP;
1038  }
1039  } else {
1040  if(!Vcb->CDR_Mode) {
1041  WParams->Byte3.Flags |= WParam_FP;
1042  } else {
1043  WParams->Byte3.Flags &= ~WParam_FP;
1044  }
1045  }
1046 
1047  // select multisession mode
1048  WParams->Byte3.Flags &= ~WParam_MultiSes_Mask;
1049  if((Vcb->DiscStat & DiscInfo_Disk_Mask) == DiscInfo_Disk_Appendable) {
1050  WParams->Byte3.Flags |= WParam_Multises_Multi;
1051  } else
1052  if(Vcb->LastSession > 1) {
1053  WParams->Byte3.Flags |= WParam_Multises_Final;
1054  } else {
1055  WParams->Byte3.Flags |= WParam_Multises_None;
1056  }
1057  // set sector mode (Mode1/XA)
1058  WParams->Byte4.Flags &= ~WParam_BlkType_Mask;
1059  if((Vcb->TrackMap[i].DataParam & TrkInfo_Dat_Mask) == TrkInfo_Dat_XA) {
1060  // XA Mode2
1062  WParams->SesFmt = WParam_SesFmt_CdRomXa;
1063  } else if((Vcb->TrackMap[i].DataParam & TrkInfo_Dat_Mask) == TrkInfo_Dat_Mode1) {
1064  // Mode1
1065  WParams->Byte4.Flags |= WParam_BlkType_M1_2048;
1066  WParams->SesFmt = WParam_SesFmt_CdRom;
1067  } else {
1068 #ifdef UDF_FORMAT_MEDIA
1069  if(fms) {
1070  fms->SkipPrepareW = 1;
1071  MyFreePool__(WParams);
1072  return STATUS_SUCCESS;
1073  }
1074 #endif //UDF_FORMAT_MEDIA
1075  UDFPrint((" inv sector mode\n"));
1076  return STATUS_INVALID_PARAMETER;
1077  }
1078  // set packet size
1079  *((uint32*)&(WParams->PacketSize)) = BCount;
1080  *((uint32*)&(WParams->SubHeader)) = 0;
1081  // set additional flags for VP
1082 
1083  if(Vcb->CDR_Mode) {
1084 // if(opt_partition == PT_VAT15)
1085  WParams->SubHeader.Params.Params1.SubMode = WParam_SubHdr_SubMode1;
1086  }
1087  WParams->PageLength = sizeof(GET_WRITE_MODE_USER_OUT)-2;
1088  WParams->PageCode = MODE_PAGE_WRITE_PARAMS;
1089  // apply write parameters
1090  RC = UDFPhSendIOCTL(IOCTL_CDRW_SET_WRITE_MODE, Vcb->TargetDeviceObject,
1091  (void*)WParams,sizeof(SET_WRITE_MODE_USER_IN),
1092  NULL,0,FALSE,NULL);
1093 
1094 #ifdef UDF_FORMAT_MEDIA
1095  if(fms) {
1096  if(!NT_SUCCESS(RC)) {
1097  fms->SkipPrepareW = 1;
1098  MyFreePool__(WParams);
1099  return STATUS_SUCCESS;
1100  }
1101 
1102  RC = UDFPhSendIOCTL(IOCTL_CDRW_GET_WRITE_MODE, Vcb->TargetDeviceObject,
1103  NULL,0,
1104  (PVOID)WParams,sizeof(GET_WRITE_MODE_USER_OUT),
1105  FALSE, NULL);
1106  if(!NT_SUCCESS(RC)) {
1107  MyFreePool__(WParams);
1108  return RC;
1109  }
1110 
1111  if(fms->opt_partition == PT_VAT15 ||
1112  fms->opt_blank_vat15) {
1113  if(WParams->Byte3.Flags & WParam_FP) {
1114  MyFreePool__(WParams);
1116  }
1117  } else {
1118  if(!(WParams->Byte3.Flags & WParam_FP)) {
1119  MyFreePool__(WParams);
1121  }
1122  }
1123  }
1124 #endif //UDF_FORMAT_MEDIA
1125 
1126  // switch to random access mode
1127  ((PSET_RANDOM_ACCESS_USER_IN)WParams)->RandomAccessMode = Vcb->CDR_Mode ? FALSE : TRUE;
1128 // ((PSET_RANDOM_ACCESS_USER_IN)WParams)->RandomAccessMode = (opt_partition != PT_VAT15) ? TRUE : FALSE;
1129  RC = UDFPhSendIOCTL(IOCTL_CDRW_SET_RANDOM_ACCESS, Vcb->TargetDeviceObject,
1130  (void*)WParams,sizeof(SET_RANDOM_ACCESS_USER_IN),
1131  NULL,0,FALSE, NULL);
1132 
1133 check_dvd_bg_format:
1134 
1135  UDFPrint((" check BGF\n"));
1136  if(!Vcb->CDR_Mode) {
1137  if(OS_SUCCESS(RC)) {
1138  Vcb->LastModifiedTrack = i;
1139  if(!(Vcb->TrackMap[i].Flags & TrackMap_Use_variation)) {
1140  if(Vcb->TrackMap[i].Flags & TrackMap_Try_variation) {
1141  Vcb->TrackMap[i].Flags |= TrackMap_Use_variation;
1142  } else {
1143  Vcb->TrackMap[i].Flags |= TrackMap_Try_variation;
1144  }
1145  }
1146  }
1147  } else {
1148  Vcb->LastModifiedTrack = 0;
1149  }
1150 // fms->SkipPrepareW = 1;
1151 
1152 
1153  if((Vcb->MediaClassEx == CdMediaClass_DVDRW ||
1154  Vcb->MediaClassEx == CdMediaClass_DVDpRW ||
1155  Vcb->MediaClassEx == CdMediaClass_DVDRAM ||
1156  Vcb->MRWStatus == DiscInfo_BGF_Interrupted )
1157  && (Lba > Vcb->LastLBA)) {
1158 
1159  ULONG fLba;
1160  ULONG WrittenBytes;
1161  ULONG PSz = BCount << Vcb->BlockSizeBits;
1162 #ifdef _BROWSE_UDF_
1163  ULONG retry;
1164 #endif //_BROWSE_UDF_
1166 
1167  ASSERT((Vcb->LastLBA+1) == Vcb->NWA);
1168 
1169  if(Lba+BCount <= (Vcb->LastLBA+1) ) {
1170  UDFPrint(("DVD cont. fmt, LBA+BCount<=NWA, exiting\n"));
1171  return STATUS_SUCCESS;
1172  }
1173  if((Vcb->MRWStatus != DiscInfo_BGF_Interrupted) &&
1174  (Lba <= (Vcb->LastLBA+1)) ) {
1175  UDFPrint(("!PausedBGF + DVD cont. fmt, LBA<=NWA, exiting\n"));
1176  return STATUS_SUCCESS;
1177  }
1178 
1179  if(Vcb->MRWStatus == DiscInfo_BGF_Interrupted) {
1180  // This code also can restart background MRW formatting
1181  UDFPrint(("DVD cont. fmt, LastLBA %x, Lba %x\n", Vcb->LastLBA, Lba));
1182 
1184  if(ForBuf) {
1186  ForBuf->Flags.FlagsEx = FORMAT_UNIT_RESTART_MRW;
1187  ForBuf->BlockCount = 0xffffffff;
1188 
1189  RC = UDFPhSendIOCTL(IOCTL_CDRW_FORMAT_UNIT, Vcb->TargetDeviceObject,
1190  ForBuf,sizeof(FORMAT_CDRW_PARAMETERS_USER_IN),
1191  NULL,0,FALSE, NULL);
1192  DbgFreePool(ForBuf);
1193  if(OS_SUCCESS(RC)) {
1194  UDFPrint(("BGFormat restarted Interrupted->InProgress\n"));
1195  Vcb->MRWStatus = DiscInfo_BGF_InProgress;
1196  } else {
1198  if(!Vcb->Error) {
1199  Vcb->Error = (PGET_LAST_ERROR_USER_OUT)
1201  }
1202  Error = Vcb->Error;
1203  if(Error) {
1204  UDFPhSendIOCTL( IOCTL_CDRW_GET_LAST_ERROR, Vcb->TargetDeviceObject,
1205  NULL,0,
1207  TRUE,NULL);
1208  UDFPrint(("SK=%x ASC=%x, ASCQ=%x, IE=%x\n",
1209  Error->SenseKey, Error->AdditionalSenseCode, Error->AdditionalSenseCodeQualifier, Error->LastError));
1210  // check for Long Write In Progress
1211  if( (Error->SenseKey == SCSI_SENSE_NOT_READY) &&
1212  (Error->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY) &&
1213  ((Error->AdditionalSenseCodeQualifier == SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS) ||
1214  (Error->AdditionalSenseCodeQualifier == SCSI_SENSEQ_FORMAT_IN_PROGRESS)) ) {
1215  RC = STATUS_SUCCESS;
1216  UDFPrint(("Seems, BGFormat already restarted\n"));
1217  Vcb->MRWStatus = DiscInfo_BGF_InProgress;
1218  }
1219  }
1220  }
1221  }
1222  } else {
1223  RC = STATUS_SUCCESS;
1224  }
1225 
1226  UDFPrint(("DVD cont. write, LastLBA %x, Lba %x\n", Vcb->LastLBA, Lba));
1227 
1228  ASSERT(Vcb->MediaClassEx == CdMediaClass_DVDRW);
1229  if(!Vcb->fZBuffer) {
1230  Vcb->fZBuffer = (PCHAR)DbgAllocatePoolWithTag(NonPagedPool, PSz, 'zNWD');
1231  RtlZeroMemory(Vcb->fZBuffer, PSz);
1232  Vcb->fZBufferSize = PSz;
1233  } else
1234  if(Vcb->fZBufferSize < PSz) {
1235  PSz = Vcb->fZBufferSize;
1236  }
1237  if(!Vcb->fZBuffer) {
1238  BrutePoint();
1240  } else {
1241  for(fLba = Vcb->NWA; fLba < Lba; fLba+=BCount) {
1242 #ifdef _BROWSE_UDF_
1243  retry = UDF_WRITE_MAX_RETRY;
1244 retry_1:
1245 #endif //_BROWSE_UDF_
1246  RC = UDFPhWriteVerifySynchronous(Vcb->TargetDeviceObject, Vcb->fZBuffer, PSz,
1247  ((uint64)fLba) << Vcb->BlockSizeBits, &WrittenBytes, PH_TMP_BUFFER);
1248  Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
1249  UDFPrint(("Fmt status: %x\n", RC));
1250 #ifdef _BROWSE_UDF_
1251  if(!OS_SUCCESS(RC) &&
1252  OS_SUCCESS(RC = UDFRecoverFromError(Vcb, TRUE, RC, fLba, BCount, &retry)) ) {
1253  goto retry_1;
1254  UDFPrint(("Fmt retry\n"));
1255  }
1256 #endif //_BROWSE_UDF_
1257  if(!OS_SUCCESS(RC)) {
1258  BrutePoint();
1259  UDFPrint(("Fmt break on ERROR\n"));
1260  break;
1261  }
1262  UDFUpdateNWA(Vcb, fLba, BCount, RC);
1263  }
1264  }
1265  } else {
1266  UDFPrint((" no special processing\n"));
1267  }
1268 
1269  return RC;
1270  }
1271 #endif //UDF_READ_ONLY_BUILD
1272  UDFPrint((" no suitable track!\n"));
1273  return STATUS_INVALID_PARAMETER;
1274 } // end UDFPrepareForWriteOperation()
unsigned long long uint64
Definition: platform.h:18
void UDFUpdateNWA(PVCB Vcb, uint32 LBA, uint32 BCount, OSSTATUS RC)
Definition: phys_lib.cpp:3826
#define CdMediaClass_DVDRAM
Definition: cdrw_usr.h:747
#define SCSI_SENSEQ_FORMAT_IN_PROGRESS
Definition: cdrw_hw.h:1316
OSSTATUS UDFRecoverFromError(IN PVCB Vcb, IN BOOLEAN WriteOp, IN OSSTATUS status, IN uint32 Lba, IN uint32 BCount, IN OUT uint32 *retry)
Definition: phys_lib.cpp:1283
#define WParam_SesFmt_CdRomXa
Definition: cdrw_hw.h:2700
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
#define TrkInfo_FP
Definition: cdrw_hw.h:2417
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define WParam_BlkType_M1_2048
Definition: cdrw_hw.h:2671
#define FORMAT_UNIT_RESTART_MRW
Definition: cdrw_usr.h:516
#define DbgAllocatePoolWithTag(a, b, c)
Definition: env_spec_w32.h:333
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _SET_RANDOM_ACCESS_USER_IN * PSET_RANDOM_ACCESS_USER_IN
#define IOCTL_CDRW_FORMAT_UNIT
Definition: cdrw_usr.h:98
unsigned int uint32
Definition: types.h:32
#define IOCTL_CDRW_SET_RANDOM_ACCESS
Definition: cdrw_usr.h:99
union _MODE_WRITE_PARAMS_PAGE_USER::@922 Byte3
#define SYNC_CACHE_RECOVERY_NONE
Definition: udf_common.h:277
#define DiscInfo_Disk_Mask
Definition: cdrw_hw.h:2270
#define CdMediaClass_DVDRW
Definition: cdrw_usr.h:749
#define WParam_Copy
Definition: cdrw_hw.h:2648
#define UDF_WRITE_MAX_RETRY
Definition: udf_rel.h:502
#define SCSI_ADSENSE_LUN_NOT_READY
Definition: cdrw_hw.h:1218
#define WParam_TrkMode_AllowCpy
Definition: cdrw_hw.h:2647
#define WParam_BlkType_Mask
Definition: cdrw_hw.h:2665
#define SCSI_SENSE_NOT_READY
Definition: cdrw_hw.h:1189
#define TrkInfo_Packet
Definition: cdrw_hw.h:2418
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
#define TrackMap_Use_variation
Definition: cdrw_usr.h:1640
OSSTATUS UDFDoOPC(IN PVCB Vcb)
Definition: phys_lib.cpp:850
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct _FORMAT_CDRW_PARAMETERS_USER_IN * PFORMAT_CDRW_PARAMETERS_USER_IN
#define OSSTATUS
Definition: env_spec_w32.h:57
#define WParam_TrkMode_Mask
Definition: cdrw_hw.h:2640
#define WParam_SubHdr_SubMode1
Definition: cdrw_hw.h:2730
#define WParam_WType_Packet
Definition: cdrw_hw.h:2621
#define WParam_TestWrite
Definition: cdrw_hw.h:2625
#define DiscInfo_BGF_Interrupted
Definition: cdrw_hw.h:2300
smooth NULL
Definition: ftsmooth.c:416
#define WParam_BlkType_M2XAF1_2048
Definition: cdrw_hw.h:2673
struct _MODE_WRITE_PARAMS_PAGE_USER::@925 SubHeader
#define TrackMap_Try_variation
Definition: cdrw_usr.h:1639
#define DbgFreePool
Definition: env_spec_w32.h:334
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define PCHAR
Definition: match.c:90
#define UDF_VCB_SKIP_EJECT_CHECK
Definition: udf_common.h:470
#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS
Definition: cdrw_hw.h:1318
#define WParam_SesFmt_CdRom
Definition: cdrw_hw.h:2698
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
MODE_WRITE_PARAMS_PAGE_USER GET_WRITE_MODE_USER_OUT
Definition: cdrw_usr.h:1010
#define _BROWSE_UDF_
Definition: struct.h:330
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
Definition: udf_common.h:466
#define TrkInfo_Dat_Mask
Definition: cdrw_hw.h:2410
#define Vcb
Definition: cdprocs.h:1425
#define TrkInfo_Dat_Mode1
Definition: cdrw_hw.h:2411
#define IOCTL_CDRW_GET_LAST_ERROR
Definition: cdrw_usr.h:103
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define BrutePoint()
Definition: env_spec_w32.h:504
#define WParam_FP
Definition: cdrw_hw.h:2649
#define fms
BOOL Error
Definition: chkdsk.c:66
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
Definition: udf_common.h:459
#define IOCTL_CDRW_SET_WRITE_MODE
Definition: cdrw_usr.h:86
#define WParam_Multises_None
Definition: cdrw_hw.h:2651
#define WParam_WType_Mask
Definition: cdrw_hw.h:2620
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define WParam_Multises_Final
Definition: cdrw_hw.h:2652
#define DiscInfo_BGF_InProgress
Definition: cdrw_hw.h:2301
#define SYNC_CACHE_RECOVERY_ATTEMPT
Definition: udf_common.h:278
PMODE_WRITE_PARAMS_PAGE_USER PGET_WRITE_MODE_USER_OUT
Definition: cdrw_usr.h:1011
struct _GET_LAST_ERROR_USER_OUT * PGET_LAST_ERROR_USER_OUT
NTSTATUS UDFSetMRWMode(IN PVCB Vcb)
Definition: phys_lib.cpp:811
union _MODE_WRITE_PARAMS_PAGE_USER::@923 Byte4
#define UDF_VCB_LAST_WRITE
Definition: udf_common.h:472
#define SYNC_CACHE_RECOVERY_RETRY
Definition: udf_common.h:279
union _MODE_WRITE_PARAMS_PAGE_USER::@921 Byte2
#define UDFPhWriteVerifySynchronous
Definition: env_spec.h:46
#define PH_TMP_BUFFER
Definition: phys_lib.h:65
#define TrkInfo_Dat_XA
Definition: cdrw_hw.h:2413
#define CdMediaClass_DVDpRW
Definition: cdrw_usr.h:751
#define WParam_MultiSes_Mask
Definition: cdrw_hw.h:2650
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:108
#define DiscInfo_Disk_Appendable
Definition: cdrw_hw.h:2272
#define UDFIsWriteParamsReq(Vcb)
Definition: udf_common.h:525
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define WParam_Multises_Multi
Definition: cdrw_hw.h:2653
#define UDFGetBit(arr, bit)
Definition: udf_info.h:1180
#define MODE_PAGE_WRITE_PARAMS
Definition: cdrw_hw.h:844
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define IOCTL_CDRW_GET_WRITE_MODE
Definition: cdrw_usr.h:85
#define WParam_LS_V
Definition: cdrw_hw.h:2626
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159

Referenced by UDFRecoverFromError(), and UDFTWrite().

◆ UDFReadAndProcessFullToc()

OSSTATUS UDFReadAndProcessFullToc ( PDEVICE_OBJECT  DeviceObject,
PVCB  Vcb 
)

Definition at line 2243 of file phys_lib.cpp.

2247 {
2248  OSSTATUS RC = STATUS_SUCCESS;
2250  uint32 index;
2251  uint8 POINT;
2252  uint8 CurTrack = 0;
2253  uint32 LastLeadOut = 0;
2254 // BOOLEAN IsMRW = FALSE;
2255 
2256  UDFPrint(("UDFReadAndProcessFullToc\n"));
2257 
2258  if(!toc) return STATUS_INSUFFICIENT_RESOURCES;
2259  Vcb->FirstTrackNum = 0xFF;
2260 
2262 
2264  NULL,0,
2265  toc,sizeof(READ_FULL_TOC_USER_OUT),
2266  TRUE,NULL);
2267 
2268  if(!OS_SUCCESS(RC)) {
2269 
2270  MyFreePool__(toc);
2271  return RC;
2272  }
2273 
2274 #ifdef _CONSOLE
2275  Vcb->PhDeviceType = FILE_DEVICE_CD_ROM;
2276 #endif //_CONSOLE
2277  Vcb->LastSession = toc->Sessions.Last_TrackSes;
2278 
2279  RC = UDFReallocTrackMap(Vcb, 0x100);
2280  if(!OS_SUCCESS(RC)) {
2281  MyFreePool__(toc);
2282  return RC;
2283  }
2284 
2285  // get LastPossibleLBA
2286 
2287  // Note: some drives return Full TOC items unordered.
2288  // So, LeadOut position may come before Track definition.
2289  // In order to handle such situation, we must initialize
2290  // CurTrack when First or Last Track descriptor comes
2292 /* if((toc->SessionData[index].Adr == TOC_ADR_TrackInfo) &&
2293  ((toc->SessionData[index].Control == TOC_CTL_MRWTrackInfo) || (toc->SessionData[index].Control == TOC_CTL_MRWLastSes))) {
2294  IsMRW = TRUE;
2295  }*/
2296  if(toc->SessionData[index].Adr == 1) {
2297  switch (POINT = toc->SessionData[index].POINT) {
2298  case POINT_FirstTrackNum: {
2299  Vcb->FirstTrackNum = toc->SessionData[index].Params.FirstTrackNum.FirstTrackNum;
2300  if(!CurTrack)
2301  CurTrack = (uint8)(Vcb->FirstTrackNum);
2302  break;
2303  }
2304  case POINT_LastTrackNum: {
2305  Vcb->LastTrackNum = toc->SessionData[index].Params.LastTrackNum.LastTrackNum;
2306  if(CurTrack < Vcb->LastTrackNum)
2307  CurTrack = (uint8)(Vcb->FirstTrackNum);
2308  break;
2309  }
2311 #define TempMSF toc->SessionData[index].Params.StartPositionOfLeadOut.MSF
2312  Vcb->TrackMap[CurTrack].LastLba = MSF_TO_LBA(TempMSF[0],TempMSF[1],TempMSF[2]);
2313  LastLeadOut = max(LastLeadOut, Vcb->TrackMap[CurTrack].LastLba);
2314 #undef TempMSF
2315  break;
2316  }
2317  default: {
2318  if( (Vcb->FirstTrackNum != 0x0FF) &&
2319  (toc->SessionData[index].POINT == Vcb->FirstTrackNum) ) {
2320 #define TempMSF toc->SessionData[index].Params.StartPositionOfTrack.MSF
2321  Vcb->FirstLBA = MSF_TO_LBA(TempMSF[0],TempMSF[1],TempMSF[2]);
2322  if(Vcb->FirstLBA & 0x80000000) {
2323  Vcb->FirstLBA = 0;
2324  }
2325 #undef TempMSF
2326  }
2327  break;
2328  }
2329  }
2332 #define TempMSF toc->SessionData[index].Params.StartPositionOfTrack.MSF
2333  Vcb->TrackMap[POINT].FirstLba = MSF_TO_LBA(TempMSF[0],TempMSF[1],TempMSF[2])-1;
2334  if(Vcb->TrackMap[POINT].FirstLba & 0x80000000) {
2335  if(POINT == 1) {
2336  Vcb->TrackMap[POINT].FirstLba = 0;
2337  } else {
2338  if(Vcb->TrackMap[POINT-1].LastLba) {
2339  Vcb->TrackMap[POINT].FirstLba = Vcb->TrackMap[POINT-1].LastLba+1;
2340  }
2341  }
2342  }
2343 #undef TempMSF
2345  Vcb->TrackMap[POINT-1].LastLba = Vcb->TrackMap[POINT].FirstLba-1;
2346  }
2347  CurTrack = POINT;
2348  }
2349  } else
2350  if(toc->SessionData[index].Adr == 5) {
2351  switch (POINT = toc->SessionData[index].POINT) {
2353 #define TempMSF toc->SessionData[index].Params.StartPositionOfNextProgramArea.MaxLeadOut_MSF
2354  Vcb->LastPossibleLBA = MSF_TO_LBA(TempMSF[0],TempMSF[1],TempMSF[2]);
2355 #undef TempMSF
2356  break;
2357  }
2358  default: {
2359  break;
2360  }
2361  }
2362  }
2363 
2364  }
2365 
2366 /* if(!IsMRW) {
2367  UDFPrint(("No MRW\n"));
2368  Vcb->CompatFlags &= ~UDF_VCB_IC_MRW_ADDR_PROBLEM;
2369  }*/
2370 // Vcb->CompatFlags &= ~UDF_VCB_IC_MRW_ADDR_PROBLEM;
2371  // some devices report LastTrackNum=0 for full disks
2372  Vcb->LastTrackNum = max(Vcb->LastTrackNum, Vcb->FirstTrackNum);
2373  Vcb->TrackMap[Vcb->LastTrackNum].LastLba = max(LastLeadOut, Vcb->TrackMap[Vcb->LastTrackNum].LastLba);
2374 
2375  Vcb->LastLBA = Vcb->TrackMap[Vcb->LastTrackNum].LastLba;
2376 
2377  MyFreePool__(toc);
2378 // Vcb->LastLBA=PacketVariable2Fixed(Vcb->LastLBA)-2;
2379  return STATUS_SUCCESS;
2380 } // end UDFReadAndProcessFullToc()
#define POINT_LastTrackNum
Definition: cdrw_hw.h:1561
#define max(a, b)
Definition: svc.c:63
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define POINT_FirstTrackNum
Definition: cdrw_hw.h:1560
unsigned int uint32
Definition: types.h:32
#define POINT_StartPositionOfLeadOut
Definition: cdrw_hw.h:1562
PREAD_TOC_FULL_TOC PREAD_FULL_TOC_USER_OUT
Definition: cdrw_usr.h:1385
UCHAR POINT
Definition: cdrw_hw.h:1584
TOC_SES_INFO SessionData[MAXIMUM_NUMBER_OF_SESSIONS]
Definition: cdrw_hw.h:1689
UCHAR FirstTrackNum
Definition: cdrw_hw.h:1619
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:107
READ_TOC_HEADER Sessions
Definition: cdrw_hw.h:1688
#define POINT_StartPositionOfNextProgramArea
Definition: cdrw_hw.h:1566
union _TOC_SES_INFO::@787 Params
#define OSSTATUS
Definition: env_spec_w32.h:57
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define POINT
Definition: precomp.h:30
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
OSSTATUS UDFReallocTrackMap(IN PVCB Vcb, IN uint32 TrackNum)
Definition: phys_lib.cpp:69
#define MSF_TO_LBA(Minutes, Seconds, Frames)
Definition: tools.h:269
#define IOCTL_CDRW_READ_FULL_TOC
Definition: cdrw_usr.h:113
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
unsigned char uint8
Definition: types.h:28
#define POINT_StartPositionOfTrack_Min
Definition: cdrw_hw.h:1558
#define POINT_StartPositionOfTrack_Max
Definition: cdrw_hw.h:1559
#define index(s, c)
Definition: various.h:29
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define MAXIMUM_NUMBER_OF_SESSIONS
Definition: cdrw_hw.h:835
UCHAR Last_TrackSes
Definition: cdrw_hw.h:1528
#define TempMSF
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
UCHAR LastTrackNum
Definition: cdrw_hw.h:1628
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by UDFGetDiskInfo().

◆ UDFReadDiscTrackInfo()

OSSTATUS UDFReadDiscTrackInfo ( PDEVICE_OBJECT  DeviceObject,
PVCB  Vcb 
)

Definition at line 1635 of file phys_lib.cpp.

1639 {
1640  OSSTATUS RC = STATUS_SUCCESS;
1643  PTRACK_INFO_BLOCK_USER_IN TrackInfoIn = (PTRACK_INFO_BLOCK_USER_IN)TrackInfoOut;
1644  READ_CAPACITY_USER_OUT CapacityBuffer;
1645  LONG TrackNumber;
1646  BOOLEAN NotFP = FALSE;
1647  BOOLEAN ForceFP = FALSE;
1648  BOOLEAN PacketTrack = FALSE;
1649  BOOLEAN MRWRetry = FALSE;
1650 // BOOLEAN ReadCapacityOk = FALSE;
1651 #ifdef UDF_FORMAT_MEDIA
1652  PUDFFmtState fms = Vcb->fms;
1653 #endif
1654 
1655  _SEH2_TRY {
1656  if(!DiscInfo || !TrackInfoOut)
1658 
1659 MRWRetry_label:
1660 
1662  NULL, 0,
1663  DiscInfo,sizeof(DISC_INFO_BLOCK_USER_OUT), TRUE, NULL);
1664  if(!OS_SUCCESS(RC)) {
1665  UDFPrint(("ReadDiskInfo failed. Use default.\n"));
1666  if(Vcb->MediaClassEx == CdMediaClass_DVDRW ||
1667  Vcb->MediaClassEx == CdMediaClass_DVDpRW ||
1668  Vcb->MediaClassEx == CdMediaClass_DVDRAM) {
1669  Vcb->LastPossibleLBA = DEFAULT_LAST_LBA_DVD;
1670  } else
1671  if(Vcb->MediaClassEx == CdMediaClass_BDRE) {
1672  Vcb->LastPossibleLBA = DEFAULT_LAST_LBA_BD;
1673  } else {
1674  Vcb->LastPossibleLBA = DEFAULT_LAST_LBA_FP_CD;
1675  }
1676  try_return(RC);
1677  }
1678 #ifdef UDF_FORMAT_MEDIA
1679  if(fms && fms->opt_disk_info) {
1680  UserPrint(("ReadDiskInfo OK\n"));
1681  }
1682 #endif //UDF_FORMAT_MEDIA
1683 
1685  NULL, 0,
1686  &CapacityBuffer,sizeof(READ_CAPACITY_USER_OUT), TRUE, NULL);
1687  if(!OS_SUCCESS(RC)) {
1688  UDFPrint(("ReadCapacity failed.\n"));
1689  if(Vcb->MediaClassEx == CdMediaClass_DVDpRW) {
1690  Vcb->LastPossibleLBA = DEFAULT_LAST_LBA_DVD;
1691  }
1692  } else {
1693  UDFPrint(("ReadCapacity ok.\n"));
1694  UDFPrint(("Last possible LBA %#x.\n", CapacityBuffer.LogicalBlockAddress));
1695  if(!(CapacityBuffer.LogicalBlockAddress & 0xc0000000) &&
1696  (CapacityBuffer.LogicalBlockAddress != 0x7fffffff)) {
1697  // good value from ReadCapacity
1698  UDFPrint(("Update Last possible LBA %#x.\n", CapacityBuffer.LogicalBlockAddress));
1699  Vcb->LastPossibleLBA = CapacityBuffer.LogicalBlockAddress;
1700 // ReadCapacityOk = TRUE;
1701 #ifdef UDF_FORMAT_MEDIA
1702  if(fms && fms->opt_disk_info) {
1703  UserPrint(("ReadCapacity OK\n"));
1704  }
1705 #endif //UDF_FORMAT_MEDIA
1706  }
1707  }
1708 
1709 #ifdef _CONSOLE
1710  Vcb->PhDeviceType = FILE_DEVICE_CD_ROM;
1711 #endif //_CONSOLE
1712  Vcb->PhSerialNumber = *((uint32*)&(DiscInfo->DiskId));
1713  Vcb->PhErasable = DiscInfo->DiscStat.Flags & DiscInfo_Disk_Erasable;
1714  Vcb->PhDiskType = DiscInfo->DiskType;
1715  // save OPC info
1716  if(DiscInfo->OPCNum)
1717  Vcb->OPCNum = DiscInfo->OPCNum;
1718  UDFPrint(("DiskInfo: SN %x, OPCn %x(%x), Stat %x, Flg: %x\n",
1719  Vcb->PhSerialNumber, Vcb->OPCNum, DiscInfo->OPCNum, DiscInfo->DiscStat.Flags, DiscInfo->Flags.Flags));
1720 #ifdef UDF_FORMAT_MEDIA
1721  if(fms && fms->opt_disk_info) {
1722  UserPrint(("Media type: "));
1723  switch(Vcb->MediaClassEx) {
1724  case CdMediaClass_CDROM : UserPrint(("CD-ROM \n")); break;
1725  case CdMediaClass_CDR : UserPrint(("CD-R \n")); break;
1726  case CdMediaClass_CDRW : UserPrint(("CD-RW \n")); break;
1727  case CdMediaClass_DVDROM : UserPrint(("DVD-ROM \n")); break;
1728  case CdMediaClass_DVDRAM : UserPrint(("DVD-RAM \n")); break;
1729  case CdMediaClass_DVDR : UserPrint(("DVD-R \n")); break;
1730  case CdMediaClass_DVDRW : UserPrint(("DVD-RW \n")); break;
1731  case CdMediaClass_DVDpR : UserPrint(("DVD+R \n")); break;
1732  case CdMediaClass_DVDpRW : UserPrint(("DVD+RW \n")); break;
1733  case CdMediaClass_DDCDROM : UserPrint(("DDCD-ROM \n")); break;
1734  case CdMediaClass_DDCDR : UserPrint(("DDCD-R \n")); break;
1735  case CdMediaClass_DDCDRW : UserPrint(("DDCD-RW \n")); break;
1736  case CdMediaClass_BDROM : UserPrint(("BD-ROM \n")); break;
1737  case CdMediaClass_BDRE : UserPrint(("BD-RE \n")); break;
1738  case CdMediaClass_BDR : UserPrint(("BD-R \n")); break;
1739  case CdMediaClass_HD_DVDROM : UserPrint(("HD DVD-ROM \n")); break;
1740  case CdMediaClass_HD_DVDRAM : UserPrint(("HD DVD-RAM \n")); break;
1741  case CdMediaClass_HD_DVDR : UserPrint(("HD DVD-R \n")); break;
1742  case CdMediaClass_HD_DVDRW : UserPrint(("HD DVD-RW \n")); break;
1743  default: UserPrint(("Unknown\n")); break;
1744  }
1745  UserPrint(("SN %#x, OPCn %#x\n",
1746  Vcb->PhSerialNumber, Vcb->OPCNum, DiscInfo->OPCNum));
1747  UserPrint(("Disk State: "));
1748  switch(DiscInfo->DiscStat.Flags & DiscInfo_Disk_Mask) {
1749  case DiscInfo_Disk_Empty:
1750  UserPrint(("Empty\n"));
1751  break;
1753  UserPrint(("Appendable\n"));
1754  break;
1756  UserPrint(("Complete\n"));
1757  break;
1758  case DiscInfo_Disk_OtherRW:
1759  UserPrint(("RW in unknown state\n"));
1760  break;
1761  }
1762  UserPrint(("Last Session State: "));
1763  switch(DiscInfo->DiscStat.Flags & DiscInfo_Ses_Mask) {
1764  case DiscInfo_Ses_Empty:
1765  UserPrint(("Empty\n"));
1766  break;
1768  UserPrint(("Incomplete\n"));
1769  break;
1770  case DiscInfo_Ses_Complete:
1771  UserPrint(("Complete\n"));
1772  break;
1773  default:
1774  UserPrint(("unknown state\n"));
1775  break;
1776  }
1777  UserPrint(("Erasable: %s\n",
1778  (DiscInfo->DiscStat.Flags & DiscInfo_Disk_Erasable) ? "yes" : "no"
1779  ));
1780  }
1781 #endif //UDF_FORMAT_MEDIA
1782  // Save disk status
1783  Vcb->DiscStat = DiscInfo->DiscStat.Flags;
1784  if((DiscInfo->DiscStat.Flags & DiscInfo_Disk_Mask) == DiscInfo_Disk_Empty) {
1785  UDFPrint(("Blank\n"));
1786  Vcb->BlankCD = TRUE;
1787  }
1788  if( (DiscInfo->DiscStat.Flags & DiscInfo_Disk_Mask) == DiscInfo_Disk_Empty ||
1789  (DiscInfo->DiscStat.Flags & DiscInfo_Ses_Mask) == DiscInfo_Ses_Incomplete) {
1790  // we shall mount empty disk to make it possible for
1791  // external applications to perform format operation
1792  // or something like this
1793  UDFPrint(("Try RAW_MOUNT\n"));
1794  Vcb->VCBFlags |= UDF_VCB_FLAGS_RAW_DISK;
1795  PacketTrack = TRUE;
1796  }
1797 
1798 #ifndef _BROWSE_UDF_
1799  // If drive returned reasonable value from ReadCapacity, do not use
1800  // last LeadIn/LeadOut
1801  if(Vcb->MediaClassEx != CdMediaClass_DVDpRW &&
1802  !ReadCapacityOk) {
1803  // +RW returns bad value
1804  UDFPrint(("+RW returns bad value\n"));
1805  Vcb->LastPossibleLBA = (DiscInfo->LastSesLeadOutLBA & 0x80000000) ?
1806  0 : DiscInfo->LastSesLeadOutLBA;
1807  if(!(DiscInfo->LastSesLeadInLBA & 0x80000000)) {
1808  Vcb->LastPossibleLBA = max(DiscInfo->LastSesLeadInLBA, Vcb->LastPossibleLBA);
1809  }
1810  }
1811 #endif // _BROWSE_UDF_
1812  if((DiscInfo->Flags.Flags & DiscInfo_BGF_Mask) != 0) {
1813  UDFPrint(("ForceFP + MRW\n"));
1814  ForceFP = TRUE;
1815  Vcb->MRWStatus = DiscInfo->Flags.Flags & DiscInfo_BGF_Mask;
1816  // update addressing mode
1817  if(!MRWRetry) {
1818  UDFSetMRWMode(Vcb);
1819  MRWRetry = TRUE;
1820  goto MRWRetry_label;
1821  }
1822  }
1823  UDFPrint(("MRW state %x\n", Vcb->MRWStatus));
1824  if(Vcb->MediaClassEx == CdMediaClass_DVDRW) {
1825  if(Vcb->PhMediaCapFlags & CdCapFlags_RandomWritable) {
1826  UDFPrint(("DVD-RW Rewritable\n"));
1827  ForceFP = TRUE;
1828  } else
1829  if((DiscInfo->DiscStat.Flags & DiscInfo_Disk_Mask) == DiscInfo_Disk_Empty) {
1830  UDFPrint(("Blank DVD-RW\n"));
1831  ForceFP = TRUE;
1832  } else {
1833  UDFPrint(("DVD-RW Sequential\n"));
1834  NotFP = TRUE;
1835  }
1836  } else
1837  if(CdrwIsDvdOverwritable(Vcb->MediaClassEx)) {
1838  UDFPrint(("force Rewritable (2)\n"));
1839  ForceFP = TRUE;
1840  }
1841  // We have incomplete last session, so process each track from last to first
1842 // Vcb->LastPossibleLBA = DiscInfo->LastSesLeadInLBA;
1843 
1844  Vcb->LastSession = DiscInfo->Status.NumOfSes;
1845  Vcb->LastTrackNum = DiscInfo->Status.LastTrackNumLastSes;
1846  Vcb->FirstTrackNum = DiscInfo->FirstTrackNum;
1847  // some devices report LastTrackNum=0 for full disks
1848  Vcb->LastTrackNum = max(Vcb->LastTrackNum, Vcb->FirstTrackNum);
1849  if(!Vcb->LastTrackNum) {
1850  UDFPrint(("Try read 1st track...\n"));
1851  Vcb->LastTrackNum = 1;
1852  }
1853  UDFPrint(("DiskInfo: 1st trk %x, last trk %x\n", Vcb->FirstTrackNum, Vcb->LastTrackNum));
1854 #ifdef UDF_FORMAT_MEDIA
1855  if(fms && fms->opt_disk_info) {
1856  UserPrint(("First track: %d\n"
1857  "Last track: %d\n", Vcb->FirstTrackNum, Vcb->LastTrackNum));
1858  UserPrint(("------------------------------------------\n"));
1859  }
1860 #endif //UDF_FORMAT_MEDIA
1861 
1862  RC = UDFReallocTrackMap(Vcb, Vcb->LastTrackNum+1);
1863  if(!OS_SUCCESS(RC))
1864  try_return(RC);
1865 
1866  // Get last LBA from invisible track (if any)
1867  RtlZeroMemory(TrackInfoOut,sizeof(TRACK_INFO_BLOCK_USER_OUT));
1868 
1869  TrackInfoIn->LBA_TrkNum = 0; // invisible track
1870  TrackInfoIn->Track = TRUE;
1871 
1873  TrackInfoIn, sizeof(TRACK_INFO_BLOCK_USER_IN),
1874  TrackInfoOut,sizeof(TRACK_INFO_BLOCK_USER_OUT), TRUE, NULL);
1875  if(OS_SUCCESS(RC)) {
1876  if((Vcb->LastTrackNum < TrackInfoOut->TrackNum) &&
1877  TrackInfoOut->TrackLength &&
1878  (TrackInfoOut->TrackStartLBA != TrackInfoOut->NextWriteLBA)) {
1879  Vcb->LastTrackNum = TrackInfoOut->TrackNum;
1880  if(!(TrackInfoOut->NextWriteLBA & 0x80000000))
1881  Vcb->NWA = TrackInfoOut->NextWriteLBA;
1882  if(TrackInfoOut->TrackLength > 1) {
1883  Vcb->LastPossibleLBA =
1884  TrackInfoOut->TrackStartLBA + TrackInfoOut->TrackLength - (TrackInfoOut->TrackLength ? 1 : 0);
1885  UDFPrint((" set LastPossibleLBA=%x\n", Vcb->LastPossibleLBA));
1886  }
1887  }
1888 
1889  UDFPrint(("Ses %d, Track %d (%x, len %x) PckSize %x: \n"
1890  " NWA: %x (%s) DatType:%x, %s %s %s %s TrkType:%x %s %s\n"
1891  " LRA: %x (%s) RC_LBA:%x\n",
1892  TrackInfoOut->SesNum,
1893  0,
1894  TrackInfoOut->TrackStartLBA,
1895  TrackInfoOut->TrackLength,
1896  TrackInfoOut->FixPacketSize,
1897 
1898  TrackInfoOut->NextWriteLBA,
1899  TrackInfoOut->NWA_V & TrkInfo_NWA_V ? "vld" : "inv",
1900  TrackInfoOut->DataParam.Flags & TrkInfo_Dat_Mask,
1901  (TrackInfoOut->DataParam.Flags & TrkInfo_Packet) ? "Pck" : "",
1902  (TrackInfoOut->DataParam.Flags & TrkInfo_FP) ? "FP" : "",
1903  (TrackInfoOut->DataParam.Flags & TrkInfo_Blank) ? "Blank" : "",
1904  (TrackInfoOut->DataParam.Flags & TrkInfo_RT) ? "RT" : "",
1905 
1906  TrackInfoOut->TrackParam.Flags & TrkInfo_Trk_Mask,
1907  (TrackInfoOut->TrackParam.Flags & TrkInfo_Copy) ? "Cpy" : "",
1908  (TrackInfoOut->TrackParam.Flags & TrkInfo_Damage) ? "Damage" : "",
1909 
1910  TrackInfoOut->LastRecordedAddr,
1911  (TrackInfoOut->NWA_V & TrkInfo_LRA_V) ? "vld" : "inv",
1912 
1913  TrackInfoOut->ReadCompatLBA
1914  ));
1915 #ifdef UDF_FORMAT_MEDIA
1916  if(fms && fms->opt_disk_info) {
1917  UserPrint(("Invisible track: \n"));
1918  UserPrint((" Ses %d, Track %d (%x, len %x) PckSize %x: \n"
1919  " NWA: %x (%s) DatType:%x, %s %s %s %s TrkType:%x %s %s\n"
1920  " LRA: %x (%s) RC_LBA:%x\n",
1921  TrackInfoOut->SesNum,
1922  0,
1923  TrackInfoOut->TrackStartLBA,
1924  TrackInfoOut->TrackLength,
1925  TrackInfoOut->FixPacketSize,
1926 
1927  TrackInfoOut->NextWriteLBA,
1928  TrackInfoOut->NWA_V & TrkInfo_NWA_V ? "vld" : "inv",
1929  TrackInfoOut->DataParam.Flags & TrkInfo_Dat_Mask,
1930  (TrackInfoOut->DataParam.Flags & TrkInfo_Packet) ? "Pck" : "",
1931  (TrackInfoOut->DataParam.Flags & TrkInfo_FP) ? "FP" : "",
1932  (TrackInfoOut->DataParam.Flags & TrkInfo_Blank) ? "Blank" : "",
1933  (TrackInfoOut->DataParam.Flags & TrkInfo_RT) ? "RT" : "",
1934 
1935  TrackInfoOut->TrackParam.Flags & TrkInfo_Trk_Mask,
1936  (TrackInfoOut->TrackParam.Flags & TrkInfo_Copy) ? "Cpy" : "",
1937  (TrackInfoOut->TrackParam.Flags & TrkInfo_Damage) ? "Damage" : "",
1938 
1939  TrackInfoOut->LastRecordedAddr,
1940  (TrackInfoOut->NWA_V & TrkInfo_LRA_V) ? "vld" : "inv",
1941 
1942  TrackInfoOut->ReadCompatLBA
1943  ));
1944  }
1945 #endif //UDF_FORMAT_MEDIA
1946 
1947  }
1948 
1949  for (TrackNumber=(LONG)DiscInfo->FirstTrackNum;TrackNumber <= (LONG)Vcb->LastTrackNum;TrackNumber++) {
1950 
1951  RtlZeroMemory(TrackInfoOut,sizeof(TRACK_INFO_BLOCK_USER_OUT));
1952  TrackInfoIn->LBA_TrkNum = TrackNumber;
1953  TrackInfoIn->Track = TRUE;
1954 
1956  TrackInfoIn, sizeof(TRACK_INFO_BLOCK_USER_IN),
1957  TrackInfoOut,sizeof(TRACK_INFO_BLOCK_USER_OUT), TRUE, NULL);
1958  // fill sector type map
1959  if(TrackInfoOut->TrackStartLBA & 0x80000000) {
1960  UDFPrint(("TrkInfo: Bad FirstLba (%x), change to %x\n", TrackInfoOut->TrackStartLBA, 0));
1961  Vcb->TrackMap[TrackNumber].FirstLba = 0;
1962  } else {
1963  Vcb->TrackMap[TrackNumber].FirstLba = TrackInfoOut->TrackStartLBA;
1964  }
1965  if(TrackInfoOut->TrackLength & 0x80000000) {
1966  UDFPrint(("TrkInfo: Bad TrackLength (%x), change to %x\n", TrackInfoOut->TrackLength,
1967  Vcb->LastPossibleLBA - Vcb->TrackMap[TrackNumber].FirstLba + 1));
1968  TrackInfoOut->TrackLength = Vcb->LastPossibleLBA - Vcb->TrackMap[TrackNumber].FirstLba + 1;
1969  }
1970  Vcb->TrackMap[TrackNumber].LastLba = TrackInfoOut->TrackStartLBA +
1971  TrackInfoOut->TrackLength -
1972  (TrackInfoOut->TrackLength ? 1 : 0);
1973 
1974  Vcb->TrackMap[TrackNumber].TrackParam = TrackInfoOut->TrackParam.Flags;
1975  Vcb->TrackMap[TrackNumber].DataParam = TrackInfoOut->DataParam.Flags;
1976  Vcb->TrackMap[TrackNumber].NWA_V = TrackInfoOut->NWA_V;
1977  if((TrackInfoOut->NextWriteLBA & 0x80000000) ||
1978  (TrackInfoOut->NextWriteLBA < TrackInfoOut->TrackStartLBA)) {
1979  if(!(Vcb->TrackMap[TrackNumber].LastLba & 0x8000000)) {
1980  UDFPrint(("TrkInfo: set NWA to LastLba (%x)\n", Vcb->TrackMap[TrackNumber].LastLba));
1981  Vcb->TrackMap[TrackNumber].NWA =
1982  Vcb->TrackMap[TrackNumber].LastLba;
1983  } else {
1984  UDFPrint(("TrkInfo: set NWA to INV (1)\n"));
1985  Vcb->TrackMap[TrackNumber].NWA = 0;
1986  Vcb->TrackMap[TrackNumber].NWA_V = 0;
1987  }
1988  } else {
1989  if(!(TrackInfoOut->NextWriteLBA & 0x80000000)) {
1990  UDFPrint(("TrkInfo: Good NWA (%x)\n", TrackInfoOut->NextWriteLBA));
1991  Vcb->TrackMap[TrackNumber].NWA =
1992  TrackInfoOut->NextWriteLBA;
1993  } else {
1994  UDFPrint(("TrkInfo: set NWA to INV (2)\n"));
1995  Vcb->TrackMap[TrackNumber].NWA = 0;
1996  Vcb->TrackMap[TrackNumber].NWA_V = 0;
1997  }
1998  }
1999  Vcb->TrackMap[TrackNumber].Session = TrackInfoOut->SesNum;
2000  // for FP tracks we shall get PacketSize from returned info
2001  // otherwise set to default UDF value (0x20)
2002  if(NotFP) {
2003  UDFPrint(("Apply NotFP\n"));
2004  Vcb->TrackMap[TrackNumber].DataParam &= ~TrkInfo_FP;
2005 #ifdef DBG
2006  TrackInfoOut->DataParam.Flags &= ~TrkInfo_FP;
2007 #endif //DBG
2008  } else
2009  if(ForceFP) {
2010  UDFPrint(("Apply ForceFP\n"));
2011  PacketTrack = TRUE;
2012  Vcb->TrackMap[TrackNumber].DataParam |= TrkInfo_FP;
2013 #ifdef DBG
2014  TrackInfoOut->DataParam.Flags |= TrkInfo_FP;
2015 #endif //DBG
2016  }
2017  if(Vcb->TrackMap[TrackNumber].DataParam & TrkInfo_FP) {
2018  Vcb->TrackMap[TrackNumber].PacketSize = TrackInfoOut->FixPacketSize;
2019  Vcb->VCBFlags |= UDF_VCB_FLAGS_RAW_DISK;
2020  Vcb->FP_disc = TRUE;
2021  } else {
2022  Vcb->TrackMap[TrackNumber].PacketSize = PACKETSIZE_UDF;
2023  }
2024  // presence of Damaged track means, that we should mount this disk in RAW mode
2025  if(Vcb->TrackMap[TrackNumber].TrackParam & TrkInfo_Damage) {
2026  UDFPrint(("TrkInfo_Damage, Try RAW_MOUNT\n"));
2027  Vcb->VCBFlags |= UDF_VCB_FLAGS_RAW_DISK;
2028  }
2029  // presence of track with Unknown data type means, that we should mount
2030  // this disk in RAW mode
2031  if((TrackInfoOut->DataParam.Flags & TrkInfo_Dat_Mask) == TrkInfo_Trk_unknown) {
2032  UDFPrint(("Unknown DatType, Try RAW_MOUNT\n"));
2033  Vcb->VCBFlags |= UDF_VCB_FLAGS_RAW_DISK;
2034  }
2035 
2036  PacketTrack |= ((TrackInfoOut->DataParam.Flags & TrkInfo_Packet) != 0);
2037 
2038  UDFPrint(("Ses %d, Track %d (%x - %x) PckSize %x: \n"
2039  " NWA: %x (%s) DatType:%x, %s %s %s %s TrkType:%x %s %s\n"
2040  " LRA: %x (%s) RC_LBA:%x\n",
2041  TrackInfoOut->SesNum,
2042  TrackNumber,
2043  Vcb->TrackMap[TrackNumber].FirstLba,
2044  Vcb->TrackMap[TrackNumber].LastLba,
2045  TrackInfoOut->FixPacketSize,
2046 
2047  TrackInfoOut->NextWriteLBA,
2048  TrackInfoOut->NWA_V & TrkInfo_NWA_V ? "vld" : "inv",
2049  TrackInfoOut->DataParam.Flags & TrkInfo_Dat_Mask,
2050  (TrackInfoOut->DataParam.Flags & TrkInfo_Packet) ? "Pck" : "",
2051  (TrackInfoOut->DataParam.Flags & TrkInfo_FP) ? "FP" : "",
2052  (TrackInfoOut->DataParam.Flags & TrkInfo_Blank) ? "Blank" : "",
2053  (TrackInfoOut->DataParam.Flags & TrkInfo_RT) ? "RT" : "",
2054 
2055  TrackInfoOut->TrackParam.Flags & TrkInfo_Trk_Mask,
2056  (TrackInfoOut->TrackParam.Flags & TrkInfo_Copy) ? "Cpy" : "",
2057  (TrackInfoOut->TrackParam.Flags & TrkInfo_Damage) ? "Damage" : "",
2058 
2059  TrackInfoOut->LastRecordedAddr,
2060  (TrackInfoOut->NWA_V & TrkInfo_LRA_V) ? "vld" : "inv",
2061 
2062  TrackInfoOut->ReadCompatLBA
2063  ));
2064 #ifdef UDF_FORMAT_MEDIA
2065  if(fms && fms->opt_disk_info) {
2066  UserPrint(("Track %d: \n", TrackNumber));
2067  UserPrint((" Ses %d, Track %d (%x, len %x) PckSize %x: \n"
2068  " NWA: %x (%s) DatType:%x, %s %s %s %s TrkType:%x %s %s\n"
2069  " LRA: %x (%s) RC_LBA:%x\n",
2070  TrackInfoOut->SesNum,
2071  TrackNumber,
2072  TrackInfoOut->TrackStartLBA,
2073  TrackInfoOut->TrackLength,
2074  TrackInfoOut->FixPacketSize,
2075 
2076  TrackInfoOut->NextWriteLBA,
2077  TrackInfoOut->NWA_V & TrkInfo_NWA_V ? "vld" : "inv",
2078  TrackInfoOut->DataParam.Flags & TrkInfo_Dat_Mask,
2079  (TrackInfoOut->DataParam.Flags & TrkInfo_Packet) ? "Pck" : "",
2080  (TrackInfoOut->DataParam.Flags & TrkInfo_FP) ? "FP" : "",
2081  (TrackInfoOut->DataParam.Flags & TrkInfo_Blank) ? "Blank" : "",
2082  (TrackInfoOut->DataParam.Flags & TrkInfo_RT) ? "RT" : "",
2083 
2084  TrackInfoOut->TrackParam.Flags & TrkInfo_Trk_Mask,
2085  (TrackInfoOut->TrackParam.Flags & TrkInfo_Copy) ? "Cpy" : "",
2086  (TrackInfoOut->TrackParam.Flags & TrkInfo_Damage) ? "Damage" : "",
2087 
2088  TrackInfoOut->LastRecordedAddr,
2089  (TrackInfoOut->NWA_V & TrkInfo_LRA_V) ? "vld" : "inv",
2090 
2091  TrackInfoOut->ReadCompatLBA
2092  ));
2093  }
2094 #endif //UDF_FORMAT_MEDIA
2095 
2096  if(TrackNumber == DiscInfo->FirstTrackNum) {
2097  if(!(Vcb->TrackMap[TrackNumber].FirstLba & 0x80000000)) {
2098  UDFPrint(("TrkInfo: Update FirstLBA (%x)\n", Vcb->TrackMap[TrackNumber].FirstLba));
2099  Vcb->FirstLBA = Vcb->TrackMap[TrackNumber].FirstLba;
2100  }
2101  }
2102  if((TrackInfoOut->SesNum == Vcb->LastSession) && !Vcb->FirstTrackNumLastSes) {
2103  if(!(Vcb->TrackMap[TrackNumber].FirstLba & 0x80000000)) {
2104  UDFPrint(("TrkInfo: Update FirstLBALastSes (%x)\n", Vcb->TrackMap[TrackNumber].FirstLba));
2105  Vcb->FirstLBALastSes = Vcb->TrackMap[TrackNumber].FirstLba;
2106  }
2107  Vcb->FirstTrackNumLastSes = TrackNumber;
2108  }
2109  }
2110 
2111  if(!(TrackInfoOut->NextWriteLBA & 0x80000000) &&
2112  !(TrackInfoOut->TrackLength & 0x80000000) &&
2113  (Vcb->NWA < TrackInfoOut->NextWriteLBA)
2114  ) {
2115  UDFPrint((" set NWA to %x\n", TrackInfoOut->NextWriteLBA));
2116  if(Vcb->MediaClassEx != CdMediaClass_DVDpRW) {
2117  Vcb->NWA = TrackInfoOut->NextWriteLBA;
2118  } else {
2119  Vcb->NWA =
2120  TrackInfoOut->TrackStartLBA + TrackInfoOut->TrackLength - (TrackInfoOut->TrackLength ? 1 : 0);
2121  }
2122  }
2123  if(Vcb->MediaClassEx != CdMediaClass_DVDpRW &&
2124  !(TrackInfoOut->TrackLength & 0x80000000) &&
2125  TrackInfoOut->TrackLength > 1) {
2126  Vcb->LastPossibleLBA =
2127  TrackInfoOut->TrackStartLBA + TrackInfoOut->TrackLength - (TrackInfoOut->TrackLength ? 1 : 0);
2128  UDFPrint((" set LastPossibleLBA=%x\n", Vcb->LastPossibleLBA));
2129  }
2130  TrackNumber = Vcb->LastTrackNum;
2131  // quick formatted +RW returns bogus value
2132  if(Vcb->MediaClassEx == CdMediaClass_DVDpRW) {
2133  UDFPrint((" check quick formatted +RW\n"));
2134  if(Vcb->TrackMap[TrackNumber].LastLba &&
2135  !(Vcb->TrackMap[TrackNumber].LastLba & 0x80000000) &&
2136  Vcb->TrackMap[TrackNumber].LastLba < Vcb->LastPossibleLBA /*&&
2137  Vcb->TrackMap[TrackNumber].LastLba != Vcb->LastPossibleLBA*/
2138  ) {
2139  UDFPrint((" track LastLBA %x != LastPossibleLBA %x, verify\n",
2140  Vcb->TrackMap[TrackNumber].LastLba, Vcb->LastPossibleLBA));
2141 
2142  if(Vcb->MRWStatus == DiscInfo_BGF_Complete) {
2143  UDFPrint((" complete MRW state\n"));
2144 #ifdef _BROWSE_UDF_
2145  Vcb->LastPossibleLBA =
2146  Vcb->NWA =
2147  Vcb->LastLBA =
2148  Vcb->TrackMap[TrackNumber].LastLba;
2149  goto valid_track_length;
2150 #endif // _BROWSE_UDF_
2151  } else
2152  if(Vcb->MRWStatus) {
2153  uint8* buff;
2154  uint32 ReadBytes;
2155 
2156  UDFPrint((" MRW state %x\n", Vcb->MRWStatus));
2157 
2158  buff = (uint8*)DbgAllocatePoolWithTag(NonPagedPool, Vcb->WriteBlockSize, 'bNWD' );
2159  if(buff) {
2160  RC = UDFTRead(Vcb,
2161  buff,
2162  Vcb->WriteBlockSize,
2163  Vcb->TrackMap[TrackNumber].LastLba+1,
2164  &ReadBytes,
2165  PH_TMP_BUFFER);
2166  DbgFreePool(buff);
2167  if(!OS_SUCCESS(RC)) {
2168  UDFPrint((" Can't read beyond track LastLBA (%x)\n", Vcb->TrackMap[TrackNumber].LastLba+1));
2169  Vcb->LastLBA = Vcb->TrackMap[TrackNumber].LastLba;
2170  Vcb->NWA = Vcb->LastLBA+1;
2171  Vcb->TrackMap[TrackNumber].NWA_V = 1;
2172  Vcb->TrackMap[TrackNumber].NWA = Vcb->NWA;
2173  Vcb->TrackMap[TrackNumber].LastLba = Vcb->LastPossibleLBA;
2174  RC = STATUS_SUCCESS;
2175  goto valid_track_length;
2176  }
2177  }
2178  }
2179  }
2180  UDFPrint((" set track LastLBA %x\n", Vcb->LastPossibleLBA));
2181  Vcb->NWA =
2182  Vcb->LastLBA =
2183  Vcb->TrackMap[TrackNumber].LastLba =
2184  Vcb->LastPossibleLBA;
2185  }
2186 valid_track_length:
2187  // Test for last empty session
2188  if((Vcb->TrackMap[TrackNumber].Session !=
2189  Vcb->TrackMap[TrackNumber-1].Session) &&
2190  (Vcb->LastSession > 1)) {
2191  // Note: some devices return negative track length
2192  if((Vcb->TrackMap[TrackNumber].LastLba <=
2193  Vcb->TrackMap[TrackNumber].FirstLba) ||
2194  (Vcb->TrackMap[TrackNumber].FirstLba ==
2195  Vcb->TrackMap[TrackNumber].NWA)) {
2196  // empty last session...
2197  Vcb->LastTrackNum--;
2198 // TrackNumber--;
2199 /* for(SesNum = Vcb->TrackMap[TrackNumber].Session;
2200  Vcb->TrackMap[TrackNumber].Session == SesNum;
2201  TrackNumber--) {
2202  }*/
2203  if(TrackNumber>1)
2204  Vcb->LastSession = Vcb->TrackMap[TrackNumber-1].Session;
2205  }
2206  }
2207 
2208  TrackNumber = Vcb->LastTrackNum;
2209 #ifdef _BROWSE_UDF_
2210  Vcb->LastLBA = min(Vcb->TrackMap[TrackNumber].LastLba, Vcb->TrackMap[TrackNumber].NWA);
2211 #endif //_BROWSE_UDF_
2212 
2213  if(Vcb->TrackMap[TrackNumber].NWA_V & TrkInfo_NWA_V) {
2214  UDFPrint((" NWA ok, set LastLBA to min(Last %x, NWA %x\n",
2215  Vcb->TrackMap[TrackNumber].LastLba,
2216  Vcb->TrackMap[TrackNumber].NWA));
2217  Vcb->LastLBA = min(Vcb->TrackMap[TrackNumber].LastLba, Vcb->TrackMap[TrackNumber].NWA);
2218  } else {
2219  UDFPrint((" no NWA, set LastLBA to Last %x\n", Vcb->TrackMap[TrackNumber].LastLba));
2220  Vcb->LastLBA = Vcb->TrackMap[TrackNumber].LastLba;
2221  }
2222 
2223  Vcb->VCBFlags |= UDF_VCB_FLAGS_TRACKMAP;
2224  if(!PacketTrack && Vcb->MediaClassEx != CdMediaClass_DVDRAM ) {
2225  UDFPrint((" disable Raw mount\n"));
2226  Vcb->VCBFlags &= ~UDF_VCB_FLAGS_RAW_DISK;
2227  }
2228 
2229 try_exit: NOTHING;
2230 
2231  } _SEH2_FINALLY {
2232  if(DiscInfo) MyFreePool__(DiscInfo);
2233  if(TrackInfoOut) MyFreePool__(TrackInfoOut);
2234  } _SEH2_END;
2235 
2236  return RC;
2237 } // end UDFReadDiscTrackInfo()
#define TrkInfo_Trk_unknown
Definition: cdrw_hw.h:2393
#define CdMediaClass_BDROM
Definition: cdrw_usr.h:755
#define CdMediaClass_DVDRAM
Definition: cdrw_usr.h:747
#define max(a, b)
Definition: svc.c:63
#define DiscInfo_Disk_Complete
Definition: cdrw_hw.h:2273
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
#define TrkInfo_FP
Definition: cdrw_hw.h:2417
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define CdMediaClass_DVDpR
Definition: cdrw_usr.h:750
#define DiscInfo_Disk_Erasable
Definition: cdrw_hw.h:2281
#define CdMediaClass_DVDR
Definition: cdrw_usr.h:748
#define DiscInfo_Ses_Incomplete
Definition: cdrw_hw.h:2278
#define DbgAllocatePoolWithTag(a, b, c)
Definition: env_spec_w32.h:333
union _TRACK_INFO_BLOCK_USER_OUT::@899 TrackParam
unsigned int uint32
Definition: types.h:32
#define DiscInfo_Ses_Empty
Definition: cdrw_hw.h:2277
#define DiscInfo_Disk_Mask
Definition: cdrw_hw.h:2270
#define CdMediaClass_DVDRW
Definition: cdrw_usr.h:749
ULONG LogicalBlockAddress
Definition: cdrw_hw.h:1471
#define UserPrint(x)
Definition: env_spec_w32.h:202
#define TrkInfo_Packet
Definition: cdrw_hw.h:2418
_SEH2_TRY
Definition: create.c:4250
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:107
union _TRACK_INFO_BLOCK_USER_OUT::@900 DataParam
#define CdrwIsDvdOverwritable(MediaClassEx)
Definition: cdrw_usr.h:804
#define DEFAULT_LAST_LBA_FP_CD
Definition: cdrw_usr.h:1820
#define TrkInfo_Copy
Definition: cdrw_hw.h:2395
long LONG
Definition: pedump.c:60
#define OSSTATUS
Definition: env_spec_w32.h:57
#define CdMediaClass_DVDROM
Definition: cdrw_usr.h:746
#define IOCTL_CDRW_READ_DISC_INFO
Definition: cdrw_usr.h:93
#define DiscInfo_Disk_Empty
Definition: cdrw_hw.h:2271
unsigned char BOOLEAN
OSSTATUS UDFTRead(IN void *_Vcb, IN void *Buffer, IN uint32 Length, IN uint32 LBA, OUT uint32 *ReadBytes, IN uint32 Flags)
Definition: phys_lib.cpp:596
smooth NULL
Definition: ftsmooth.c:416
#define TrkInfo_RT
Definition: cdrw_hw.h:2420
#define TrkInfo_NWA_V
Definition: cdrw_hw.h:2429
static NTSTATUS ReadBytes(IN PDEVICE_OBJECT LowerDevice, OUT PUCHAR Buffer, IN ULONG BufferSize, OUT PULONG_PTR FilledBytes)
Definition: detect.c:67
#define DbgFreePool
Definition: env_spec_w32.h:334
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define CdMediaClass_HD_DVDROM
Definition: cdrw_usr.h:758
#define CdMediaClass_CDRW
Definition: cdrw_usr.h:745
#define DiscInfo_Disk_OtherRW
Definition: cdrw_hw.h:2274
#define CdMediaClass_HD_DVDRAM
Definition: cdrw_usr.h:759
OSSTATUS UDFReallocTrackMap(IN PVCB Vcb, IN uint32 TrackNum)
Definition: phys_lib.cpp:69
#define try_return(S)
Definition: cdprocs.h:2189
#define TrkInfo_Dat_Mask
Definition: cdrw_hw.h:2410
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define PACKETSIZE_UDF
Definition: cdrw_usr.h:1753
#define TrkInfo_Trk_Mask
Definition: cdrw_hw.h:2385
#define fms
DISC_STATUS_INFO_USER_OUT Status
Definition: cdrw_usr.h:630
unsigned char uint8
Definition: types.h:28
#define DiscInfo_BGF_Complete
Definition: cdrw_hw.h:2302
#define UDF_VCB_FLAGS_TRACKMAP
Definition: udf_common.h:473
#define CdMediaClass_CDR
Definition: cdrw_usr.h:744
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define DEFAULT_LAST_LBA_BD
Definition: cdrw_usr.h:1822
#define CdMediaClass_DDCDRW
Definition: cdrw_usr.h:754
#define NOTHING
Definition: env_spec_w32.h:461
#define DiscInfo_BGF_Mask
Definition: cdrw_hw.h:2298
#define DiscInfo_Ses_Mask
Definition: cdrw_hw.h:2276
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define TrkInfo_Damage
Definition: cdrw_hw.h:2396
NTSTATUS UDFSetMRWMode(IN PVCB Vcb)
Definition: phys_lib.cpp:811
_SEH2_END
Definition: create.c:4424
#define CdMediaClass_HD_DVDR
Definition: cdrw_usr.h:760
#define TrkInfo_LRA_V
Definition: cdrw_hw.h:2430
#define DiscInfo_Ses_Complete
Definition: cdrw_hw.h:2279
#define CdMediaClass_DDCDR
Definition: cdrw_usr.h:753
#define CdCapFlags_RandomWritable
Definition: cdrw_usr.h:796
#define CdMediaClass_CDROM
Definition: cdrw_usr.h:743
_SEH2_FINALLY
Definition: create.c:4395
#define min(a, b)
Definition: monoChain.cc:55
#define PH_TMP_BUFFER
Definition: phys_lib.h:65
#define CdMediaClass_BDR
Definition: cdrw_usr.h:757
#define CdMediaClass_DDCDROM
Definition: cdrw_usr.h:752
#define CdMediaClass_BDRE
Definition: cdrw_usr.h:756
#define CdMediaClass_DVDpRW
Definition: cdrw_usr.h:751
#define IOCTL_CDRW_READ_CAPACITY
Definition: cdrw_usr.h:128
#define DiscInfo_Disk_Appendable
Definition: cdrw_hw.h:2272
#define IOCTL_CDRW_READ_TRACK_INFO
Definition: cdrw_usr.h:92
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define DEFAULT_LAST_LBA_DVD
Definition: cdrw_usr.h:1821
#define TrkInfo_Blank
Definition: cdrw_hw.h:2419
struct _TRACK_INFO_BLOCK_USER_OUT * PTRACK_INFO_BLOCK_USER_OUT
struct _DISC_INFO_BLOCK_USER_OUT * PDISC_INFO_BLOCK_USER_OUT
return STATUS_SUCCESS
Definition: btrfs.c:2725
struct _TRACK_INFO_BLOCK_USER_IN * PTRACK_INFO_BLOCK_USER_IN
static unsigned char buff[32768]
Definition: fatten.c:17
#define CdMediaClass_HD_DVDRW
Definition: cdrw_usr.h:761

Referenced by UDFGetDiskInfo().

◆ UDFReallocTrackMap()

OSSTATUS UDFReallocTrackMap ( IN PVCB  Vcb,
IN uint32  TrackNum 
)

Definition at line 69 of file phys_lib.cpp.

73 {
74 #ifdef _BROWSE_UDF_
75  if(Vcb->TrackMap) {
76  MyFreePool__(Vcb->TrackMap);
77  Vcb->TrackMap = NULL;
78  }
79  Vcb->TrackMap = (PUDFTrackMap)
80  MyAllocatePool__(NonPagedPool, TrackNum*sizeof(UDFTrackMap));
81  if(!Vcb->TrackMap) {
83  }
84 #endif //_BROWSE_UDF_
85  RtlZeroMemory(Vcb->TrackMap,TrackNum*sizeof(UDFTrackMap));
86  return STATUS_SUCCESS;
87 } // end UDFReallocTrackMap()
struct _UDFTrackMap * PUDFTrackMap
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
smooth NULL
Definition: ftsmooth.c:416
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by UDFReadAndProcessFullToc(), UDFReadDiscTrackInfo(), and UDFUseStandard().

◆ UDFRecoverFromError()

OSSTATUS UDFRecoverFromError ( IN PVCB  Vcb,
IN BOOLEAN  WriteOp,
IN OSSTATUS  status,
IN uint32  Lba,
IN uint32  BCount,
IN OUT uint32 retry 
)

Definition at line 1283 of file phys_lib.cpp.

1291 {
1294 // OSSTATUS RC;
1295  uint32 i;
1296  BOOLEAN UpdateBB = FALSE;
1297 
1298  if(!(*retry) ||
1299  !(Vcb->VCBFlags & UDF_VCB_FLAGS_OUR_DEVICE_DRIVER) ||
1300  (Vcb->FsDeviceType != FILE_DEVICE_CD_ROM_FILE_SYSTEM))
1301  return status;
1302  (*retry)--;
1303  // allocate tmp buffer
1304  _SEH2_TRY {
1305  if(!Vcb->Error) {
1306  if(!(Vcb->Error = (PGET_LAST_ERROR_USER_OUT)
1308  try_return(status);
1309  }
1310  if(status == STATUS_NO_SUCH_DEVICE) {
1311  UDFPrint(("Error recovery: STATUS_NO_SUCH_DEVICE, die.....\n"));
1313  try_return(status);
1314  }
1315 
1316 #ifdef _UDF_STRUCTURES_H_
1317  if(status == STATUS_NO_MEDIA_IN_DEVICE && !Vcb->EjectWaiter) {
1318  UDFPrint(("Error recovery: STATUS_NO_MEDIA_IN_DEVICE, prevent further remount.....\n"));
1319  // Make sure, that volume will never be quick-remounted
1320  // It is very important for ChkUdf utility and
1321  // some CD-recording libraries
1322  Vcb->SerialNumber--;
1323  try_return(status);
1324  }
1325 #endif //_UDF_STRUCTURES_H_
1326 
1327  Error = Vcb->Error;
1328  UDFPhSendIOCTL( IOCTL_CDRW_GET_LAST_ERROR, Vcb->TargetDeviceObject,
1329  NULL,0,
1331  TRUE,NULL);
1332  UDFPrint(("SK=%x ASC=%x, ASCQ=%x, IE=%x\n",
1333  Error->SenseKey, Error->AdditionalSenseCode, Error->AdditionalSenseCodeQualifier, Error->LastError));
1334  // check for Long Write In Progress
1335  if( ((Error->SenseKey == SCSI_SENSE_NOT_READY) &&
1336  (Error->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY) &&
1337  (Error->AdditionalSenseCodeQualifier == SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS)) ) {
1338  // we should wait...
1339  if(WriteOp) {
1340  if((*retry) == UDF_WRITE_MAX_RETRY-1) {
1341  UDFPrint(("Error recovery: reserve retry count for write retries\n"));
1342  (*retry) = UDF_WRITE_MAX_RETRY*3;
1343  } else
1344  if((*retry) == UDF_WRITE_MAX_RETRY) {
1345  UDFPrint(("Error recovery: jump over UDF_WRITE_MAX_RETRY\n"));
1346  (*retry)--;
1347  }
1348  delay.QuadPart = -500000; // 0.05 sec
1350  if(WriteOp && ((*retry) > UDF_WRITE_MAX_RETRY-1)) {
1351  UDFPrint(("Error recovery: simple write retry with delay\n"));
1353  }
1354  } else {
1355  delay.QuadPart = -500000; // 0.05 sec
1357  if((*retry) == UDF_WRITE_MAX_RETRY-1) {
1358  UDFPrint(("Error recovery: retry read after small delay\n"));
1360  }
1361  }
1362  UDFPrint(("Error recovery: sync cache\n"));
1363  // ...flush device cache...
1364  UDFSyncCache(Vcb);
1365  // wait again & retry
1366  delay.QuadPart = -1000000; // 0.1 sec
1368 #ifdef _UDF_STRUCTURES_H_
1369  if(Vcb->BGWriters) (*retry)++;
1370 #endif //_UDF_STRUCTURES_H_
1372  } else
1373  // check for Long Write In Progress
1374  if((Error->SenseKey == SCSI_SENSE_NOT_READY) &&
1375  (Error->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY) &&
1376  ((Error->AdditionalSenseCodeQualifier == SCSI_SENSEQ_FORMAT_IN_PROGRESS) ||
1377  (Error->AdditionalSenseCodeQualifier == SCSI_SENSEQ_BECOMING_READY) ||
1378  (Error->AdditionalSenseCodeQualifier == SCSI_SENSEQ_OPERATION_IN_PROGRESS) ) ) {
1379  // we should wait & retry
1380  UDFPrint(("Error recovery: op. in progress, waiting 0.3 sec\n"));
1381  delay.QuadPart = -3000000; // 0.3 sec
1383 #ifdef _UDF_STRUCTURES_H_
1384  if(Vcb->BGWriters) (*retry)++;
1385 #endif //_UDF_STRUCTURES_H_
1386  Vcb->SyncCacheState = SYNC_CACHE_RECOVERY_ATTEMPT;
1388  } else
1389  // check for non empty cache special case
1390  if((Error->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) &&
1391  (Error->AdditionalSenseCode == SCSI_ADSENSE_INVALID_CMD_SEQUENCE)) {
1392  // we should wait & retry
1393  if(!WriteOp) {
1394  UDFPrint(("Error recovery: invalid command sequence on read\n"));
1395  delay.QuadPart = -1000000; // 0.1 sec
1397  UDFPrint(("Error recovery: sync cache\n"));
1398  // ...flush device cache...
1399  UDFSyncCache(Vcb);
1400  // wait again & retry
1401  delay.QuadPart = -1000000; // 0.1 sec
1403 #ifdef _UDF_STRUCTURES_H_
1404  if(Vcb->BGWriters) (*retry)++;
1405 #endif //_UDF_STRUCTURES_H_
1407  }
1408  goto reinit_sector_mode;
1409  } else
1410  // check for Bus Reset (sometimes it happends...)
1411  if((Error->SenseKey == SCSI_SENSE_UNIT_ATTENTION) &&
1412  (Error->AdditionalSenseCode == SCSI_ADSENSE_BUS_RESET) ) {
1413  // we should wait
1414  UDFPrint(("Error recovery: bus reset...\n"));
1415  Vcb->MediaChangeCount = Error->MediaChangeCount;
1416  delay.QuadPart = -1000000; // 0.1 sec
1418  // reset driver
1419  UDFResetDeviceDriver(Vcb, Vcb->TargetDeviceObject, FALSE);
1420  delay.QuadPart = -1000000; // 0.1 sec
1422  // lock it
1423 /* ((PPREVENT_MEDIA_REMOVAL_USER_IN)(Error))->PreventMediaRemoval = TRUE;
1424  UDFPhSendIOCTL( IOCTL_STORAGE_MEDIA_REMOVAL,
1425  Vcb->TargetDeviceObject,
1426  Error,sizeof(PREVENT_MEDIA_REMOVAL_USER_IN),
1427  NULL,0,
1428  FALSE,NULL);
1429  delay.QuadPart = -1000000; // 0.1 sec
1430  KeDelayExecutionThread(KernelMode, FALSE, &delay);*/
1431 
1432  // reinit write mode the following is performed inside UDFResetDeviceDriver()
1433  //Vcb->LastModifiedTrack = 0;
1434  //Vcb->OPCDone = FALSE;
1435 
1436 reinit_sector_mode:
1437  // reinit sector mode
1438  Vcb->LastModifiedTrack = 0;
1439  UDFPrepareForWriteOperation(Vcb, Lba, BCount);
1441  } else
1442  // check for Illegal Sector Mode.
1443  // We can get this error 'cause of 2 reasons:
1444  // a) Bus reset occured. We should reinit
1445  // b) CopyProtection settings missmatch
1446  // c) preblems with DNA of firmware developer, some TEACs fall into such state
1447  // after failed streaming read
1448  if((Error->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) &&
1449  (Error->AdditionalSenseCode == SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK)) {
1450 bad_rw_seek_recovery:
1451  if(WriteOp) {
1452 
1453  if((*retry) <= 1) {
1454  // Variate CopyProtection...
1455  for(i=Vcb->FirstTrackNum; i<=Vcb->LastTrackNum; i++) {
1456  if((Vcb->TrackMap[i].FirstLba > Lba) ||
1457  (Vcb->TrackMap[i].LastLba < Lba))
1458  continue;
1459  /* if(Vcb->TrackMap[i].Flags & TrackMap_CopyBit_variated)
1460  // Last chance....
1461  goto reinit_sector_mode;*/
1462 
1463  // check if we have successuflly completed WriteOp
1464  // using Variation.
1465  // We should not variate these bits again in this case.
1466  if(Vcb->TrackMap[i].Flags & TrackMap_Use_variation)
1467  break;
1468  Vcb->TrackMap[i].Flags &= ~TrackMap_Try_variation;
1469  /* if((Vcb->TrackMap[i].Flags & TrackMap_Try_variation) &&
1470  (Vcb->TrackMap[i].Flags & (TrackMap_AllowCopyBit_variated |
1471  TrackMap_CopyBit_variated)))
1472  break;*/
1473  /* if(Vcb->TrackMap[i].Flags & TrackMap_Use_variation)
1474  break;*/
1475  Vcb->TrackMap[i].Flags |= TrackMap_Try_variation;
1476  // Try variation.
1477  if(!(Vcb->TrackMap[i].Flags ^= TrackMap_AllowCopyBit_variated))
1478  Vcb->TrackMap[i].Flags ^= TrackMap_CopyBit_variated;
1479  if(Vcb->TrackMap[i].Flags & (TrackMap_AllowCopyBit_variated |
1481  (*retry) = 1;
1482  } else {
1483  Vcb->TrackMap[i].Flags &= ~TrackMap_Try_variation;
1484  }
1485  // reinit sector mode
1486  Vcb->LastModifiedTrack = 0;
1487  UDFPrepareForWriteOperation(Vcb, Lba, BCount);
1488  break;
1489  }
1490  } else {
1491  // Reinit...
1492 //reinit_sector_mode:
1493  // we should wait
1494  delay.QuadPart = -1000000; // 0.1 sec
1496  // reinit sector mode
1497  goto reinit_sector_mode;
1498 /*
1499  Vcb->LastModifiedTrack = 0;
1500  UDFPrepareForWriteOperation(Vcb, Lba, BCount);
1501  try_return(status = STATUS_SUCCESS);
1502 */
1503  }
1504  } else
1505  if((Vcb->CompatFlags & UDF_VCB_IC_BAD_RW_SEEK) &&
1506  (Vcb->IncrementalSeekState != INCREMENTAL_SEEK_DONE)) {
1507  UDFPrint(("Using incremental seek workaround...\n"));
1508  Vcb->IncrementalSeekState = INCREMENTAL_SEEK_WORKAROUND;
1510  } else {
1511  UDFPrint(("Seems to be BB @ %x\n", Lba));
1512  UpdateBB = TRUE;
1513  }
1514  } else
1515  if((Error->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) &&
1516  (Error->AdditionalSenseCode == SCSI_ADSENSE_INVALID_SESSION_MODE)) {
1517  if(WriteOp &&
1518  (Vcb->SavedFeatures & CDRW_FEATURE_STREAMING) &&
1519  Lba+BCount <= Vcb->LastLBA+1) {
1520  UDFPrint(("bad Session in streaming mode. Lba %x, try fix-up\n", Lba));
1521  // ...flush device cache...
1522  UDFSyncCache(Vcb);
1523  // we should wait
1524  delay.QuadPart = -10000000; // 1 sec
1527  }
1528  } else
1529  if((Error->LastError == CDRW_ERR_WRITE_IN_PROGRESS_BUSY) ||
1530  (status == STATUS_DEVICE_BUSY)) {
1531  delay.QuadPart = -5000000; // 0.5 sec
1532  UDFPrint(("CDRW_ERR_WRITE_IN_PROGRESS_BUSY || STATUS_DEVICE_BUSY\n"));
1534 #ifdef _UDF_STRUCTURES_H_
1535  if(Vcb->BGWriters) (*retry)++;
1536 #endif //_UDF_STRUCTURES_H_
1538  } else
1539  // some devices (SONY) return such a strange sequence....
1540  if( ((Error->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) &&
1541  (Error->AdditionalSenseCode == SCSI_ADSENSE_INVALID_CDB)) &&
1542  WriteOp) {
1543  // reinit write mode
1544  Vcb->LastModifiedTrack = 0;
1545  UDFPrepareForWriteOperation(Vcb, Lba, BCount);
1547  } else
1548  // No seek on Read... to morgue, I'm afraid
1549  if((Error->SenseKey == SCSI_SENSE_MEDIUM_ERROR) /*&&
1550  ((Error->AdditionalSenseCode == SCSI_ADSENSE_CD_READ_ERROR) ||
1551  (Error->AdditionalSenseCode == SCSI_ADSENSE_NO_SENSE) ||
1552  (Error->AdditionalSenseCode == SCSI_ADSENSE_FORMAT_CORRUPTED) ||
1553  (Error->AdditionalSenseCode == SCSI_ADSENSE_SEEK_ERROR))*/ &&
1554  !WriteOp) {
1555  if(Error->AdditionalSenseCode == SCSI_ADSENSE_SEEK_ERROR) {
1556  UDFPrint(("Seek error\n"));
1557  if(Vcb->CompatFlags & UDF_VCB_IC_BAD_RW_SEEK) {
1558  UDFPrint(("try recovery\n"));
1559  goto bad_rw_seek_recovery;
1560  }
1561  UDFPrint(("map error to STATUS_NONEXISTENT_SECTOR\n"));
1563  }
1564  UDFPrint(("Seems to be BB @ %x (read 2)\n", Lba));
1565  UpdateBB = TRUE;
1566  } else
1567  // handle invalid block address
1568  if( ((Error->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) &&
1569  (Error->AdditionalSenseCode == SCSI_ADSENSE_ILLEGAL_BLOCK)) ) {
1570  if(!WriteOp &&
1571  (Vcb->SavedFeatures & CDRW_FEATURE_STREAMING) &&
1572  Lba+BCount <= Vcb->LastLBA+1) {
1573  UDFPrint(("bad LBA %x in streaming mode, try fix-up\n", Lba));
1574  // ...flush device cache...
1575  UDFSyncCache(Vcb);
1577  }
1578 
1579  if((Lba+BCount >= Vcb->LastLBA) &&
1580  (Vcb->MRWStatus == DiscInfo_BGF_Interrupted)) {
1581  UDFPrint(("stupid drive, cannot read beyond formatted area on DiscInfo_BGF_Interrupted\n"));
1582  UpdateBB = FALSE;
1584  }
1585  // prevent Bad Block Bitmap modification
1586  }
1587 
1588 try_exit: NOTHING;
1589 
1590  } _SEH2_FINALLY {
1591 #ifdef UDF_DBG
1592  if(OS_SUCCESS(status)) {
1593  UDFPrint(("Retry\n"));
1594  }
1595 #endif //UDF_DBG
1596  } _SEH2_END;
1597  if(!OS_SUCCESS(status)) {
1598  if((Vcb->MountPhErrorCount != (ULONG)-1) &&
1599  (Vcb->MountPhErrorCount < 0x7fffffff)) {
1600  Vcb->MountPhErrorCount++;
1601  }
1602 //#ifdef _UDF_STRUCTURES_H_
1603  if(UpdateBB && (BCount == 1)) {
1604  uint32* bm;
1605  if(!(bm = (uint32*)(Vcb->BSBM_Bitmap))) {
1606  bm = (uint32*)(Vcb->BSBM_Bitmap = (int8*)DbgAllocatePoolWithTag(NonPagedPool, (i = (Vcb->LastPossibleLBA+1+7)>>3), 'mNWD' ));
1607  if(bm) {
1608  RtlZeroMemory(bm, i);
1609  } else {
1610  UDFPrint(("Can't alloc BSBM for %x blocks\n", Vcb->LastPossibleLBA));
1611  }
1612  }
1613  if(bm) {
1614  UDFSetBit(bm, Lba);
1615  UDFPrint(("Set BB @ %#x\n", Lba));
1616  }
1617 #ifdef _BROWSE_UDF_
1618  bm = (uint32*)(Vcb->FSBM_Bitmap);
1619  if(bm) {
1620  UDFSetUsedBit(bm, Lba);
1621  UDFPrint(("Set BB @ %#x as used\n", Lba));
1622  }
1623 #endif //_BROWSE_UDF_
1624  }
1625 //#endif //_UDF_STRUCTURES_H_
1626  }
1627  return status;
1628 } // end UDFRecoverFromError()
#define TrackMap_CopyBit_variated
Definition: cdrw_usr.h:1638
#define INCREMENTAL_SEEK_DONE
Definition: udf_common.h:303
#define SCSI_SENSEQ_FORMAT_IN_PROGRESS
Definition: cdrw_hw.h:1316
#define STATUS_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:141
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define TrackMap_AllowCopyBit_variated
Definition: cdrw_usr.h:1637
#define DbgAllocatePoolWithTag(a, b, c)
Definition: env_spec_w32.h:333
#define INCREMENTAL_SEEK_WORKAROUND
Definition: udf_common.h:302
#define SCSI_ADSENSE_INVALID_CMD_SEQUENCE
Definition: cdrw_hw.h:1270
unsigned int uint32
Definition: types.h:32
#define CDRW_FEATURE_STREAMING
Definition: cdrw_usr.h:1494
#define UDF_WRITE_MAX_RETRY
Definition: udf_rel.h:502
#define SCSI_ADSENSE_LUN_NOT_READY
Definition: cdrw_hw.h:1218
#define SCSI_SENSE_NOT_READY
Definition: cdrw_hw.h:1189
#define STATUS_NONEXISTENT_SECTOR
Definition: udferr_usr.h:143
#define STATUS_BUFFER_ALL_ZEROS
Definition: udferr_usr.h:125
#define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK
Definition: cdrw_hw.h:1278
_SEH2_TRY
Definition: create.c:4250
#define TrackMap_Use_variation
Definition: cdrw_usr.h:1640
#define SCSI_SENSE_MEDIUM_ERROR
Definition: cdrw_hw.h:1190
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UDF_VCB_FLAGS_UNSAFE_IOCTL
Definition: udf_common.h:488
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
unsigned char BOOLEAN
#define DiscInfo_BGF_Interrupted
Definition: cdrw_hw.h:2300
smooth NULL
Definition: ftsmooth.c:416
#define UDF_VCB_FLAGS_DEAD
Definition: udf_common.h:489
#define UDFSetBit(arr, bit)
Definition: udf_info.h:1181
#define TrackMap_Try_variation
Definition: cdrw_usr.h:1639
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS
Definition: cdrw_hw.h:1318
#define SCSI_ADSENSE_SEEK_ERROR
Definition: cdrw_hw.h:1232
#define SCSI_ADSENSE_ILLEGAL_BLOCK
Definition: cdrw_hw.h:1264
#define SCSI_SENSEQ_BECOMING_READY
Definition: cdrw_hw.h:1313
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define try_return(S)
Definition: cdprocs.h:2189
#define CDRW_ERR_WRITE_IN_PROGRESS_BUSY
Definition: cdrw_usr.h:1691
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
Definition: udf_common.h:466
#define Vcb
Definition: cdprocs.h:1425
#define IOCTL_CDRW_GET_LAST_ERROR
Definition: cdrw_usr.h:103
BOOL Error
Definition: chkdsk.c:66
#define SCSI_SENSEQ_OPERATION_IN_PROGRESS
Definition: cdrw_hw.h:1317
void delay(unsigned msec)
Definition: i386rtl.c:32
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define SCSI_ADSENSE_BUS_RESET
Definition: cdrw_hw.h:1289
#define NOTHING
Definition: env_spec_w32.h:461
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
Definition: phys_lib.cpp:4199
#define UDF_VCB_IC_BAD_RW_SEEK
Definition: udf_common.h:508
#define SYNC_CACHE_RECOVERY_ATTEMPT
Definition: udf_common.h:278
_SEH2_END
Definition: create.c:4424
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
_SEH2_FINALLY
Definition: create.c:4395
NTSTATUS UDFSyncCache(IN PVCB Vcb)
Definition: phys_lib.cpp:52
OSSTATUS UDFPrepareForWriteOperation(IN PVCB Vcb, IN uint32 Lba, IN uint32 BCount)
Definition: phys_lib.cpp:893
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:108
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define SCSI_ADSENSE_INVALID_SESSION_MODE
Definition: cdrw_hw.h:1271
#define SCSI_SENSE_ILLEGAL_REQUEST
Definition: cdrw_hw.h:1192
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define UDFSetUsedBit(arr, bit)
Definition: udf_info.h:1200
static SERVICE_STATUS status
Definition: service.c:31
#define SCSI_SENSE_UNIT_ATTENTION
Definition: cdrw_hw.h:1193
#define SCSI_ADSENSE_INVALID_CDB
Definition: cdrw_hw.h:1265
char int8
Definition: platform.h:10
Definition: ps.c:97

Referenced by UDFPrepareForWriteOperation(), UDFTRead(), and UDFTWrite().

◆ UDFResetDeviceDriver()

OSSTATUS UDFResetDeviceDriver ( IN PVCB  Vcb,
IN PDEVICE_OBJECT  TargetDeviceObject,
IN BOOLEAN  Unlock 
)

Definition at line 4199 of file phys_lib.cpp.

4204 {
4207  OSSTATUS RC;
4208  if(!tmp)
4211  tmp->UnlockTray = (Unlock ? 1 : 0);
4212  tmp->MagicWord = 0x3a6 | (Unlock ? 1 : 0);
4214  tmp, sizeof(CDRW_RESET_DRIVER_USER_IN), NULL, 0, TRUE,NULL);
4215  if(Vcb) {
4216  Vcb->LastReadTrack = 0;
4217  Vcb->LastModifiedTrack = 0;
4218  Vcb->OPCDone = FALSE;
4219  if((Vcb->VCBFlags & UDF_VCB_FLAGS_USE_CAV) &&
4220  Vcb->TargetDeviceObject) {
4221  // limit both read & write speed to last write speed for CAV mode
4222  // some drives damage data when speed is adjusted during recording process
4223  // even in packet mode
4224  UDFSetSpeeds(Vcb);
4225  }
4226  UDFSetCaching(Vcb);
4227  }
4228 
4229  MyFreePool__(tmp);
4230  return RC;
4231 } // end UDFResetDeviceDriver()
OSSTATUS UDFSetSpeeds(IN PVCB Vcb)
Definition: phys_lib.cpp:4234
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: env_spec.cpp:511
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _CDRW_RESET_DRIVER_USER_IN * PCDRW_RESET_DRIVER_USER_IN
#define UDF_VCB_FLAGS_USE_CAV
Definition: udf_common.h:487
#define OSSTATUS
Definition: env_spec_w32.h:57
smooth NULL
Definition: ftsmooth.c:416
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define IOCTL_CDRW_RESET_DRIVER_EX
Definition: cdrw_usr.h:122
NTSTATUS UDFSetCaching(IN PVCB Vcb)
Definition: phys_lib.cpp:4263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
Definition: fatprocs.h:1664

Referenced by UDFCommonCleanup(), UDFDoDismountSequence(), UDFGetDiskInfo(), UDFMountVolume(), and UDFRecoverFromError().

◆ UDFSetCaching()

NTSTATUS UDFSetCaching ( IN PVCB  Vcb)

Definition at line 4263 of file phys_lib.cpp.

4266 {
4267 #pragma pack(push,1)
4268  struct {