Author: pschweitzer
Date: Wed Jul 7 20:27:04 2010
New Revision: 47965
URL:
http://svn.reactos.org/svn/reactos?rev=47965&view=rev
Log:
[NTOSKRNL]
Implement volume mount notification in RawFS
Modified:
trunk/reactos/ntoskrnl/io/iomgr/rawfs.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/rawfs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/rawfs.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/rawfs.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/rawfs.c [iso-8859-1] Wed Jul 7 20:27:04 2010
@@ -312,6 +312,7 @@
NTSTATUS Status;
PDEVICE_OBJECT DeviceObject;
PVOLUME_DEVICE_OBJECT Volume;
+ PFILE_OBJECT FileObject = NULL;
PAGED_CODE();
/* Remember our owner */
@@ -349,6 +350,36 @@
Volume->DeviceObject.SectorSize = DeviceObject->SectorSize;
Volume->DeviceObject.Flags |= DO_DIRECT_IO;
Volume->DeviceObject.Flags &= ~DO_DEVICE_INITIALIZING;
+
+ /* Try to get associated FO (for notification) */
+ _SEH2_TRY
+ {
+ FileObject = IoCreateStreamFileObjectLite(NULL,
+ &(Volume->DeviceObject));
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ /* Get the exception code */
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+
+ /* If failed, delete devive */
+ if (!NT_SUCCESS(Status))
+ {
+ IoDeleteDevice((PDEVICE_OBJECT)Volume);
+ return Status;
+ }
+
+ /* Increment OpenCount by two to avoid dismount when RawClose() will be called on
ObDereferenceObject() */
+ Volume->Vcb.OpenCount += 2;
+ /* Notify for sucessful mount */
+ FsRtlNotifyVolumeEvent(FileObject, FSRTL_VOLUME_MOUNT);
+ /* Decrease refcount to 0 to make FileObject being released */
+ ObDereferenceObject(FileObject);
+ /* It's not open anymore, go back to 0 */
+ Volume->Vcb.OpenCount -= 2;
+
return Status;
}