319{
327
330 ULONG MediaChangeCount = 0;
331 ULONG Characteristics;
345
347 UDFPrint((
"\n !!! UDFMountVolume\n"));
348
349
350 fsDeviceObject = PtrIrpContext->TargetDeviceObject;
351 UDFPrint((
"Mount on device object %x\n", fsDeviceObject));
356 } else
360 } else {
361 UDFPrintErr((
"Invalid node type in FS or FILTER DeviceObject\n"));
363 }
364
366
370 } else {
375 }
376 }
379#ifdef UDF_HDD_SUPPORT
380 } else
385 }
386 } else {
389 }
390 }
392#endif
393 } else {
395 }
396 }
397
398
400
402
404
406
408 UDFPrint((
"UDFMountVolume: removable media\n"));
409
410
411
412
413
414
415
419 &MediaChangeCount,
sizeof(
ULONG),
421
422
423
427
434 UDFPrint((
"UDFMountVolume: TEST_UNIT_READY %x\n", RC));
436 break;
440 UDFPrint((
"UDFMountVolume: retry\n"));
442
443 } else {
444 break;
445 }
446 }
448 UDFPrint((
"UDFMountVolume: additional delay 3 sec\n"));
451 }
452 }
453
454
455
459 &MediaChangeCount,
sizeof(
ULONG),
461
463 UDFPrint((
"UDFMountVolume: retry check verify\n"));
467 &MediaChangeCount,
sizeof(
ULONG),
469 }
470
473
474
476 MediaChangeCount = 0;
477 }
478
480
481
482
483
484
486 if(!ioBuf) {
488 }
493
495
498 }
499 }
500
501
502 if(!WrongMedia) {
510 }
511
512 }
513
514
515
516 UDFPrint((
"UDFMountVolume: create device\n"));
520 FsDeviceType,
521 0,
523 &VolDo );
524
526
527
528
531 }
532
533 VolDo->
Flags &= ~DO_DEVICE_INITIALIZING;
534
535
536
538
539
540
542
543 Vcb = (
PVCB)VolDo->DeviceExtension;
544
545
546
551 }
552
555
558
559
560
561 Vcb->Vpb->ReferenceCount ++;
562
563 Vcb->MediaChangeCount = MediaChangeCount;
564 Vcb->FsDeviceType = FsDeviceType;
565
566
568 Vcb->Vpb->RealDevice->Flags &= ~DO_VERIFY_VOLUME;
569 RestoreDoVerify =
TRUE;
570 }
571
572 DeviceNotTouched =
FALSE;
575
576
578
579 Vcb->MountPhErrorCount = 0;
580
581
584 Vcb->WCacheMaxFrames,
585 Vcb->WCacheMaxBlocks,
587 5,
Vcb->BlockSizeBits,
588 Vcb->WCacheBlocksPerFrameSh,
590 0 |
594 Vcb->WCacheFramesToKeepFree,
595
597#ifdef UDF_ASYNC_IO
598 UDFTWriteAsync, UDFTReadAsync,
599#else
601#endif
606
609
613
618
619#ifdef UDF_READ_ONLY_BUILD
622#endif
623
625 UDFPrint((
"UDFMountVolume: try raw mount\n"));
627 UDFPrint((
"UDFMountVolume: block raw mount due to ISO9660 presence\n"));
628 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_RAW_DISK;
630 }
631try_raw_mount:
632 UDFPrint((
"UDFMountVolume: try raw mount (2)\n"));
634
635 UDFPrint((
"UDFMountVolume: trying raw mount...\n"));
636 Vcb->VolIdent.Length =
638 if(
Vcb->VolIdent.Buffer)
641 if(!
Vcb->VolIdent.Buffer)
644
647
648 } else {
649
651 }
652 } else {
653 Vcb->MountPhErrorCount = -1;
654#ifndef UDF_READ_ONLY_BUILD
655
657 UDFPrint((
"UDFMountVolume: writable volume\n"));
661 UDFPrint((
"UDFMountVolume: RAM mode\n"));
663 } else {
664 UDFPrint((
"UDFMountVolume: RW mode\n"));
666 }
667
668
669
670
671 } else {
672 UDFPrint((
"UDFMountVolume: R mode\n"));
674 }
675
677 UDFPrint((
"UDFMountVolume: NO ACL and ExtFE support\n"));
680 }
681 }
683#endif
684
689
690
691
692
693
694
695
697 Vcb->VCBOpenCount = 1;
700 goto try_raw_mount;
701 }
702 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_RAW_DISK;
703 }
704
705#ifndef UDF_READ_ONLY_BUILD
709 } else {
710 UDFPrint((
"UDFMountVolume: RO mount\n"));
712 }
713#endif
714
715 Vcb->Vpb->SerialNumber =
Vcb->PhSerialNumber;
716 Vcb->Vpb->VolumeLabelLength =
Vcb->VolIdent.Length;
718 Vcb->VolIdent.Buffer,
719 Vcb->VolIdent.Length );
720
722
726
727 if(!
Vcb->ShutdownRegistered) {
728 UDFPrint((
"UDFMountVolume: Register shutdown routine\n"));
730 Vcb->ShutdownRegistered =
TRUE;
731 }
732
733
736 UDFPrint((
"UDFMountVolume: unlock media on RO volume\n"));
745 }
746 }
747
749 {
750 Vcb->IsVolumeJustMounted =
TRUE;
752 }
753
754
758
760
763
764 UDFPrint((
"UDFMountVolume: RC = %x\n", RC));
765
766 if(ioBuf) {
768 }
769
771
773 UDFPrint((
"UDFMountVolume: unlock media\n"));
780 }
781
782
783
784 if(!DeviceNotTouched &&
786 UDFPrint((
"UDFMountVolume: reset driver\n"));
788 }
789
791 UDFPrint((
"UDFMountVolume: status -> STATUS_UNRECOGNIZED_VOLUME\n"));
793 }
794
795
798 }
799
801
802 if(RestoreDoVerify) {
804 }
805
806 if(
Vcb->VCBOpenCount)
808
811 }
812 } else if(VolDo) {
814 }
815 }
816
818
821
822
823 UDFPrint((
"UDFMountVolume: complete req RC %x\n", RC));
825
826 Irp->IoStatus.Status = RC;
828 }
829 } else {
830
831
832
833
834 Irp->CurrentLocation++;
835 Irp->Tail.Overlay.CurrentStackLocation++;
836
837
839
840 }
841
843
844 UDFPrint((
"UDFMountVolume: final RC = %x\n", RC));
845 return RC;
846
847}
int64 __fastcall UDFGetTotalSpace(IN PVCB Vcb)
int64 __fastcall UDFGetFreeSpace(IN PVCB Vcb)
uint32 UDFIsBlockAllocated(IN void *_Vcb, IN uint32 Lba)
#define SCSI_ADSENSE_LUN_NOT_READY
#define SCSI_SENSEQ_BECOMING_READY
#define SCSI_SENSE_NOT_READY
#define CdrwMediaClassEx_IsRAM(MediaClassEx)
#define IOCTL_CDRW_TEST_UNIT_READY
ULONG UDFGetRegParameter(IN PVCB Vcb, IN PCWSTR Name, IN ULONG DefValue)
NTSTATUS UDFWCacheErrorHandler(IN PVOID Context, IN PWCACHE_ERROR_CONTEXT ErrorInfo)
NTSTATUS UDFInitializeVCB(IN PDEVICE_OBJECT PtrVolumeDeviceObject, IN PDEVICE_OBJECT PtrTargetDeviceObject, IN PVPB PtrVPB)
VOID CompleteIrp(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
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)
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define KeSetEvent(pEvt, foo, foo2)
#define KeDelayExecutionThread(mode, foo, t)
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
NTSTATUS UDFBlankMount(IN PVCB Vcb)
NTSTATUS UDFCompleteMount(IN PVCB Vcb)
NTSTATUS UDFStartEjectWaiter(IN PVCB Vcb)
VOID UDFCloseResidual(IN PVCB Vcb)
OSSTATUS UDFGetDiskInfoAndVerify(IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
#define FILE_FLOPPY_DISKETTE
#define FILE_REMOVABLE_MEDIA
#define IOCTL_CDROM_GET_DRIVE_GEOMETRY
#define IOCTL_STORAGE_CHECK_VERIFY
#define IOCTL_STORAGE_MEDIA_REMOVAL
#define FSRTL_VOLUME_MOUNT
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
NTSTATUS NTAPI IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
OSSTATUS UDFGetDiskInfo(IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
OSSTATUS UDFTReadVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
OSSTATUS UDFTWriteVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T WrittenBytes, IN uint32 Flags)
BOOLEAN UDFDismountVcb(IN PVCB Vcb, IN BOOLEAN VcbAcquired)
#define FILE_DEVICE_DISK_FILE_SYSTEM
#define FILE_DEVICE_CD_ROM
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
OSSTATUS UDFVInit(IN PVCB Vcb)
#define STATUS_DEVICE_NOT_READY
#define UDF_NODE_TYPE_FILTER_DEVOBJ
struct _FILTER_DEV_EXTENSION * PFILTER_DEV_EXTENSION
#define UDF_NODE_TYPE_UDFFS_DEVOBJ
ULONG AlignmentRequirement
PDEVICE_OBJECT lowerFSDeviceObject
UDFIdentifier NodeIdentifier
struct _IO_STACK_LOCATION::@3974::@3994 MountVolume
UCHAR AdditionalSenseCodeQualifier
UCHAR AdditionalSenseCode
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
#define UDF_VCB_FLAGS_MEDIA_READ_ONLY
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
#define UDF_DATA_FLAGS_BEING_UNLOADED
OSSTATUS UDFUpdateVAT(IN void *_Vcb, IN uint32 Lba, IN uint32 *RelocTab, IN uint32 BCount)
#define UDFNtAclSupported(Vcb)
#define REG_MOUNT_ON_ZIP_NAME
#define REG_MOUNT_ON_HDD_NAME
#define REG_MOUNT_ON_CDONLY_NAME
#define UDF_WAIT_CD_SPINUP
#define UDF_BLANK_VOLUME_LABEL
#define UDF_READY_MAX_RETRY
#define VRS_ISO9660_FOUND
#define STATUS_IO_DEVICE_ERROR
#define STATUS_VERIFY_REQUIRED
#define STATUS_FILE_CORRUPT_ERROR
OSSTATUS WCacheInit__(IN PW_CACHE Cache, IN ULONG MaxFrames, IN ULONG MaxBlocks, IN SIZE_T MaxBytesToRead, IN ULONG PacketSizeSh, IN ULONG BlockSizeSh, IN ULONG BlocksPerFrameSh, IN lba_t FirstLba, IN lba_t LastLba, IN ULONG Mode, IN ULONG Flags, IN ULONG FramesToKeepFree, IN PWRITE_BLOCK WriteProc, IN PREAD_BLOCK ReadProc, IN PWRITE_BLOCK_ASYNC WriteProcAsync, IN PREAD_BLOCK_ASYNC ReadProcAsync, IN PCHECK_BLOCK CheckUsedProc, IN PUPDATE_RELOC UpdateRelocProc, IN PWC_ERROR_HANDLER ErrorHandlerProc)
OSSTATUS WCacheSetMode__(IN PW_CACHE Cache, IN ULONG Mode)
ULONG WCacheChFlags__(IN PW_CACHE Cache, IN ULONG SetFlags, IN ULONG ClrFlags)
#define WCACHE_RO_BAD_BLOCKS
#define WCACHE_CACHE_WHOLE_PACKET
#define WCACHE_MARK_BAD_BLOCKS
#define WCACHE_DO_NOT_COMPARE
#define WCACHE_CHAINED_IO