[Wine-patches] [eterhack 1/8] ntoskrnl.exe: Add support of buffered and neither i/o for reading.

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Ср Мар 25 16:28:52 MSK 2009


---
 dlls/ntoskrnl.exe/ntoskrnl.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 2fef745..a805bf0 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -497,7 +497,6 @@ static NTSTATUS process_read( DEVICE_OBJECT *device, void *buff, ULONG *size )
     irp = IoAllocateIrp( device->StackSize, FALSE );
     if (irp == NULL)
         return STATUS_NO_MEMORY;
-    irp->MdlAddress = &mdl;
     irp->RequestorMode = UserMode;
     irpsp = irp->Tail.Overlay.s.u.CurrentStackLocation - 1;
     irpsp->DeviceObject = device;
@@ -505,12 +504,19 @@ static NTSTATUS process_read( DEVICE_OBJECT *device, void *buff, ULONG *size )
     irpsp->Parameters.Read.Length = *size;
     device->CurrentIrp = irp;
 
-    mdl.Next = NULL;
-    mdl.Size = 0;
-    mdl.StartVa = buff;
-    mdl.MappedSystemVa = buff;
-    mdl.ByteCount = *size;
-    mdl.ByteOffset = 0;
+    if (device->Flags & DO_DIRECT_IO)
+    {
+        mdl.Next = NULL;
+        mdl.Size = 0;
+        mdl.StartVa = buff;
+        mdl.MappedSystemVa = buff;
+        mdl.ByteCount = *size;
+        mdl.ByteOffset = 0;
+        irp->MdlAddress = &mdl;
+    }
+    else if (device->Flags & DO_BUFFERED_IO)
+        irp->AssociatedIrp.SystemBuffer = buff;
+    else irp->UserBuffer = buff;
 
     KeQueryTickCount( &count );  /* update the global KeTickCount */
     status = __regs_IofCallDriver( device, irp );
-- 
1.6.1.3.GIT



Подробная информация о списке рассылки Wine-patches