VBoxMFInternal.cpp revision e12a4168124cdb9ebd1f61bc4a93f765bf399bef
/* $Id$ */
/** @file
* VBox Mouse filter internal functions
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "VBoxMF.h"
#include <VBox/VBoxGuestLib.h>
typedef struct _VBoxGlobalContext
{
volatile LONG cDevicesStarted;
volatile LONG fVBGLInited;
volatile LONG fVBGLInitFailed;
volatile LONG fHostInformed;
volatile LONG fHostMouseFound;
static BOOLEAN vboxIsVBGLInited(void)
{
}
static BOOLEAN vboxIsVBGLInitFailed (void)
{
}
static BOOLEAN vboxIsHostInformed(void)
{
}
static BOOLEAN vboxIsHostMouseFound(void)
{
}
{
LOGF_ENTER();
/* One time Vbgl initialization */
if (callCnt == 1)
{
if (!vboxIsVBGLInited() && !vboxIsVBGLInitFailed())
{
if (RT_SUCCESS(rc))
{
LOG(("VBGL init OK"));
}
else
{
}
}
}
if (!vboxIsHostMouseFound())
{
if (!NT_SUCCESS(rc))
{
return;
}
/* Check if device claims IO port 0x60 or int12 */
{
LOG(("FullDescriptor[%i]: IfType %d, Bus %d, Ver %d, Rev %d, Count %d",
{
CM_PARTIAL_RESOURCE_DESCRIPTOR *pPartialDescriptor = &pFullDescriptor->PartialResourceList.PartialDescriptors[j];
LOG(("PartialDescriptor[%d]: type %d, ShareDisposition %d, Flags 0x%04X, Start 0x%llx, length 0x%x",
switch(pPartialDescriptor->Type)
{
case CmResourceTypePort:
{
{
}
break;
}
case CmResourceTypeInterrupt:
{
{
}
break;
}
default:
{
break;
}
}
}
}
if (bDetected)
{
* For this device the filter will query absolute mouse coords from the host.
*/
LOG(("Host mouse found"));
}
}
LOGF_LEAVE();
}
{
LOGF_ENTER();
if (!vboxIsVBGLInited())
{
WARN(("!vboxIsVBGLInited"));
return;
}
/* Inform host we support absolute coordinates */
{
int rc = VbglGRAlloc((VMMDevRequestHeader **)&req, sizeof(VMMDevReqMouseStatus), VMMDevReq_SetMouseStatus);
if (RT_SUCCESS(rc))
{
req->pointerXPos = 0;
req->pointerYPos = 0;
if (RT_SUCCESS(rc))
{
}
else
{
}
}
else
{
}
}
/* Preallocate request to be used in VBoxServiceCB*/
{
int rc = VbglGRAlloc((VMMDevRequestHeader **)&req, sizeof(VMMDevReqMouseStatus), VMMDevReq_GetMouseStatus);
if (RT_SUCCESS(rc))
{
}
else
{
}
}
LOGF_LEAVE();
}
{
LOGF_ENTER();
/* Save the allocated request pointer and clear the devExt. */
VMMDevReqMouseStatus *pSCReq = (VMMDevReqMouseStatus *) InterlockedExchangePointer((PVOID volatile *)&pDevExt->pSCReq, NULL);
{
// tell the VMM that from now on we can't handle absolute coordinates anymore
int rc = VbglGRAlloc((VMMDevRequestHeader **)&req, sizeof(VMMDevReqMouseStatus), VMMDevReq_SetMouseStatus);
if (RT_SUCCESS(rc))
{
req->mouseFeatures = 0;
req->pointerXPos = 0;
req->pointerYPos = 0;
if (RT_FAILURE(rc))
{
}
}
else
{
}
}
if (pSCReq)
{
}
if (callCnt == 0)
{
if (vboxIsVBGLInited())
{
/* Set the flag to prevent reinitializing of the VBGL. */
/* The VBGL is now in the not initialized state. */
}
}
LOGF_LEAVE();
}