X-Git-Url: http://git.jankratochvil.net/?p=reactos.git;a=blobdiff_plain;f=ntoskrnl%2Fio%2Ffs.c;fp=ntoskrnl%2Fio%2Ffs.c;h=76d577d4dcfda1bcf212355a464195aa93196691;hp=f2e0346179ab15f5e5609c301c2533e010e42759;hb=a3df8bf1429570e0bd6c6428f6ed80073578cf4b;hpb=7c0db166f81fbe8c8b913d7f26048e337d383605 diff --git a/ntoskrnl/io/fs.c b/ntoskrnl/io/fs.c index f2e0346..76d577d 100644 --- a/ntoskrnl/io/fs.c +++ b/ntoskrnl/io/fs.c @@ -35,7 +35,6 @@ typedef struct _FS_CHANGE_NOTIFY_ENTRY PFSDNOTIFICATIONPROC FSDNotificationProc; } FS_CHANGE_NOTIFY_ENTRY, *PFS_CHANGE_NOTIFY_ENTRY; - /* GLOBALS ******************************************************************/ static ERESOURCE FileSystemListLock; @@ -55,6 +54,9 @@ IopNotifyFileSystemChange(PDEVICE_OBJECT DeviceObject, /* FUNCTIONS *****************************************************************/ +/* + * @implemented + */ NTSTATUS STDCALL NtFsControlFile ( IN HANDLE DeviceHandle, @@ -73,7 +75,7 @@ NtFsControlFile ( PFILE_OBJECT FileObject; PDEVICE_OBJECT DeviceObject; PIRP Irp; - PIO_STACK_LOCATION StackPtr; + PEXTENDED_IO_STACK_LOCATION StackPtr; PKEVENT ptrEvent; IO_STATUS_BLOCK IoSB; @@ -130,10 +132,13 @@ NtFsControlFile ( ptrEvent, &IoSB); + //trigger FileObject/Event dereferencing + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr = (PEXTENDED_IO_STACK_LOCATION) IoGetNextIrpStackLocation(Irp); StackPtr->FileObject = FileObject; StackPtr->DeviceObject = DeviceObject; StackPtr->Parameters.FileSystemControl.InputBufferLength = InputBufferSize; @@ -224,7 +229,7 @@ IopMountFileSystem(PDEVICE_OBJECT DeviceObject, PIRP Irp; NTSTATUS Status; - DPRINT("IoAskFileSystemToMountDevice(DeviceObject %x, DeviceToMount %x)\n", + DPRINT("IopMountFileSystem(DeviceObject %x, DeviceToMount %x)\n", DeviceObject,DeviceToMount); assert_irql(PASSIVE_LEVEL); @@ -365,8 +370,17 @@ IoMountVolume(IN PDEVICE_OBJECT DeviceObject, current_entry = current_entry->Flink; continue; } - Status = IopMountFileSystem(current->DeviceObject, - DeviceObject); + /* If we are not allowed to mount this volume as a raw filesystem volume + then don't try this */ + if (!AllowRawMount && RawFsIsRawFileSystemDeviceObject(current->DeviceObject)) + { + Status = STATUS_UNRECOGNIZED_VOLUME; + } + else + { + Status = IopMountFileSystem(current->DeviceObject, + DeviceObject); + } switch (Status) { case STATUS_FS_DRIVER_REQUIRED: @@ -415,6 +429,8 @@ IoMountVolume(IN PDEVICE_OBJECT DeviceObject, * * RETURN VALUE * Status + * + * @implemented */ NTSTATUS STDCALL IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, @@ -425,6 +441,7 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, KEVENT Event; PIRP Irp; NTSTATUS Status; + PDEVICE_OBJECT DevObject; DPRINT("IoVerifyVolume(DeviceObject %x AllowRawMount %x)\n", DeviceObject, AllowRawMount); @@ -442,12 +459,13 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, if (DeviceObject->Vpb->Flags & VPB_MOUNTED) { /* Issue verify request to the FSD */ + DevObject = DeviceObject->Vpb->DeviceObject; KeInitializeEvent(&Event, NotificationEvent, FALSE); - Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); + Irp = IoAllocateIrp(DevObject->StackSize, TRUE); if (Irp==NULL) { return(STATUS_INSUFFICIENT_RESOURCES); @@ -462,14 +480,14 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, StackPtr->MinorFunction = IRP_MN_VERIFY_VOLUME; StackPtr->Flags = 0; StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; + StackPtr->DeviceObject = DevObject; StackPtr->FileObject = NULL; StackPtr->CompletionRoutine = NULL; StackPtr->Parameters.VerifyVolume.Vpb = DeviceObject->Vpb; StackPtr->Parameters.VerifyVolume.DeviceObject = DeviceObject; - Status = IoCallDriver(DeviceObject, + Status = IoCallDriver(DevObject, Irp); if (Status==STATUS_PENDING) { @@ -507,6 +525,9 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, } +/* + * @implemented + */ PDEVICE_OBJECT STDCALL IoGetDeviceToVerify(IN PETHREAD Thread) /* @@ -518,6 +539,9 @@ IoGetDeviceToVerify(IN PETHREAD Thread) } +/* + * @implemented + */ VOID STDCALL IoSetDeviceToVerify(IN PETHREAD Thread, IN PDEVICE_OBJECT DeviceObject) @@ -526,6 +550,9 @@ IoSetDeviceToVerify(IN PETHREAD Thread, } +/* + * @implemented + */ VOID STDCALL IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject) @@ -534,6 +561,9 @@ IoSetHardErrorOrVerifyDevice(IN PIRP Irp, } +/* + * @implemented + */ VOID STDCALL IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject) { @@ -549,7 +579,12 @@ IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject) Fs->DeviceObject = DeviceObject; ExAcquireResourceExclusiveLite(&FileSystemListLock, TRUE); - InsertTailList(&FileSystemListHead, + /* The RAW filesystem device objects must be last in the list so the + raw filesystem driver is the last filesystem driver asked to mount + a volume. It is always the first filesystem driver registered so + we use InsertHeadList() here as opposed to the other alternative + InsertTailList(). */ + InsertHeadList(&FileSystemListHead, &Fs->Entry); ExReleaseResourceLite(&FileSystemListLock); @@ -559,6 +594,9 @@ IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject) } +/* + * @implemented + */ VOID STDCALL IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject) { @@ -601,6 +639,8 @@ IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject) * * NOTE * From Bo Branten's ntifs.h v13. + * + * @implemented */ PDEVICE_OBJECT STDCALL IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject) @@ -665,6 +705,9 @@ IopNotifyFileSystemChange(PDEVICE_OBJECT DeviceObject, } +/* + * @implemented + */ NTSTATUS STDCALL IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, IN PFSDNOTIFICATIONPROC FSDNotificationProc) @@ -688,6 +731,9 @@ IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, } +/* + * @implemented + */ VOID STDCALL IoUnregisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, IN PFSDNOTIFICATIONPROC FSDNotificationProc)