[Wine-patches] ntoskrnl.exe: Fix mountmgr.sys crash.
Alexander Morozov
=?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Ср Окт 29 19:43:12 MSK 2008
Патч к eterhack.
http://bugs.etersoft.ru/show_bug.cgi?id=2754
----------- следующая часть -----------
From a6bf35e70ed63fa8abb58f43808746327c5e334e Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Wed, 29 Oct 2008 19:38:03 +0300
Subject: [PATCH] ntoskrnl.exe: Fix mountmgr.sys crash.
---
dlls/ntoskrnl.exe/ntoskrnl.c | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index e7a884f..52139bd 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -152,9 +152,8 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff,
--irp->CurrentLocation;
irpsp = --irp->Tail.Overlay.s.u.CurrentStackLocation;
- switch (code & 3)
+ if (METHOD_BUFFERED == code & 3)
{
- case METHOD_BUFFERED:
buf = ExAllocatePool( NonPagedPool, (*out_size > in_size) ? *out_size : in_size );
if (buf == NULL)
{
@@ -163,29 +162,32 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff,
}
memcpy( buf, in_buff, in_size );
irp->AssociatedIrp.SystemBuffer = buf;
- irp->UserBuffer = out_buff;
- break;
- case METHOD_NEITHER:
- irpsp->Parameters.DeviceIoControl.Type3InputBuffer = in_buff;
- irp->UserBuffer = out_buff;
- break;
- default:
- irp->AssociatedIrp.SystemBuffer = in_buff;
- irp->MdlAddress = &mdl;
- mdl.Next = NULL;
- mdl.Size = 0;
- mdl.StartVa = out_buff;
- mdl.ByteCount = *out_size;
- mdl.ByteOffset = 0;
}
+ else
+ irp->AssociatedIrp.SystemBuffer = in_buff;
+
+ /* When METHOD_BUFFERED is used MdlAddress and Type3InputBuffer
+ are equal to NULL on Windows XP. But we initialize them
+ for compatibility with mountmgr.sys from winehq.org. */
irp->RequestorMode = UserMode;
+ irp->UserBuffer = out_buff;
+ irp->MdlAddress = &mdl;
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
+
irpsp->MajorFunction = IRP_MJ_DEVICE_CONTROL;
irpsp->Parameters.DeviceIoControl.OutputBufferLength = *out_size;
irpsp->Parameters.DeviceIoControl.InputBufferLength = in_size;
irpsp->Parameters.DeviceIoControl.IoControlCode = code;
+ irpsp->Parameters.DeviceIoControl.Type3InputBuffer = in_buff;
irpsp->DeviceObject = device;
+
+ mdl.Next = NULL;
+ mdl.Size = 0;
+ mdl.StartVa = out_buff;
+ mdl.ByteCount = *out_size;
+ mdl.ByteOffset = 0;
+
device->CurrentIrp = irp;
KeQueryTickCount( &count ); /* update the global KeTickCount */
--
1.5.6.5.GIT
Подробная информация о списке рассылки Wine-patches