[Wine-patches] [eterhack 3/6] ntoskrnl.exe: Initialize Tail.Overlay.OriginalFileObject.

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Ср Май 20 13:01:42 MSD 2009


----------- следующая часть -----------
From cafa8fc8cdf3d74451fc21b3ea844a010c33f568 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 5 May 2009 19:28:34 +0400
Subject: [eterhack 3/6] ntoskrnl.exe: Initialize Tail.Overlay.OriginalFileObject.

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

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 22ccab0..e49915d 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -446,6 +446,7 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff,
 {
     PIRP irp;
     PIO_STACK_LOCATION irpsp;
+    PFILE_OBJECT file;
     NTSTATUS status;
     LARGE_INTEGER count;
     IO_STATUS_BLOCK iosb;
@@ -456,15 +457,25 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff,
 
     TRACE( "ioctl %x device %p in_size %u out_size %u\n", code, device, in_size, *out_size );
 
+    file = ExAllocatePool( NonPagedPool, sizeof(*file) );
+    if (file == NULL)
+        return STATUS_NO_MEMORY;
     irp = IoBuildDeviceIoControlRequest( code, device, in_buff, in_size,
             out_buff, *out_size, FALSE, NULL, &iosb );
     if (irp == NULL)
+    {
+        ExFreePool( file );
         return STATUS_NO_MEMORY;
+    }
     irpsp = irp->Tail.Overlay.s.u.CurrentStackLocation - 1;
     irp->RequestorMode = UserMode;
     irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
+    irp->Tail.Overlay.OriginalFileObject = file;
     irpsp->DeviceObject = device;
     device->CurrentIrp = irp;
+    file->Type = IO_TYPE_FILE;
+    file->Size = sizeof(*file);
+    file->DeviceObject = device;
 
     /* HACK for UPKey.sys */
     if (0x3fc == code) offset = 2;
@@ -1991,6 +2002,7 @@ void WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
         {
             void *buf = irp->AssociatedIrp.SystemBuffer;
             MDL *mdl = irp->MdlAddress;
+            struct _FILE_OBJECT *file = irp->Tail.Overlay.OriginalFileObject;
 
             list_remove( &instance->entry );
             HeapFree( GetProcessHeap(), 0, instance );
@@ -2003,6 +2015,7 @@ void WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
                 memcpy( irp->UserBuffer, buf, irp->IoStatus.Information );
                 ExFreePool( buf );
             }
+            if (file) ExFreePool( file );
             IoFreeIrp( irp );
             break;
         }
-- 
1.6.2.5



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