VirtualBox

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

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

Shared Clipboard/URI: Build fix.

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