153{
156
163
172 PCHAR ModeSelectData;
173
174 UDFPrint((
"UDFCommonDeviceControl\n"));
175
177
180
181
183
186
188
189 if(FSDevObj) {
194#ifndef UDF_READ_ONLY_BUILD
196#endif
198 break;
199 default:
203 }
204 } else {
208 goto ioctl_do_default;
209 }
213
214
216
218 } else {
221
226 break;
227 default:
230 }
231 }
232
235
240
245
250
255
269
274
278
280
298
300
303
310
311
313
315 break;
316 }
317
320 } else {
322 }
324 }
325
327
328
330
333
334 if(!
Irp->AssociatedIrp.SystemBuffer)
335 goto ioctl_do_default;
336
340 } else {
345 } else {
347 }
348 }
349 ScsiCommand =
Cdb->
CDB6.OperationCode;
350
352 UDFPrint((
"Write10, LBA %2.2x%2.2x%2.2x%2.2x\n",
357 ));
358 } else
360 UDFPrint((
"Write12, LBA %2.2x%2.2x%2.2x%2.2x\n",
365 ));
366 } else {
367 }
368
369 switch(ScsiCommand) {
371
372 ModeSelectData = CdbData+4;
373 switch(ModeSelectData[0]) {
377 UDFPrint((
"Unsafe MODE_SELECT_6 via pass-through (%2.2x)\n", ModeSelectData[0]));
378 goto unsafe_direct_scsi_cmd;
379 }
380 break; }
381
383
384 ModeSelectData = CdbData+8;
385 switch(ModeSelectData[0]) {
389 UDFPrint((
"Unsafe MODE_SELECT_10 via pass-through (%2.2x)\n", ModeSelectData[0]));
390 goto unsafe_direct_scsi_cmd;
391 }
392 break; }
393
404 UDFPrint((
"UDF Direct media modification via pass-through (%2.2x)\n", ScsiCommand));
405unsafe_direct_scsi_cmd:
407 goto ioctl_do_default;
408
410
413
416 }
417#ifdef UDF_DELAYED_CLOSE
418
420#endif
421
422
424 if(!Buf)
426
430
434 Vcb->MediaLockCount = 0;
435
436 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_VOLUME_MOUNTED;
438
439
442
444
445
446
447
449
451
452 goto notify_media_change;
453
458 UDFPrint((
"UDF Medium/Tray control IOCTL via pass-through\n"));
459 }
460 goto ioctl_do_default;
461
465
466notify_media_change:
467
468
469
470
471
472 goto ioctl_do_default;
473
475
476 UDFPrint((
"UDF Register Autoformat\n"));
479 } else {
482 }
484 Irp->IoStatus.Information = 0;
485 break;
486 }
487
489
492
496 }
497
498
499
502 }
503
504
506
509 }
512 Irp->IoStatus.Information = 0;
513 break;
514 }
516 UDFPrint((
"UDF Invaidate volume\n"));
517 if(AcquiredVcb) {
520 }
523 Irp->IoStatus.Information = 0;
524 break;
525 }
526
528 {
530 {
532 }
533 else
534 {
536 if (MountEventHandle)
537 {
539 {
541 MountEventHandle,
542 0,
547
549 {
551 }
552 }
553 else
554 {
556 }
557 }
558 else
559 {
561 {
563 }
564 else
565 {
568 }
569 }
570 }
571
573 Irp->IoStatus.Information = 0;
574 break;
575 }
576
578 {
580 {
582 }
583 else
584 {
585 *(
PBOOLEAN)
Irp->AssociatedIrp.SystemBuffer =
Vcb->IsVolumeJustMounted;
587 }
588
590 Irp->IoStatus.Information = 0;
591 break;
592 }
593
594
595
597 UDFPrint((
"UDF: Get Retrieval Pointers\n"));
600 break;
601 }
603 UDFPrint((
"UDF: Get Spec Retrieval Pointers\n"));
604 PUDF_GET_SPEC_RETRIEVAL_POINTERS_IN SpecRetrPointer;
605 SpecRetrPointer = (PUDF_GET_SPEC_RETRIEVAL_POINTERS_IN)(
Irp->AssociatedIrp.SystemBuffer);
608 break;
609 }
611 UDFPrint((
"UDF: Get File Alloc mode (from ICB)\n"));
614 break;
615 }
616#ifndef UDF_READ_ONLY_BUILD
618 UDFPrint((
"UDF: Set File Alloc mode\n"));
621 break;
622 }
623#endif
625 if(AcquiredVcb) {
628 }
631 break;
633 if(AcquiredVcb) {
636 }
639 break;
640#ifndef UDF_READ_ONLY_BUILD
643
644 Irp->IoStatus.Information = 0;
647 break;
648#endif
650
652
653 UDFPrint((
"UDFUserFsCtrlRequest: IOCTL_UDF_GET_VERSION\n"));
654
655 Irp->IoStatus.Information = 0;
657
659 UDFPrint((
"!OutputBufferLength\n"));
661 }
662
666 }
667
669 if(!udf_ver) {
672 }
673
675
677 udf_ver->
header.DriverVersionMj = 0x00010005;
678 udf_ver->
header.DriverVersionMn = 0x12;
680
686 ||
688 UDFPrint((
" UDF_USER_FS_FLAGS_RO\n"));
690 }
692 UDFPrint((
" UDF_USER_FS_FLAGS_OUR_DRIVER\n"));
694 }
696 UDFPrint((
" UDF_USER_FS_FLAGS_RAW\n"));
698 }
700 UDFPrint((
" UDF_USER_FS_FLAGS_MEDIA_RO\n"));
702 }
704 UDFPrint((
" UDF_USER_FS_FLAGS_FP\n"));
706 }
708
710
714
715 break; }
717
720
721 UDFPrint((
"UDF: IOCTL_UDF_SET_OPTIONS\n"));
722
723 Irp->IoStatus.Information = 0;
725
729 }
730
732 if(!udf_opt) {
735 }
736
740 }
741
742 if(AcquiredVcb) {
745 }
748
749 PrevVerifyOnWrite =
Vcb->VerifyOnWrite;
750
757
758 if(PrevVerifyOnWrite !=
Vcb->VerifyOnWrite) {
759 if(
Vcb->VerifyOnWrite) {
761 } else {
765 }
766 }
767
769 break; }
770#if 0
771 case IOCTL_UDF_GET_OPTIONS_VERSION: {
772
773 PUDF_GET_OPTIONS_VERSION_OUT udf_opt_ver;
774
775 UDFPrint((
"UDF: IOCTL_UDF_GET_OPTIONS_VERSION\n"));
776
777 Irp->IoStatus.Information = 0;
779
781 UDFPrint((
"OutputBufferLength < %x\n",
sizeof(UDF_GET_OPTIONS_VERSION_OUT)));
783 }
784
785 udf_opt_ver = (PUDF_GET_OPTIONS_VERSION_OUT)(
Irp->AssociatedIrp.SystemBuffer);
786 if(!udf_opt_ver) {
789 }
790
791
792
793
794
795
796
797
798 udf_opt_ver->CfgVersion =
Vcb->CfgVersion;
799 Irp->IoStatus.Information =
sizeof(UDF_GET_OPTIONS_VERSION_OUT);
800
802 break; }
803#endif
805
806 UDFPrint((
"UDF: IOCTL_CDRW_RESET_DRIVER\n"));
807 Vcb->MediaLockCount = 0;
808 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_MEDIA_LOCKED;
809 goto ioctl_do_default;
810
812
813 UDFPrint((
"UDFUserFsCtrlRequest: FSCTL_ALLOW_EXTENDED_DASD_IO\n"));
814
815
817
818 Irp->IoStatus.Information = 0;
821 break;
822
824
825 UDFPrint((
"UDFUserFsCtrlRequest: FSCTL_IS_VOLUME_DIRTY\n"));
826
827
830 break;
831
835
836 UDFPrint((
"UDF Reset/Eject request\n"));
837
838
839 if(
Vcb->EjectWaiter) {
840 UDFPrint((
" Vcb->EjectWaiter present\n"));
841 Irp->IoStatus.Information = 0;
842 Vcb->EjectWaiter->SoftEjectReq =
TRUE;
846 }
848 goto ioctl_do_default;
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869 }
871
872 UDFPrint((
"UDF Cdrom Disk Type\n"));
874
875 Irp->IoStatus.Information = 0;
879
880
883
884
886 for(TrackNumber=
Vcb->FirstTrackNum; TrackNumber<Vcb->LastTrackNum; TrackNumber++) {
890 break;
891 }
892 }
893
896 break;
897 }
898
909 goto ioctl_do_default;
910 }
913 Irp->IoStatus.Information = 0;
916 break;
917 }
918 if(!
buffer->PreventMediaRemoval &&
919 !
Vcb->MediaLockCount) {
920
921 UDFPrint((
"!locked + unlock req\n"));
924 goto ioctl_do_default;
925 }
926#if 0
927
929 if(!Buf)
931
932
935
936#ifdef UDF_DELAYED_CLOSE
937
939#endif
940
943
947 Vcb->MediaLockCount = 0;
948
951
953#else
954
955#endif
956ignore_lock:
959 Irp->IoStatus.Information = 0;
961 break;
962 }
963 if(
buffer->PreventMediaRemoval) {
965 Vcb->MediaLockCount++;
968 } else {
970 if(
Vcb->MediaLockCount) {
971 UDFPrint((
"lock count %d\n",
Vcb->MediaLockCount));
973 Vcb->MediaLockCount--;
974 }
975 }
978 goto ioctl_do_default;
979 }
980 goto ignore_lock;
981 }
982 default:
983
985ioctl_do_default:
986
987
988 if(
Vcb && UnsafeIoctl) {
991 }
992
993
994
996
997
998
999
1000
1003
1005 }
1006 break;
1007 }
1008
1009 if(
Vcb && UnsafeIoctl) {
1012 }
1013
1015
1017
1018 if(AcquiredVcb) {
1020 AcquiredVcb =
FALSE;
1021 }
1022
1023 if(Buf) {
1025 }
1026
1029 UDFPrint((
" complete Irp %x, ctx %x, status %x, iolen %x\n",
1030 Irp, PtrIrpContext, RC,
Irp->IoStatus.Information));
1031 Irp->IoStatus.Status = RC;
1032
1034
1036 }
1038
1039 return(RC);
1040}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
#define Trk_QSubChan_Type_Mask
#define SCSIOP_DOORUNLOCK
#define Trk_QSubChan_Type_Audio
#define SCSIOP_SEND_CUE_SHEET
#define SCSIOP_MEDIUM_REMOVAL
#define SCSIOP_SEND_DVD_STRUCTURE
#define SCSIOP_FORMAT_UNIT
#define SCSIOP_RESERVE_TRACK
#define MODE_PAGE_WRITE_PARAMS
#define SCSIOP_CLOSE_TRACK_SESSION
#define SCSIOP_START_STOP_UNIT
#define SCSIOP_SET_STREAMING
#define SCSIOP_MODE_SELECT10
#define SCSIOP_MODE_SELECT
#define IOCTL_CDRW_READ_ATIP
#define IOCTL_CDRW_GET_WRITE_MODE
#define IOCTL_CDROM_EJECT_MEDIA
#define IOCTL_CDRW_READ_SESSION_INFO
#define IOCTL_CDRW_BUFFER_CAPACITY
#define IOCTL_CDRW_GET_MEDIA_TYPE
#define IOCTL_CDRW_MODE_SENSE
struct _CDROM_DISK_DATA_USER_OUT CDROM_DISK_DATA_USER_OUT
struct _PREVENT_MEDIA_REMOVAL_USER_IN * PPREVENT_MEDIA_REMOVAL_USER_IN
#define IOCTL_DISK_CHECK_VERIFY
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
struct _CDROM_DISK_DATA_USER_OUT * PCDROM_DISK_DATA_USER_OUT
#define IOCTL_CDRW_READ_TOC_EX
#define IOCTL_CDRW_LL_READ
#define IOCTL_DISK_MEDIA_REMOVAL
#define IOCTL_CDRW_READ_TRACK_INFO
#define IOCTL_DISK_EJECT_MEDIA
#define IOCTL_CDRW_LOCK_DOOR
#define IOCTL_DISK_LOAD_MEDIA
#define IOCTL_CDRW_READ_PMA
#define IOCTL_CDRW_GET_DEVICE_NAME
#define IOCTL_DISK_GET_MEDIA_TYPES
#define IOCTL_CDRW_RESET_DRIVER
#define IOCTL_CDRW_GET_SIGNATURE
#define IOCTL_DISK_IS_WRITABLE
#define IOCTL_CDROM_LOAD_MEDIA
#define IOCTL_CDRW_TEST_UNIT_READY
#define IOCTL_DVD_READ_STRUCTURE
#define IOCTL_CDRW_GET_DEVICE_INFO
#define IOCTL_CDROM_MEDIA_REMOVAL
#define IOCTL_CDRW_READ_CD_TEXT
#define IOCTL_CDRW_LL_WRITE
#define IOCTL_CDRW_GET_EVENT
#define IOCTL_CDRW_READ_FULL_TOC
#define IOCTL_CDRW_READ_DISC_INFO
#define IOCTL_CDRW_GET_LAST_ERROR
#define IOCTL_CDRW_GET_MEDIA_TYPE_EX
#define IOCTL_CDRW_SET_SPEED
#define IOCTL_CDRW_FORMAT_UNIT
#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX
#define IOCTL_CDRW_GET_CAPABILITIES
VOID UDFCloseAllDelayed(IN PVCB Vcb)
NTSTATUS UDFGetFileAllocModeFromICB(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
#define UDF_CURRENT_BUILD
NTSTATUS UDFSetFileAllocModeFromICB(PtrUDFIrpContext IrpContext, PIRP Irp)
#define NT_SUCCESS(StatCode)
_In_ PIO_STACK_LOCATION IrpSp
VOID UDFReadRegKeys(PVCB Vcb, BOOLEAN Update, BOOLEAN UseCfg)
VOID UDFDestroyZones(VOID)
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
VOID CompleteIrp(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
#define INTEGRITY_TYPE_OPEN
#define UDFReleaseResource(Resource)
#define UDFDeleteResource(Resource)
#define UDFAcquireResourceShared(Resource, CanWait)
#define UDFAcquireResourceExclusive(Resource, CanWait)
#define UDFInterlockedDecrement(addr)
#define UDFInterlockedIncrement(addr)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
#define IOCTL_DISK_GET_PARTITION_INFO_EX
#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX
#define IOCTL_STORAGE_CHECK_VERIFY2
#define IOCTL_STORAGE_LOAD_MEDIA2
ULONG UDFFlushLogicalVolume(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp, IN PVCB Vcb, IN ULONG FlushFlags)
NTSTATUS UDFUnlockVolume(IN PtrUDFIrpContext IrpContext, IN PIRP Irp, IN ULONG PID)
NTSTATUS UDFLockVolume(IN PtrUDFIrpContext IrpContext, IN PIRP Irp, IN ULONG PID)
NTSTATUS UDFGetRetrievalPointers(IN PtrUDFIrpContext IrpContext, IN PIRP Irp, IN ULONG Special)
NTSTATUS UDFIsVolumeDirty(IN PtrUDFIrpContext IrpContext, IN PIRP Irp)
NTSTATUS UDFInvalidateVolumes(IN PtrUDFIrpContext IrpContext, IN PIRP Irp)
#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
#define IOCTL_CDROM_GET_LAST_SESSION
#define IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX
#define IOCTL_CDROM_SEEK_AUDIO_MSF
#define IOCTL_CDROM_READ_TOC_EX
#define CDROM_DISK_DATA_TRACK
#define IOCTL_CDROM_GET_VOLUME
#define IOCTL_CDROM_CHECK_VERIFY
#define IOCTL_CDROM_DISK_TYPE
#define IOCTL_CDROM_PAUSE_AUDIO
#define CDROM_DISK_AUDIO_TRACK
#define IOCTL_CDROM_SET_VOLUME
#define IOCTL_CDROM_STOP_AUDIO
#define IOCTL_CDROM_GET_CONTROL
#define IOCTL_CDROM_READ_Q_CHANNEL
#define IOCTL_CDROM_GET_DRIVE_GEOMETRY
#define IOCTL_CDROM_GET_CONFIGURATION
#define IOCTL_CDROM_PLAY_AUDIO_MSF
#define IOCTL_CDROM_RESUME_AUDIO
#define IOCTL_CDROM_READ_TOC
#define IOCTL_CDROM_RAW_READ
#define IOCTL_DISK_GET_DRIVE_LAYOUT
#define IOCTL_DISK_GET_PARTITION_INFO
#define IOCTL_STORAGE_CHECK_VERIFY
#define IOCTL_STORAGE_LOAD_MEDIA
#define IOCTL_STORAGE_GET_MEDIA_TYPES
#define IOCTL_STORAGE_EJECT_MEDIA
#define IOCTL_STORAGE_MEDIA_REMOVAL
#define IoSkipCurrentIrpStackLocation(Irp)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
#define IoCompleteRequest
VOID NTAPI IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
OSSTATUS UDFDoDismountSequence(IN PVCB Vcb, IN PPREVENT_MEDIA_REMOVAL_USER_IN Buf, IN BOOLEAN Eject)
VOID UDFStopEjectWaiter(PVCB Vcb)
NTSTATUS UDFVerifyVcb(IN PtrUDFIrpContext IrpContext, IN PVCB Vcb)
#define UDFCloseAllSystemDelayedInDir(Vcb, FI)
#define FSCTL_IS_VOLUME_DIRTY
#define _SEH2_AbnormalTermination()
#define FSCTL_ALLOW_EXTENDED_DASD_IO
VOID UDFVFlush(IN PVCB Vcb)
VOID UDFVRelease(IN PVCB Vcb)
OSSTATUS UDFVInit(IN PVCB Vcb)
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
#define IOCTL_SCSI_PASS_THROUGH
struct _SCSI_PASS_THROUGH * PSCSI_PASS_THROUGH
#define IOCTL_SCSI_PASS_THROUGH_DIRECT
#define offsetof(TYPE, MEMBER)
#define STATUS_BUFFER_TOO_SMALL
struct _UDFContextControlBlock * PtrUDFCCB
#define UDF_NODE_TYPE_VCB
struct _FCB::@731::@734 Fcb
union _IO_STACK_LOCATION::@1581 Parameters
struct _IO_STACK_LOCATION::@1581::@1582 DeviceIoControl
PDEVICE_OBJECT TargetDeviceObject
struct _UDF_GET_VERSION_OUT::@972 header
struct _UDF_SET_OPTIONS_IN::@973 header
#define RtlZeroMemory(Destination, Length)
#define UDF_DATA_FLAGS_RESOURCE_INITIALIZED
#define UDF_VCB_IC_DIRTY_RO
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
#define UDF_DATA_FLAGS_ZONES_INITIALIZED
#define UDF_VCB_FLAGS_UNSAFE_IOCTL
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
#define UDF_VCB_FLAGS_RAW_DISK
#define UDF_VCB_FLAGS_MEDIA_READ_ONLY
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
#define UDF_VCB_FLAGS_MEDIA_LOCKED
#define STATUS_INVALID_PARAMETER
#define STATUS_INVALID_USER_BUFFER
#define STATUS_SHARING_VIOLATION
#define STATUS_INSUFFICIENT_RESOURCES
#define UDFClearFlag(Flag, Value)
#define UDF_USER_FS_FLAGS_MEDIA_RO
#define IOCTL_UDF_SET_FILE_ALLOCATION_MODE
struct _UDF_GET_VERSION_OUT UDF_GET_VERSION_OUT
#define IOCTL_UDF_SET_OPTIONS
#define IOCTL_UDF_REGISTER_AUTOFORMAT
#define UDF_USER_FS_FLAGS_RAW
#define IOCTL_UDF_SET_NOTIFICATION_EVENT
#define IOCTL_UDF_GET_VERSION
#define IOCTL_UDF_GET_RETRIEVAL_POINTERS
#define IOCTL_UDF_INVALIDATE_VOLUMES
struct _UDF_SET_OPTIONS_IN * PUDF_SET_OPTIONS_IN
#define UDF_USER_FS_FLAGS_OUR_DRIVER
#define UDF_SET_OPTIONS_FLAG_TEMPORARY
struct _UDF_GET_VERSION_OUT * PUDF_GET_VERSION_OUT
#define IOCTL_UDF_GET_SPEC_RETRIEVAL_POINTERS
#define IOCTL_UDF_IS_VOLUME_JUST_MOUNTED
#define UDF_USER_FS_FLAGS_FP
#define UDF_USER_FS_FLAGS_RO
#define IOCTL_UDF_GET_FILE_ALLOCATION_MODE
#define IOCTL_UDF_LOCK_VOLUME_BY_PID
#define IOCTL_UDF_DISABLE_DRIVER
#define IOCTL_UDF_UNLOCK_VOLUME_BY_PID
#define UDF_SET_OPTIONS_FLAG_MASK
#define IOCTL_UDF_SEND_LICENSE_KEY
struct _CDB::_WRITE_CD WRITE_CD
struct _CDB::_CDB12READWRITE CDB12READWRITE
OSSTATUS WCacheFlushBlocks__(IN PW_CACHE Cache, IN PVOID Context, IN lba_t Lba, IN ULONG BCount)
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
#define IO_DISK_INCREMENT
#define ObDereferenceObject