VirtualBox

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

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

Shared Clipboard/URI: Update.

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