VBoxGuest.h revision ba2e65ca2c6ee70366bca6b355a22b44899490e7
/** @file
* VBoxGuest - VirtualBox Guest Additions interface
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___VBox_VBoxGuest_h
#define ___VBox_VBoxGuest_h
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** @todo The following is a temporary fix for the problem of accessing
hypervisor pointers from within guest additions */
/** Hypervisor linear pointer size type */
/* @todo support 64 bits virtual addresses (interface change) */
typedef RTGCPTR32 vmmDevHypPtr;
/** Hypervisor physical pointer size type */
/* @todo support 64 bits physical addresses (interface change) */
typedef RTGCPHYS32 vmmDevHypPhys;
#if defined(RT_OS_LINUX)
/** The support device name. */
# define VBOXGUEST_DEVICE_NAME "/dev/vboxadd"
/** The support device name. */
# define VBOXGUEST_DEVICE_NAME "\\Dev\\VBoxGst$"
#elif defined(RT_OS_SOLARIS)
/** The support device name. */
# define VBOXGUEST_DEVICE_NAME "/devices/pci@0,0/pci80ee,cafe@4:vboxguest"
#elif defined(RT_OS_WINDOWS)
/** The support service name. */
# define VBOXGUEST_SERVICE_NAME "VBoxGuest"
/** Win32 Device name. */
# define VBOXGUEST_DEVICE_NAME "\\\\.\\VBoxGuest"
/** Global name for Win2k+ */
# define VBOXGUEST_DEVICE_NAME_GLOBAL "\\\\.\\Global\\VBoxGuest"
/** Win32 driver name */
# define VBOXGUEST_DEVICE_NAME_NT L"\\Device\\VBoxGuest"
/** device name */
# define VBOXGUEST_DEVICE_NAME_DOS L"\\DosDevices\\VBoxGuest"
#elif defined(RT_OS_FREEBSD)
/** The support device name. */
# define VBOXGUEST_DEVICE_NAME "/dev/vboxguest"
#else
/* PORTME */
#endif
/** VirtualBox vendor ID */
#define VBOX_PCI_VENDORID (0x80ee)
/** VMMDev PCI card identifiers */
#define VMMDEV_VENDORID VBOX_PCI_VENDORID
#define VMMDEV_DEVICEID (0xcafe)
/** VirtualBox graphics card identifiers */
#define VBOX_VENDORID VBOX_PCI_VENDORID
#define VBOX_VESA_VENDORID VBOX_PCI_VENDORID
#define VBOX_DEVICEID (0xbeef)
#define VBOX_VESA_DEVICEID (0xbeef)
/**
* VBoxGuest port definitions
* @{
*/
/** guest can (== wants to) handle absolute coordinates */
#define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0)
/** host can (== wants to) send absolute coordinates */
/** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
/** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
/** fictive start address of the hypervisor physical memory for MmMapIoSpace */
#define HYPERVISOR_PHYSICAL_START 0xf8000000
/*
* VMMDev Generic Request Interface
*/
/** port for generic request interface */
#define PORT_VMMDEV_REQUEST_OFFSET 0
/** Current version of the VMMDev interface.
*
* Additions are allowed to work only if
* additions_major == vmmdev_current && additions_minor <= vmmdev_current.
* Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
*
* @remark These defines also live in the 16-bit and assembly versions of this header.
*/
#define VMMDEV_VERSION 0x00010004
/* Maximum request packet size */
#define VMMDEV_MAX_VMMDEVREQ_SIZE _1M
/**
* VMMDev request types.
* @note when updating this, adjust vmmdevGetRequestSize() as well
*/
typedef enum
{
/** @todo implement on host side */
VMMDevReq_Idle = 5,
VMMDevReq_GetHostTime = 10,
VMMDevReq_SetPowerStatus = 30,
#ifdef VBOX_HGCM
VMMDevReq_HGCMConnect = 60,
VMMDevReq_HGCMDisconnect = 61,
#ifdef VBOX_WITH_64_BITS_GUESTS
VMMDevReq_HGCMCall32 = 62,
VMMDevReq_HGCMCall64 = 63,
#else
VMMDevReq_HGCMCall = 62,
#endif /* VBOX_WITH_64_BITS_GUESTS */
VMMDevReq_HGCMCancel = 64,
#endif
VMMDevReq_QueryCredentials = 100,
VMMDevReq_ReportGuestStats = 110,
VMMDevReq_ChangeMemBalloon = 113,
VMMDevReq_LogString = 200,
VMMDevReq_SizeHack = 0x7fffffff
#ifdef VBOX_WITH_64_BITS_GUESTS
/*
* Constants and structures are redefined for the guest.
*
* Host code MUST always use either *32 or *64 variant explicitely.
* Host source code will use VBOX_HGCM_HOST_CODE define to catch undefined
* data types and constants.
*
* This redefinition means that the new additions builds will use
* the *64 or *32 variants depending on the current architecture bit count (ARCH_BITS).
*/
# ifndef VBOX_HGCM_HOST_CODE
# if ARCH_BITS == 64
# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall64
# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall32
# else
# error "Unsupported ARCH_BITS"
# endif
# endif /* !VBOX_HGCM_HOST_CODE */
#endif /* VBOX_WITH_64_BITS_GUESTS */
/** Version of VMMDevRequestHeader structure. */
#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
#pragma pack(4)
/** generic VMMDev request header */
typedef struct
{
/** size of the structure in bytes (including body). Filled by caller */
/** version of the structure. Filled by caller */
/** type of the request */
/** return code. Filled by VMMDev */
/** reserved fields */
/** mouse status request structure */
typedef struct
{
/** header */
/** mouse feature mask */
/** mouse x position */
/** mouse y position */
/** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
* values must be <= 0x8000 and must not be changed.
*/
/** pointer is visible */
#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
/** pointer has alpha channel */
#define VBOX_MOUSE_POINTER_ALPHA (0x0002)
/** pointerData contains new pointer shape */
#define VBOX_MOUSE_POINTER_SHAPE (0x0004)
/** mouse pointer shape/visibility change request */
typedef struct
{
/** header */
/** VBOX_MOUSE_POINTER_* bit flags */
/** x coordinate of hot spot */
/** y coordinate of hot spot */
/** width of the pointer in pixels */
/** height of the pointer in scanlines */
/** Pointer data.
*
****
* The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
*
* For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
* For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
*
* Guest driver must create the AND mask for pointers with alpha channel, so if host does not
* support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
* be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
*
* The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
* therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
* end of any scanline are undefined.
*
* The XOR mask follows the AND mask on the next 4 bytes aligned offset:
* uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
* Bytes in the gap between the AND and the XOR mask are undefined.
* XOR mask scanlines have no gap between them and size of XOR mask is:
* cXor = width * 4 * height.
****
*
* Preallocate 4 bytes for accessing actual data as p->pointerData
*/
char pointerData[4];
/** string log request structure */
typedef struct
{
/** header */
/** variable length string data */
char szString[1];
/** host version request structure */
typedef struct
{
/** header */
/** major version */
/** minor version */
/** build number */
/** guest capabilites structure */
typedef struct
{
/** header */
/** capabilities (VMMDEV_GUEST_*) */
/** guest capabilites structure */
typedef struct
{
/** header */
/** mask of capabilities to be added */
/** mask of capabilities to be removed */
/** idle request structure */
typedef struct
{
/** header */
/** host time request structure */
typedef struct
{
/** header */
/** time in milliseconds since unix epoch. Filled by VMMDev. */
/** hypervisor info structure */
typedef struct
{
/** header */
/** guest virtual address of proposed hypervisor start */
/** hypervisor size in bytes */
/** system power requests */
typedef enum
{
VMMDevPowerState_SizeHack = 0x7fffffff
/** system power status structure */
typedef struct
{
/** header */
/** power state request */
/** pending events structure */
typedef struct
{
/** header */
/** pending event bitmap */
} VMMDevEvents;
/** guest filter mask control */
typedef struct
{
/** header */
/** mask of events to be added to filter */
/** mask of events to be removed from filter */
/** guest information structure */
typedef struct VBoxGuestInfo
{
/** The VMMDev interface version expected by additions. */
/** guest OS type */
/** @todo */
/** guest information structure */
typedef struct
{
/** header */
/** Guest information. */
/** guest statistics values */
#define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
/** guest statistics structure */
typedef struct VBoxGuestStatistics
{
/** Virtual CPU id */
/** Reported statistics */
/** Idle CPU load (0-100) for last interval */
/** Kernel CPU load (0-100) for last interval */
/** User CPU load (0-100) for last interval */
/** Nr of threads */
/** Nr of processes */
/** Nr of handles */
/** Memory load (0-100) */
/** Page size of guest system */
/** Total physical memory (in 4kb pages) */
/** Available physical memory (in 4kb pages) */
/** Ballooned physical memory (in 4kb pages) */
/** Total number of committed memory (which is not necessarily in-use) (in 4kb pages) */
/** Total amount of memory used by the kernel (in 4kb pages) */
/** Total amount of paged memory used by the kernel (in 4kb pages) */
/** Total amount of nonpaged memory used by the kernel (in 4kb pages) */
/** Total amount of memory used for the system cache (in 4kb pages) */
/** Pagefile size (in 4kb pages) */
/** guest statistics command structure */
typedef struct
{
/** header */
/** Guest information. */
/** memory balloon change request structure */
typedef struct
{
/** header */
typedef struct
{
/** header */
/** Physical address (RTGCPHYS) of each page, variable size. */
/** guest statistics interval change request structure */
typedef struct
{
/** header */
/** display change request structure */
typedef struct
{
/** header */
/** horizontal pixel resolution (0 = do not change) */
/** vertical pixel resolution (0 = do not change) */
/** bits per pixel (0 = do not change) */
/** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
* Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
*/
typedef struct
{
/** header */
/** horizontal pixel resolution (0 = do not change) */
/** vertical pixel resolution (0 = do not change) */
/** bits per pixel (0 = do not change) */
/** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
* Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
*/
/** 0 for primary display, 1 for the first secondary, etc. */
/** video mode supported request structure */
typedef struct
{
/** header */
/** horizontal pixel resolution (input) */
/** vertical pixel resolution (input) */
/** bits per pixel (input) */
/** supported flag (output) */
bool fSupported;
/** video modes height reduction request structure */
typedef struct
{
/** header */
/** height reduction in pixels (output) */
#define VRDP_EXPERIENCE_LEVEL_ZERO 0 /* Theming disabled. */
typedef struct
{
/** header */
/** Whether VRDP is active or not */
/** The configured experience level for active VRDP. */
#pragma pack()
#ifdef VBOX_HGCM
/** HGCM flags.
* @{
*/
#define VBOX_HGCM_REQ_DONE (0x1)
#define VBOX_HGCM_REQ_CANCELLED (0x2)
/** @} */
#pragma pack(4)
typedef struct _VMMDevHGCMRequestHeader
{
/** Request header. */
/** HGCM flags. */
/** Result code. */
/** HGCM service location types. */
typedef enum
{
VMMDevHGCMLoc_SizeHack = 0x7fffffff
typedef struct
{
typedef struct HGCMSERVICELOCATION
{
/** Type of the location. */
union
{
} u;
typedef struct
{
/* request header */
/** IN: Description of service to connect to. */
/** OUT: Client identifier assigned by local instance of HGCM. */
typedef struct
{
/* request header */
/** IN: Client identifier. */
typedef enum
{
VMMDevHGCMParmType_SizeHack = 0x7fffffff
#ifdef VBOX_WITH_64_BITS_GUESTS
typedef struct _HGCMFUNCTIONPARAMETER32
{
union
{
struct
{
union
{
} u;
} Pointer;
} u;
typedef struct _HGCMFUNCTIONPARAMETER64
{
union
{
struct
{
union
{
} u;
} Pointer;
} u;
#else
typedef struct _HGCMFUNCTIONPARAMETER
{
union
{
struct
{
union
{
} u;
} Pointer;
} u;
#endif /* VBOX_WITH_64_BITS_GUESTS */
#ifdef VBOX_WITH_64_BITS_GUESTS
/* Redefine the structure type for the guest code. */
# ifndef VBOX_HGCM_HOST_CODE
# if ARCH_BITS == 64
# else
# error "Unsupported sizeof (void *)"
# endif
# endif /* !VBOX_HGCM_HOST_CODE */
#endif /* VBOX_WITH_64_BITS_GUESTS */
typedef struct
{
/* request header */
/** IN: Client identifier. */
/** IN: Service function number. */
/** IN: Number of parameters. */
/** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
#pragma pack()
#define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
#ifdef VBOX_WITH_64_BITS_GUESTS
/* Explicit defines for the host code. */
# ifdef VBOX_HGCM_HOST_CODE
# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
# define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
# endif /* VBOX_HGCM_HOST_CODE */
#endif /* VBOX_WITH_64_BITS_GUESTS */
#define VBOX_HGCM_MAX_PARMS 32
/* The Cancel request is issued using the same physical memory address
* as was used for the corresponding initial HGCMCall.
*/
typedef struct
{
/* request header */
#endif /* VBOX_HGCM */
#define VBVA_F_STATUS_ACCEPTED (0x01)
#define VBVA_F_STATUS_ENABLED (0x02)
#pragma pack(4)
typedef struct _VMMDevVideoAccelEnable
{
/* request header */
/** 0 - disable, !0 - enable. */
/** The size of VBVAMEMORY::au8RingBuffer expected by driver.
* The host will refuse to enable VBVA if the size is not equal to
* VBVA_RING_BUFFER_SIZE.
*/
/** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
typedef struct _VMMDevVideoAccelFlush
{
/* request header */
typedef struct _VMMDevVideoSetVisibleRegion
{
/* request header */
/** Number of rectangles */
/** Rectangle array */
/** Seamless mode */
typedef enum
{
VMMDev_Seamless_Disabled = 0, /* normal mode; entire guest desktop displayed */
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 */
typedef struct
{
/** header */
/** New seamless mode */
/** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
* Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
*/
#pragma pack()
#pragma pack(1)
/** VBVA command header. */
typedef struct _VBVACMDHDR
{
/** Coordinates of affected rectangle. */
int16_t x;
int16_t y;
uint16_t w;
uint16_t h;
} VBVACMDHDR;
#pragma pack()
/* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
* For example big bitmaps which do not fit to the buffer.
*
* Guest starts writing to the buffer by initializing a record entry in the
* aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
* written. As data is written to the ring buffer, the guest increases off32End
* for the record.
*
* The host reads the aRecords on flushes and processes all completed records.
* When host encounters situation when only a partial record presents and
* cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
* the host fetched all record data and updates off32Head. After that on each flush
* the host continues fetching the data until the record is completed.
*
*/
#define VBVA_MAX_RECORDS (64)
#define VBVA_F_MODE_ENABLED (0x00000001)
#define VBVA_F_MODE_VRDP (0x00000002)
#define VBVA_F_MODE_VRDP_RESET (0x00000004)
#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
#define VBVA_F_RECORD_PARTIAL (0x80000000)
#pragma pack(1)
typedef struct _VBVARECORD
{
/** The length of the record. Changed by guest. */
} VBVARECORD;
typedef struct _VBVAMEMORY
{
/** VBVA_F_MODE_* */
/** The offset where the data start in the buffer. */
/** The offset where next data must be placed in the buffer. */
/** The ring buffer for data. */
/** The queue of record descriptions. */
/* RDP orders supported by the client. The guest reports only them
* and falls back to DIRTY rects for not supported ones.
*
* (1 << VBVA_VRDP_*)
*/
} VBVAMEMORY;
#pragma pack()
/** @} */
/**
* VMMDev RAM
* @{
*/
#pragma pack(1)
/** Layout of VMMDEV RAM region that contains information for guest */
typedef struct
{
/** size */
/** version */
union {
/** Flag telling that VMMDev set the IRQ and acknowlegment is required */
struct {
bool fHaveEvents;
} V1_04;
struct {
/** Pending events flags, set by host. */
/** Mask of events the guest wants to see, set by guest. */
} V1_03;
} V;
} VMMDevMemory;
#pragma pack()
/** Version of VMMDevMemory structure. */
#define VMMDEV_MEMORY_VERSION (1)
/** @} */
/**
* VMMDev events.
* @{
*/
/** Host mouse capabilities has been changed. */
#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0)
/** HGCM event. */
/** A display change request has been issued. */
/** Credentials are available for judgement. */
/** The guest has been restored. */
/** Seamless mode state changed */
/** Memory balloon size changed */
/** Statistics interval changed */
/** VRDP status changed. */
/** @} */
/**
* VBoxGuest IOCTL codes and structures.
*
* The range 0..15 is for basic driver communication.
* The range 16..31 is for HGCM communcation.
* The range 32..47 is reserved for future use.
* The range 48..63 is for OS specific communcation.
* The 7th bit is reserved for future hacks.
* The 8th bit is reserved for distinguishing between 32-bit and 64-bit
* processes in future 64-bit guest additions.
*
* While windows IOCTL function number has to start at 2048 and stop at 4096 there
* never was any need to do this for everyone. A simple ((Function) | 0x800) would
* have sufficed. On Linux we're now intruding upon the type field. Fortunately
* this hasn't caused any trouble because the FILE_DEVICE_UNKNOWN value was set
* to 0x22 (if it were 0x2C it would not have worked soo smoothly). The situation
* would've been the same for *BSD and Darwin since they seems to share common
* _IOC() heritage.
*
* However, on good old OS/2 we only have 8-bit handy for the function number. The
* result from using the old IOCTL function numbers her would've been overlapping
* between the two ranges.
*
* To fix this problem and get rid of all the unnecessary windowsy crap that I
* bet was copied from my SUPDRVIOC.h once upon a time (although the concept of
* prefixing macros with the purpose of avoid clashes with system stuff and
* to indicate exactly how owns them seems to have been lost somewhere along
* IOCtls on new ports of the additions.
*
* @remarks When creating new IOCtl interfaces keep in mind that not all OSes supports
* reporting back the output size. (This got messed up a little bit in VBoxDrv.)
*
* The request size is also a little bit tricky as it's passed as part of the
* request code on unix. The size field is 14 bits on Linux, 12 bits on *BSD,
* 13 bits Darwin, and 8-bits on Solaris. All the BSDs and Darwin kernels
* will make use of the size field, while Linux and Solaris will not. We're of
* to be valid.
*
* For Solaris we will have to do something special though, 255 isn't
* sufficent for all we need. A 4KB restriction (BSD) is probably not
* too problematic (yet) as a general one.
*
* More info can be found in SUPDRVIOC.h and related sources.
*
* @remarks If adding interfaces that only has input or only has output, some new macros
* needs to be created so the most efficient IOCtl data buffering method can be
* used.
* @{
*/
#ifdef RT_ARCH_AMD64
# define VBOXGUEST_IOCTL_FLAG 128
#elif defined(RT_ARCH_X86)
# define VBOXGUEST_IOCTL_FLAG 0
#else
# error "dunno which arch this is!"
#endif
/** Ring-3 request wrapper for big requests.
*
* This is necessary because the ioctl number scheme on many Unixy OSes (esp. Solaris)
* only allows a relatively small size to be encoded into the request. So, for big
* request this generic form is used instead. */
typedef struct VBGLBIGREQ
{
/** Magic value (VBGLBIGREQ_MAGIC). */
/** The size of the data buffer. */
/** The user address of the data buffer. */
} VBGLBIGREQ;
/** Pointer to a request wrapper for solaris guests. */
typedef VBGLBIGREQ *PVBGLBIGREQ;
/** Pointer to a const request wrapper for solaris guests. */
typedef const VBGLBIGREQ *PCVBGLBIGREQ;
/** The VBGLBIGREQ::u32Magic value (Ryuu Murakami). */
#define VBGLBIGREQ_MAGIC 0x19520219
#if defined(RT_OS_WINDOWS)
/* @todo Remove IOCTL_CODE later! Integrate it in VBOXGUEST_IOCTL_CODE below. */
/** @todo r=bird: IOCTL_CODE is supposedly defined in some header included by Windows.h or ntddk.h, which is why it wasn't in the #if 0 earlier. See HostDrivers/Support/SUPDrvIOC.h... */
# define VBOXGUEST_IOCTL_CODE(Function, Size) IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2048 + (Function), METHOD_BUFFERED, FILE_WRITE_ACCESS, 0)
/* No automatic buffering, size not encoded. */
# define VBOXGUEST_IOCTL_CATEGORY 0xc2
#elif defined(RT_OS_SOLARIS)
/* No automatic buffering, size limited to 255 bytes => use VBGLBIGREQ for everything. */
# define VBOXGUEST_IOCTL_CODE(Function, Size) _IOWRN('V', (Function) | VBOXGUEST_IOCTL_FLAG, sizeof(VBGLBIGREQ))
#elif defined(RT_OS_LINUX)
/* No automatic buffering, size limited to 16KB. */
# 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)
#else
/* PORTME */
#endif
/** IOCTL to VBoxGuest to query the VMMDev IO port region start. */
#pragma pack(4)
typedef struct _VBoxGuestPortInfo
{
/** IOCTL to VBoxGuest to wait for a VMMDev host notification */
/** IOCTL to VBoxGuest to interrupt (cancel) any pending WAITEVENTs and return.
* Handled inside the guest additions and not seen by the host at all.
* @see VBOXGUEST_IOCTL_WAITEVENT */
/**
* Result codes for VBoxGuestWaitEventInfo::u32Result
* @{
*/
/** Successful completion, an event occured. */
#define VBOXGUEST_WAITEVENT_OK (0)
/** Successful completion, timed out. */
#define VBOXGUEST_WAITEVENT_TIMEOUT (1)
/** Wait was interrupted. */
#define VBOXGUEST_WAITEVENT_INTERRUPTED (2)
/** An error occured while processing the request. */
#define VBOXGUEST_WAITEVENT_ERROR (3)
/** @} */
/** Input and output buffers layout of the IOCTL_VBOXGUEST_WAITEVENT */
typedef struct _VBoxGuestWaitEventInfo
{
/** timeout in milliseconds */
/** events to wait for */
/** result code */
/** events occured */
/** IOCTL to VBoxGuest to perform a VMM request
* @remark The data buffer for this IOCtl has an variable size, keep this in mind
* on systems where this matters. */
/** Input and output buffer layout of the IOCTL_VBOXGUEST_CTL_FILTER_MASK. */
typedef struct _VBoxGuestFilterMaskInfo
{
#pragma pack()
/** IOCTL to VBoxGuest to control event filter mask. */
/** IOCTL to VBoxGuest to check memory ballooning. */
/** IOCTL to VBoxGuest to perform backdoor logging. */
#ifdef VBOX_HGCM
/* These structures are shared between the driver and other binaries,
* therefore packing must be defined explicitely.
*/
# pragma pack(1)
typedef struct _VBoxGuestHGCMConnectInfo
{
typedef struct _VBoxGuestHGCMDisconnectInfo
{
typedef struct _VBoxGuestHGCMCallInfo
{
/* Parameters follow in form HGCMFunctionParameter aParms[cParms] */
# pragma pack()
# define VBOXGUEST_IOCTL_HGCM_DISCONNECT VBOXGUEST_IOCTL_CODE(17, sizeof(VBoxGuestHGCMDisconnectInfo))
# define VBOXGUEST_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VBoxGuestHGCMCallInfo)))
#endif /* VBOX_HGCM */
/*
* Credentials request flags and structure
*/
#define VMMDEV_CREDENTIALS_STRLEN 128
/** query from host whether credentials are present */
/** read credentials from host (can be combined with clear) */
/** clear credentials on host (can be combined with read) */
/** read credentials for judgement in the guest */
/** clear credentials for judegement on the host */
/** report credentials acceptance by guest */
/** report credentials denial by guest */
/** report that no judgement could be made by guest */
/** flag telling the guest that credentials are present */
/** flag telling guest that local logons should be prohibited */
/** credentials request structure */
#pragma pack(4)
typedef struct _VMMDevCredentials
{
/* request header */
/* user name (UTF-8) (out) */
/* password (UTF-8) (out) */
/* domain name (UTF-8) (out) */
#pragma pack()
/** inline helper to determine the request size for the given operation */
{
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);
#ifdef VBOX_WITH_64_BITS_GUESTS
case VMMDevReq_HGCMCall32:
return sizeof(VMMDevHGCMCall);
case VMMDevReq_HGCMCall64:
return sizeof(VMMDevHGCMCall);
#else
case VMMDevReq_HGCMCall:
return sizeof(VMMDevHGCMCall);
#endif /* VBOX_WITH_64_BITS_GUESTS */
case VMMDevReq_HGCMCancel:
return sizeof(VMMDevHGCMCancel);
#endif /* VBOX_HGCM */
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);
default:
return 0;
}
}
/**
* Initializes a request structure.
*
*/
{
if (!req)
return VERR_INVALID_PARAMETER;
if (!requestSize)
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
}
#ifdef RT_OS_OS2
/**
* The data buffer layout for the IDC entry point (AttachDD).
*
* @remark This is defined in multiple 16-bit headers / sources.
* Some places it's called VBGOS2IDC to short things a bit.
*/
typedef struct VBOXGUESTOS2IDCCONNECT
{
/** VMMDEV_VERSION. */
/** Opaque session handle. */
/**
* The 32-bit service entry point.
*
* @returns VBox status code.
* @param u32Session The above session handle.
* @param iFunction The requested function.
* cannot be swapped out, or that it's acceptable to take a
* page in fault in the current context. If the request doesn't
* take input or produces output, apssing NULL is okay.
* @param cbData The size of the data buffer.
* @param pcbDataReturned Where to store the amount of data that's returned.
* This can be NULL if pvData is NULL.
*/
DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned);
/** The 16-bit service entry point for C code (cdecl).
*
* It's the same as the 32-bit entry point, but the types has
* changed to 16-bit equivalents.
*
* @code
* int far cdecl
* VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
* void far *fpvData, uint16_t cbData, uint16_t far *pcbDataReturned);
* @endcode
*/
/** The 16-bit service entry point for Assembly code (register).
*
* This is just a wrapper around fpfnServiceEP to simplify calls
* from 16-bit assembly code.
*
* @returns (e)ax: VBox status code; cx: The amount of data returned.
*
* @param u32Session eax - The above session handle.
* @param iFunction dl - The requested function.
* @param cbData cx - The size of the data buffer.
*/
/** Pointer to VBOXGUESTOS2IDCCONNECT buffer. */
/** OS/2 specific: IDC client disconnect request.
*
* This takes no input and it doesn't return anything. Obviously this
* is only recognized if it arrives thru the IDC service EP.
*/
#endif /* RT_OS_OS2 */
/** @} */
#ifdef IN_RING3
/** @def VBGLR3DECL
* Ring 3 VBGL declaration.
* @param type The return type of the function declaration.
*/
/* General-purpose functions */
VBGLR3DECL(int) VbglR3Init(void);
VBGLR3DECL(void) VbglR3Term(void);
# ifdef ___iprt_time_h
# endif
VBGLR3DECL(int) VbglR3InterruptEventWaits(void);
/** @name Shared clipboard
* @{ */
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);
/** @} */
/** @name Seamless mode
* @{ */
/** @} */
/** @name Mouse
* @{ */
/** @} */
/** @name Video
* @{ */
VBGLR3DECL(int) VbglR3VideoAccelFlush(void);
VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvImg, size_t cbImg);
/** @} */
/** @name Display
* @{ */
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);
VBGLR3DECL(int) VbglR3RetrieveVideoMode(const char *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);
/** @} */
#ifdef VBOX_WITH_INFO_SVC
/** @name Information Services
* @{ */
VBGLR3DECL(int) VbglR3InfoSvcReadKey(uint32_t u32ClientId, char *pszKey, char *pszValue, uint32_t cbValue, uint32_t *pcbActual);
/** @} */
#endif /* VBOX_WITH_INFO_SVC defined */
#endif /* IN_RING3 */
#endif