VBoxMouse.cpp revision 35396ee506ef68dd1c161f1ef2c3c0b68a146ff2
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VBoxGuest -- VirtualBox Win32 guest mouse filter driver
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Based on a Microsoft DDK sample
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * additional information or have any questions.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// #define LOG_ENABLED
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// VBOX start
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncNTSTATUS DriverEntry (PDRIVER_OBJECT, PUNICODE_STRING);
ULONG i;
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
return STATUS_SUCCESS;
#ifdef LOG_ENABLED
dprintf ((
devExt->EnableCount, devExt->UpperContext, devExt->UpperIsrHook, devExt->IsrWritePort, devExt->CallContext,
#define dumpDevExt(a) do {} while (0)
typedef struct _VBoxGlobalContext
if ( !vboxIsVBGLInited ()
&& !vboxIsVBGLInitFailed ())
if (!vboxIsHostMouseFound ())
ResultLength = 0;
sizeof (Property),
&Property,
&ResultLength);
dprintf(("VBoxMouse::vboxDeviceAdded: Descriptor %d: InterfaceType %d, BusType %d, list ver %d, list rev %d, count %d\n",
CM_PARTIAL_RESOURCE_DESCRIPTOR *pPartialDescriptor = &pFullDescriptor->PartialResourceList.PartialDescriptors[iPartialDescriptor];
dprintf(("VBoxMouse::vboxDeviceAdded: PartialDescriptor %d: type %d, ShareDisposition %d, Flags 0x%04X, Start 0x%llx, length 0x%x\n",
case CmResourceTypePort:
dprintf(("VBoxMouse::vboxDeviceAdded: PartialDescriptor %d: Port 0x%x\n", iPartialDescriptor, pPartialDescriptor->u.Port.Start.QuadPart));
case CmResourceTypeInterrupt:
dprintf(("VBoxMouse::vboxDeviceAdded: PartialDescriptor %d: Int %ld\n", iPartialDescriptor, pPartialDescriptor->u.Interrupt.Vector));
if (bDetected)
VMMDevReqMouseStatus *reqSC = (VMMDevReqMouseStatus *)InterlockedExchangePointer ((PVOID volatile *)&devExt->reqSC, NULL);
int vboxRC = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReqMouseStatus), VMMDevReq_SetMouseStatus);
if (reqSC)
if (vboxIsVBGLInited ())
VbglTerminate ();
if (vboxIsVBGLInited ())
int vboxRC = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReqMouseStatus), VMMDevReq_SetMouseStatus);
int vboxRC = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReqMouseStatus), VMMDevReq_GetMouseStatus);
PAGED_CODE();
#ifdef LOG_ENABLED
wszProperty[0] = 0;
sizeof (wszProperty),
&ResultLength);
sizeof(DEVICE_EXTENSION),
NULL,
return (status);
return STATUS_DEVICE_NOT_CONNECTED;
dprintf(("VBoxMouse::AddDevice: DevExt = %p, returning from AddDevice with rc = 0x%x\n", devExt, status));
return status;
return STATUS_MORE_PROCESSING_REQUIRED;
PAGED_CODE();
case IRP_MJ_CREATE:
case IRP_MJ_CLOSE:
sizeof(CONNECT_DATA)) {
sizeof(INTERNAL_I8042_HOOK_MOUSE)) {
return status;
PAGED_CODE();
case IRP_MN_START_DEVICE: {
&event,
TRUE,
TRUE,
&event,
case IRP_MN_SURPRISE_REMOVAL:
case IRP_MN_REMOVE_DEVICE:
case IRP_MN_QUERY_STOP_DEVICE:
case IRP_MN_STOP_DEVICE:
case IRP_MN_QUERY_INTERFACE:
case IRP_MN_QUERY_DEVICE_TEXT:
case IRP_MN_QUERY_RESOURCES:
case IRP_MN_READ_CONFIG:
case IRP_MN_WRITE_CONFIG:
case IRP_MN_EJECT:
case IRP_MN_SET_LOCK:
case IRP_MN_QUERY_ID:
return status;
PAGED_CODE();
case IRP_MN_SET_POWER:
case IRP_MN_QUERY_POWER:
case IRP_MN_WAIT_WAKE:
case IRP_MN_POWER_SEQUENCE:
return retVal;
return retVal;
if (req)
inputData++;
PAGED_CODE();