mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 08:25:53 +00:00
[NTOSKRNL]
Implement volume mount notification in RawFS svn path=/trunk/; revision=47965
This commit is contained in:
parent
358331354d
commit
1781e13d31
|
@ -312,6 +312,7 @@ RawMountVolume(IN PIO_STACK_LOCATION IoStackLocation)
|
|||
NTSTATUS Status;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PVOLUME_DEVICE_OBJECT Volume;
|
||||
PFILE_OBJECT FileObject = NULL;
|
||||
PAGED_CODE();
|
||||
|
||||
/* Remember our owner */
|
||||
|
@ -349,6 +350,36 @@ RawMountVolume(IN PIO_STACK_LOCATION IoStackLocation)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue