- 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.

svn path=/trunk/; revision=41119
This commit is contained in:
Michael Martin 2009-05-25 16:15:33 +00:00
parent 9f8bb1becc
commit 434caf81e7
2 changed files with 39 additions and 5 deletions

View file

@ -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

View file

@ -482,8 +482,19 @@ cleanup:
}
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;
}