[Wine-patches] [eterhack] ntoskrnl: Allocate MDL dynamically. (eterbug #10621).

Dmitry Timoshkov dtimoshkov на etersoft.ru
Ср Ноя 11 08:23:21 MSK 2015


---
 dlls/ntoskrnl.exe/ntoskrnl.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 3bcdc86..90a67bb 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -857,7 +857,6 @@ static NTSTATUS process_read( DEVICE_OBJECT *device, void *buff, ULONG *size )
     PIO_STACK_LOCATION irpsp;
     NTSTATUS status;
     LARGE_INTEGER count;
-    MDL mdl;
 
     irp = IoAllocateIrp( device->StackSize, FALSE );
     if (irp == NULL)
@@ -870,16 +869,7 @@ static NTSTATUS process_read( DEVICE_OBJECT *device, void *buff, ULONG *size )
     device->CurrentIrp = irp;
 
     if (device->Flags & DO_DIRECT_IO)
-    {
-        mdl.Next = NULL;
-        mdl.Size = sizeof(mdl);
-        mdl.MdlFlags = MDL_PAGES_LOCKED;
-        mdl.StartVa = buff;
-        mdl.MappedSystemVa = buff;
-        mdl.ByteCount = *size;
-        mdl.ByteOffset = 0;
-        irp->MdlAddress = &mdl;
-    }
+        IoAllocateMdl( buff, *size, FALSE, FALSE, irp );
     else if (device->Flags & DO_BUFFERED_IO)
         irp->AssociatedIrp.SystemBuffer = buff;
     else irp->UserBuffer = buff;
@@ -897,7 +887,6 @@ static NTSTATUS process_write( DEVICE_OBJECT *device, void *buff, ULONG *size )
     PIO_STACK_LOCATION irpsp;
     NTSTATUS status;
     LARGE_INTEGER count;
-    MDL mdl;
 
     irp = IoAllocateIrp( device->StackSize, FALSE );
     if (irp == NULL)
@@ -910,16 +899,7 @@ static NTSTATUS process_write( DEVICE_OBJECT *device, void *buff, ULONG *size )
     device->CurrentIrp = irp;
 
     if (device->Flags & DO_DIRECT_IO)
-    {
-        mdl.Next = NULL;
-        mdl.Size = sizeof(mdl);
-        mdl.MdlFlags = MDL_PAGES_LOCKED;
-        mdl.StartVa = buff;
-        mdl.MappedSystemVa = buff;
-        mdl.ByteCount = *size;
-        mdl.ByteOffset = 0;
-        irp->MdlAddress = &mdl;
-    }
+        IoAllocateMdl( buff, *size, FALSE, FALSE, irp );
     else if (device->Flags & DO_BUFFERED_IO)
         irp->AssociatedIrp.SystemBuffer = buff;
     else irp->UserBuffer = buff;
-- 
2.6.3



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