+
+ /* 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;
+