VBoxGuest.h revision 5b452e49d0ffacfeadda3d0c085bc0a66ffdc5bb
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * VBoxGuest - VirtualBox Guest Additions interface
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * available from http://www.virtualbox.org. This file is free software;
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * you can redistribute it and/or modify it under the terms of the GNU
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * General Public License (GPL) as published by the Free Software
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * The contents of this file may alternatively be used under the terms
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * of the Common Development and Distribution License Version 1.0
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * VirtualBox OSE distribution, in which case the provisions of the
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * CDDL are applicable instead of those of the GPL.
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * You may elect to license modified versions of this file under the
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * terms and conditions of either the GPL or the CDDL or both.
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * additional information or have any questions.
20fc4a350a4a8e56ffaac6cf57dcd677a7ac36c5vboxsync/*******************************************************************************
152b12e401b58b34fbdbf2a4510152b67884ee89vboxsync* Defined Constants And Macros *
20fc4a350a4a8e56ffaac6cf57dcd677a7ac36c5vboxsync*******************************************************************************/
152b12e401b58b34fbdbf2a4510152b67884ee89vboxsync/** @todo The following is a temporary fix for the problem of accessing
b2ce45796dce5018f423e5b3909eb4b36f83f073vboxsync hypervisor pointers from within guest additions */
b2ce45796dce5018f423e5b3909eb4b36f83f073vboxsync/** Hypervisor linear pointer size type */
b2ce45796dce5018f423e5b3909eb4b36f83f073vboxsync/* @todo support 64 bits virtual addresses (interface change) */
b2ce45796dce5018f423e5b3909eb4b36f83f073vboxsync/** Hypervisor physical pointer size type */
b2ce45796dce5018f423e5b3909eb4b36f83f073vboxsync/* @todo support 64 bits physical addresses (interface change) */
152b12e401b58b34fbdbf2a4510152b67884ee89vboxsync/** The support device name. */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** The support device name. */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** The support device name. */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync# define VBOXGUEST_DEVICE_NAME "/devices/pci@0,0/pci80ee,cafe@4:vboxguest"
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** The support service name. */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** Win32 Device name. */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** Global name for Win2k+ */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync# define VBOXGUEST_DEVICE_NAME_GLOBAL "\\\\.\\Global\\VBoxGuest"
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** Win32 driver name */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync# define VBOXGUEST_DEVICE_NAME_NT L"\\Device\\VBoxGuest"
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** device name */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync# define VBOXGUEST_DEVICE_NAME_DOS L"\\DosDevices\\VBoxGuest"
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** The support device name. */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/* PORTME */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** VirtualBox vendor ID */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** VMMDev PCI card identifiers */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** VirtualBox graphics card identifiers */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * VBoxGuest port definitions
152b12e401b58b34fbdbf2a4510152b67884ee89vboxsync/** guest can (== wants to) handle absolute coordinates */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync#define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0)
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** host can (== wants to) send absolute coordinates */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync#define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync#define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER RT_BIT(3)
152b12e401b58b34fbdbf2a4510152b67884ee89vboxsync/** fictive start address of the hypervisor physical memory for MmMapIoSpace */
c33cfc3b3717e118f6e786433bd3725c33f2b8f8vboxsync * VMMDev Generic Request Interface
90ec75021ad8bca45729eedf9d3de4726381bb9dvboxsync/** port for generic request interface */
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/** Current version of the VMMDev interface.
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * Additions are allowed to work only if
152b12e401b58b34fbdbf2a4510152b67884ee89vboxsync * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
152b12e401b58b34fbdbf2a4510152b67884ee89vboxsync * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync * @remark These defines also live in the 16-bit and assembly versions of this header.
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync#define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync/* Maximum request packet size */
ae7831c5adb71bdf2ef86aa7aa8dc19402b3345evboxsync * VMMDev request types.
b2ce45796dce5018f423e5b3909eb4b36f83f073vboxsync * @note when updating this, adjust vmmdevGetRequestSize() as well
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsynctypedef enum
75fb03f8c1ac60d0449d333b78ec1ef08fcc9868vboxsync /** @todo implement on host side */
#ifdef VBOX_HGCM
/** mouse pointer shape/visibility change request */
} VMMDevEvents;
typedef struct VBoxGuestInfo
typedef struct VBoxGuestStatistics
bool fSupported;
#pragma pack()
#ifdef VBOX_HGCM
typedef struct _VMMDevHGCMRequestHeader
typedef struct HGCMSERVICELOCATION
typedef struct _HGCMFUNCTIONPARAMETER
} Pointer;
#pragma pack()
typedef struct _VMMDevVideoAccelEnable
typedef struct _VMMDevVideoAccelFlush
typedef struct _VMMDevVideoSetVisibleRegion
VMMDev_Seamless_Visible_Region = 1, /* visible region mode; only top-level guest windows displayed */
VMMDev_Seamless_Host_Window = 2 /* windowed mode; each top-level guest window is represented in a host window */
#pragma pack()
typedef struct _VBVACMDHDR
int16_t x;
int16_t y;
uint16_t w;
uint16_t h;
} VBVACMDHDR;
#pragma pack()
typedef struct _VBVARECORD
} VBVARECORD;
typedef struct _VBVAMEMORY
} VBVAMEMORY;
#pragma pack()
bool fHaveEvents;
} V1_04;
} V1_03;
} VMMDevMemory;
#pragma pack()
* bet was copied from my SUPDRVIOC.h once upon a time (although the concept of
* More info can be found in SUPDRVIOC.h and related sources.
#ifdef RT_ARCH_AMD64
# define VBOXGUEST_IOCTL_FLAG 0
typedef struct VBGLBIGREQ
} VBGLBIGREQ;
#if defined(RT_OS_WINDOWS)
# define VBOXGUEST_IOCTL_CODE(Function, Size) _IOWRN('V', (Function) | VBOXGUEST_IOCTL_FLAG, sizeof(VBGLBIGREQ))
# define VBOXGUEST_IOCTL_CODE(Function, Size) _IOC(_IOC_READ|_IOC_WRITE, 'V', (Function) | VBOXGUEST_IOCTL_FLAG, (Size))
#elif defined(RT_OS_FREEBSD) /** @todo r=bird: Please do it like SUPDRVIOC to keep it as similar as possible. */
# define VBOXGUEST_IOCTL_CODE(Function, Size) _IOWR('V', (Function) | VBOXGUEST_IOCTL_FLAG, VBGLBIGREQ)
#ifdef VBOXGUEST_IOCTL_CODE
# define IOCTL_VBOXGUEST_GETVMMDEVPORT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2048, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestPortInfo))
typedef struct _VBoxGuestPortInfo
#ifdef VBOXGUEST_IOCTL_CODE
# define IOCTL_VBOXGUEST_WAITEVENT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2049, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestWaitEventInfo))
#ifdef VBOXGUEST_IOCTL_CODE
# define VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2054, METHOD_BUFFERED, FILE_WRITE_ACCESS, 0)
#define VBOXGUEST_WAITEVENT_OK (0)
typedef struct _VBoxGuestWaitEventInfo
#ifdef VBOXGUEST_IOCTL_CODE
# define IOCTL_VBOXGUEST_VMMREQUEST IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2050, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VMMDevRequestHeader))
typedef struct _VBoxGuestFilterMaskInfo
#pragma pack()
#ifdef VBOXGUEST_IOCTL_CODE
# define IOCTL_VBOXGUEST_CTL_FILTER_MASK IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2051, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof (VBoxGuestFilterMaskInfo))
#ifdef VBOXGUEST_IOCTL_CODE
# define IOCTL_VBOXGUEST_CTL_CHECK_BALLOON IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2052, METHOD_BUFFERED, FILE_WRITE_ACCESS, 0)
#ifdef VBOXGUEST_IOCTL_CODE
# define VBOXGUEST_IOCTL_LOG(Size) IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2055, METHOD_BUFFERED, FILE_WRITE_ACCESS, (Size))
#ifdef VBOX_HGCM
typedef struct _VBoxGuestHGCMConnectInfo
typedef struct _VBoxGuestHGCMDisconnectInfo
typedef struct _VBoxGuestHGCMCallInfo
#pragma pack()
#ifdef VBOXGUEST_IOCTL_CODE
# define VBOXGUEST_IOCTL_HGCM_DISCONNECT VBOXGUEST_IOCTL_CODE(17, sizeof(VBoxGuestHGCMDisconnectInfo))
# define IOCTL_VBOXGUEST_HGCM_CONNECT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3072, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestHGCMConnectInfo))
# define IOCTL_VBOXGUEST_HGCM_DISCONNECT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3073, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestHGCMDisconnectInfo))
# define IOCTL_VBOXGUEST_HGCM_CALL IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3074, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestHGCMCallInfo))
# define IOCTL_VBOXGUEST_CLIPBOARD_CONNECT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3075, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(uint32_t))
#define VBOXGUEST_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VBoxGuestHGCMCallInfo)))
typedef struct _VMMDevCredentials
#pragma pack()
switch (requestType)
case VMMDevReq_GetMouseStatus:
case VMMDevReq_SetMouseStatus:
return sizeof(VMMDevReqMouseStatus);
return sizeof(VMMDevReqMousePointer);
case VMMDevReq_GetHostVersion:
return sizeof(VMMDevReqHostVersion);
case VMMDevReq_Idle:
return sizeof(VMMDevReqIdle);
case VMMDevReq_GetHostTime:
return sizeof(VMMDevReqHostTime);
return sizeof(VMMDevReqHypervisorInfo);
case VMMDevReq_SetPowerStatus:
return sizeof(VMMDevPowerStateRequest);
return sizeof(VMMDevEvents);
return sizeof(VMMDevReportGuestInfo);
return sizeof(VMMDevDisplayChangeRequest);
return sizeof(VMMDevDisplayChangeRequest2);
return sizeof(VMMDevVideoModeSupportedRequest);
return sizeof(VMMDevGetHeightReductionRequest);
return sizeof(VMMDevReqGuestCapabilities);
return sizeof(VMMDevReqGuestCapabilities2);
#ifdef VBOX_HGCM
case VMMDevReq_HGCMConnect:
return sizeof(VMMDevHGCMConnect);
case VMMDevReq_HGCMDisconnect:
return sizeof(VMMDevHGCMDisconnect);
case VMMDevReq_HGCMCall:
return sizeof(VMMDevHGCMCall);
return sizeof(VMMDevVideoAccelEnable);
return sizeof(VMMDevVideoAccelFlush);
return sizeof(VMMDevVideoSetVisibleRegion);
return sizeof(VMMDevSeamlessChangeRequest);
return sizeof(VMMDevCredentials);
return sizeof(VMMDevReportGuestStats);
return sizeof(VMMDevGetMemBalloonChangeRequest);
return sizeof(VMMDevGetStatisticsChangeRequest);
return sizeof(VMMDevChangeMemBalloon);
return sizeof(VMMDevVRDPChangeRequest);
case VMMDevReq_LogString:
return sizeof(VMMDevReqLogString);
if (!req)
return VERR_INVALID_PARAMETER;
if (!requestSize)
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
#ifdef RT_OS_OS2
typedef struct VBOXGUESTOS2IDCCONNECT
DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned);
#ifdef IN_RING3
# ifdef ___iprt_time_h
VBGLR3DECL(int) VbglR3ClipboardGetHostMsg(uint32_t u32ClientId, uint32_t *pMsg, uint32_t *pfFormats);
VBGLR3DECL(int) VbglR3ClipboardReadData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
VBGLR3DECL(int) VbglR3ClipboardWriteData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb);
VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvImg, size_t cbImg);
VBGLR3DECL(int) VbglR3GetLastDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay);
VBGLR3DECL(int) VbglR3DisplayChangeWaitEvent(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay);