Helper.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/** @file
*
* VBoxGuest -- VirtualBox Win 2000/XP guest video driver
*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*
*/
// enable backdoor logging
//#define LOG_ENABLED
extern "C"
{
#include <ntddk.h>
}
#include <VBox/VBoxGuestLib.h>
/* the video miniport headers not compatible with the NT DDK headers */
typedef struct _VIDEO_POINTER_ATTRIBUTES
{
// supported.
#include "Helper.h"
/**
* Globals
*/
/* note: should not do that but we can't use these datatypes in the global header */
{
int rc = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevDisplayChangeRequest), VMMDevReq_GetDisplayChangeRequest);
if (VBOX_FAILURE(rc))
{
}
else
{
{
if (xres)
if (yres)
if (bpp)
}
else
{
dprintf(("VBoxVideo::vboxQueryDisplayRequest: ERROR querying display request from VMMDev."
}
}
return bRC;
}
{
int rc = VbglGRAlloc((VMMDevRequestHeader**)&req, sizeof(VMMDevVideoModeSupportedRequest), VMMDevReq_VideoModeSupported);
if (VBOX_FAILURE(rc))
{
}
else
{
{
}
else
{
dprintf(("VBoxVideo::vboxLikesVideoMode: ERROR querying video mode supported status from VMMDev."
}
}
return bRC;
}
{
dprintf(("VBoxVideo::vboxGetHeightReduction\n"));
int rc = VbglGRAlloc((VMMDevRequestHeader**)&req, sizeof(VMMDevGetHeightReductionRequest), VMMDevReq_GetHeightReduction);
if (VBOX_FAILURE(rc))
{
}
else
{
{
}
else
{
dprintf(("VBoxVideo::vboxGetHeightReduction: ERROR querying height reduction value from VMMDev."
}
}
return retHeight;
}
{
dprintf(("VBoxVideo::vboxQueryPointerPosInternal: pointerXPos = %p, pointerYPos = %p\n", pointerXPos, pointerYPos));
int rc = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReqMouseStatus), VMMDevReq_GetMouseStatus);
if (VBOX_FAILURE(rc))
{
}
else
{
{
{
if (pointerXPos)
{
}
if (pointerYPos)
{
}
}
}
else
{
dprintf(("VBoxVideo::vboxQueryPointerPosInternal: ERROR querying mouse capabilities from VMMDev."
}
}
return bRC;
}
/**
* Return the current absolute mouse position in normalized format
* (between 0 and 0xFFFF).
*
* @returns BOOLEAN success indicator
* @param pointerXPos address of result variable for x pos
* @param pointerYPos address of result variable for y pos
*/
{
if (!pointerXPos || !pointerYPos)
{
return FALSE;
}
}
/**
* Returns whether the host wants us to take absolute coordinates.
*
* @returns BOOLEAN TRUE if the host wants to send absolute coordinates.
*/
{
}
{
if (winVersion != UNKNOWN_WINVERSION)
return winVersion;
dprintf(("VBoxVideo::vboxQueryWinVersion: running on Windows NT version %d.%d, build %d\n",
if (majorVersion >= 5)
{
if (minorVersion >= 1)
{
winVersion = WINXP;
} else
{
winVersion = WIN2K;
}
} else
if (majorVersion == 4)
{
winVersion = WINNT4;
} else
{
dprintf(("VBoxVideo::vboxQueryWinVersion: NT4 required!\n"));
}
return winVersion;
}
/**
* Sends the pointer shape to the VMMDev
*
* @returns success indicator
* @param pointerAttr pointer description
*/
{
{
}
{
dprintf(("vboxUpdatePointerShape: calculated pointer data size is too big (%d bytes, limit %d)\n",
return FALSE;
}
int rc = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReqMousePointer) + cbData, VMMDevReq_SetPointerShape);
if (VBOX_FAILURE(rc))
{
}
else
{
/* We have our custom flags in the field */
/* Even if pointer is invisible, we have to pass following data,
* so host could create the pointer with initial status - invisible
*/
{
/* copy the actual pointer data */
}
{
}
else
{
dprintf(("VBoxVideo::vboxUpdatePointerShape: ERROR querying mouse capabilities from VMMDev."
}
}
return bRC;
}