VirtualBox

source: vbox/trunk/include/VBox/VBoxGuestLib.h@ 58181

Last change on this file since 58181 was 58181, checked in by vboxsync, 9 years ago

VBoxGuestLib: Removed misunderstood common/VBoxGuestLib/VBoxGuestR0LibCrOgl.h moving the function prototypes into VBoxGuestLib.h where they belong, after correcting the prefix. Did some more positive thinking excercises.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.5 KB
Line 
1/** @file
2 * VBoxGuestLib - VirtualBox Guest Additions Library.
3 */
4
5/*
6 * Copyright (C) 2006-2015 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_VBoxGuestLib_h
27#define ___VBox_VBoxGuestLib_h
28
29#include <VBox/types.h>
30#include <VBox/VMMDev2.h>
31#include <VBox/VMMDev.h> /* grumble */
32#ifdef IN_RING0
33# include <VBox/VBoxGuest.h>
34# include <VBox/VBoxGuest2.h>
35#endif
36
37
38/** @defgroup grp_vboxguest_lib VirtualBox Guest Additions Library
39 * @ingroup grp_vboxguest
40 * @{
41 */
42
43/** @page pg_guest_lib VirtualBox Guest Library
44 *
45 * This is a library for abstracting the additions driver interface. There are
46 * multiple versions of the library depending on the context. The main
47 * distinction is between kernel and user mode where the interfaces are very
48 * different.
49 *
50 *
51 * @section sec_guest_lib_ring0 Ring-0
52 *
53 * In ring-0 there are two version:
54 * - VBOX_LIB_VBGL_R0_BASE / VBoxGuestR0LibBase for the VBoxGuest main driver,
55 * who is responsible for managing the VMMDev virtual hardware.
56 * - VBOX_LIB_VBGL_R0 / VBoxGuestR0Lib for other (client) guest drivers.
57 *
58 *
59 * The library source code and the header have a define VBGL_VBOXGUEST, which is
60 * defined for VBoxGuest and undefined for other drivers. Drivers must choose
61 * right library in their makefiles and set VBGL_VBOXGUEST accordingly.
62 *
63 * The libraries consists of:
64 * - common code to be used by both VBoxGuest and other drivers;
65 * - VBoxGuest specific code;
66 * - code for other drivers which communicate with VBoxGuest via an IOCTL.
67 *
68 *
69 * @section sec_guest_lib_ring3 Ring-3
70 *
71 * There are more variants of the library here:
72 * - VBOX_LIB_VBGL_R3 / VBoxGuestR3Lib for programs.
73 * - VBOX_LIB_VBGL_R3_XFREE86 / VBoxGuestR3LibXFree86 for old style XFree
74 * drivers which uses special loader and or symbol resolving strategy.
75 * - VBOX_LIB_VBGL_R3_SHARED / VBoxGuestR3LibShared for shared objects / DLLs /
76 * Dylibs.
77 *
78 */
79
80RT_C_DECLS_BEGIN
81
82/** @defgroup grp_vboxguest_lib_r0 Ring-0 interface.
83 * @{
84 */
85#if defined(IN_RING0) && !defined(IN_RING0_AGNOSTIC)
86/** @def DECLR0VBGL
87 * Declare a VBGL ring-0 API with the right calling convention and visibilitiy.
88 * @param type Return type. */
89# ifdef RT_OS_DARWIN /** @todo probably apply to all, but don't want a forest fire on our hands right now. */
90# define DECLR0VBGL(type) DECLHIDDEN(type) VBOXCALL
91# else
92# define DECLR0VBGL(type) type VBOXCALL
93# endif
94# define DECLVBGL(type) DECLR0VBGL(type)
95
96
97# ifdef VBGL_VBOXGUEST
98
99/**
100 * The library initialization function to be used by the main
101 * VBoxGuest system driver.
102 *
103 * @return VBox status code.
104 */
105DECLVBGL(int) VbglInitPrimary(RTIOPORT portVMMDev, struct VMMDevMemory *pVMMDevMemory);
106
107# else
108
109/**
110 * The library initialization function to be used by all drivers
111 * other than the main VBoxGuest system driver.
112 *
113 * @return VBox status code.
114 */
115DECLVBGL(int) VbglInitClient(void);
116
117# endif
118
119/**
120 * The library termination function.
121 */
122DECLVBGL(void) VbglTerminate(void);
123
124
125/** @name Generic request functions.
126 * @{
127 */
128
129/**
130 * Allocate memory for generic request and initialize the request header.
131 *
132 * @returns VBox status code.
133 * @param ppReq Where to return the pointer to the allocated memory.
134 * @param cbReq Size of memory block required for the request.
135 * @param enmReqType the generic request type.
136 */
137DECLVBGL(int) VbglGRAlloc(VMMDevRequestHeader **ppReq, uint32_t cbReq, VMMDevRequestType enmReqType);
138
139/**
140 * Perform the generic request.
141 *
142 * @param pReq pointer the request structure.
143 *
144 * @return VBox status code.
145 */
146DECLVBGL(int) VbglGRPerform(VMMDevRequestHeader *pReq);
147
148/**
149 * Free the generic request memory.
150 *
151 * @param pReq pointer the request structure.
152 *
153 * @return VBox status code.
154 */
155DECLVBGL(void) VbglGRFree(VMMDevRequestHeader *pReq);
156
157/**
158 * Verify the generic request header.
159 *
160 * @param pReq pointer the request header structure.
161 * @param cbReq size of the request memory block. It should be equal to the request size
162 * for fixed size requests. It can be greater than the request size for
163 * variable size requests.
164 *
165 * @return VBox status code.
166 */
167DECLVBGL(int) VbglGRVerify(const VMMDevRequestHeader *pReq, size_t cbReq);
168/** @} */
169
170# ifdef VBOX_WITH_HGCM
171
172# ifdef VBGL_VBOXGUEST
173
174/**
175 * Callback function called from HGCM helpers when a wait for request
176 * completion IRQ is required.
177 *
178 * @returns VINF_SUCCESS, VERR_INTERRUPT or VERR_TIMEOUT.
179 * @param pvData VBoxGuest pointer to be passed to callback.
180 * @param u32Data VBoxGuest 32 bit value to be passed to callback.
181 */
182typedef DECLCALLBACK(int) FNVBGLHGCMCALLBACK(VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data);
183/** Pointer to a FNVBGLHGCMCALLBACK. */
184typedef FNVBGLHGCMCALLBACK *PFNVBGLHGCMCALLBACK;
185
186/**
187 * Perform a connect request. That is locate required service and
188 * obtain a client identifier for future access.
189 *
190 * @note This function can NOT handle cancelled requests!
191 *
192 * @param pConnectInfo The request data.
193 * @param pfnAsyncCallback Required pointer to function that is calledwhen
194 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
195 * implements waiting for an IRQ in this function.
196 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
197 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
198 *
199 * @return VBox status code.
200 */
201
202DECLR0VBGL(int) VbglR0HGCMInternalConnect(VBoxGuestHGCMConnectInfo *pConnectInfo,
203 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
204
205
206/**
207 * Perform a disconnect request. That is tell the host that
208 * the client will not call the service anymore.
209 *
210 * @note This function can NOT handle cancelled requests!
211 *
212 * @param pDisconnectInfo The request data.
213 * @param pfnAsyncCallback Required pointer to function that is called when
214 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
215 * implements waiting for an IRQ in this function.
216 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
217 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to
218 * callback.
219 *
220 * @return VBox status code.
221 */
222
223DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(VBoxGuestHGCMDisconnectInfo *pDisconnectInfo,
224 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
225
226/** Call a HGCM service.
227 *
228 * @note This function can deal with cancelled requests.
229 *
230 * @param pCallInfo The request data.
231 * @param fFlags Flags, see VBGLR0_HGCMCALL_F_XXX.
232 * @param pfnAsyncCallback Required pointer to function that is called when
233 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
234 * implements waiting for an IRQ in this function.
235 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
236 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
237 *
238 * @return VBox status code.
239 */
240DECLR0VBGL(int) VbglR0HGCMInternalCall(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
241 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
242
243/** Call a HGCM service. (32 bits packet structure in a 64 bits guest)
244 *
245 * @note This function can deal with cancelled requests.
246 *
247 * @param pCallInfo The request data.
248 * @param fFlags Flags, see VBGLR0_HGCMCALL_F_XXX.
249 * @param pfnAsyncCallback Required pointer to function that is called when
250 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
251 * implements waiting for an IRQ in this function.
252 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
253 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
254 *
255 * @return VBox status code.
256 */
257DECLR0VBGL(int) VbglR0HGCMInternalCall32(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
258 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
259
260/** @name VbglR0HGCMInternalCall flags
261 * @{ */
262/** User mode request.
263 * Indicates that only user mode addresses are permitted as parameters. */
264#define VBGLR0_HGCMCALL_F_USER UINT32_C(0)
265/** Kernel mode request.
266 * Indicates that kernel mode addresses are permitted as parameters. Whether or
267 * not user mode addresses are permitted is, unfortunately, OS specific. The
268 * following OSes allows user mode addresses: Windows, TODO.
269 */
270#define VBGLR0_HGCMCALL_F_KERNEL UINT32_C(1)
271/** Mode mask. */
272#define VBGLR0_HGCMCALL_F_MODE_MASK UINT32_C(1)
273/** @} */
274
275# else /* !VBGL_VBOXGUEST */
276
277struct VBGLHGCMHANDLEDATA;
278typedef struct VBGLHGCMHANDLEDATA *VBGLHGCMHANDLE;
279
280/** @name HGCM functions
281 * @{
282 */
283
284/**
285 * Connect to a service.
286 *
287 * @param pHandle Pointer to variable that will hold a handle to be used
288 * further in VbglHGCMCall and VbglHGCMClose.
289 * @param pData Connection information structure.
290 *
291 * @return VBox status code.
292 */
293DECLVBGL(int) VbglHGCMConnect(VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo *pData);
294
295/**
296 * Connect to a service.
297 *
298 * @param handle Handle of the connection.
299 * @param pData Disconnect request information structure.
300 *
301 * @return VBox status code.
302 */
303DECLVBGL(int) VbglHGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
304
305/**
306 * Call to a service.
307 *
308 * @param handle Handle of the connection.
309 * @param pData Call request information structure, including function parameters.
310 * @param cbData Length in bytes of data.
311 *
312 * @return VBox status code.
313 */
314DECLVBGL(int) VbglHGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
315
316/**
317 * Call to a service with user-mode data received by the calling driver from the User-Mode process.
318 * The call must be done in the context of a calling process.
319 *
320 * @param handle Handle of the connection.
321 * @param pData Call request information structure, including function parameters.
322 * @param cbData Length in bytes of data.
323 *
324 * @return VBox status code.
325 */
326DECLVBGL(int) VbglHGCMCallUserData(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
327
328/**
329 * Call to a service with timeout.
330 *
331 * @param handle Handle of the connection.
332 * @param pData Call request information structure, including function parameters.
333 * @param cbData Length in bytes of data.
334 * @param cMillies Timeout in milliseconds. Use RT_INDEFINITE_WAIT to wait forever.
335 *
336 * @return VBox status code.
337 */
338DECLVBGL(int) VbglHGCMCallTimed(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfoTimed *pData, uint32_t cbData);
339/** @} */
340
341/** @name Undocumented helpers for talking to the Chromium OpenGL Host Service
342 * @{ */
343typedef VBGLHGCMHANDLE HVBOXCRCTL;
344DECLVBGL(int) VbglR0CrCtlCreate(HVBOXCRCTL *phCtl);
345DECLVBGL(int) VbglR0CrCtlDestroy(HVBOXCRCTL hCtl);
346DECLVBGL(int) VbglR0CrCtlConConnect(HVBOXCRCTL hCtl, uint32_t *pu32ClientID);
347DECLVBGL(int) VbglR0CrCtlConDisconnect(HVBOXCRCTL hCtl, uint32_t u32ClientID);
348DECLVBGL(int) VbglR0CrCtlConCall(HVBOXCRCTL hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo);
349DECLVBGL(int) VbglR0CrCtlConCallUserData(HVBOXCRCTL hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo);
350/** @} */
351
352# endif /* !VBGL_VBOXGUEST */
353
354# endif /* VBOX_WITH_HGCM */
355
356
357/**
358 * Initialize the heap.
359 *
360 * @returns VBox status code.
361 */
362DECLVBGL(int) VbglPhysHeapInit(void);
363
364/**
365 * Shutdown the heap.
366 */
367DECLVBGL(void) VbglPhysHeapTerminate(void);
368
369/**
370 * Allocate a memory block.
371 *
372 * @returns Virtual address of the allocated memory block.
373 * @param cbSize Size of block to be allocated.
374 */
375DECLVBGL(void *) VbglPhysHeapAlloc(uint32_t cbSize);
376
377/**
378 * Get physical address of memory block pointed by the virtual address.
379 *
380 * @note WARNING!
381 * The function does not acquire the Heap mutex!
382 * When calling the function make sure that the pointer is a valid one and
383 * is not being deallocated. This function can NOT be used for verifying
384 * if the given pointer is a valid one allocated from the heap.
385 *
386 * @param pv Virtual address of memory block.
387 * @returns Physical address of the memory block.
388 */
389DECLVBGL(uint32_t) VbglPhysHeapGetPhysAddr(void *pv);
390
391/**
392 * Free a memory block.
393 *
394 * @param pv Virtual address of memory block.
395 */
396DECLVBGL(void) VbglPhysHeapFree(void *pv);
397
398DECLVBGL(int) VbglQueryVMMDevMemory(VMMDevMemory **ppVMMDevMemory);
399DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void);
400
401# ifndef VBOX_GUEST
402/** @name Mouse
403 * @{ */
404DECLVBGL(int) VbglSetMouseNotifyCallback(PFNVBOXGUESTMOUSENOTIFY pfnNotify, void *pvUser);
405DECLVBGL(int) VbglGetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
406DECLVBGL(int) VbglSetMouseStatus(uint32_t fFeatures);
407/** @} */
408# endif /* VBOX_GUEST */
409
410#endif /* IN_RING0 && !IN_RING0_AGNOSTIC */
411
412/** @} */
413
414
415/** @defgroup grp_vboxguest_lib_r3 Ring-3 interface.
416 * @{
417 */
418#ifdef IN_RING3
419
420/** @def VBGLR3DECL
421 * Ring 3 VBGL declaration.
422 * @param type The return type of the function declaration.
423 */
424# define VBGLR3DECL(type) type VBOXCALL
425
426/** @name General-purpose functions
427 * @{ */
428VBGLR3DECL(int) VbglR3Init(void);
429VBGLR3DECL(int) VbglR3InitUser(void);
430VBGLR3DECL(void) VbglR3Term(void);
431# ifdef ___iprt_time_h
432VBGLR3DECL(int) VbglR3GetHostTime(PRTTIMESPEC pTime);
433# endif
434VBGLR3DECL(int) VbglR3InterruptEventWaits(void);
435VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cch);
436VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot);
437VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn, unsigned *pcRespawn);
438VBGLR3DECL(int) VbglR3PidFile(const char *pszPath, PRTFILE phFile);
439VBGLR3DECL(void) VbglR3ClosePidFile(const char *pszPath, RTFILE hFile);
440VBGLR3DECL(int) VbglR3SetGuestCaps(uint32_t fOr, uint32_t fNot);
441VBGLR3DECL(int) VbglR3WaitEvent(uint32_t fMask, uint32_t cMillies, uint32_t *pfEvents);
442
443VBGLR3DECL(int) VbglR3ReportAdditionsStatus(VBoxGuestFacilityType Facility, VBoxGuestFacilityStatus StatusCurrent,
444 uint32_t fFlags);
445VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char **ppszRev);
446VBGLR3DECL(int) VbglR3GetAdditionsInstallationPath(char **ppszPath);
447VBGLR3DECL(int) VbglR3GetSessionId(uint64_t *pu64IdSession);
448
449/** @} */
450
451/** @name Shared clipboard
452 * @{ */
453VBGLR3DECL(int) VbglR3ClipboardConnect(uint32_t *pidClient);
454VBGLR3DECL(int) VbglR3ClipboardDisconnect(uint32_t idClient);
455VBGLR3DECL(int) VbglR3ClipboardGetHostMsg(uint32_t idClient, uint32_t *pMsg, uint32_t *pfFormats);
456VBGLR3DECL(int) VbglR3ClipboardReadData(uint32_t idClient, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
457VBGLR3DECL(int) VbglR3ClipboardReportFormats(uint32_t idClient, uint32_t fFormats);
458VBGLR3DECL(int) VbglR3ClipboardWriteData(uint32_t idClient, uint32_t fFormat, void *pv, uint32_t cb);
459/** @} */
460
461/** @name Seamless mode
462 * @{ */
463VBGLR3DECL(int) VbglR3SeamlessSetCap(bool fState);
464VBGLR3DECL(int) VbglR3SeamlessWaitEvent(VMMDevSeamlessMode *pMode);
465VBGLR3DECL(int) VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects);
466VBGLR3DECL(int) VbglR3SeamlessGetLastEvent(VMMDevSeamlessMode *pMode);
467
468/** @} */
469
470/** @name Mouse
471 * @{ */
472VBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
473VBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures);
474/** @} */
475
476/** @name Video
477 * @{ */
478VBGLR3DECL(int) VbglR3VideoAccelEnable(bool fEnable);
479VBGLR3DECL(int) VbglR3VideoAccelFlush(void);
480VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
481 const void *pvImg, size_t cbImg);
482VBGLR3DECL(int) VbglR3SetPointerShapeReq(struct VMMDevReqMousePointer *pReq);
483/** @} */
484
485/** @name Display
486 * @{ */
487/** The folder for the video mode hint unix domain socket on Unix-like guests.
488 * @note This can be safely changed as all users are rebuilt in lock-step. */
489#define VBGLR3HOSTDISPSOCKETPATH "/tmp/.VBoxService"
490/** The path to the video mode hint unix domain socket on Unix-like guests. */
491#define VBGLR3HOSTDISPSOCKET VBGLR3VIDEOMODEHINTSOCKETPATH "/VideoModeHint"
492
493/** The folder for saving video mode hints to between sessions. */
494#define VBGLR3HOSTDISPSAVEDMODEPATH "/var/lib/VBoxGuestAdditions"
495/** The path to the file for saving video mode hints to between sessions. */
496#define VBGLR3HOSTDISPSAVEDMODE VBGLR3HOSTDISPSAVEDMODEPATH "/SavedVideoModes"
497
498VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay,
499 uint32_t *pdx, uint32_t *pdy, bool *pfEnabled, bool *pfChangeOrigin, bool fAck);
500VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
501VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen);
502VBGLR3DECL(int) VbglR3SaveVideoMode(unsigned cScreen, unsigned cx, unsigned cy, unsigned cBits,
503 unsigned x, unsigned y, bool fEnabled);
504VBGLR3DECL(int) VbglR3RetrieveVideoMode(unsigned cScreen, unsigned *pcx, unsigned *pcy, unsigned *pcBits,
505 unsigned *px, unsigned *py, bool *pfEnabled);
506/** @} */
507
508/** @name VM Statistics
509 * @{ */
510VBGLR3DECL(int) VbglR3StatQueryInterval(uint32_t *pu32Interval);
511VBGLR3DECL(int) VbglR3StatReport(VMMDevReportGuestStats *pReq);
512/** @} */
513
514/** @name Memory ballooning
515 * @{ */
516VBGLR3DECL(int) VbglR3MemBalloonRefresh(uint32_t *pcChunks, bool *pfHandleInR3);
517VBGLR3DECL(int) VbglR3MemBalloonChange(void *pv, bool fInflate);
518/** @} */
519
520/** @name Core Dump
521 * @{ */
522VBGLR3DECL(int) VbglR3WriteCoreDump(void);
523
524/** @} */
525
526# ifdef VBOX_WITH_GUEST_PROPS
527/** @name Guest properties
528 * @{ */
529/** @todo Docs. */
530typedef struct VBGLR3GUESTPROPENUM VBGLR3GUESTPROPENUM;
531/** @todo Docs. */
532typedef VBGLR3GUESTPROPENUM *PVBGLR3GUESTPROPENUM;
533VBGLR3DECL(int) VbglR3GuestPropConnect(uint32_t *pidClient);
534VBGLR3DECL(int) VbglR3GuestPropDisconnect(uint32_t idClient);
535VBGLR3DECL(int) VbglR3GuestPropWrite(uint32_t idClient, const char *pszName, const char *pszValue, const char *pszFlags);
536VBGLR3DECL(int) VbglR3GuestPropWriteValue(uint32_t idClient, const char *pszName, const char *pszValue);
537VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t idClient, const char *pszName,
538 const char *pszValueFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
539VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t idClient, const char *pszName,
540 const char *pszValueFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
541VBGLR3DECL(int) VbglR3GuestPropRead(uint32_t idClient, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue,
542 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
543VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue,
544 uint32_t *pcchValueActual);
545VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(uint32_t idClient, const char *pszName, char **ppszValue);
546VBGLR3DECL(void) VbglR3GuestPropReadValueFree(char *pszValue);
547VBGLR3DECL(int) VbglR3GuestPropEnumRaw(uint32_t idClient, const char *paszPatterns, char *pcBuf, uint32_t cbBuf,
548 uint32_t *pcbBufActual);
549VBGLR3DECL(int) VbglR3GuestPropEnum(uint32_t idClient, char const * const *ppaszPatterns, uint32_t cPatterns,
550 PVBGLR3GUESTPROPENUM *ppHandle, char const **ppszName, char const **ppszValue,
551 uint64_t *pu64Timestamp, char const **ppszFlags);
552VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue,
553 uint64_t *pu64Timestamp, char const **ppszFlags);
554VBGLR3DECL(void) VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle);
555VBGLR3DECL(int) VbglR3GuestPropDelete(uint32_t idClient, const char *pszName);
556VBGLR3DECL(int) VbglR3GuestPropDelSet(uint32_t idClient, char const * const *papszPatterns, uint32_t cPatterns);
557VBGLR3DECL(int) VbglR3GuestPropWait(uint32_t idClient, const char *pszPatterns, void *pvBuf, uint32_t cbBuf,
558 uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue,
559 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
560/** @} */
561
562/** @name Guest user handling / reporting.
563 * @{ */
564VBGLR3DECL(int) VbglR3GuestUserReportState(const char *pszUser, const char *pszDomain, VBoxGuestUserState enmState,
565 uint8_t *pbDetails, uint32_t cbDetails);
566/** @} */
567
568/** @name Host version handling
569 * @{ */
570VBGLR3DECL(int) VbglR3HostVersionCheckForUpdate(uint32_t idClient, bool *pfUpdate, char **ppszHostVersion,
571 char **ppszGuestVersion);
572VBGLR3DECL(int) VbglR3HostVersionLastCheckedLoad(uint32_t idClient, char **ppszVer);
573VBGLR3DECL(int) VbglR3HostVersionLastCheckedStore(uint32_t idClient, const char *pszVer);
574/** @} */
575# endif /* VBOX_WITH_GUEST_PROPS defined */
576
577# ifdef VBOX_WITH_SHARED_FOLDERS
578/** @name Shared folders
579 * @{ */
580/**
581 * Structure containing mapping information for a shared folder.
582 */
583typedef struct VBGLR3SHAREDFOLDERMAPPING
584{
585 /** Mapping status. */
586 uint32_t u32Status;
587 /** Root handle. */
588 uint32_t u32Root;
589} VBGLR3SHAREDFOLDERMAPPING;
590/** Pointer to a shared folder mapping information structure. */
591typedef VBGLR3SHAREDFOLDERMAPPING *PVBGLR3SHAREDFOLDERMAPPING;
592/** Pointer to a const shared folder mapping information structure. */
593typedef VBGLR3SHAREDFOLDERMAPPING const *PCVBGLR3SHAREDFOLDERMAPPING;
594
595VBGLR3DECL(int) VbglR3SharedFolderConnect(uint32_t *pidClient);
596VBGLR3DECL(int) VbglR3SharedFolderDisconnect(uint32_t idClient);
597VBGLR3DECL(bool) VbglR3SharedFolderExists(uint32_t idClient, const char *pszShareName);
598VBGLR3DECL(int) VbglR3SharedFolderGetMappings(uint32_t idClient, bool fAutoMountOnly,
599 PVBGLR3SHAREDFOLDERMAPPING *ppaMappings, uint32_t *pcMappings);
600VBGLR3DECL(void) VbglR3SharedFolderFreeMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings);
601VBGLR3DECL(int) VbglR3SharedFolderGetName(uint32_t idClient,uint32_t u32Root, char **ppszName);
602VBGLR3DECL(int) VbglR3SharedFolderGetMountPrefix(char **ppszPrefix);
603VBGLR3DECL(int) VbglR3SharedFolderGetMountDir(char **ppszDir);
604/** @} */
605# endif /* VBOX_WITH_SHARED_FOLDERS defined */
606
607# ifdef VBOX_WITH_GUEST_CONTROL
608/** @name Guest control
609 * @{ */
610
611/**
612 * Structure containing the context required for
613 * either retrieving or sending a HGCM guest control
614 * commands from or to the host.
615 *
616 * Note: Do not change parameter order without also
617 * adapting all structure initializers.
618 */
619typedef struct VBGLR3GUESTCTRLCMDCTX
620{
621 /** @todo This struct could be handy if we want to implement
622 * a second communication channel, e.g. via TCP/IP.
623 * Use a union for the HGCM stuff then. */
624
625 /** IN: HGCM client ID to use for
626 * communication. */
627 uint32_t uClientID;
628 /** IN/OUT: Context ID to retrieve
629 * or to use. */
630 uint32_t uContextID;
631 /** IN: Protocol version to use. */
632 uint32_t uProtocol;
633 /** OUT: Number of parameters retrieved. */
634 uint32_t uNumParms;
635} VBGLR3GUESTCTRLCMDCTX, *PVBGLR3GUESTCTRLCMDCTX;
636
637/* General message handling on the guest. */
638VBGLR3DECL(int) VbglR3GuestCtrlConnect(uint32_t *pidClient);
639VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t uClientId);
640VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove);
641VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterUnset(uint32_t uClientId);
642VBGLR3DECL(int) VbglR3GuestCtrlMsgReply(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc);
643VBGLR3DECL(int) VbglR3GuestCtrlMsgReplyEx(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc, uint32_t uType,
644 void *pvPayload, uint32_t cbPayload);
645VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t uClientId);
646VBGLR3DECL(int) VbglR3GuestCtrlMsgWaitFor(uint32_t uClientId, uint32_t *puMsg, uint32_t *puNumParms);
647VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(uint32_t idClient);
648/* Guest session handling. */
649VBGLR3DECL(int) VbglR3GuestCtrlSessionClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t fFlags);
650VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uType, uint32_t uResult);
651VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puProtocol, char *pszUser, uint32_t cbUser,
652 char *pszPassword, uint32_t cbPassword, char *pszDomain, uint32_t cbDomain,
653 uint32_t *pfFlags, uint32_t *puSessionID);
654VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *pfFlags, uint32_t *puSessionID);
655/* Guest path handling. */
656VBGLR3DECL(int) VbglR3GuestCtrlPathGetRename(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszSource, uint32_t cbSource, char *pszDest,
657 uint32_t cbDest, uint32_t *pfFlags);
658/* Guest process execution. */
659VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszCmd, uint32_t cbCmd, uint32_t *pfFlags,
660 char *pszArgs, uint32_t cbArgs, uint32_t *puNumArgs, char *pszEnv, uint32_t *pcbEnv,
661 uint32_t *puNumEnvVars, char *pszUser, uint32_t cbUser, char *pszPassword,
662 uint32_t cbPassword, uint32_t *puTimeoutMS, uint32_t *puPriority,
663 uint64_t *puAffinity, uint32_t cbAffinity, uint32_t *pcAffinity);
664VBGLR3DECL(int) VbglR3GuestCtrlProcGetTerminate(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID);
665VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *pfFlags, void *pvData,
666 uint32_t cbData, uint32_t *pcbSize);
667VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puHandle, uint32_t *pfFlags);
668VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puWaitFlags,
669 uint32_t *puTimeoutMS);
670/* Guest native directory handling. */
671VBGLR3DECL(int) VbglR3GuestCtrlDirGetRemove(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *pfFlags);
672/* Guest native file handling. */
673VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszFileName, uint32_t cbFileName, char *pszOpenMode,
674 uint32_t cbOpenMode, char *pszDisposition, uint32_t cbDisposition, char *pszSharing,
675 uint32_t cbSharing, uint32_t *puCreationMode, uint64_t *puOffset);
676VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
677VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puToRead);
678VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
679 uint32_t *puToRead, uint64_t *poffRead);
680VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
681 void *pvData, uint32_t cbData, uint32_t *pcbActual);
682VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, void *pvData, uint32_t cbData,
683 uint32_t *pcbActual, uint64_t *poffWrite);
684VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
685 uint32_t *puSeekMethod, uint64_t *poffSeek);
686VBGLR3DECL(int) VbglR3GuestCtrlFileGetTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
687/* Guest -> Host. */
688VBGLR3DECL(int) VbglR3GuestCtrlFileCbOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uFileHandle);
689VBGLR3DECL(int) VbglR3GuestCtrlFileCbClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
690VBGLR3DECL(int) VbglR3GuestCtrlFileCbError(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
691VBGLR3DECL(int) VbglR3GuestCtrlFileCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, void *pvData, uint32_t cbData);
692VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uWritten);
693VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
694VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
695VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uStatus, uint32_t fFlags,
696 void *pvData, uint32_t cbData);
697VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uHandle, uint32_t fFlags,
698 void *pvData, uint32_t cbData);
699VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t u32PID, uint32_t uStatus,
700 uint32_t fFlags, uint32_t cbWritten);
701
702/** @} */
703# endif /* VBOX_WITH_GUEST_CONTROL defined */
704
705/** @name Auto-logon handling
706 * @{ */
707VBGLR3DECL(int) VbglR3AutoLogonReportStatus(VBoxGuestFacilityStatus enmStatus);
708VBGLR3DECL(bool) VbglR3AutoLogonIsRemoteSession(void);
709/** @} */
710
711/** @name User credentials handling
712 * @{ */
713VBGLR3DECL(int) VbglR3CredentialsQueryAvailability(void);
714VBGLR3DECL(int) VbglR3CredentialsRetrieve(char **ppszUser, char **ppszPassword, char **ppszDomain);
715VBGLR3DECL(int) VbglR3CredentialsRetrieveUtf16(PRTUTF16 *ppwszUser, PRTUTF16 *ppwszPassword, PRTUTF16 *ppwszDomain);
716VBGLR3DECL(void) VbglR3CredentialsDestroy(char *pszUser, char *pszPassword, char *pszDomain, uint32_t cPasses);
717VBGLR3DECL(void) VbglR3CredentialsDestroyUtf16(PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTUTF16 pwszDomain,
718 uint32_t cPasses);
719/** @} */
720
721/** @name CPU hotplug monitor
722 * @{ */
723VBGLR3DECL(int) VbglR3CpuHotPlugInit(void);
724VBGLR3DECL(int) VbglR3CpuHotPlugTerm(void);
725VBGLR3DECL(int) VbglR3CpuHotPlugWaitForEvent(VMMDevCpuEventType *penmEventType, uint32_t *pidCpuCore, uint32_t *pidCpuPackage);
726/** @} */
727
728/** @name Page sharing
729 * @{ */
730VBGLR3DECL(int) VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule,
731 unsigned cRegions, VMMDEVSHAREDREGIONDESC *pRegions);
732VBGLR3DECL(int) VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule);
733VBGLR3DECL(int) VbglR3CheckSharedModules(void);
734VBGLR3DECL(bool) VbglR3PageSharingIsEnabled(void);
735VBGLR3DECL(int) VbglR3PageIsShared(RTGCPTR pPage, bool *pfShared, uint64_t *puPageFlags);
736/** @} */
737
738# ifdef VBOX_WITH_DRAG_AND_DROP
739/** @name Drag and Drop
740 * @{ */
741/**
742 * Structure containing the context required for
743 * either retrieving or sending a HGCM guest drag'n drop
744 * commands from or to the host.
745 *
746 * Note: Do not change parameter order without also
747 * adapting all structure initializers.
748 */
749typedef struct VBGLR3GUESTDNDCMDCTX
750{
751 /** @todo This struct could be handy if we want to implement
752 * a second communication channel, e.g. via TCP/IP.
753 * Use a union for the HGCM stuff then. */
754
755 /** IN: HGCM client ID to use for communication. */
756 uint32_t uClientID;
757 /** IN: Protocol version to use. */
758 uint32_t uProtocol;
759 /** OUT: Number of parameters retrieved. */
760 uint32_t uNumParms;
761} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
762
763typedef struct VBGLR3DNDHGCMEVENT
764{
765 uint32_t uType; /** The event type this struct contains. */
766 uint32_t uScreenId; /** Screen ID this request belongs to. */
767 char *pszFormats; /** Format list (\r\n separated). */
768 uint32_t cbFormats; /** Size of pszFormats (\0 included). */
769 union
770 {
771 struct
772 {
773 uint32_t uXpos; /** X position of guest screen. */
774 uint32_t uYpos; /** Y position of guest screen. */
775 uint32_t uDefAction; /** Proposed DnD action. */
776 uint32_t uAllActions; /** Allowed DnD actions. */
777 } a; /** Values used in init, move and drop event type. */
778 struct
779 {
780 void *pvData; /** Data request. */
781 size_t cbData; /** Size of pvData. */
782 } b; /** Values used in drop data event type. */
783 } u;
784} VBGLR3DNDHGCMEVENT;
785typedef VBGLR3DNDHGCMEVENT *PVBGLR3DNDHGCMEVENT;
786typedef const PVBGLR3DNDHGCMEVENT CPVBGLR3DNDHGCMEVENT;
787VBGLR3DECL(int) VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx);
788VBGLR3DECL(int) VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
789
790VBGLR3DECL(int) VbglR3DnDProcessNextMessage(PVBGLR3GUESTDNDCMDCTX pCtx, CPVBGLR3DNDHGCMEVENT pEvent);
791
792VBGLR3DECL(int) VbglR3DnDHGAcknowledgeOperation(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uAction);
793VBGLR3DECL(int) VbglR3DnDHGRequestData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat);
794VBGLR3DECL(int) VbglR3DnDHGSetProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
795# ifdef VBOX_WITH_DRAG_AND_DROP_GH
796VBGLR3DECL(int) VbglR3DnDGHAcknowledgePending(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uDefAction,
797 uint32_t uAllActions, const char *pszFormats);
798VBGLR3DECL(int) VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData);
799VBGLR3DECL(int) VbglR3DnDGHSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcOp);
800# endif /* VBOX_WITH_DRAG_AND_DROP_GH */
801/** @} */
802# endif /* VBOX_WITH_DRAG_AND_DROP */
803
804/* Generic Host Channel Service. */
805VBGLR3DECL(int) VbglR3HostChannelInit(uint32_t *pu32HGCMClientId);
806VBGLR3DECL(void) VbglR3HostChannelTerm(uint32_t u32HGCMClientId);
807VBGLR3DECL(int) VbglR3HostChannelAttach(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
808 const char *pszName, uint32_t u32Flags);
809VBGLR3DECL(void) VbglR3HostChannelDetach(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
810VBGLR3DECL(int) VbglR3HostChannelSend(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
811 void *pvData, uint32_t cbData);
812VBGLR3DECL(int) VbglR3HostChannelRecv(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
813 void *pvData, uint32_t cbData,
814 uint32_t *pu32SizeReceived, uint32_t *pu32SizeRemaining);
815VBGLR3DECL(int) VbglR3HostChannelControl(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
816 uint32_t u32Code, void *pvParm, uint32_t cbParm,
817 void *pvData, uint32_t cbData, uint32_t *pu32SizeDataReturned);
818VBGLR3DECL(int) VbglR3HostChannelEventWait(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
819 uint32_t *pu32EventId, void *pvParm, uint32_t cbParm,
820 uint32_t *pu32SizeReturned);
821VBGLR3DECL(int) VbglR3HostChannelEventCancel(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
822VBGLR3DECL(int) VbglR3HostChannelQuery(const char *pszName, uint32_t u32HGCMClientId, uint32_t u32Code,
823 void *pvParm, uint32_t cbParm, void *pvData, uint32_t cbData,
824 uint32_t *pu32SizeDataReturned);
825
826/** @name Mode hint storage
827 * @{ */
828VBGLR3DECL(int) VbglR3ReadVideoMode(unsigned cDisplay, unsigned *cx,
829 unsigned *cy, unsigned *cBPP, unsigned *x,
830 unsigned *y, unsigned *fEnabled);
831VBGLR3DECL(int) VbglR3WriteVideoMode(unsigned cDisplay, unsigned cx,
832 unsigned cy, unsigned cBPP, unsigned x,
833 unsigned y, unsigned fEnabled);
834/** @} */
835
836#endif /* IN_RING3 */
837/** @} */
838
839RT_C_DECLS_END
840
841/** @} */
842
843#endif
844
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette