Author: mjmartin
Date: Mon May 25 20:15:33 2009
New Revision: 41119
URL:
http://svn.reactos.org/svn/reactos?rev=41119&view=rev
Log:
- i8042MouInternalDeviceControl: Implement IoControlCode of
IOCTL_INTERNAL_I8042_HOOK_MOUSE.
- ForwardIrpAndWait: Don't use IoForwardIrpSynchronously to Forward IRPs as it fails
if no next stack location is available, which prevents the mouse from initializing.
Changed it to match implementation of our other input drivers. Mouse pointer now works
with VBoxMouse driver loaded.
Modified:
trunk/reactos/drivers/input/i8042prt/misc.c
trunk/reactos/drivers/input/i8042prt/mouse.c
Modified: trunk/reactos/drivers/input/i8042prt/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/i8042prt/mis…
==============================================================================
--- trunk/reactos/drivers/input/i8042prt/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/input/i8042prt/misc.c [iso-8859-1] Mon May 25 20:15:33 2009
@@ -11,20 +11,43 @@
#include "i8042prt.h"
/* FUNCTIONS *****************************************************************/
+static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
+
+static NTSTATUS NTAPI
+ForwardIrpAndWaitCompletion(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PVOID Context)
+{
+ if (Irp->PendingReturned)
+ KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
+ return STATUS_MORE_PROCESSING_REQUIRED;
+}
NTSTATUS NTAPI
ForwardIrpAndWait(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
+ KEVENT Event;
+ NTSTATUS Status;
PDEVICE_OBJECT LowerDevice =
((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
-
ASSERT(LowerDevice);
- if (!IoForwardIrpSynchronously(LowerDevice, Irp))
- return STATUS_UNSUCCESSFUL;
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+ IoCopyCurrentIrpStackLocationToNext(Irp);
- return Irp->IoStatus.Status;
+ IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
+
+ Status = IoCallDriver(LowerDevice, Irp);
+ if (Status == STATUS_PENDING)
+ {
+ Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
+ if (NT_SUCCESS(Status))
+ Status = Irp->IoStatus.Status;
+ }
+
+ return Status;
}
NTSTATUS NTAPI
Modified: trunk/reactos/drivers/input/i8042prt/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/i8042prt/mou…
==============================================================================
--- trunk/reactos/drivers/input/i8042prt/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/input/i8042prt/mouse.c [iso-8859-1] Mon May 25 20:15:33 2009
@@ -482,8 +482,19 @@
}
case IOCTL_INTERNAL_I8042_HOOK_MOUSE:
{
+ PINTERNAL_I8042_HOOK_MOUSE MouseHook;
TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL /
IOCTL_INTERNAL_I8042_HOOK_MOUSE\n");
- /* Nothing to do here */
+ if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
+ {
+ Status = STATUS_INVALID_PARAMETER;
+ break;
+ }
+ MouseHook =
(PINTERNAL_I8042_HOOK_MOUSE)Stack->Parameters.DeviceIoControl.Type3InputBuffer;
+
+ DeviceExtension->MouseHook.Context = MouseHook->Context;
+ if (MouseHook->IsrRoutine)
+ DeviceExtension->MouseHook.IsrRoutine = MouseHook->IsrRoutine;
+
Status = STATUS_SUCCESS;
break;
}