[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 10 May 2015 20:35:40 +0000 (20:35 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 10 May 2015 20:35:40 +0000 (20:35 +0000)
Handle IRP_MJ_READ with the dispatch routine

svn path=/trunk/; revision=67634

reactos/drivers/filesystems/ntfs/dispatch.c
reactos/drivers/filesystems/ntfs/ntfs.c
reactos/drivers/filesystems/ntfs/ntfs.h
reactos/drivers/filesystems/ntfs/rw.c

index 7a08fc1..6f42b41 100644 (file)
@@ -76,6 +76,10 @@ NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
             case IRP_MJ_DIRECTORY_CONTROL:
                 Status = NtfsDirectoryControl(IrpContext);
                 break;
+
+            case IRP_MJ_READ:
+                Status = NtfsRead(IrpContext);
+                break;
         }
     }
     else
index 304b290..918bcb3 100644 (file)
@@ -121,7 +121,7 @@ NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
 {
     DriverObject->MajorFunction[IRP_MJ_CREATE]                   = NtfsFsdCreate;
     DriverObject->MajorFunction[IRP_MJ_CLOSE]                    = NtfsFsdClose;
-    DriverObject->MajorFunction[IRP_MJ_READ]                     = NtfsFsdRead;
+    DriverObject->MajorFunction[IRP_MJ_READ]                     = NtfsFsdDispatch;
     DriverObject->MajorFunction[IRP_MJ_WRITE]                    = NtfsFsdWrite;
     DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION]        = NtfsFsdDispatch;
     DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = NtfsFsdDispatch;
index e4e2a34..05d63e8 100644 (file)
@@ -759,10 +759,8 @@ NtfsFileFlagsToAttributes(ULONG NtfsAttributes,
 
 /* rw.c */
 
-DRIVER_DISPATCH NtfsFsdRead;
-NTSTATUS NTAPI
-NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
-            PIRP Irp);
+NTSTATUS
+NtfsRead(PNTFS_IRP_CONTEXT IrpContext);
 
 DRIVER_DISPATCH NtfsFsdWrite;
 NTSTATUS NTAPI
index 0ae0a28..a5b5f74 100644 (file)
@@ -161,9 +161,7 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
 
 
 NTSTATUS
-NTAPI
-NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
-            PIRP Irp)
+NtfsRead(PNTFS_IRP_CONTEXT IrpContext)
 {
     PDEVICE_EXTENSION DeviceExt;
     PIO_STACK_LOCATION Stack;
@@ -173,13 +171,17 @@ NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
     LARGE_INTEGER ReadOffset;
     ULONG ReturnedReadLength = 0;
     NTSTATUS Status = STATUS_SUCCESS;
+    PIRP Irp;
+    PDEVICE_OBJECT DeviceObject;
 
-    DPRINT("NtfsRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
+    DPRINT("NtfsRead(DeviceObject %p)\n", IrpContext);
 
-    DeviceExt = DeviceObject->DeviceExtension;
-    Stack = IoGetCurrentIrpStackLocation(Irp);
-    FileObject = Stack->FileObject;
+    DeviceObject = IrpContext->DeviceObject;
+    Irp = IrpContext->Irp;
+    Stack = IrpContext->Stack;
+    FileObject = IrpContext->FileObject;
 
+    DeviceExt = DeviceObject->DeviceExtension;
     ReadLength = Stack->Parameters.Read.Length;
     ReadOffset = Stack->Parameters.Read.ByteOffset;
     Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
@@ -206,9 +208,6 @@ NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
         Irp->IoStatus.Information = 0;
     }
 
-    Irp->IoStatus.Status = Status;
-    IoCompleteRequest(Irp,IO_NO_INCREMENT);
-
     return Status;
 }