VirtualBox

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

Last change on this file since 75758 was 75758, checked in by vboxsync, 6 years ago

VBoxGuestLib,VBoxService: Preps for using GUEST_MSG_PEEK/GEt/CANCEL, currently disabled on the client side.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 46.4 KB
Line 
1/** @file
2 * VBoxGuestLib - VirtualBox Guest Additions Library.
3 */
4
5/*
6 * Copyright (C) 2006-2018 Oracle Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person
9 * obtaining a copy of this software and associated documentation
10 * files (the "Software"), to deal in the Software without
11 * restriction, including without limitation the rights to use,
12 * copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following
15 * conditions:
16 *
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30#ifndef ___VBox_VBoxGuestLib_h
31#define ___VBox_VBoxGuestLib_h
32
33#include <VBox/types.h>
34#include <VBox/VMMDev.h>
35#include <VBox/VBoxGuestCoreTypes.h>
36# ifdef VBOX_WITH_DRAG_AND_DROP
37# include <VBox/GuestHost/DragAndDropDefs.h>
38# endif
39
40/** @defgroup grp_vboxguest_lib VirtualBox Guest Additions Library
41 * @ingroup grp_vboxguest
42 * @{
43 */
44
45/** @page pg_guest_lib VirtualBox Guest Library
46 *
47 * This is a library for abstracting the additions driver interface. There are
48 * multiple versions of the library depending on the context. The main
49 * distinction is between kernel and user mode where the interfaces are very
50 * different.
51 *
52 *
53 * @section sec_guest_lib_ring0 Ring-0
54 *
55 * In ring-0 there are two version:
56 * - VBOX_LIB_VBGL_R0_BASE / VBoxGuestR0LibBase for the VBoxGuest main driver,
57 * who is responsible for managing the VMMDev virtual hardware.
58 * - VBOX_LIB_VBGL_R0 / VBoxGuestR0Lib for other (client) guest drivers.
59 *
60 *
61 * The library source code and the header have a define VBGL_VBOXGUEST, which is
62 * defined for VBoxGuest and undefined for other drivers. Drivers must choose
63 * right library in their makefiles and set VBGL_VBOXGUEST accordingly.
64 *
65 * The libraries consists of:
66 * - common code to be used by both VBoxGuest and other drivers;
67 * - VBoxGuest specific code;
68 * - code for other drivers which communicate with VBoxGuest via an IOCTL.
69 *
70 *
71 * @section sec_guest_lib_ring3 Ring-3
72 *
73 * There are more variants of the library here:
74 * - VBOX_LIB_VBGL_R3 / VBoxGuestR3Lib for programs.
75 * - VBOX_LIB_VBGL_R3_XFREE86 / VBoxGuestR3LibXFree86 for old style XFree
76 * drivers which uses special loader and or symbol resolving strategy.
77 * - VBOX_LIB_VBGL_R3_SHARED / VBoxGuestR3LibShared for shared objects / DLLs /
78 * Dylibs.
79 *
80 */
81
82RT_C_DECLS_BEGIN
83
84/** HGCM client ID.
85 * @todo Promote to VBox/types.h */
86typedef uint32_t HGCMCLIENTID;
87
88
89/** @defgroup grp_vboxguest_lib_r0 Ring-0 interface.
90 * @{
91 */
92#ifdef IN_RING0
93/** @def DECLR0VBGL
94 * Declare a VBGL ring-0 API with the right calling convention and visibilitiy.
95 * @param type Return type. */
96# ifdef RT_OS_DARWIN /** @todo probably apply to all, but don't want a forest fire on our hands right now. */
97# define DECLR0VBGL(type) DECLHIDDEN(type) VBOXCALL
98# else
99# define DECLR0VBGL(type) type VBOXCALL
100# endif
101# define DECLVBGL(type) DECLR0VBGL(type)
102
103
104/**
105 * The library initialization function to be used by the main VBoxGuest driver.
106 *
107 * @return VBox status code.
108 */
109DECLR0VBGL(int) VbglR0InitPrimary(RTIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory, uint32_t *pfFeatures);
110
111/**
112 * The library termination function to be used by the main VBoxGuest driver.
113 *
114 * @author bird (2017-08-23)
115 */
116DECLR0VBGL(void) VbglR0TerminatePrimary(void);
117
118/**
119 * The library initialization function to be used by all drivers
120 * other than the main VBoxGuest system driver.
121 *
122 * @return VBox status code.
123 */
124DECLR0VBGL(int) VbglR0InitClient(void);
125
126/**
127 * The library termination function.
128 */
129DECLR0VBGL(void) VbglR0TerminateClient(void);
130
131/**
132 * Query the host feature mask.
133 *
134 * @returns VBox status code.
135 * @param pfHostFeatures Where to return the host feature mask,
136 * VMMDEV_HVF_XXX.
137 * @note Client only. May fail we're unable to connect VBoxGuest.
138 */
139DECLR0VBGL(int) VbglR0QueryHostFeatures(uint32_t *pfHostFeatures);
140
141
142/** @name The IDC Client Interface
143 * @{
144 */
145
146/**
147 * Inter-Driver Communication Handle.
148 */
149typedef union VBGLIDCHANDLE
150{
151 /** Padding for opaque usage.
152 * Must be greater or equal in size than the private struct. */
153 void *apvPadding[4];
154#ifdef VBGLIDCHANDLEPRIVATE_DECLARED
155 /** The private view. */
156 struct VBGLIDCHANDLEPRIVATE s;
157#endif
158} VBGLIDCHANDLE;
159/** Pointer to a handle. */
160typedef VBGLIDCHANDLE *PVBGLIDCHANDLE;
161
162DECLR0VBGL(int) VbglR0IdcOpen(PVBGLIDCHANDLE pHandle, uint32_t uReqVersion, uint32_t uMinVersion,
163 uint32_t *puSessionVersion, uint32_t *puDriverVersion, uint32_t *puDriverRevision);
164struct VBGLREQHDR;
165DECLR0VBGL(int) VbglR0IdcCallRaw(PVBGLIDCHANDLE pHandle, uintptr_t uReq, struct VBGLREQHDR *pReqHdr, uint32_t cbReq);
166DECLR0VBGL(int) VbglR0IdcCall(PVBGLIDCHANDLE pHandle, uintptr_t uReq, struct VBGLREQHDR *pReqHdr, uint32_t cbReq);
167DECLR0VBGL(int) VbglR0IdcClose(PVBGLIDCHANDLE pHandle);
168
169/** @} */
170
171
172/** @name Generic request functions.
173 * @{
174 */
175
176/**
177 * Allocate memory for generic request and initialize the request header.
178 *
179 * @returns VBox status code.
180 * @param ppReq Where to return the pointer to the allocated memory.
181 * @param cbReq Size of memory block required for the request.
182 * @param enmReqType the generic request type.
183 */
184# if defined(___VBox_VMMDev_h) || defined(DOXYGEN_RUNNING)
185DECLR0VBGL(int) VbglR0GRAlloc(struct VMMDevRequestHeader **ppReq, size_t cbReq, VMMDevRequestType enmReqType);
186# else
187DECLR0VBGL(int) VbglR0GRAlloc(struct VMMDevRequestHeader **ppReq, size_t cbReq, int32_t enmReqType);
188# endif
189
190/**
191 * Perform the generic request.
192 *
193 * @param pReq pointer the request structure.
194 *
195 * @return VBox status code.
196 */
197DECLR0VBGL(int) VbglR0GRPerform(struct VMMDevRequestHeader *pReq);
198
199/**
200 * Free the generic request memory.
201 *
202 * @param pReq pointer the request structure.
203 *
204 * @return VBox status code.
205 */
206DECLR0VBGL(void) VbglR0GRFree(struct VMMDevRequestHeader *pReq);
207
208/**
209 * Verify the generic request header.
210 *
211 * @param pReq pointer the request header structure.
212 * @param cbReq size of the request memory block. It should be equal to the request size
213 * for fixed size requests. It can be greater than the request size for
214 * variable size requests.
215 *
216 * @return VBox status code.
217 */
218DECLR0VBGL(int) VbglGR0Verify(const struct VMMDevRequestHeader *pReq, size_t cbReq);
219
220/** @} */
221
222# ifdef VBOX_WITH_HGCM
223struct VBGLIOCHGCMCALL;
224struct VBGLIOCIDCHGCMFASTCALL;
225
226# ifdef VBGL_VBOXGUEST
227
228/**
229 * Callback function called from HGCM helpers when a wait for request
230 * completion IRQ is required.
231 *
232 * @returns VINF_SUCCESS, VERR_INTERRUPT or VERR_TIMEOUT.
233 * @param pvData VBoxGuest pointer to be passed to callback.
234 * @param u32Data VBoxGuest 32 bit value to be passed to callback.
235 */
236typedef DECLCALLBACK(int) FNVBGLHGCMCALLBACK(VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data);
237/** Pointer to a FNVBGLHGCMCALLBACK. */
238typedef FNVBGLHGCMCALLBACK *PFNVBGLHGCMCALLBACK;
239
240/**
241 * Perform a connect request.
242 *
243 * That is locate required service and obtain a client identifier for future
244 * access.
245 *
246 * @note This function can NOT handle cancelled requests!
247 *
248 * @param pLoc The service to connect to.
249 * @param fRequestor VMMDEV_REQUESTOR_XXX.
250 * @param pidClient Where to return the client ID on success.
251 * @param pfnAsyncCallback Required pointer to function that is calledwhen
252 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
253 * implements waiting for an IRQ in this function.
254 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
255 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
256 *
257 * @return VBox status code.
258 */
259DECLR0VBGL(int) VbglR0HGCMInternalConnect(HGCMServiceLocation const *pLoc, uint32_t fRequestor, HGCMCLIENTID *pidClient,
260 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
261
262
263/**
264 * Perform a disconnect request.
265 *
266 * That is tell the host that the client will not call the service anymore.
267 *
268 * @note This function can NOT handle cancelled requests!
269 *
270 * @param idClient The client ID to disconnect.
271 * @param fRequestor VMMDEV_REQUESTOR_XXX.
272 * @param pfnAsyncCallback Required pointer to function that is called when
273 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
274 * implements waiting for an IRQ in this function.
275 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
276 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to
277 * callback.
278 *
279 * @return VBox status code.
280 */
281
282DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(HGCMCLIENTID idClient, uint32_t fRequestor,
283 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
284
285/** Call a HGCM service.
286 *
287 * @note This function can deal with cancelled requests.
288 *
289 * @param pCallInfo The request data.
290 * @param fFlags Flags, see VBGLR0_HGCMCALL_F_XXX.
291 * @param fRequestor VMMDEV_REQUESTOR_XXX.
292 * @param pfnAsyncCallback Required pointer to function that is called when
293 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
294 * implements waiting for an IRQ in this function.
295 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
296 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
297 *
298 * @return VBox status code.
299 */
300DECLR0VBGL(int) VbglR0HGCMInternalCall(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags, uint32_t fRequestor,
301 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
302
303/** Call a HGCM service. (32 bits packet structure in a 64 bits guest)
304 *
305 * @note This function can deal with cancelled requests.
306 *
307 * @param pCallInfo The request data.
308 * @param fFlags Flags, see VBGLR0_HGCMCALL_F_XXX.
309 * @param fRequestor VMMDEV_REQUESTOR_XXX.
310 * @param pfnAsyncCallback Required pointer to function that is called when
311 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
312 * implements waiting for an IRQ in this function.
313 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
314 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
315 *
316 * @return VBox status code.
317 */
318DECLR0VBGL(int) VbglR0HGCMInternalCall32(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags, uint32_t fRequestor,
319 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
320
321/** @name VbglR0HGCMInternalCall flags
322 * @{ */
323/** User mode request.
324 * Indicates that only user mode addresses are permitted as parameters. */
325#define VBGLR0_HGCMCALL_F_USER UINT32_C(0)
326/** Kernel mode request.
327 * Indicates that kernel mode addresses are permitted as parameters. Whether or
328 * not user mode addresses are permitted is, unfortunately, OS specific. The
329 * following OSes allows user mode addresses: Windows, TODO.
330 */
331#define VBGLR0_HGCMCALL_F_KERNEL UINT32_C(1)
332/** Mode mask. */
333#define VBGLR0_HGCMCALL_F_MODE_MASK UINT32_C(1)
334/** @} */
335
336# else /* !VBGL_VBOXGUEST */
337
338#ifndef VBGL_VBOXGUEST
339/** @internal */
340typedef struct VBGLHGCMHANDLEDATA
341{
342 uint32_t fAllocated;
343 VBGLIDCHANDLE IdcHandle;
344} VBGLHGCMHANDLEDATA;
345#else
346struct VBGLHGCMHANDLEDATA;
347#endif
348
349typedef struct VBGLHGCMHANDLEDATA *VBGLHGCMHANDLE;
350
351/** @name HGCM functions
352 * @{
353 */
354
355/**
356 * Initializes HGCM in the R0 guest library. Must be called before any HGCM
357 * connections are made. Is called by VbglInitClient().
358 *
359 * @return VBox status code.
360 */
361DECLR0VBGL(int) VbglR0HGCMInit(void);
362
363/**
364 * Terminates HGCM in the R0 guest library. Is called by VbglTerminate().
365 *
366 * @return VBox status code.
367 */
368DECLR0VBGL(int) VbglR0HGCMTerminate(void);
369
370/**
371 * Connect to a service.
372 *
373 * @param pHandle Pointer to variable that will hold a handle to be used
374 * further in VbglHGCMCall and VbglHGCMClose.
375 * @param pszServiceName The service to connect to.
376 * @param pidClient Where to return the client ID for the connection.
377 *
378 * @return VBox status code.
379 *
380 * @todo consider baking the client Id into the handle.
381 */
382DECLR0VBGL(int) VbglR0HGCMConnect(VBGLHGCMHANDLE *pHandle, const char *pszServiceName, HGCMCLIENTID *pidClient);
383
384/**
385 * Connect to a service.
386 *
387 * @param handle Handle of the connection.
388 * @param idClient The ID of the client connection.
389 *
390 * @return VBox status code.
391 *
392 * @todo consider baking the client Id into the handle.
393 */
394DECLR0VBGL(int) VbglR0HGCMDisconnect(VBGLHGCMHANDLE handle, HGCMCLIENTID idClient);
395
396/**
397 * Call to a service, returning only the I/O control status code.
398 *
399 * @param handle Handle of the connection.
400 * @param pData Call request information structure, including function parameters.
401 * @param cbData Length in bytes of data.
402 *
403 * @return VBox status code.
404 */
405DECLR0VBGL(int) VbglR0HGCMCallRaw(VBGLHGCMHANDLE handle, struct VBGLIOCHGCMCALL *pData, uint32_t cbData);
406
407/**
408 * Call to a service, returning the HGCM status code.
409 *
410 * @param handle Handle of the connection.
411 * @param pData Call request information structure, including function parameters.
412 * @param cbData Length in bytes of data.
413 *
414 * @return VBox status code. Either the I/O control status code if that failed,
415 * or the HGCM status code (pData->Hdr.rc).
416 */
417DECLR0VBGL(int) VbglR0HGCMCall(VBGLHGCMHANDLE handle, struct VBGLIOCHGCMCALL *pData, uint32_t cbData);
418
419/**
420 * Call to a service with user-mode data received by the calling driver from the User-Mode process.
421 * The call must be done in the context of a calling process.
422 *
423 * @param handle Handle of the connection.
424 * @param pData Call request information structure, including function parameters.
425 * @param cbData Length in bytes of data.
426 *
427 * @return VBox status code.
428 */
429DECLR0VBGL(int) VbglR0HGCMCallUserDataRaw(VBGLHGCMHANDLE handle, struct VBGLIOCHGCMCALL *pData, uint32_t cbData);
430
431/**
432 * Call to a service, w/o any repacking and buffer locking in VBoxGuest,
433 * returning the only request related status code (not HGCM).
434 *
435 * The driver only submits the request and waits for completion, nothing else.
436 *
437 * @param hHandle The connection handle.
438 * @param pCallReq The call request. Will be passed directly to the host.
439 * @param cbCallReq The size of the whole call request.
440 *
441 * @return VBox status code.
442 *
443 * @remarks The result of the HGCM call is found in
444 * @a pCallReq->HgcmCallReq.header.result on a successful return. The
445 * @a pCallReq->Hdr.rc and @a pCallReq->HgcmCallReq.header.header.rc
446 * fields are the same as the return value and can safely be ignored.
447 */
448DECLR0VBGL(int) VbglR0HGCMFastCall(VBGLHGCMHANDLE hHandle, struct VBGLIOCIDCHGCMFASTCALL *pCallReq, uint32_t cbCallReq);
449
450/** @} */
451
452/** @name Undocumented helpers for talking to the Chromium OpenGL Host Service
453 * @{ */
454typedef VBGLHGCMHANDLE VBGLCRCTLHANDLE;
455DECLR0VBGL(int) VbglR0CrCtlCreate(VBGLCRCTLHANDLE *phCtl);
456DECLR0VBGL(int) VbglR0CrCtlDestroy(VBGLCRCTLHANDLE hCtl);
457DECLR0VBGL(int) VbglR0CrCtlConConnect(VBGLCRCTLHANDLE hCtl, HGCMCLIENTID *pidClient);
458DECLR0VBGL(int) VbglR0CrCtlConDisconnect(VBGLCRCTLHANDLE hCtl, HGCMCLIENTID idClient);
459struct VBGLIOCHGCMCALL;
460DECLR0VBGL(int) VbglR0CrCtlConCallRaw(VBGLCRCTLHANDLE hCtl, struct VBGLIOCHGCMCALL *pCallInfo, int cbCallInfo);
461DECLR0VBGL(int) VbglR0CrCtlConCall(VBGLCRCTLHANDLE hCtl, struct VBGLIOCHGCMCALL *pCallInfo, int cbCallInfo);
462DECLR0VBGL(int) VbglR0CrCtlConCallUserDataRaw(VBGLCRCTLHANDLE hCtl, struct VBGLIOCHGCMCALL *pCallInfo, int cbCallInfo);
463/** @} */
464
465# endif /* !VBGL_VBOXGUEST */
466
467# endif /* VBOX_WITH_HGCM */
468
469
470/**
471 * Initialize the heap.
472 *
473 * @returns VBox status code.
474 */
475DECLR0VBGL(int) VbglR0PhysHeapInit(void);
476
477/**
478 * Shutdown the heap.
479 */
480DECLR0VBGL(void) VbglR0PhysHeapTerminate(void);
481
482/**
483 * Allocate a memory block.
484 *
485 * @returns Virtual address of the allocated memory block.
486 * @param cbSize Size of block to be allocated.
487 */
488DECLR0VBGL(void *) VbglR0PhysHeapAlloc(uint32_t cbSize);
489
490/**
491 * Get physical address of memory block pointed by the virtual address.
492 *
493 * @note WARNING!
494 * The function does not acquire the Heap mutex!
495 * When calling the function make sure that the pointer is a valid one and
496 * is not being deallocated. This function can NOT be used for verifying
497 * if the given pointer is a valid one allocated from the heap.
498 *
499 * @param pv Virtual address of memory block.
500 * @returns Physical address of the memory block.
501 */
502DECLR0VBGL(uint32_t) VbglR0PhysHeapGetPhysAddr(void *pv);
503
504/**
505 * Free a memory block.
506 *
507 * @param pv Virtual address of memory block.
508 */
509DECLR0VBGL(void) VbglR0PhysHeapFree(void *pv);
510
511DECLR0VBGL(int) VbglR0QueryVMMDevMemory(struct VMMDevMemory **ppVMMDevMemory);
512DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void);
513
514# ifndef VBOX_GUEST
515/** @name Mouse
516 * @{ */
517DECLR0VBGL(int) VbglR0SetMouseNotifyCallback(PFNVBOXGUESTMOUSENOTIFY pfnNotify, void *pvUser);
518DECLR0VBGL(int) VbglR0GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
519DECLR0VBGL(int) VbglR0SetMouseStatus(uint32_t fFeatures);
520/** @} */
521# endif /* VBOX_GUEST */
522
523#endif /* IN_RING0 */
524
525/** @} */
526
527
528/** @defgroup grp_vboxguest_lib_r3 Ring-3 interface.
529 * @{
530 */
531#ifdef IN_RING3
532
533/** @def VBGLR3DECL
534 * Ring 3 VBGL declaration.
535 * @param type The return type of the function declaration.
536 */
537# define VBGLR3DECL(type) DECLHIDDEN(type) VBOXCALL
538
539/** @name General-purpose functions
540 * @{ */
541VBGLR3DECL(int) VbglR3Init(void);
542VBGLR3DECL(int) VbglR3InitUser(void);
543VBGLR3DECL(void) VbglR3Term(void);
544# ifdef ___iprt_time_h
545VBGLR3DECL(int) VbglR3GetHostTime(PRTTIMESPEC pTime);
546# endif
547VBGLR3DECL(int) VbglR3InterruptEventWaits(void);
548VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cch);
549VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot);
550VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn, unsigned *pcRespawn);
551VBGLR3DECL(int) VbglR3PidFile(const char *pszPath, PRTFILE phFile);
552VBGLR3DECL(void) VbglR3ClosePidFile(const char *pszPath, RTFILE hFile);
553VBGLR3DECL(int) VbglR3SetGuestCaps(uint32_t fOr, uint32_t fNot);
554VBGLR3DECL(int) VbglR3AcquireGuestCaps(uint32_t fOr, uint32_t fNot, bool fConfig);
555VBGLR3DECL(int) VbglR3WaitEvent(uint32_t fMask, uint32_t cMillies, uint32_t *pfEvents);
556
557VBGLR3DECL(int) VbglR3ReportAdditionsStatus(VBoxGuestFacilityType Facility, VBoxGuestFacilityStatus StatusCurrent,
558 uint32_t fFlags);
559VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char **ppszRev);
560VBGLR3DECL(int) VbglR3GetAdditionsInstallationPath(char **ppszPath);
561VBGLR3DECL(int) VbglR3GetSessionId(uint64_t *pu64IdSession);
562
563/** @} */
564
565/** @name Shared clipboard
566 * @{ */
567VBGLR3DECL(int) VbglR3ClipboardConnect(HGCMCLIENTID *pidClient);
568VBGLR3DECL(int) VbglR3ClipboardDisconnect(HGCMCLIENTID idClient);
569VBGLR3DECL(int) VbglR3ClipboardGetHostMsg(HGCMCLIENTID idClient, uint32_t *pMsg, uint32_t *pfFormats);
570VBGLR3DECL(int) VbglR3ClipboardReadData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
571VBGLR3DECL(int) VbglR3ClipboardReportFormats(HGCMCLIENTID idClient, uint32_t fFormats);
572VBGLR3DECL(int) VbglR3ClipboardWriteData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb);
573/** @} */
574
575/** @name Seamless mode
576 * @{ */
577VBGLR3DECL(int) VbglR3SeamlessSetCap(bool fState);
578VBGLR3DECL(int) VbglR3SeamlessWaitEvent(VMMDevSeamlessMode *pMode);
579VBGLR3DECL(int) VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects);
580VBGLR3DECL(int) VbglR3SeamlessGetLastEvent(VMMDevSeamlessMode *pMode);
581
582/** @} */
583
584/** @name Mouse
585 * @{ */
586VBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
587VBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures);
588/** @} */
589
590/** @name Video
591 * @{ */
592VBGLR3DECL(int) VbglR3VideoAccelEnable(bool fEnable);
593VBGLR3DECL(int) VbglR3VideoAccelFlush(void);
594VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
595 const void *pvImg, size_t cbImg);
596VBGLR3DECL(int) VbglR3SetPointerShapeReq(struct VMMDevReqMousePointer *pReq);
597/** @} */
598
599/** @name Display
600 * @{ */
601/** The folder for the video mode hint unix domain socket on Unix-like guests.
602 * @note This can be safely changed as all users are rebuilt in lock-step. */
603#define VBGLR3HOSTDISPSOCKETPATH "/tmp/.VBoxService"
604/** The path to the video mode hint unix domain socket on Unix-like guests. */
605#define VBGLR3HOSTDISPSOCKET VBGLR3VIDEOMODEHINTSOCKETPATH "/VideoModeHint"
606
607/** The folder for saving video mode hints to between sessions. */
608#define VBGLR3HOSTDISPSAVEDMODEPATH "/var/lib/VBoxGuestAdditions"
609/** The path to the file for saving video mode hints to between sessions. */
610#define VBGLR3HOSTDISPSAVEDMODE VBGLR3HOSTDISPSAVEDMODEPATH "/SavedVideoModes"
611
612VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay,
613 uint32_t *pdx, uint32_t *pdy, bool *pfEnabled, bool *pfChangeOrigin, bool fAck);
614VBGLR3DECL(int) VbglR3GetDisplayChangeRequestMulti(uint32_t cDisplaysIn, uint32_t *pcDisplaysOut,
615 VMMDevDisplayDef *paDisplays, bool fAck);
616VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
617VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen);
618VBGLR3DECL(int) VbglR3SaveVideoMode(unsigned cScreen, unsigned cx, unsigned cy, unsigned cBits,
619 unsigned x, unsigned y, bool fEnabled);
620VBGLR3DECL(int) VbglR3RetrieveVideoMode(unsigned cScreen, unsigned *pcx, unsigned *pcy, unsigned *pcBits,
621 unsigned *px, unsigned *py, bool *pfEnabled);
622/** @} */
623
624/** @name VRDP
625 * @{ */
626VBGLR3DECL(int) VbglR3VrdpGetChangeRequest(bool *pfActive, uint32_t *puExperienceLevel);
627/** @} */
628
629/** @name VM Statistics
630 * @{ */
631VBGLR3DECL(int) VbglR3StatQueryInterval(uint32_t *pu32Interval);
632# if defined(___VBox_VMMDev_h) || defined(DOXYGEN_RUNNING)
633VBGLR3DECL(int) VbglR3StatReport(VMMDevReportGuestStats *pReq);
634# endif
635/** @} */
636
637/** @name Memory ballooning
638 * @{ */
639VBGLR3DECL(int) VbglR3MemBalloonRefresh(uint32_t *pcChunks, bool *pfHandleInR3);
640VBGLR3DECL(int) VbglR3MemBalloonChange(void *pv, bool fInflate);
641/** @} */
642
643/** @name Core Dump
644 * @{ */
645VBGLR3DECL(int) VbglR3WriteCoreDump(void);
646
647/** @} */
648
649# ifdef VBOX_WITH_GUEST_PROPS
650/** @name Guest properties
651 * @{ */
652/** @todo Docs. */
653typedef struct VBGLR3GUESTPROPENUM VBGLR3GUESTPROPENUM;
654/** @todo Docs. */
655typedef VBGLR3GUESTPROPENUM *PVBGLR3GUESTPROPENUM;
656VBGLR3DECL(int) VbglR3GuestPropConnect(uint32_t *pidClient);
657VBGLR3DECL(int) VbglR3GuestPropDisconnect(HGCMCLIENTID idClient);
658VBGLR3DECL(int) VbglR3GuestPropWrite(HGCMCLIENTID idClient, const char *pszName, const char *pszValue, const char *pszFlags);
659VBGLR3DECL(int) VbglR3GuestPropWriteValue(HGCMCLIENTID idClient, const char *pszName, const char *pszValue);
660VBGLR3DECL(int) VbglR3GuestPropWriteValueV(HGCMCLIENTID idClient, const char *pszName,
661 const char *pszValueFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
662VBGLR3DECL(int) VbglR3GuestPropWriteValueF(HGCMCLIENTID idClient, const char *pszName,
663 const char *pszValueFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
664VBGLR3DECL(int) VbglR3GuestPropRead(HGCMCLIENTID idClient, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue,
665 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
666VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue,
667 uint32_t *pcchValueActual);
668VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(HGCMCLIENTID idClient, const char *pszName, char **ppszValue);
669VBGLR3DECL(void) VbglR3GuestPropReadValueFree(char *pszValue);
670VBGLR3DECL(int) VbglR3GuestPropEnumRaw(HGCMCLIENTID idClient, const char *paszPatterns, char *pcBuf, uint32_t cbBuf,
671 uint32_t *pcbBufActual);
672VBGLR3DECL(int) VbglR3GuestPropEnum(HGCMCLIENTID idClient, char const * const *ppaszPatterns, uint32_t cPatterns,
673 PVBGLR3GUESTPROPENUM *ppHandle, char const **ppszName, char const **ppszValue,
674 uint64_t *pu64Timestamp, char const **ppszFlags);
675VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue,
676 uint64_t *pu64Timestamp, char const **ppszFlags);
677VBGLR3DECL(void) VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle);
678VBGLR3DECL(int) VbglR3GuestPropDelete(HGCMCLIENTID idClient, const char *pszName);
679VBGLR3DECL(int) VbglR3GuestPropDelSet(HGCMCLIENTID idClient, char const * const *papszPatterns, uint32_t cPatterns);
680VBGLR3DECL(int) VbglR3GuestPropWait(HGCMCLIENTID idClient, const char *pszPatterns, void *pvBuf, uint32_t cbBuf,
681 uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue,
682 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
683/** @} */
684
685/** @name Guest user handling / reporting.
686 * @{ */
687VBGLR3DECL(int) VbglR3GuestUserReportState(const char *pszUser, const char *pszDomain, VBoxGuestUserState enmState,
688 uint8_t *pbDetails, uint32_t cbDetails);
689/** @} */
690
691/** @name Host version handling
692 * @{ */
693VBGLR3DECL(int) VbglR3HostVersionCheckForUpdate(HGCMCLIENTID idClient, bool *pfUpdate, char **ppszHostVersion,
694 char **ppszGuestVersion);
695VBGLR3DECL(int) VbglR3HostVersionLastCheckedLoad(HGCMCLIENTID idClient, char **ppszVer);
696VBGLR3DECL(int) VbglR3HostVersionLastCheckedStore(HGCMCLIENTID idClient, const char *pszVer);
697/** @} */
698# endif /* VBOX_WITH_GUEST_PROPS defined */
699
700# ifdef VBOX_WITH_SHARED_FOLDERS
701/** @name Shared folders
702 * @{ */
703/**
704 * Structure containing mapping information for a shared folder.
705 */
706typedef struct VBGLR3SHAREDFOLDERMAPPING
707{
708 /** Mapping status. */
709 uint32_t u32Status;
710 /** Root handle. */
711 uint32_t u32Root;
712} VBGLR3SHAREDFOLDERMAPPING;
713/** Pointer to a shared folder mapping information structure. */
714typedef VBGLR3SHAREDFOLDERMAPPING *PVBGLR3SHAREDFOLDERMAPPING;
715/** Pointer to a const shared folder mapping information structure. */
716typedef VBGLR3SHAREDFOLDERMAPPING const *PCVBGLR3SHAREDFOLDERMAPPING;
717
718VBGLR3DECL(int) VbglR3SharedFolderConnect(uint32_t *pidClient);
719VBGLR3DECL(int) VbglR3SharedFolderDisconnect(HGCMCLIENTID idClient);
720VBGLR3DECL(bool) VbglR3SharedFolderExists(HGCMCLIENTID idClient, const char *pszShareName);
721VBGLR3DECL(int) VbglR3SharedFolderGetMappings(HGCMCLIENTID idClient, bool fAutoMountOnly,
722 PVBGLR3SHAREDFOLDERMAPPING *ppaMappings, uint32_t *pcMappings);
723VBGLR3DECL(void) VbglR3SharedFolderFreeMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings);
724VBGLR3DECL(int) VbglR3SharedFolderGetName(HGCMCLIENTID idClient,uint32_t u32Root, char **ppszName); /**< @todo r=bird: GET functions return the value, not a status code!*/
725VBGLR3DECL(int) VbglR3SharedFolderQueryFolderInfo(HGCMCLIENTID idClient, uint32_t idRoot, uint64_t fQueryFlags,
726 char **ppszName, char **ppszMountPoint,
727 uint64_t *pfFlags, uint32_t *puRootIdVersion);
728VBGLR3DECL(int) VbglR3SharedFolderWaitForMappingsChanges(HGCMCLIENTID idClient, uint32_t uPrevVersion, uint32_t *puCurVersion);
729VBGLR3DECL(int) VbglR3SharedFolderCancelMappingsChangesWaits(HGCMCLIENTID idClient);
730
731VBGLR3DECL(int) VbglR3SharedFolderGetMountPrefix(char **ppszPrefix); /**< @todo r=bird: GET functions return the value, not a status code! */
732VBGLR3DECL(int) VbglR3SharedFolderGetMountDir(char **ppszDir); /**< @todo r=bird: GET functions return the value, not a status code! */
733/** @} */
734# endif /* VBOX_WITH_SHARED_FOLDERS defined */
735
736# ifdef VBOX_WITH_GUEST_CONTROL
737/** @name Guest control
738 * @{ */
739
740/**
741 * Structure containing the context required for
742 * either retrieving or sending a HGCM guest control
743 * commands from or to the host.
744 *
745 * Note: Do not change parameter order without also
746 * adapting all structure initializers.
747 */
748typedef struct VBGLR3GUESTCTRLCMDCTX
749{
750 /** @todo This struct could be handy if we want to implement
751 * a second communication channel, e.g. via TCP/IP.
752 * Use a union for the HGCM stuff then. */
753
754 /** IN: HGCM client ID to use for
755 * communication. */
756 uint32_t uClientID;
757 /** IN/OUT: Context ID to retrieve
758 * or to use. */
759 uint32_t uContextID;
760 /** IN: Protocol version to use. */
761 uint32_t uProtocol;
762 /** OUT: Number of parameters retrieved. */
763 uint32_t uNumParms;
764} VBGLR3GUESTCTRLCMDCTX, *PVBGLR3GUESTCTRLCMDCTX;
765
766/* General message handling on the guest. */
767VBGLR3DECL(int) VbglR3GuestCtrlConnect(uint32_t *pidClient);
768VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t idClient);
769VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove);
770VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterUnset(uint32_t uClientId);
771VBGLR3DECL(int) VbglR3GuestCtrlMsgReply(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc);
772VBGLR3DECL(int) VbglR3GuestCtrlMsgReplyEx(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc, uint32_t uType,
773 void *pvPayload, uint32_t cbPayload);
774VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t uClientId);
775VBGLR3DECL(int) VbglR3GuestCtrlMsgPeekWait(uint32_t idClient, uint32_t *pidMsg, uint32_t *pcParameters);
776VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(HGCMCLIENTID idClient);
777/* Guest session handling. */
778VBGLR3DECL(int) VbglR3GuestCtrlSessionClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t fFlags);
779VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uType, uint32_t uResult);
780VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puProtocol, char *pszUser, uint32_t cbUser,
781 char *pszPassword, uint32_t cbPassword, char *pszDomain, uint32_t cbDomain,
782 uint32_t *pfFlags, uint32_t *pidSession);
783VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *pfFlags, uint32_t *pidSession);
784/* Guest path handling. */
785VBGLR3DECL(int) VbglR3GuestCtrlPathGetRename(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszSource, uint32_t cbSource, char *pszDest,
786 uint32_t cbDest, uint32_t *pfFlags);
787VBGLR3DECL(int) VbglR3GuestCtrlPathGetUserDocuments(PVBGLR3GUESTCTRLCMDCTX pCtx);
788VBGLR3DECL(int) VbglR3GuestCtrlPathGetUserHome(PVBGLR3GUESTCTRLCMDCTX pCtx);
789/* Guest process execution. */
790VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszCmd, uint32_t cbCmd, uint32_t *pfFlags,
791 char *pszArgs, uint32_t cbArgs, uint32_t *puNumArgs, char *pszEnv, uint32_t *pcbEnv,
792 uint32_t *puNumEnvVars, char *pszUser, uint32_t cbUser, char *pszPassword,
793 uint32_t cbPassword, uint32_t *puTimeoutMS, uint32_t *puPriority,
794 uint64_t *puAffinity, uint32_t cbAffinity, uint32_t *pcAffinity);
795VBGLR3DECL(int) VbglR3GuestCtrlProcGetTerminate(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID);
796VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *pfFlags, void *pvData,
797 uint32_t cbData, uint32_t *pcbSize);
798VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puHandle, uint32_t *pfFlags);
799VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puWaitFlags,
800 uint32_t *puTimeoutMS);
801/* Guest native directory handling. */
802VBGLR3DECL(int) VbglR3GuestCtrlDirGetRemove(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *pfFlags);
803/* Guest native file handling. */
804VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszFileName, uint32_t cbFileName, char *pszOpenMode,
805 uint32_t cbOpenMode, char *pszDisposition, uint32_t cbDisposition, char *pszSharing,
806 uint32_t cbSharing, uint32_t *puCreationMode, uint64_t *puOffset);
807VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
808VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puToRead);
809VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
810 uint32_t *puToRead, uint64_t *poffRead);
811VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
812 void *pvData, uint32_t cbData, uint32_t *pcbActual);
813VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, void *pvData, uint32_t cbData,
814 uint32_t *pcbActual, uint64_t *poffWrite);
815VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
816 uint32_t *puSeekMethod, uint64_t *poffSeek);
817VBGLR3DECL(int) VbglR3GuestCtrlFileGetTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
818/* Guest -> Host. */
819VBGLR3DECL(int) VbglR3GuestCtrlFileCbOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uFileHandle);
820VBGLR3DECL(int) VbglR3GuestCtrlFileCbClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
821VBGLR3DECL(int) VbglR3GuestCtrlFileCbError(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
822VBGLR3DECL(int) VbglR3GuestCtrlFileCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, void *pvData, uint32_t cbData);
823VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uWritten);
824VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
825VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
826VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uStatus, uint32_t fFlags,
827 void *pvData, uint32_t cbData);
828VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uHandle, uint32_t fFlags,
829 void *pvData, uint32_t cbData);
830VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t u32PID, uint32_t uStatus,
831 uint32_t fFlags, uint32_t cbWritten);
832
833/** @} */
834# endif /* VBOX_WITH_GUEST_CONTROL defined */
835
836/** @name Auto-logon handling
837 * @{ */
838VBGLR3DECL(int) VbglR3AutoLogonReportStatus(VBoxGuestFacilityStatus enmStatus);
839VBGLR3DECL(bool) VbglR3AutoLogonIsRemoteSession(void);
840/** @} */
841
842/** @name User credentials handling
843 * @{ */
844VBGLR3DECL(int) VbglR3CredentialsQueryAvailability(void);
845VBGLR3DECL(int) VbglR3CredentialsRetrieve(char **ppszUser, char **ppszPassword, char **ppszDomain);
846VBGLR3DECL(int) VbglR3CredentialsRetrieveUtf16(PRTUTF16 *ppwszUser, PRTUTF16 *ppwszPassword, PRTUTF16 *ppwszDomain);
847VBGLR3DECL(void) VbglR3CredentialsDestroy(char *pszUser, char *pszPassword, char *pszDomain, uint32_t cPasses);
848VBGLR3DECL(void) VbglR3CredentialsDestroyUtf16(PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTUTF16 pwszDomain,
849 uint32_t cPasses);
850/** @} */
851
852/** @name CPU hotplug monitor
853 * @{ */
854VBGLR3DECL(int) VbglR3CpuHotPlugInit(void);
855VBGLR3DECL(int) VbglR3CpuHotPlugTerm(void);
856VBGLR3DECL(int) VbglR3CpuHotPlugWaitForEvent(VMMDevCpuEventType *penmEventType, uint32_t *pidCpuCore, uint32_t *pidCpuPackage);
857/** @} */
858
859/** @name Page sharing
860 * @{ */
861struct VMMDEVSHAREDREGIONDESC;
862VBGLR3DECL(int) VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule,
863 unsigned cRegions, struct VMMDEVSHAREDREGIONDESC *pRegions);
864VBGLR3DECL(int) VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule);
865VBGLR3DECL(int) VbglR3CheckSharedModules(void);
866VBGLR3DECL(bool) VbglR3PageSharingIsEnabled(void);
867VBGLR3DECL(int) VbglR3PageIsShared(RTGCPTR pPage, bool *pfShared, uint64_t *puPageFlags);
868/** @} */
869
870# ifdef VBOX_WITH_DRAG_AND_DROP
871/** @name Drag and Drop
872 * @{ */
873/**
874 * Structure containing the context required for
875 * either retrieving or sending a HGCM guest drag'n drop
876 * commands from or to the host.
877 *
878 * Note: Do not change parameter order without also
879 * adapting all structure initializers.
880 */
881typedef struct VBGLR3GUESTDNDCMDCTX
882{
883 /** @todo This struct could be handy if we want to implement
884 * a second communication channel, e.g. via TCP/IP.
885 * Use a union for the HGCM stuff then. */
886
887 /** HGCM client ID to use for communication. */
888 uint32_t uClientID;
889 /** The VM's current session ID. */
890 uint64_t uSessionID;
891 /** Protocol version to use. */
892 uint32_t uProtocol;
893 /** Number of parameters retrieved for the current command. */
894 uint32_t uNumParms;
895 /** Max chunk size (in bytes) for data transfers. */
896 uint32_t cbMaxChunkSize;
897} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
898
899/**
900 * Enumeration for specifying the DnD meta data type.
901 */
902typedef enum VBGLR3GUESTDNDMETADATATYPE
903{
904 /** Unknown meta data type; don't use. */
905 VBGLR3GUESTDNDMETADATATYPE_UNKNOWN = 0,
906 /** Raw meta data; can be everything. */
907 VBGLR3GUESTDNDMETADATATYPE_RAW,
908 /** Meta data is an URI list, specifying objects. */
909 VBGLR3GUESTDNDMETADATATYPE_URI_LIST,
910 /** Blow the type up to 32-bit. */
911 VBGLR3GUESTDNDMETADATATYPE_32BIT_HACK = 0x7fffffff
912} VBGLR3GUESTDNDMETADATATYPE;
913
914/**
915 * Structure for keeping + handling DnD meta data.
916 *
917 * Note: Don't treat this struct as POD object, as the union has classes in it.
918 */
919typedef struct VBGLR3GUESTDNDMETADATA
920{
921 /** The meta data type the union contains. */
922 VBGLR3GUESTDNDMETADATATYPE enmType;
923 /** Pointer to actual meta data. */
924 void *pvMeta;
925 /** Size (in bytes) of meta data. */
926 uint32_t cbMeta;
927} VBGLR3GUESTDNDMETADATA;
928
929/** Pointer to VBGLR3GUESTDNDMETADATA. */
930typedef VBGLR3GUESTDNDMETADATA *PVBGLR3GUESTDNDMETADATA;
931
932/** Const pointer to VBGLR3GUESTDNDMETADATA. */
933typedef const PVBGLR3GUESTDNDMETADATA CPVBGLR3GUESTDNDMETADATA;
934
935/**
936 * Enumeration specifying a DnD event type.
937 */
938typedef enum VBGLR3DNDEVENTTYPE
939{
940 VBGLR3DNDEVENTTYPE_INVALID = 0,
941 VBGLR3DNDEVENTTYPE_HG_ERROR = 1,
942 VBGLR3DNDEVENTTYPE_HG_ENTER = 2,
943 VBGLR3DNDEVENTTYPE_HG_MOVE = 3,
944 VBGLR3DNDEVENTTYPE_HG_LEAVE = 4,
945 VBGLR3DNDEVENTTYPE_HG_DROP = 5,
946 VBGLR3DNDEVENTTYPE_HG_RECEIVE = 6,
947 VBGLR3DNDEVENTTYPE_HG_CANCEL = 7,
948# ifdef VBOX_WITH_DRAG_AND_DROP_GH
949 VBGLR3DNDEVENTTYPE_GH_ERROR = 100,
950 VBGLR3DNDEVENTTYPE_GH_REQ_PENDING = 101,
951 VBGLR3DNDEVENTTYPE_GH_DROP = 102,
952# endif
953 /** Blow the type up to 32-bit. */
954 VBGLR3DNDEVENTTYPE_32BIT_HACK = 0x7fffffff
955} VBGLR3DNDEVENTTYPE;
956
957typedef struct VBGLR3DNDEVENT
958{
959 /** The event type the union contains. */
960 VBGLR3DNDEVENTTYPE enmType;
961 union
962 {
963 struct
964 {
965 /** Screen ID this request belongs to. */
966 uint32_t uScreenID;
967 /** Format list (UTF-8, \r\n separated). */
968 char *pszFormats;
969 /** Size (in bytes) of pszFormats (\0 included). */
970 uint32_t cbFormats;
971 /** List of allowed DnD actions. */
972 VBOXDNDACTIONLIST dndLstActionsAllowed;
973 } HG_Enter;
974 struct
975 {
976 /** Absolute X position of guest screen. */
977 uint32_t uXpos;
978 /** Absolute Y position of guest screen. */
979 uint32_t uYpos;
980 /** Default DnD action. */
981 VBOXDNDACTION dndActionDefault;
982 } HG_Move;
983 struct
984 {
985 /** Absolute X position of guest screen. */
986 uint32_t uXpos;
987 /** Absolute Y position of guest screen. */
988 uint32_t uYpos;
989 /** Default DnD action. */
990 VBOXDNDACTION dndActionDefault;
991 } HG_Drop;
992 struct
993 {
994 /** Meta data for the operation. */
995 VBGLR3GUESTDNDMETADATA Meta;
996 } HG_Received;
997 struct
998 {
999 /** IPRT-style error code. */
1000 int rc;
1001 } HG_Error;
1002# ifdef VBOX_WITH_DRAG_AND_DROP_GH
1003 struct
1004 {
1005 /** Screen ID this request belongs to. */
1006 uint32_t uScreenID;
1007 } GH_IsPending;
1008 struct
1009 {
1010 /** Requested format by the host. */
1011 char *pszFormat;
1012 /** Size (in bytes) of pszFormat (\0 included). */
1013 uint32_t cbFormat;
1014 /** Requested DnD action. */
1015 VBOXDNDACTION dndActionRequested;
1016 } GH_Drop;
1017# endif
1018 } u;
1019} VBGLR3DNDEVENT;
1020typedef VBGLR3DNDEVENT *PVBGLR3DNDEVENT;
1021typedef const PVBGLR3DNDEVENT CPVBGLR3DNDEVENT;
1022
1023VBGLR3DECL(int) VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx);
1024VBGLR3DECL(int) VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
1025
1026VBGLR3DECL(int) VbglR3DnDEventGetNext(PVBGLR3GUESTDNDCMDCTX pCtx, PVBGLR3DNDEVENT *ppEvent);
1027VBGLR3DECL(void) VbglR3DnDEventFree(PVBGLR3DNDEVENT pEvent);
1028
1029VBGLR3DECL(int) VbglR3DnDHGSendAckOp(PVBGLR3GUESTDNDCMDCTX pCtx, VBOXDNDACTION dndAction);
1030VBGLR3DECL(int) VbglR3DnDHGSendReqData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pcszFormat);
1031VBGLR3DECL(int) VbglR3DnDHGSendProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
1032# ifdef VBOX_WITH_DRAG_AND_DROP_GH
1033VBGLR3DECL(int) VbglR3DnDGHSendAckPending(PVBGLR3GUESTDNDCMDCTX pCtx, VBOXDNDACTION dndActionDefault, VBOXDNDACTIONLIST dndLstActionsAllowed, const char* pcszFormats, uint32_t cbFormats);
1034VBGLR3DECL(int) VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData);
1035VBGLR3DECL(int) VbglR3DnDGHSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcOp);
1036# endif /* VBOX_WITH_DRAG_AND_DROP_GH */
1037/** @} */
1038# endif /* VBOX_WITH_DRAG_AND_DROP */
1039
1040/* Generic Host Channel Service. */
1041VBGLR3DECL(int) VbglR3HostChannelInit(uint32_t *pidClient);
1042VBGLR3DECL(void) VbglR3HostChannelTerm(uint32_t idClient);
1043VBGLR3DECL(int) VbglR3HostChannelAttach(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
1044 const char *pszName, uint32_t u32Flags);
1045VBGLR3DECL(void) VbglR3HostChannelDetach(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
1046VBGLR3DECL(int) VbglR3HostChannelSend(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1047 void *pvData, uint32_t cbData);
1048VBGLR3DECL(int) VbglR3HostChannelRecv(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1049 void *pvData, uint32_t cbData,
1050 uint32_t *pu32SizeReceived, uint32_t *pu32SizeRemaining);
1051VBGLR3DECL(int) VbglR3HostChannelControl(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1052 uint32_t u32Code, void *pvParm, uint32_t cbParm,
1053 void *pvData, uint32_t cbData, uint32_t *pu32SizeDataReturned);
1054VBGLR3DECL(int) VbglR3HostChannelEventWait(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
1055 uint32_t *pu32EventId, void *pvParm, uint32_t cbParm,
1056 uint32_t *pu32SizeReturned);
1057VBGLR3DECL(int) VbglR3HostChannelEventCancel(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
1058VBGLR3DECL(int) VbglR3HostChannelQuery(const char *pszName, uint32_t u32HGCMClientId, uint32_t u32Code,
1059 void *pvParm, uint32_t cbParm, void *pvData, uint32_t cbData,
1060 uint32_t *pu32SizeDataReturned);
1061
1062/** @name Mode hint storage
1063 * @{ */
1064VBGLR3DECL(int) VbglR3ReadVideoMode(unsigned cDisplay, unsigned *cx,
1065 unsigned *cy, unsigned *cBPP, unsigned *x,
1066 unsigned *y, unsigned *fEnabled);
1067VBGLR3DECL(int) VbglR3WriteVideoMode(unsigned cDisplay, unsigned cx,
1068 unsigned cy, unsigned cBPP, unsigned x,
1069 unsigned y, unsigned fEnabled);
1070/** @} */
1071
1072/** @name Generic HGCM
1073 * @{ */
1074VBGLR3DECL(int) VbglR3HGCMConnect(const char *pszServiceName, HGCMCLIENTID *pidClient);
1075VBGLR3DECL(int) VbglR3HGCMDisconnect(HGCMCLIENTID idClient);
1076struct VBGLIOCHGCMCALL;
1077VBGLR3DECL(int) VbglR3HGCMCall(struct VBGLIOCHGCMCALL *pInfo, size_t cbInfo);
1078/** @} */
1079
1080#endif /* IN_RING3 */
1081/** @} */
1082
1083RT_C_DECLS_END
1084
1085/** @} */
1086
1087#endif
1088
Note: See TracBrowser for help on using the repository browser.

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