VirtualBox

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

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

VBox/VBoxGuestLib.h: Removed empty sub-struct HG_Leave in VBGLR3DNDEVENT as clang++ does not accept it. I'm wouldn't be suprised if other compiler frowns upon empty structus too.

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