[ros-diffs] [pschweitzer] 39077: - Fixed a TODO. - Added volume mount notification

pschweitzer at svn.reactos.org pschweitzer at svn.reactos.org
Sun Jan 25 09:55:52 CET 2009


Author: pschweitzer
Date: Sun Jan 25 02:55:52 2009
New Revision: 39077

URL: http://svn.reactos.org/svn/reactos?rev=39077&view=rev
Log:
- Fixed a TODO.
- Added volume mount notification

Modified:
    trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h
    trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c

Modified: trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h?rev=39077&r1=39076&r2=39077&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] Sun Jan 25 02:55:52 2009
@@ -111,6 +111,8 @@
     FAT_METHODS Methods;
     /*  Root Directory Fcb: */
     struct _FCB *RootFcb;
+
+    ULONG MediaChangeCount;
 } VCB, *PVCB;
 
 #define VcbToVolumeDeviceObject(xVcb) \

Modified: trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c?rev=39077&r1=39076&r2=39077&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c [iso-8859-1] Sun Jan 25 02:55:52 2009
@@ -56,6 +56,7 @@
 {
     NTSTATUS Status;
     DISK_GEOMETRY DiskGeometry;
+    ULONG MediaChangeCount = 0;
     PVOLUME_DEVICE_OBJECT VolumeDevice;
 
     DPRINT1("FatMountVolume()\n");
@@ -63,7 +64,17 @@
     /* Make sure this IRP is waitable */
     ASSERT(IrpContext->Flags & IRPCONTEXT_CANWAIT);
 
-    /* TODO: IOCTL_DISK_CHECK_VERIFY */
+    /* Request media changes count, mostly usefull for removable devices */
+    Status = FatPerformDevIoCtrl(TargetDeviceObject,
+                                 IOCTL_STORAGE_CHECK_VERIFY,
+                                 NULL,
+                                 0,
+                                 &MediaChangeCount,
+                                 sizeof(ULONG),
+                                 TRUE);
+
+    if (!NT_SUCCESS(Status)) return Status;
+
     /* TODO: Check if data-track present in case of a CD drive */
     /* TODO: IOCTL_DISK_GET_PARTITION_INFO_EX */
 
@@ -113,6 +124,12 @@
     Status = FatInitializeVcb(&VolumeDevice->Vcb, TargetDeviceObject, Vpb);
     if (!NT_SUCCESS(Status)) goto FatMountVolumeCleanup;
 
+    /* Keep trace of media changes */
+    VolumeDevice->Vcb.MediaChangeCount = MediaChangeCount;
+
+    /* Notify about volume mount */
+    FsRtlNotifyVolumeEvent(VolumeDevice->Vcb.VolumeFileObject, FSRTL_VOLUME_MOUNT);
+
     /* Return success */
     return STATUS_SUCCESS;
 



More information about the Ros-diffs mailing list