VirtualBox

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

Last change on this file since 76507 was 76507, checked in by vboxsync, 5 years ago

/include: scm --fix-header-guards. bugref:9344

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 46.9 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#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_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_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/** @name Shared clipboard
569 * @{ */
570VBGLR3DECL(int) VbglR3ClipboardConnect(HGCMCLIENTID *pidClient);
571VBGLR3DECL(int) VbglR3ClipboardDisconnect(HGCMCLIENTID idClient);
572VBGLR3DECL(int) VbglR3ClipboardGetHostMsg(HGCMCLIENTID idClient, uint32_t *pMsg, uint32_t *pfFormats);
573VBGLR3DECL(int) VbglR3ClipboardReadData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
574VBGLR3DECL(int) VbglR3ClipboardReportFormats(HGCMCLIENTID idClient, uint32_t fFormats);
575VBGLR3DECL(int) VbglR3ClipboardWriteData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb);
576/** @} */
577
578/** @name Seamless mode
579 * @{ */
580VBGLR3DECL(int) VbglR3SeamlessSetCap(bool fState);
581VBGLR3DECL(int) VbglR3SeamlessWaitEvent(VMMDevSeamlessMode *pMode);
582VBGLR3DECL(int) VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects);
583VBGLR3DECL(int) VbglR3SeamlessGetLastEvent(VMMDevSeamlessMode *pMode);
584
585/** @} */
586
587/** @name Mouse
588 * @{ */
589VBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
590VBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures);
591/** @} */
592
593/** @name Video
594 * @{ */
595VBGLR3DECL(int) VbglR3VideoAccelEnable(bool fEnable);
596VBGLR3DECL(int) VbglR3VideoAccelFlush(void);
597VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
598 const void *pvImg, size_t cbImg);
599VBGLR3DECL(int) VbglR3SetPointerShapeReq(struct VMMDevReqMousePointer *pReq);
600/** @} */
601
602/** @name Display
603 * @{ */
604/** The folder for the video mode hint unix domain socket on Unix-like guests.
605 * @note This can be safely changed as all users are rebuilt in lock-step. */
606#define VBGLR3HOSTDISPSOCKETPATH "/tmp/.VBoxService"
607/** The path to the video mode hint unix domain socket on Unix-like guests. */
608#define VBGLR3HOSTDISPSOCKET VBGLR3VIDEOMODEHINTSOCKETPATH "/VideoModeHint"
609
610/** The folder for saving video mode hints to between sessions. */
611#define VBGLR3HOSTDISPSAVEDMODEPATH "/var/lib/VBoxGuestAdditions"
612/** The path to the file for saving video mode hints to between sessions. */
613#define VBGLR3HOSTDISPSAVEDMODE VBGLR3HOSTDISPSAVEDMODEPATH "/SavedVideoModes"
614
615VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay,
616 uint32_t *pdx, uint32_t *pdy, bool *pfEnabled, bool *pfChangeOrigin, bool fAck);
617VBGLR3DECL(int) VbglR3GetDisplayChangeRequestMulti(uint32_t cDisplaysIn, uint32_t *pcDisplaysOut,
618 VMMDevDisplayDef *paDisplays, bool fAck);
619VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
620VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen);
621VBGLR3DECL(int) VbglR3SaveVideoMode(unsigned cScreen, unsigned cx, unsigned cy, unsigned cBits,
622 unsigned x, unsigned y, bool fEnabled);
623VBGLR3DECL(int) VbglR3RetrieveVideoMode(unsigned cScreen, unsigned *pcx, unsigned *pcy, unsigned *pcBits,
624 unsigned *px, unsigned *py, bool *pfEnabled);
625/** @} */
626
627/** @name VRDP
628 * @{ */
629VBGLR3DECL(int) VbglR3VrdpGetChangeRequest(bool *pfActive, uint32_t *puExperienceLevel);
630/** @} */
631
632/** @name VM Statistics
633 * @{ */
634VBGLR3DECL(int) VbglR3StatQueryInterval(uint32_t *pu32Interval);
635# if defined(___VBox_VMMDev_h) || defined(DOXYGEN_RUNNING)
636VBGLR3DECL(int) VbglR3StatReport(VMMDevReportGuestStats *pReq);
637# endif
638/** @} */
639
640/** @name Memory ballooning
641 * @{ */
642VBGLR3DECL(int) VbglR3MemBalloonRefresh(uint32_t *pcChunks, bool *pfHandleInR3);
643VBGLR3DECL(int) VbglR3MemBalloonChange(void *pv, bool fInflate);
644/** @} */
645
646/** @name Core Dump
647 * @{ */
648VBGLR3DECL(int) VbglR3WriteCoreDump(void);
649
650/** @} */
651
652# ifdef VBOX_WITH_GUEST_PROPS
653/** @name Guest properties
654 * @{ */
655/** @todo Docs. */
656typedef struct VBGLR3GUESTPROPENUM VBGLR3GUESTPROPENUM;
657/** @todo Docs. */
658typedef VBGLR3GUESTPROPENUM *PVBGLR3GUESTPROPENUM;
659VBGLR3DECL(int) VbglR3GuestPropConnect(uint32_t *pidClient);
660VBGLR3DECL(int) VbglR3GuestPropDisconnect(HGCMCLIENTID idClient);
661VBGLR3DECL(int) VbglR3GuestPropWrite(HGCMCLIENTID idClient, const char *pszName, const char *pszValue, const char *pszFlags);
662VBGLR3DECL(int) VbglR3GuestPropWriteValue(HGCMCLIENTID idClient, const char *pszName, const char *pszValue);
663VBGLR3DECL(int) VbglR3GuestPropWriteValueV(HGCMCLIENTID idClient, const char *pszName,
664 const char *pszValueFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
665VBGLR3DECL(int) VbglR3GuestPropWriteValueF(HGCMCLIENTID idClient, const char *pszName,
666 const char *pszValueFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
667VBGLR3DECL(int) VbglR3GuestPropRead(HGCMCLIENTID idClient, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue,
668 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
669VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue,
670 uint32_t *pcchValueActual);
671VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(HGCMCLIENTID idClient, const char *pszName, char **ppszValue);
672VBGLR3DECL(void) VbglR3GuestPropReadValueFree(char *pszValue);
673VBGLR3DECL(int) VbglR3GuestPropEnumRaw(HGCMCLIENTID idClient, const char *paszPatterns, char *pcBuf, uint32_t cbBuf,
674 uint32_t *pcbBufActual);
675VBGLR3DECL(int) VbglR3GuestPropEnum(HGCMCLIENTID idClient, char const * const *ppaszPatterns, uint32_t cPatterns,
676 PVBGLR3GUESTPROPENUM *ppHandle, char const **ppszName, char const **ppszValue,
677 uint64_t *pu64Timestamp, char const **ppszFlags);
678VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue,
679 uint64_t *pu64Timestamp, char const **ppszFlags);
680VBGLR3DECL(void) VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle);
681VBGLR3DECL(int) VbglR3GuestPropDelete(HGCMCLIENTID idClient, const char *pszName);
682VBGLR3DECL(int) VbglR3GuestPropDelSet(HGCMCLIENTID idClient, char const * const *papszPatterns, uint32_t cPatterns);
683VBGLR3DECL(int) VbglR3GuestPropWait(HGCMCLIENTID idClient, const char *pszPatterns, void *pvBuf, uint32_t cbBuf,
684 uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue,
685 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
686/** @} */
687
688/** @name Guest user handling / reporting.
689 * @{ */
690VBGLR3DECL(int) VbglR3GuestUserReportState(const char *pszUser, const char *pszDomain, VBoxGuestUserState enmState,
691 uint8_t *pbDetails, uint32_t cbDetails);
692/** @} */
693
694/** @name Host version handling
695 * @{ */
696VBGLR3DECL(int) VbglR3HostVersionCheckForUpdate(HGCMCLIENTID idClient, bool *pfUpdate, char **ppszHostVersion,
697 char **ppszGuestVersion);
698VBGLR3DECL(int) VbglR3HostVersionLastCheckedLoad(HGCMCLIENTID idClient, char **ppszVer);
699VBGLR3DECL(int) VbglR3HostVersionLastCheckedStore(HGCMCLIENTID idClient, const char *pszVer);
700/** @} */
701# endif /* VBOX_WITH_GUEST_PROPS defined */
702
703# ifdef VBOX_WITH_SHARED_FOLDERS
704/** @name Shared folders
705 * @{ */
706/**
707 * Structure containing mapping information for a shared folder.
708 */
709typedef struct VBGLR3SHAREDFOLDERMAPPING
710{
711 /** Mapping status. */
712 uint32_t u32Status;
713 /** Root handle. */
714 uint32_t u32Root;
715} VBGLR3SHAREDFOLDERMAPPING;
716/** Pointer to a shared folder mapping information structure. */
717typedef VBGLR3SHAREDFOLDERMAPPING *PVBGLR3SHAREDFOLDERMAPPING;
718/** Pointer to a const shared folder mapping information structure. */
719typedef VBGLR3SHAREDFOLDERMAPPING const *PCVBGLR3SHAREDFOLDERMAPPING;
720
721VBGLR3DECL(int) VbglR3SharedFolderConnect(uint32_t *pidClient);
722VBGLR3DECL(int) VbglR3SharedFolderDisconnect(HGCMCLIENTID idClient);
723VBGLR3DECL(bool) VbglR3SharedFolderExists(HGCMCLIENTID idClient, const char *pszShareName);
724VBGLR3DECL(int) VbglR3SharedFolderGetMappings(HGCMCLIENTID idClient, bool fAutoMountOnly,
725 PVBGLR3SHAREDFOLDERMAPPING *ppaMappings, uint32_t *pcMappings);
726VBGLR3DECL(void) VbglR3SharedFolderFreeMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings);
727VBGLR3DECL(int) VbglR3SharedFolderGetName(HGCMCLIENTID idClient,uint32_t u32Root, char **ppszName); /**< @todo r=bird: GET functions return the value, not a status code!*/
728VBGLR3DECL(int) VbglR3SharedFolderQueryFolderInfo(HGCMCLIENTID idClient, uint32_t idRoot, uint64_t fQueryFlags,
729 char **ppszName, char **ppszMountPoint,
730 uint64_t *pfFlags, uint32_t *puRootIdVersion);
731VBGLR3DECL(int) VbglR3SharedFolderWaitForMappingsChanges(HGCMCLIENTID idClient, uint32_t uPrevVersion, uint32_t *puCurVersion);
732VBGLR3DECL(int) VbglR3SharedFolderCancelMappingsChangesWaits(HGCMCLIENTID idClient);
733
734VBGLR3DECL(int) VbglR3SharedFolderGetMountPrefix(char **ppszPrefix); /**< @todo r=bird: GET functions return the value, not a status code! */
735VBGLR3DECL(int) VbglR3SharedFolderGetMountDir(char **ppszDir); /**< @todo r=bird: GET functions return the value, not a status code! */
736/** @} */
737# endif /* VBOX_WITH_SHARED_FOLDERS defined */
738
739# ifdef VBOX_WITH_GUEST_CONTROL
740/** @name Guest control
741 * @{ */
742
743/**
744 * Structure containing the context required for
745 * either retrieving or sending a HGCM guest control
746 * commands from or to the host.
747 *
748 * Note: Do not change parameter order without also
749 * adapting all structure initializers.
750 */
751typedef struct VBGLR3GUESTCTRLCMDCTX
752{
753 /** @todo This struct could be handy if we want to implement
754 * a second communication channel, e.g. via TCP/IP.
755 * Use a union for the HGCM stuff then. */
756
757 /** IN: HGCM client ID to use for communication. */
758 uint32_t uClientID;
759 /** IN/OUT: Context ID to retrieve or to use. */
760 uint32_t uContextID;
761 /** IN: Protocol version to use. */
762 uint32_t uProtocol;
763 /** OUT: Number of parameters retrieved. */
764 uint32_t uNumParms;
765} VBGLR3GUESTCTRLCMDCTX, *PVBGLR3GUESTCTRLCMDCTX;
766
767/* General message handling on the guest. */
768VBGLR3DECL(int) VbglR3GuestCtrlConnect(uint32_t *pidClient);
769VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t idClient);
770VBGLR3DECL(bool) VbglR3GuestCtrlSupportsOptimizations(uint32_t idClient);
771VBGLR3DECL(int) VbglR3GuestCtrlMakeMeMaster(uint32_t idClient);
772VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove);
773VBGLR3DECL(int) VbglR3GuestCtrlMsgReply(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc);
774VBGLR3DECL(int) VbglR3GuestCtrlMsgReplyEx(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc, uint32_t uType,
775 void *pvPayload, uint32_t cbPayload);
776VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t idClient, int rcSkip, uint32_t idMsg);
777VBGLR3DECL(int) VbglR3GuestCtrlMsgSkipOld(uint32_t uClientId);
778VBGLR3DECL(int) VbglR3GuestCtrlMsgPeekWait(uint32_t idClient, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck);
779VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(HGCMCLIENTID idClient);
780/* Guest session handling. */
781VBGLR3DECL(int) VbglR3GuestCtrlSessionPrepare(uint32_t idClient, uint32_t idSession, void const *pvKey, uint32_t cbKey);
782VBGLR3DECL(int) VbglR3GuestCtrlSessionAccept(uint32_t idClient, uint32_t idSession, void const *pvKey, uint32_t cbKey);
783VBGLR3DECL(int) VbglR3GuestCtrlSessionCancelPrepared(uint32_t idClient, uint32_t idSession);
784VBGLR3DECL(int) VbglR3GuestCtrlSessionClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t fFlags);
785VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uType, int32_t iResult);
786VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puProtocol, char *pszUser, uint32_t cbUser,
787 char *pszPassword, uint32_t cbPassword, char *pszDomain, uint32_t cbDomain,
788 uint32_t *pfFlags, uint32_t *pidSession);
789VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *pfFlags, uint32_t *pidSession);
790/* Guest path handling. */
791VBGLR3DECL(int) VbglR3GuestCtrlPathGetRename(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszSource, uint32_t cbSource, char *pszDest,
792 uint32_t cbDest, uint32_t *pfFlags);
793VBGLR3DECL(int) VbglR3GuestCtrlPathGetUserDocuments(PVBGLR3GUESTCTRLCMDCTX pCtx);
794VBGLR3DECL(int) VbglR3GuestCtrlPathGetUserHome(PVBGLR3GUESTCTRLCMDCTX pCtx);
795/* Guest process execution. */
796VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszCmd, uint32_t cbCmd, uint32_t *pfFlags,
797 char *pszArgs, uint32_t cbArgs, uint32_t *puNumArgs, char *pszEnv, uint32_t *pcbEnv,
798 uint32_t *puNumEnvVars, char *pszUser, uint32_t cbUser, char *pszPassword,
799 uint32_t cbPassword, uint32_t *puTimeoutMS, uint32_t *puPriority,
800 uint64_t *puAffinity, uint32_t cbAffinity, uint32_t *pcAffinity);
801VBGLR3DECL(int) VbglR3GuestCtrlProcGetTerminate(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID);
802VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *pfFlags, void *pvData,
803 uint32_t cbData, uint32_t *pcbSize);
804VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puHandle, uint32_t *pfFlags);
805VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puWaitFlags,
806 uint32_t *puTimeoutMS);
807/* Guest native directory handling. */
808VBGLR3DECL(int) VbglR3GuestCtrlDirGetRemove(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *pfFlags);
809/* Guest native file handling. */
810VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszFileName, uint32_t cbFileName, char *pszOpenMode,
811 uint32_t cbOpenMode, char *pszDisposition, uint32_t cbDisposition, char *pszSharing,
812 uint32_t cbSharing, uint32_t *puCreationMode, uint64_t *puOffset);
813VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
814VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puToRead);
815VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
816 uint32_t *puToRead, uint64_t *poffRead);
817VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
818 void *pvData, uint32_t cbData, uint32_t *pcbActual);
819VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, void *pvData, uint32_t cbData,
820 uint32_t *pcbActual, uint64_t *poffWrite);
821VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
822 uint32_t *puSeekMethod, uint64_t *poffSeek);
823VBGLR3DECL(int) VbglR3GuestCtrlFileGetTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
824/* Guest -> Host. */
825VBGLR3DECL(int) VbglR3GuestCtrlFileCbOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uFileHandle);
826VBGLR3DECL(int) VbglR3GuestCtrlFileCbClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
827VBGLR3DECL(int) VbglR3GuestCtrlFileCbError(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
828VBGLR3DECL(int) VbglR3GuestCtrlFileCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, void *pvData, uint32_t cbData);
829VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uWritten);
830VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
831VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t uOffActual);
832VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uStatus, uint32_t fFlags,
833 void *pvData, uint32_t cbData);
834VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uHandle, uint32_t fFlags,
835 void *pvData, uint32_t cbData);
836VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t u32PID, uint32_t uStatus,
837 uint32_t fFlags, uint32_t cbWritten);
838
839/** @} */
840# endif /* VBOX_WITH_GUEST_CONTROL defined */
841
842/** @name Auto-logon handling
843 * @{ */
844VBGLR3DECL(int) VbglR3AutoLogonReportStatus(VBoxGuestFacilityStatus enmStatus);
845VBGLR3DECL(bool) VbglR3AutoLogonIsRemoteSession(void);
846/** @} */
847
848/** @name User credentials handling
849 * @{ */
850VBGLR3DECL(int) VbglR3CredentialsQueryAvailability(void);
851VBGLR3DECL(int) VbglR3CredentialsRetrieve(char **ppszUser, char **ppszPassword, char **ppszDomain);
852VBGLR3DECL(int) VbglR3CredentialsRetrieveUtf16(PRTUTF16 *ppwszUser, PRTUTF16 *ppwszPassword, PRTUTF16 *ppwszDomain);
853VBGLR3DECL(void) VbglR3CredentialsDestroy(char *pszUser, char *pszPassword, char *pszDomain, uint32_t cPasses);
854VBGLR3DECL(void) VbglR3CredentialsDestroyUtf16(PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTUTF16 pwszDomain,
855 uint32_t cPasses);
856/** @} */
857
858/** @name CPU hotplug monitor
859 * @{ */
860VBGLR3DECL(int) VbglR3CpuHotPlugInit(void);
861VBGLR3DECL(int) VbglR3CpuHotPlugTerm(void);
862VBGLR3DECL(int) VbglR3CpuHotPlugWaitForEvent(VMMDevCpuEventType *penmEventType, uint32_t *pidCpuCore, uint32_t *pidCpuPackage);
863/** @} */
864
865/** @name Page sharing
866 * @{ */
867struct VMMDEVSHAREDREGIONDESC;
868VBGLR3DECL(int) VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule,
869 unsigned cRegions, struct VMMDEVSHAREDREGIONDESC *pRegions);
870VBGLR3DECL(int) VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule);
871VBGLR3DECL(int) VbglR3CheckSharedModules(void);
872VBGLR3DECL(bool) VbglR3PageSharingIsEnabled(void);
873VBGLR3DECL(int) VbglR3PageIsShared(RTGCPTR pPage, bool *pfShared, uint64_t *puPageFlags);
874/** @} */
875
876# ifdef VBOX_WITH_DRAG_AND_DROP
877/** @name Drag and Drop
878 * @{ */
879/**
880 * Structure containing the context required for
881 * either retrieving or sending a HGCM guest drag'n drop
882 * commands from or to the host.
883 *
884 * Note: Do not change parameter order without also
885 * adapting all structure initializers.
886 */
887typedef struct VBGLR3GUESTDNDCMDCTX
888{
889 /** @todo This struct could be handy if we want to implement
890 * a second communication channel, e.g. via TCP/IP.
891 * Use a union for the HGCM stuff then. */
892
893 /** HGCM client ID to use for communication. */
894 uint32_t uClientID;
895 /** The VM's current session ID. */
896 uint64_t uSessionID;
897 /** Protocol version to use. */
898 uint32_t uProtocol;
899 /** Number of parameters retrieved for the current command. */
900 uint32_t uNumParms;
901 /** Max chunk size (in bytes) for data transfers. */
902 uint32_t cbMaxChunkSize;
903} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
904
905/**
906 * Enumeration for specifying the DnD meta data type.
907 */
908typedef enum VBGLR3GUESTDNDMETADATATYPE
909{
910 /** Unknown meta data type; don't use. */
911 VBGLR3GUESTDNDMETADATATYPE_UNKNOWN = 0,
912 /** Raw meta data; can be everything. */
913 VBGLR3GUESTDNDMETADATATYPE_RAW,
914 /** Meta data is an URI list, specifying objects. */
915 VBGLR3GUESTDNDMETADATATYPE_URI_LIST,
916 /** Blow the type up to 32-bit. */
917 VBGLR3GUESTDNDMETADATATYPE_32BIT_HACK = 0x7fffffff
918} VBGLR3GUESTDNDMETADATATYPE;
919
920/**
921 * Structure for keeping + handling DnD meta data.
922 *
923 * Note: Don't treat this struct as POD object, as the union has classes in it.
924 */
925typedef struct VBGLR3GUESTDNDMETADATA
926{
927 /** The meta data type the union contains. */
928 VBGLR3GUESTDNDMETADATATYPE enmType;
929 /** Pointer to actual meta data. */
930 void *pvMeta;
931 /** Size (in bytes) of meta data. */
932 uint32_t cbMeta;
933} VBGLR3GUESTDNDMETADATA;
934
935/** Pointer to VBGLR3GUESTDNDMETADATA. */
936typedef VBGLR3GUESTDNDMETADATA *PVBGLR3GUESTDNDMETADATA;
937
938/** Const pointer to VBGLR3GUESTDNDMETADATA. */
939typedef const PVBGLR3GUESTDNDMETADATA CPVBGLR3GUESTDNDMETADATA;
940
941/**
942 * Enumeration specifying a DnD event type.
943 */
944typedef enum VBGLR3DNDEVENTTYPE
945{
946 VBGLR3DNDEVENTTYPE_INVALID = 0,
947 VBGLR3DNDEVENTTYPE_HG_ERROR = 1,
948 VBGLR3DNDEVENTTYPE_HG_ENTER = 2,
949 VBGLR3DNDEVENTTYPE_HG_MOVE = 3,
950 VBGLR3DNDEVENTTYPE_HG_LEAVE = 4,
951 VBGLR3DNDEVENTTYPE_HG_DROP = 5,
952 VBGLR3DNDEVENTTYPE_HG_RECEIVE = 6,
953 VBGLR3DNDEVENTTYPE_HG_CANCEL = 7,
954# ifdef VBOX_WITH_DRAG_AND_DROP_GH
955 VBGLR3DNDEVENTTYPE_GH_ERROR = 100,
956 VBGLR3DNDEVENTTYPE_GH_REQ_PENDING = 101,
957 VBGLR3DNDEVENTTYPE_GH_DROP = 102,
958# endif
959 /** Blow the type up to 32-bit. */
960 VBGLR3DNDEVENTTYPE_32BIT_HACK = 0x7fffffff
961} VBGLR3DNDEVENTTYPE;
962
963typedef struct VBGLR3DNDEVENT
964{
965 /** The event type the union contains. */
966 VBGLR3DNDEVENTTYPE enmType;
967 union
968 {
969 struct
970 {
971 /** Screen ID this request belongs to. */
972 uint32_t uScreenID;
973 /** Format list (UTF-8, \r\n separated). */
974 char *pszFormats;
975 /** Size (in bytes) of pszFormats (\0 included). */
976 uint32_t cbFormats;
977 /** List of allowed DnD actions. */
978 VBOXDNDACTIONLIST dndLstActionsAllowed;
979 } HG_Enter;
980 struct
981 {
982 /** Absolute X position of guest screen. */
983 uint32_t uXpos;
984 /** Absolute Y position of guest screen. */
985 uint32_t uYpos;
986 /** Default DnD action. */
987 VBOXDNDACTION dndActionDefault;
988 } HG_Move;
989 struct
990 {
991 /** Absolute X position of guest screen. */
992 uint32_t uXpos;
993 /** Absolute Y position of guest screen. */
994 uint32_t uYpos;
995 /** Default DnD action. */
996 VBOXDNDACTION dndActionDefault;
997 } HG_Drop;
998 struct
999 {
1000 /** Meta data for the operation. */
1001 VBGLR3GUESTDNDMETADATA Meta;
1002 } HG_Received;
1003 struct
1004 {
1005 /** IPRT-style error code. */
1006 int rc;
1007 } HG_Error;
1008# ifdef VBOX_WITH_DRAG_AND_DROP_GH
1009 struct
1010 {
1011 /** Screen ID this request belongs to. */
1012 uint32_t uScreenID;
1013 } GH_IsPending;
1014 struct
1015 {
1016 /** Requested format by the host. */
1017 char *pszFormat;
1018 /** Size (in bytes) of pszFormat (\0 included). */
1019 uint32_t cbFormat;
1020 /** Requested DnD action. */
1021 VBOXDNDACTION dndActionRequested;
1022 } GH_Drop;
1023# endif
1024 } u;
1025} VBGLR3DNDEVENT;
1026typedef VBGLR3DNDEVENT *PVBGLR3DNDEVENT;
1027typedef const PVBGLR3DNDEVENT CPVBGLR3DNDEVENT;
1028
1029VBGLR3DECL(int) VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx);
1030VBGLR3DECL(int) VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
1031
1032VBGLR3DECL(int) VbglR3DnDEventGetNext(PVBGLR3GUESTDNDCMDCTX pCtx, PVBGLR3DNDEVENT *ppEvent);
1033VBGLR3DECL(void) VbglR3DnDEventFree(PVBGLR3DNDEVENT pEvent);
1034
1035VBGLR3DECL(int) VbglR3DnDHGSendAckOp(PVBGLR3GUESTDNDCMDCTX pCtx, VBOXDNDACTION dndAction);
1036VBGLR3DECL(int) VbglR3DnDHGSendReqData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pcszFormat);
1037VBGLR3DECL(int) VbglR3DnDHGSendProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
1038# ifdef VBOX_WITH_DRAG_AND_DROP_GH
1039VBGLR3DECL(int) VbglR3DnDGHSendAckPending(PVBGLR3GUESTDNDCMDCTX pCtx, VBOXDNDACTION dndActionDefault, VBOXDNDACTIONLIST dndLstActionsAllowed, const char* pcszFormats, uint32_t cbFormats);
1040VBGLR3DECL(int) VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData);
1041VBGLR3DECL(int) VbglR3DnDGHSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcOp);
1042# endif /* VBOX_WITH_DRAG_AND_DROP_GH */
1043/** @} */
1044# endif /* VBOX_WITH_DRAG_AND_DROP */
1045
1046/* Generic Host Channel Service. */
1047VBGLR3DECL(int) VbglR3HostChannelInit(uint32_t *pidClient);
1048VBGLR3DECL(void) VbglR3HostChannelTerm(uint32_t idClient);
1049VBGLR3DECL(int) VbglR3HostChannelAttach(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
1050 const char *pszName, uint32_t u32Flags);
1051VBGLR3DECL(void) VbglR3HostChannelDetach(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
1052VBGLR3DECL(int) VbglR3HostChannelSend(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1053 void *pvData, uint32_t cbData);
1054VBGLR3DECL(int) VbglR3HostChannelRecv(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1055 void *pvData, uint32_t cbData,
1056 uint32_t *pu32SizeReceived, uint32_t *pu32SizeRemaining);
1057VBGLR3DECL(int) VbglR3HostChannelControl(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1058 uint32_t u32Code, void *pvParm, uint32_t cbParm,
1059 void *pvData, uint32_t cbData, uint32_t *pu32SizeDataReturned);
1060VBGLR3DECL(int) VbglR3HostChannelEventWait(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
1061 uint32_t *pu32EventId, void *pvParm, uint32_t cbParm,
1062 uint32_t *pu32SizeReturned);
1063VBGLR3DECL(int) VbglR3HostChannelEventCancel(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
1064VBGLR3DECL(int) VbglR3HostChannelQuery(const char *pszName, uint32_t u32HGCMClientId, uint32_t u32Code,
1065 void *pvParm, uint32_t cbParm, void *pvData, uint32_t cbData,
1066 uint32_t *pu32SizeDataReturned);
1067
1068/** @name Mode hint storage
1069 * @{ */
1070VBGLR3DECL(int) VbglR3ReadVideoMode(unsigned cDisplay, unsigned *cx,
1071 unsigned *cy, unsigned *cBPP, unsigned *x,
1072 unsigned *y, unsigned *fEnabled);
1073VBGLR3DECL(int) VbglR3WriteVideoMode(unsigned cDisplay, unsigned cx,
1074 unsigned cy, unsigned cBPP, unsigned x,
1075 unsigned y, unsigned fEnabled);
1076/** @} */
1077
1078/** @name Generic HGCM
1079 * @{ */
1080VBGLR3DECL(int) VbglR3HGCMConnect(const char *pszServiceName, HGCMCLIENTID *pidClient);
1081VBGLR3DECL(int) VbglR3HGCMDisconnect(HGCMCLIENTID idClient);
1082struct VBGLIOCHGCMCALL;
1083VBGLR3DECL(int) VbglR3HGCMCall(struct VBGLIOCHGCMCALL *pInfo, size_t cbInfo);
1084/** @} */
1085
1086#endif /* IN_RING3 */
1087/** @} */
1088
1089RT_C_DECLS_END
1090
1091/** @} */
1092
1093#endif
1094
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use