VBoxGuestLib.h revision b44fa12aab2fcc2152e27180860f47eeb43c11d8
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * VBoxGuestLib - VirtualBox Guest Additions Library.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * available from http://www.virtualbox.org. This file is free software;
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * you can redistribute it and/or modify it under the terms of the GNU
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * General Public License (GPL) as published by the Free Software
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * The contents of this file may alternatively be used under the terms
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * of the Common Development and Distribution License Version 1.0
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * VirtualBox OSE distribution, in which case the provisions of the
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * CDDL are applicable instead of those of the GPL.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * You may elect to license modified versions of this file under the
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * terms and conditions of either the GPL or the CDDL or both.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync * additional information or have any questions.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync/** @defgroup grp_guest_lib VirtualBox Guest Additions Library
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync/** @page pg_guest_lib VirtualBox Guest Library
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * This is a library for abstracting the additions driver interface. There are
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * multiple versions of the library depending on the context. The main
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * distinction is between kernel and user mode where the interfaces are very
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * different.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * @section sec_guest_lib_ring0 Ring-0
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * In ring-0 there are two version:
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - VBOX_LIB_VBGL_R0_BASE / VBoxGuestR0LibBase for the VBoxGuest main driver,
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * who is responsible for managing the VMMDev virtual hardware.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - VBOX_LIB_VBGL_R0 / VBoxGuestR0Lib for other (client) guest drivers.
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync * The library source code and the header have a define VBGL_VBOXGUEST, which is
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * defined for VBoxGuest and undefined for other drivers. Drivers must choose
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * right library in their makefiles and set VBGL_VBOXGUEST accordingly.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * The libraries consists of:
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - common code to be used by both VBoxGuest and other drivers;
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - VBoxGuest specific code;
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - code for other drivers which communicate with VBoxGuest via an IOCTL.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * @section sec_guest_lib_ring3 Ring-3
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * There are more variants of the library here:
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - VBOX_LIB_VBGL_R3 / VBoxGuestR3Lib for programs.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - VBOX_LIB_VBGL_R3_XFREE86 / VBoxGuestR3LibXFree86 for old style XFree
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * drivers which uses special loader and or symbol resolving strategy.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * - VBOX_LIB_VBGL_R3_SHARED / VBoxGuestR3LibShared for shared objects / DLLs /
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync/** @defgroup grp_guest_lib_r0 Ring-0 interface.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync#if defined(IN_RING0) && !defined(IN_RING0_AGNOSTIC)
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync/** @def DECLR0VBGL
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * Declare a VBGL ring-0 API with the right calling convention and visibilitiy.
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * @param type Return type. */
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsynctypedef uint32_t VBGLIOPORT; /**< @todo r=bird: We have RTIOPORT (uint16_t) for this. */
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * The library initialization function to be used by the main
c34f9b1d1526bb5e7fa22d868de402fc50c318fevboxsync * VBoxGuest system driver.
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync * @return VBox status code.
DECLVBGL(int) VbglGRAlloc (VMMDevRequestHeader **ppReq, uint32_t cbSize, VMMDevRequestType reqType);
# ifdef VBOX_WITH_HGCM
# ifdef VBGL_VBOXGUEST
typedef DECLVBGL(int) FNVBGLHGCMCALLBACK(VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data);
DECLR0VBGL(int) VbglR0HGCMInternalCall (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
DECLR0VBGL(int) VbglR0HGCMInternalCall32 (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
struct VBGLHGCMHANDLEDATA;
#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) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay, bool fAck);
VBGLR3DECL(int) VbglR3RetrieveVideoMode(const char *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);
# ifdef VBOX_WITH_GUEST_PROPS
VBGLR3DECL(int) VbglR3GuestPropWrite(uint32_t u32ClientId, const char *pszName, const char *pszValue, const char *pszFlags);
VBGLR3DECL(int) VbglR3GuestPropWriteValue(uint32_t u32ClientId, const char *pszName, const char *pszValue);
VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, va_list va);
VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...);
VBGLR3DECL(int) VbglR3GuestPropRead(uint32_t u32ClientId, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue, uint32_t *pcchValueActual);
VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(uint32_t u32ClientId, const char *pszName, char **ppszValue);
VBGLR3DECL(int) VbglR3GuestPropEnumRaw(uint32_t u32ClientId, const char *paszPatterns, char *pcBuf, uint32_t cbBuf, uint32_t *pcbBufActual);
VBGLR3DECL(int) VbglR3GuestPropEnum(uint32_t u32ClientId, char const * const *ppaszPatterns, uint32_t cPatterns, PVBGLR3GUESTPROPENUM *ppHandle,
VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue, uint64_t *pu64Timestamp,
char const **ppszFlags);
VBGLR3DECL(int) VbglR3GuestPropDelSet(uint32_t u32ClientId, char const * const *papszPatterns, uint32_t cPatterns);
VBGLR3DECL(int) VbglR3GuestPropWait(uint32_t u32ClientId, const char *pszPatterns, void *pvBuf, uint32_t cbBuf, uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
VBGLR3DECL(int) VbglR3HostVersionCheckForUpdate(uint32_t u32ClientId, bool *pfUpdate, char **ppszHostVersion, char **ppszGuestVersion);
# ifdef VBOX_WITH_GUEST_CONTROL
VBGLR3DECL(int) VbglR3GuestCtrlGetHostMsg(uint32_t u32ClientId, uint32_t *puMsg, uint32_t *puNumParms, uint32_t u32Timeout);
void *pvData,
VBGLR3DECL(void) VbglR3CredentialsDestroy(char *pszUser, char *pszPassword, char *pszDomain, uint32_t cPasses);
VBGLR3DECL(int) VbglR3CpuHotPlugWaitForEvent(VMMDevCpuEventType *penmEventType, uint32_t *pidCpuCore, uint32_t *pidCpuPackage);
VBGLR3DECL(int) VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule, unsigned cRegions, VMMDevSharedModuleRegion *pRegions);
VBGLR3DECL(int) VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule);