VirtualBox

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

Last change on this file since 99578 was 99262, checked in by vboxsync, 21 months ago

Guest Control: Implements IGuestSession::fsQueryInfo() and IGuestSession::fsQueryFreeSpace(). bugref:10414

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 65.8 KB
Line 
1/** @file
2 * VBoxGuestLib - VirtualBox Guest Additions Library.
3 */
4
5/*
6 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
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/DragAndDrop.h>
41# include <VBox/GuestHost/DragAndDropDefs.h>
42# endif
43# ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
44# include <VBox/GuestHost/GuestControl.h>
45 using namespace guestControl;
46# endif
47# ifdef VBOX_WITH_SHARED_CLIPBOARD
48# include <VBox/GuestHost/SharedClipboard.h>
49# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
50# include <VBox/GuestHost/SharedClipboard-transfers.h>
51# endif
52# endif /* VBOX_WITH_SHARED_CLIPBOARD */
53
54/** @defgroup grp_vboxguest_lib VirtualBox Guest Additions Library
55 * @ingroup grp_vboxguest
56 * @{
57 */
58
59/** @page pg_guest_lib VirtualBox Guest Library
60 *
61 * This is a library for abstracting the additions driver interface. There are
62 * multiple versions of the library depending on the context. The main
63 * distinction is between kernel and user mode where the interfaces are very
64 * different.
65 *
66 *
67 * @section sec_guest_lib_ring0 Ring-0
68 *
69 * In ring-0 there are two version:
70 * - VBOX_LIB_VBGL_R0_BASE / VBoxGuestR0LibBase for the VBoxGuest main driver,
71 * who is responsible for managing the VMMDev virtual hardware.
72 * - VBOX_LIB_VBGL_R0 / VBoxGuestR0Lib for other (client) guest drivers.
73 *
74 *
75 * The library source code and the header have a define VBGL_VBOXGUEST, which is
76 * defined for VBoxGuest and undefined for other drivers. Drivers must choose
77 * right library in their makefiles and set VBGL_VBOXGUEST accordingly.
78 *
79 * The libraries consists of:
80 * - common code to be used by both VBoxGuest and other drivers;
81 * - VBoxGuest specific code;
82 * - code for other drivers which communicate with VBoxGuest via an IOCTL.
83 *
84 *
85 * @section sec_guest_lib_ring3 Ring-3
86 *
87 * There are more variants of the library here:
88 * - VBOX_LIB_VBGL_R3 / VBoxGuestR3Lib for programs.
89 * - VBOX_LIB_VBGL_R3_XFREE86 / VBoxGuestR3LibXFree86 for old style XFree
90 * drivers which uses special loader and or symbol resolving strategy.
91 * - VBOX_LIB_VBGL_R3_SHARED / VBoxGuestR3LibShared for shared objects / DLLs /
92 * Dylibs.
93 *
94 */
95
96RT_C_DECLS_BEGIN
97
98/** HGCM client ID.
99 * @todo Promote to VBox/types.h */
100typedef uint32_t HGCMCLIENTID;
101
102
103/** @defgroup grp_vboxguest_lib_r0 Ring-0 interface.
104 * @{
105 */
106#ifdef IN_RING0
107/** @def DECLR0VBGL
108 * Declare a VBGL ring-0 API with the right calling convention and visibilitiy.
109 * @param type Return type. */
110# ifdef RT_OS_DARWIN /** @todo probably apply to all, but don't want a forest fire on our hands right now. */
111# define DECLR0VBGL(type) DECLHIDDEN(DECL_NOTHROW(type)) VBOXCALL
112# else
113# define DECLR0VBGL(type) DECL_NOTHROW(type) VBOXCALL
114# endif
115# define DECLVBGL(type) DECLR0VBGL(type)
116
117
118/**
119 * The library initialization function to be used by the main VBoxGuest driver.
120 *
121 * @return VBox status code.
122 */
123DECLR0VBGL(int) VbglR0InitPrimary(RTIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory, uint32_t *pfFeatures);
124
125/**
126 * The library termination function to be used by the main VBoxGuest driver.
127 *
128 * @author bird (2017-08-23)
129 */
130DECLR0VBGL(void) VbglR0TerminatePrimary(void);
131
132/**
133 * The library initialization function to be used by all drivers
134 * other than the main VBoxGuest system driver.
135 *
136 * @return VBox status code.
137 */
138DECLR0VBGL(int) VbglR0InitClient(void);
139
140/**
141 * The library termination function.
142 */
143DECLR0VBGL(void) VbglR0TerminateClient(void);
144
145/**
146 * Query the host feature mask.
147 *
148 * @returns VBox status code.
149 * @param pfHostFeatures Where to return the host feature mask,
150 * VMMDEV_HVF_XXX.
151 * @note Client only. May fail we're unable to connect VBoxGuest.
152 */
153DECLR0VBGL(int) VbglR0QueryHostFeatures(uint32_t *pfHostFeatures);
154
155
156/** @name The IDC Client Interface
157 * @{
158 */
159
160/**
161 * Inter-Driver Communication Handle.
162 */
163typedef union VBGLIDCHANDLE
164{
165 /** Padding for opaque usage.
166 * Must be greater or equal in size than the private struct. */
167 void *apvPadding[4];
168#ifdef VBGLIDCHANDLEPRIVATE_DECLARED
169 /** The private view. */
170 struct VBGLIDCHANDLEPRIVATE s;
171#endif
172} VBGLIDCHANDLE;
173/** Pointer to a handle. */
174typedef VBGLIDCHANDLE *PVBGLIDCHANDLE;
175
176DECLR0VBGL(int) VbglR0IdcOpen(PVBGLIDCHANDLE pHandle, uint32_t uReqVersion, uint32_t uMinVersion,
177 uint32_t *puSessionVersion, uint32_t *puDriverVersion, uint32_t *puDriverRevision);
178struct VBGLREQHDR;
179DECLR0VBGL(int) VbglR0IdcCallRaw(PVBGLIDCHANDLE pHandle, uintptr_t uReq, struct VBGLREQHDR *pReqHdr, uint32_t cbReq);
180DECLR0VBGL(int) VbglR0IdcCall(PVBGLIDCHANDLE pHandle, uintptr_t uReq, struct VBGLREQHDR *pReqHdr, uint32_t cbReq);
181DECLR0VBGL(int) VbglR0IdcClose(PVBGLIDCHANDLE pHandle);
182
183/** @} */
184
185
186/** @name Generic request functions.
187 * @{
188 */
189
190/**
191 * Allocate memory for generic request and initialize the request header.
192 *
193 * @returns VBox status code.
194 * @param ppReq Where to return the pointer to the allocated memory.
195 * @param cbReq Size of memory block required for the request.
196 * @param enmReqType the generic request type.
197 */
198# if defined(VBOX_INCLUDED_VMMDev_h) || defined(DOXYGEN_RUNNING)
199DECLR0VBGL(int) VbglR0GRAlloc(struct VMMDevRequestHeader **ppReq, size_t cbReq, VMMDevRequestType enmReqType);
200# else
201DECLR0VBGL(int) VbglR0GRAlloc(struct VMMDevRequestHeader **ppReq, size_t cbReq, int32_t enmReqType);
202# endif
203
204/**
205 * Perform the generic request.
206 *
207 * @param pReq pointer the request structure.
208 *
209 * @return VBox status code.
210 */
211DECLR0VBGL(int) VbglR0GRPerform(struct VMMDevRequestHeader *pReq);
212
213/**
214 * Free the generic request memory.
215 *
216 * @param pReq pointer the request structure.
217 *
218 * @return VBox status code.
219 */
220DECLR0VBGL(void) VbglR0GRFree(struct VMMDevRequestHeader *pReq);
221
222/**
223 * Verify the generic request header.
224 *
225 * @param pReq pointer the request header structure.
226 * @param cbReq size of the request memory block. It should be equal to the request size
227 * for fixed size requests. It can be greater than the request size for
228 * variable size requests.
229 *
230 * @return VBox status code.
231 */
232DECLR0VBGL(int) VbglGR0Verify(const struct VMMDevRequestHeader *pReq, size_t cbReq);
233
234/** @} */
235
236# ifdef VBOX_WITH_HGCM
237struct VBGLIOCHGCMCALL;
238struct VBGLIOCIDCHGCMFASTCALL;
239
240# ifdef VBGL_VBOXGUEST
241
242/**
243 * Callback function called from HGCM helpers when a wait for request
244 * completion IRQ is required.
245 *
246 * @returns VINF_SUCCESS, VERR_INTERRUPT or VERR_TIMEOUT.
247 * @param pvData VBoxGuest pointer to be passed to callback.
248 * @param u32Data VBoxGuest 32 bit value to be passed to callback.
249 */
250typedef DECLCALLBACKTYPE(int, FNVBGLHGCMCALLBACK,(VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data));
251/** Pointer to a FNVBGLHGCMCALLBACK. */
252typedef FNVBGLHGCMCALLBACK *PFNVBGLHGCMCALLBACK;
253
254/**
255 * Perform a connect request.
256 *
257 * That is locate required service and obtain a client identifier for future
258 * access.
259 *
260 * @note This function can NOT handle cancelled requests!
261 *
262 * @param pLoc The service to connect to.
263 * @param fRequestor VMMDEV_REQUESTOR_XXX.
264 * @param pidClient Where to return the client ID on success.
265 * @param pfnAsyncCallback Required pointer to function that is calledwhen
266 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
267 * implements waiting for an IRQ in this function.
268 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
269 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
270 *
271 * @return VBox status code.
272 */
273DECLR0VBGL(int) VbglR0HGCMInternalConnect(HGCMServiceLocation const *pLoc, uint32_t fRequestor, HGCMCLIENTID *pidClient,
274 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
275
276
277/**
278 * Perform a disconnect request.
279 *
280 * That is tell the host that the client will not call the service anymore.
281 *
282 * @note This function can NOT handle cancelled requests!
283 *
284 * @param idClient The client ID to disconnect.
285 * @param fRequestor VMMDEV_REQUESTOR_XXX.
286 * @param pfnAsyncCallback Required pointer to function that is called when
287 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
288 * implements waiting for an IRQ in this function.
289 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
290 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to
291 * callback.
292 *
293 * @return VBox status code.
294 */
295
296DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(HGCMCLIENTID idClient, uint32_t fRequestor,
297 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
298
299/** Call a HGCM service.
300 *
301 * @note This function can deal with cancelled requests.
302 *
303 * @param pCallInfo The request data.
304 * @param fFlags Flags, see VBGLR0_HGCMCALL_F_XXX.
305 * @param fRequestor VMMDEV_REQUESTOR_XXX.
306 * @param pfnAsyncCallback Required pointer to function that is called when
307 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
308 * implements waiting for an IRQ in this function.
309 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
310 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
311 *
312 * @return VBox status code.
313 */
314DECLR0VBGL(int) VbglR0HGCMInternalCall(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags, uint32_t fRequestor,
315 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
316
317/** Call a HGCM service. (32 bits packet structure in a 64 bits guest)
318 *
319 * @note This function can deal with cancelled requests.
320 *
321 * @param pCallInfo The request data.
322 * @param fFlags Flags, see VBGLR0_HGCMCALL_F_XXX.
323 * @param fRequestor VMMDEV_REQUESTOR_XXX.
324 * @param pfnAsyncCallback Required pointer to function that is called when
325 * host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
326 * implements waiting for an IRQ in this function.
327 * @param pvAsyncData An arbitrary VBoxGuest pointer to be passed to callback.
328 * @param u32AsyncData An arbitrary VBoxGuest 32 bit value to be passed to callback.
329 *
330 * @return VBox status code.
331 */
332DECLR0VBGL(int) VbglR0HGCMInternalCall32(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags, uint32_t fRequestor,
333 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
334
335/** @name VbglR0HGCMInternalCall flags
336 * @{ */
337/** User mode request.
338 * Indicates that only user mode addresses are permitted as parameters. */
339#define VBGLR0_HGCMCALL_F_USER UINT32_C(0)
340/** Kernel mode request.
341 * Indicates that kernel mode addresses are permitted as parameters. Whether or
342 * not user mode addresses are permitted is, unfortunately, OS specific. The
343 * following OSes allows user mode addresses: Windows, TODO.
344 */
345#define VBGLR0_HGCMCALL_F_KERNEL UINT32_C(1)
346/** Mode mask. */
347#define VBGLR0_HGCMCALL_F_MODE_MASK UINT32_C(1)
348/** @} */
349
350# else /* !VBGL_VBOXGUEST */
351
352#ifndef VBGL_VBOXGUEST
353/** @internal */
354typedef struct VBGLHGCMHANDLEDATA
355{
356 uint32_t fAllocated;
357 VBGLIDCHANDLE IdcHandle;
358} VBGLHGCMHANDLEDATA;
359#else
360struct VBGLHGCMHANDLEDATA;
361#endif
362
363typedef struct VBGLHGCMHANDLEDATA *VBGLHGCMHANDLE;
364
365/** @name HGCM functions
366 * @{
367 */
368
369/**
370 * Initializes HGCM in the R0 guest library. Must be called before any HGCM
371 * connections are made. Is called by VbglInitClient().
372 *
373 * @return VBox status code.
374 */
375DECLR0VBGL(int) VbglR0HGCMInit(void);
376
377/**
378 * Terminates HGCM in the R0 guest library. Is called by VbglTerminate().
379 *
380 * @return VBox status code.
381 */
382DECLR0VBGL(int) VbglR0HGCMTerminate(void);
383
384/**
385 * Connect to a service.
386 *
387 * @param pHandle Pointer to variable that will hold a handle to be used
388 * further in VbglHGCMCall and VbglHGCMClose.
389 * @param pszServiceName The service to connect to.
390 * @param pidClient Where to return the client ID for the connection.
391 *
392 * @return VBox status code.
393 *
394 * @todo consider baking the client Id into the handle.
395 */
396DECLR0VBGL(int) VbglR0HGCMConnect(VBGLHGCMHANDLE *pHandle, const char *pszServiceName, HGCMCLIENTID *pidClient);
397
398/**
399 * Connect to a service.
400 *
401 * @param handle Handle of the connection.
402 * @param idClient The ID of the client connection.
403 *
404 * @return VBox status code.
405 *
406 * @todo consider baking the client Id into the handle.
407 */
408DECLR0VBGL(int) VbglR0HGCMDisconnect(VBGLHGCMHANDLE handle, HGCMCLIENTID idClient);
409
410/**
411 * Call to a service, returning only the I/O control 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.
418 */
419DECLR0VBGL(int) VbglR0HGCMCallRaw(VBGLHGCMHANDLE handle, struct VBGLIOCHGCMCALL *pData, uint32_t cbData);
420
421/**
422 * Call to a service, returning the HGCM status code.
423 *
424 * @param handle Handle of the connection.
425 * @param pData Call request information structure, including function parameters.
426 * @param cbData Length in bytes of data.
427 *
428 * @return VBox status code. Either the I/O control status code if that failed,
429 * or the HGCM status code (pData->Hdr.rc).
430 */
431DECLR0VBGL(int) VbglR0HGCMCall(VBGLHGCMHANDLE handle, struct VBGLIOCHGCMCALL *pData, uint32_t cbData);
432
433/**
434 * Call to a service with user-mode data received by the calling driver from the User-Mode process.
435 * The call must be done in the context of a calling process.
436 *
437 * @param handle Handle of the connection.
438 * @param pData Call request information structure, including function parameters.
439 * @param cbData Length in bytes of data.
440 *
441 * @return VBox status code.
442 */
443DECLR0VBGL(int) VbglR0HGCMCallUserDataRaw(VBGLHGCMHANDLE handle, struct VBGLIOCHGCMCALL *pData, uint32_t cbData);
444
445/**
446 * Call to a service, w/o any repacking and buffer locking in VBoxGuest,
447 * returning the only request related status code (not HGCM).
448 *
449 * The driver only submits the request and waits for completion, nothing else.
450 *
451 * @param hHandle The connection handle.
452 * @param pCallReq The call request. Will be passed directly to the host.
453 * @param cbCallReq The size of the whole call request.
454 *
455 * @return VBox status code.
456 *
457 * @remarks The result of the HGCM call is found in
458 * @a pCallReq->HgcmCallReq.header.result on a successful return. The
459 * @a pCallReq->Hdr.rc and @a pCallReq->HgcmCallReq.header.header.rc
460 * fields are the same as the return value and can safely be ignored.
461 */
462DECLR0VBGL(int) VbglR0HGCMFastCall(VBGLHGCMHANDLE hHandle, struct VBGLIOCIDCHGCMFASTCALL *pCallReq, uint32_t cbCallReq);
463
464/** @} */
465
466/** @name Undocumented helpers for talking to the Chromium OpenGL Host Service
467 * @{ */
468typedef VBGLHGCMHANDLE VBGLCRCTLHANDLE;
469DECLR0VBGL(int) VbglR0CrCtlCreate(VBGLCRCTLHANDLE *phCtl);
470DECLR0VBGL(int) VbglR0CrCtlDestroy(VBGLCRCTLHANDLE hCtl);
471DECLR0VBGL(int) VbglR0CrCtlConConnect(VBGLCRCTLHANDLE hCtl, HGCMCLIENTID *pidClient);
472DECLR0VBGL(int) VbglR0CrCtlConDisconnect(VBGLCRCTLHANDLE hCtl, HGCMCLIENTID idClient);
473struct VBGLIOCHGCMCALL;
474DECLR0VBGL(int) VbglR0CrCtlConCallRaw(VBGLCRCTLHANDLE hCtl, struct VBGLIOCHGCMCALL *pCallInfo, int cbCallInfo);
475DECLR0VBGL(int) VbglR0CrCtlConCall(VBGLCRCTLHANDLE hCtl, struct VBGLIOCHGCMCALL *pCallInfo, int cbCallInfo);
476DECLR0VBGL(int) VbglR0CrCtlConCallUserDataRaw(VBGLCRCTLHANDLE hCtl, struct VBGLIOCHGCMCALL *pCallInfo, int cbCallInfo);
477/** @} */
478
479# endif /* !VBGL_VBOXGUEST */
480
481# endif /* VBOX_WITH_HGCM */
482
483
484/**
485 * Initialize the heap.
486 *
487 * @returns VBox status code.
488 */
489DECLR0VBGL(int) VbglR0PhysHeapInit(void);
490
491/**
492 * Shutdown the heap.
493 */
494DECLR0VBGL(void) VbglR0PhysHeapTerminate(void);
495
496/**
497 * Allocate a memory block.
498 *
499 * @returns Virtual address of the allocated memory block.
500 * @param cb Number of bytes to allocate.
501 */
502DECLR0VBGL(void *) VbglR0PhysHeapAlloc(uint32_t cb);
503
504/**
505 * Get physical address of memory block pointed by the virtual address.
506 *
507 * @note WARNING!
508 * The function does not acquire the Heap mutex!
509 * When calling the function make sure that the pointer is a valid one and
510 * is not being deallocated. This function can NOT be used for verifying
511 * if the given pointer is a valid one allocated from the heap.
512 *
513 * @param pv Virtual address of memory block.
514 * @returns Physical address of the memory block. Zero is returned if @a pv
515 * isn't valid.
516 */
517DECLR0VBGL(uint32_t) VbglR0PhysHeapGetPhysAddr(void *pv);
518
519# ifdef IN_TESTCASE
520DECLVBGL(size_t) VbglR0PhysHeapGetFreeSize(void);
521# endif
522
523/**
524 * Free a memory block.
525 *
526 * @param pv Virtual address of memory block.
527 */
528DECLR0VBGL(void) VbglR0PhysHeapFree(void *pv);
529
530DECLR0VBGL(int) VbglR0QueryVMMDevMemory(struct VMMDevMemory **ppVMMDevMemory);
531DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void);
532
533# ifndef VBOX_GUEST
534/** @name Mouse
535 * @{ */
536DECLR0VBGL(int) VbglR0SetMouseNotifyCallback(PFNVBOXGUESTMOUSENOTIFY pfnNotify, void *pvUser);
537DECLR0VBGL(int) VbglR0GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
538DECLR0VBGL(int) VbglR0SetMouseStatus(uint32_t fFeatures);
539/** @} */
540# endif /* VBOX_GUEST */
541
542#endif /* IN_RING0 */
543
544/** @} */
545
546
547/** @defgroup grp_vboxguest_lib_r3 Ring-3 interface.
548 * @{
549 */
550#ifdef IN_RING3
551
552/** @def VBGLR3DECL
553 * Ring 3 VBGL declaration.
554 * @param type The return type of the function declaration.
555 */
556# define VBGLR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
557
558/** @name General-purpose functions
559 * @{ */
560/** Exit code which is returned by VBoxClient child process to notify
561 * parent to release VBoxGuest driver resources on Unix-like guests. */
562#define VBGLR3EXITCODERELOAD (2)
563
564VBGLR3DECL(int) VbglR3Init(void);
565VBGLR3DECL(int) VbglR3InitUser(void);
566VBGLR3DECL(void) VbglR3Term(void);
567# ifdef IPRT_INCLUDED_time_h
568VBGLR3DECL(int) VbglR3GetHostTime(PRTTIMESPEC pTime);
569# endif
570VBGLR3DECL(int) VbglR3InterruptEventWaits(void);
571VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cch);
572VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot);
573VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn, unsigned *pcRespawn);
574VBGLR3DECL(int) VbglR3DaemonizeEx(bool fNoChDir, bool fNoClose, bool fRespawn, unsigned *pcRespawn,
575 bool fReturnOnUpdate, bool *pfUpdateStarted, const char *szPidfile,
576 RTFILE *phPidfile);
577VBGLR3DECL(int) VbglR3PidFile(const char *pszPath, PRTFILE phFile);
578VBGLR3DECL(void) VbglR3ClosePidFile(const char *pszPath, RTFILE hFile);
579VBGLR3DECL(int) VbglR3PidfileWait(const char *szPidfile, RTFILE *phPidfile, uint64_t u64TimeoutMs);
580VBGLR3DECL(int) VbglR3SetGuestCaps(uint32_t fOr, uint32_t fNot);
581VBGLR3DECL(int) VbglR3AcquireGuestCaps(uint32_t fOr, uint32_t fNot, bool fConfig);
582VBGLR3DECL(int) VbglR3WaitEvent(uint32_t fMask, uint32_t cMillies, uint32_t *pfEvents);
583
584VBGLR3DECL(int) VbglR3ReportAdditionsStatus(VBoxGuestFacilityType Facility, VBoxGuestFacilityStatus StatusCurrent,
585 uint32_t fFlags);
586VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char **ppszRev);
587VBGLR3DECL(int) VbglR3GetAdditionsInstallationPath(char **ppszPath);
588VBGLR3DECL(int) VbglR3GetSessionId(uint64_t *pu64IdSession);
589
590/** @} */
591
592# ifdef VBOX_WITH_SHARED_CLIPBOARD
593/** @name Shared Clipboard
594 * @{ */
595
596# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
597/**
598 * Structure for maintaining a VbglR3 Shared Clipboard transfer context.
599 */
600typedef struct VBGLR3SHCLTRANSFERCMDCTX
601{
602 /** Default chunk size (in bytes).
603 * This is set by VbglR3ClipboardConnectEx(). */
604 uint32_t cbChunkSize;
605 /** Max chunk size (in bytes).
606 * This is set by VbglR3ClipboardConnectEx(). */
607 uint32_t cbMaxChunkSize;
608 /** Optional callbacks to invoke. */
609 SHCLTRANSFERCALLBACKTABLE Callbacks;
610} VBGLR3SHCLTRANSFERCTX;
611/** Pointer to a Shared Clipboard transfer context. */
612typedef VBGLR3SHCLTRANSFERCMDCTX *PVBGLR3SHCLTRANSFERCMDCTX;
613# endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
614
615/**
616 * The context required for either retrieving or sending a HGCM shared clipboard
617 * commands from or to the host.
618 *
619 * @todo This struct could be handy if we want to implement a second
620 * communication channel, e.g. via TCP/IP. Use a union for the HGCM stuff then.
621 */
622typedef struct VBGLR3SHCLCMDCTX
623{
624 /** HGCM client ID to use for communication.
625 * This is set by VbglR3ClipboardConnectEx(). */
626 uint32_t idClient;
627 /** This is @c false if both VBOX_SHCL_HF_0_CONTEXT_ID and
628 * VBOX_SHCL_GF_0_CONTEXT_ID are set, otherwise @c true and only the old
629 * protocol (< 6.1) should be used.
630 * This is set by VbglR3ClipboardConnectEx(). */
631 bool fUseLegacyProtocol;
632 /** Host feature flags (VBOX_SHCL_HF_XXX).
633 * This is set by VbglR3ClipboardConnectEx(). */
634 uint64_t fHostFeatures;
635 /** The guest feature flags reported to the host (VBOX_SHCL_GF_XXX).
636 * This is set by VbglR3ClipboardConnectEx(). */
637 uint64_t fGuestFeatures;
638 /** The context ID - input or/and output depending on the operation. */
639 uint64_t idContext;
640 /** OUT: Number of parameters retrieved.
641 * This is set by ??. */
642 uint32_t cParmsRecived;
643# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
644 /** Data related to Shared Clipboard file transfers. */
645 VBGLR3SHCLTRANSFERCMDCTX Transfers;
646# endif
647} VBGLR3SHCLCMDCTX;
648/** Pointer to a shared clipboard context for Vbgl. */
649typedef VBGLR3SHCLCMDCTX *PVBGLR3SHCLCMDCTX;
650
651/**
652 * Enumeration specifying a Shared Clipboard event type.
653 * @todo r=bird: Surely, this isn't necessary?!
654 */
655typedef enum _VBGLR3CLIPBOARDEVENTTYPE
656{
657 /** No event needed / defined. */
658 VBGLR3CLIPBOARDEVENTTYPE_NONE = 0,
659 /** Host reports available clipboard formats to the guest. */
660 VBGLR3CLIPBOARDEVENTTYPE_REPORT_FORMATS,
661 /** Host wants to read Shared Clipboard data from the guest. */
662 VBGLR3CLIPBOARDEVENTTYPE_READ_DATA,
663 /** Terminates the Shared Clipboard service. */
664 VBGLR3CLIPBOARDEVENTTYPE_QUIT,
665# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
666 /** Reports a transfer status to the guest. */
667 VBGLR3CLIPBOARDEVENTTYPE_TRANSFER_STATUS,
668# endif
669 /** Blow the type up to 32-bit. */
670 VBGLR3CLIPBOARDEVENTTYPE_32BIT_HACK = 0x7fffffff
671} VBGLR3CLIPBOARDEVENTTYPE;
672
673/**
674 * Structure for keeping a Shared Clipboard VbglR3 event.
675 */
676typedef struct _VBGLR3CLIPBOARDEVENT
677{
678 /** The event type the union contains. */
679 VBGLR3CLIPBOARDEVENTTYPE enmType;
680 /** Command context bound to this event. */
681 VBGLR3SHCLCMDCTX cmdCtx;
682 union
683 {
684 /** Reports available formats from the host. */
685 SHCLFORMATS fReportedFormats;
686 /** Reports that data needs to be read from the guest. */
687 SHCLFORMAT fReadData;
688# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
689 /** Reports a transfer status to the guest. */
690 struct
691 {
692 /** ID of the trnasfer. */
693 SHCLTRANSFERID uID;
694 /** Transfer direction. */
695 SHCLTRANSFERDIR enmDir;
696 /** Additional reproting information. */
697 SHCLTRANSFERREPORT Report;
698 } TransferStatus;
699# endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
700 } u;
701} VBGLR3CLIPBOARDEVENT, *PVBGLR3CLIPBOARDEVENT;
702typedef const PVBGLR3CLIPBOARDEVENT CPVBGLR3CLIPBOARDEVENT;
703
704/** @todo r=bird: I'm not sure it is appropriate for the VbglR3 to use types
705 * from VBox/GuestHost/SharedClipboard*.h, doesn't seem clean to me. */
706
707VBGLR3DECL(int) VbglR3ClipboardConnect(HGCMCLIENTID *pidClient);
708VBGLR3DECL(int) VbglR3ClipboardDisconnect(HGCMCLIENTID idClient);
709VBGLR3DECL(int) VbglR3ClipboardGetHostMsgOld(HGCMCLIENTID idClient, uint32_t *pMsg, uint32_t *pfFormats);
710VBGLR3DECL(int) VbglR3ClipboardReadData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
711VBGLR3DECL(int) VbglR3ClipboardReadDataEx(PVBGLR3SHCLCMDCTX pCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData, uint32_t *pcbRead);
712VBGLR3DECL(int) VbglR3ClipboardWriteData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb);
713VBGLR3DECL(int) VbglR3ClipboardWriteDataEx(PVBGLR3SHCLCMDCTX pCtx, SHCLFORMAT fFormat, void *pvData, uint32_t cbData);
714VBGLR3DECL(int) VbglR3ClipboardReportFormats(HGCMCLIENTID idClient, uint32_t fFormats);
715
716VBGLR3DECL(int) VbglR3ClipboardConnectEx(PVBGLR3SHCLCMDCTX pCtx, uint64_t fGuestFeatures);
717VBGLR3DECL(int) VbglR3ClipboardDisconnectEx(PVBGLR3SHCLCMDCTX pCtx);
718
719VBGLR3DECL(int) VbglR3ClipboardReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures);
720VBGLR3DECL(int) VbglR3ClipboardQueryFeatures(uint32_t idClient, uint64_t *pfHostFeatures);
721VBGLR3DECL(int) VbglR3ClipboardMsgPeekWait(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck);
722VBGLR3DECL(int) VbglR3ClipboardEventGetNext(uint32_t idMsg, uint32_t cParms, PVBGLR3SHCLCMDCTX pCtx, PVBGLR3CLIPBOARDEVENT pEvent);
723VBGLR3DECL(void) VbglR3ClipboardEventFree(PVBGLR3CLIPBOARDEVENT pEvent);
724
725VBGLR3DECL(int) VbglR3ClipboardWriteError(HGCMCLIENTID idClient, int rcErr);
726
727# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
728VBGLR3DECL(void) VbglR3ClipboardTransferSetCallbacks(PSHCLTRANSFERCALLBACKTABLE pCallbacks);
729VBGLR3DECL(int) VbglR3ClipboardEventGetNextEx(uint32_t idMsg, uint32_t cParms, PVBGLR3SHCLCMDCTX pCtx, PSHCLTRANSFERCTX pTransferCtx, PVBGLR3CLIPBOARDEVENT pEvent);
730
731VBGLR3DECL(int) VbglR3ClipboardTransferStatusReply(PVBGLR3SHCLCMDCTX pCtx, PSHCLTRANSFER pTransfer, SHCLTRANSFERSTATUS uStatus);
732
733VBGLR3DECL(int) VbglR3ClipboardRootListRead(PVBGLR3SHCLCMDCTX pCtx, PSHCLROOTLIST *ppRootList);
734
735VBGLR3DECL(int) VbglR3ClipboardRootListHdrReadReq(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pfRoots);
736VBGLR3DECL(int) VbglR3ClipboardRootListHdrReadReply(PVBGLR3SHCLCMDCTX pCtx, PSHCLROOTLIST pRootList);
737VBGLR3DECL(int) VbglR3ClipboardRootsWrite(PVBGLR3SHCLCMDCTX pCtx, PSHCLROOTLISTHDR pRoots);
738
739VBGLR3DECL(int) VbglR3ClipboardListOpenSend(PVBGLR3SHCLCMDCTX pCtx, PSHCLLISTOPENPARMS pOpenParms, PSHCLLISTHANDLE phList);
740VBGLR3DECL(int) VbglR3ClipboardListOpenRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLLISTOPENPARMS pOpenParms);
741VBGLR3DECL(int) VbglR3ClipboardListOpenReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHCLLISTHANDLE hList);
742
743VBGLR3DECL(int) VbglR3ClipboardListCloseSend(PVBGLR3SHCLCMDCTX pCtx, SHCLLISTHANDLE hList);
744VBGLR3DECL(int) VbglR3ClipboardListCloseRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLLISTHANDLE phList);
745
746VBGLR3DECL(int) VbglR3ClipboardListHdrWrite(PVBGLR3SHCLCMDCTX pCtx, SHCLLISTHANDLE hList, PSHCLLISTHDR pListHdr);
747VBGLR3DECL(int) VbglR3ClipboardListEntryWrite(PVBGLR3SHCLCMDCTX pCtx, SHCLLISTHANDLE hList, PSHCLLISTENTRY pListEntry);
748
749VBGLR3DECL(int) VbglR3ClipboardObjOpenRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLOBJOPENCREATEPARMS pCreateParms);
750VBGLR3DECL(int) VbglR3ClipboardObjOpenReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHCLOBJHANDLE hObj);
751VBGLR3DECL(int) VbglR3ClipboardObjOpenSend(PVBGLR3SHCLCMDCTX pCtx, PSHCLOBJOPENCREATEPARMS pCreateParms,
752 PSHCLOBJHANDLE phObj);
753
754VBGLR3DECL(int) VbglR3ClipboardObjCloseRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLOBJHANDLE phObj);
755VBGLR3DECL(int) VbglR3ClipboardObjCloseReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHCLOBJHANDLE hObj);
756VBGLR3DECL(int) VbglR3ClipboardObjCloseSend(PVBGLR3SHCLCMDCTX pCtx, SHCLOBJHANDLE hObj);
757
758VBGLR3DECL(int) VbglR3ClipboardObjReadRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLOBJHANDLE phObj, uint32_t pcbToRead,
759 uint32_t *pfFlags);
760VBGLR3DECL(int) VbglR3ClipboardObjReadSend(PVBGLR3SHCLCMDCTX pCtx, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf,
761 uint32_t *pcbRead);
762VBGLR3DECL(int) VbglR3ClipboardObjWriteSend(PVBGLR3SHCLCMDCTX pCtx, SHCLOBJHANDLE hObj, void *pvBuf, uint32_t cbBuf,
763 uint32_t *pcbWritten);
764# endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
765/** @} */
766# endif /* VBOX_WITH_SHARED_CLIPBOARD */
767
768/** @name Seamless mode
769 * @{ */
770VBGLR3DECL(int) VbglR3SeamlessSetCap(bool fState);
771VBGLR3DECL(int) VbglR3SeamlessWaitEvent(VMMDevSeamlessMode *pMode);
772VBGLR3DECL(int) VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects);
773VBGLR3DECL(int) VbglR3SeamlessSendMonitorPositions(uint32_t cPositions, PRTPOINT pPositions);
774VBGLR3DECL(int) VbglR3SeamlessGetLastEvent(VMMDevSeamlessMode *pMode);
775
776/** @} */
777
778/** @name Mouse
779 * @{ */
780VBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
781VBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures);
782/** @} */
783
784/** @name Video
785 * @{ */
786VBGLR3DECL(int) VbglR3VideoAccelEnable(bool fEnable);
787VBGLR3DECL(int) VbglR3VideoAccelFlush(void);
788VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
789 const void *pvImg, size_t cbImg);
790VBGLR3DECL(int) VbglR3SetPointerShapeReq(struct VMMDevReqMousePointer *pReq);
791/** @} */
792
793/** @name Display
794 * @{ */
795/** The folder for the video mode hint unix domain socket on Unix-like guests.
796 * @note This can be safely changed as all users are rebuilt in lock-step. */
797#define VBGLR3HOSTDISPSOCKETPATH "/tmp/.VBoxService"
798/** The path to the video mode hint unix domain socket on Unix-like guests. */
799#define VBGLR3HOSTDISPSOCKET VBGLR3VIDEOMODEHINTSOCKETPATH "/VideoModeHint"
800
801/** The folder for saving video mode hints to between sessions. */
802#define VBGLR3HOSTDISPSAVEDMODEPATH "/var/lib/VBoxGuestAdditions"
803/** The path to the file for saving video mode hints to between sessions. */
804#define VBGLR3HOSTDISPSAVEDMODE VBGLR3HOSTDISPSAVEDMODEPATH "/SavedVideoModes"
805
806VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay,
807 uint32_t *pdx, uint32_t *pdy, bool *pfEnabled, bool *pfChangeOrigin, bool fAck);
808VBGLR3DECL(int) VbglR3GetDisplayChangeRequestMulti(uint32_t cDisplaysIn, uint32_t *pcDisplaysOut,
809 VMMDevDisplayDef *paDisplays, bool fAck);
810VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
811VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen);
812VBGLR3DECL(int) VbglR3SaveVideoMode(unsigned cScreen, unsigned cx, unsigned cy, unsigned cBits,
813 unsigned x, unsigned y, bool fEnabled);
814VBGLR3DECL(int) VbglR3RetrieveVideoMode(unsigned cScreen, unsigned *pcx, unsigned *pcy, unsigned *pcBits,
815 unsigned *px, unsigned *py, bool *pfEnabled);
816/** @} */
817
818/** @name VRDP
819 * @{ */
820VBGLR3DECL(int) VbglR3VrdpGetChangeRequest(bool *pfActive, uint32_t *puExperienceLevel);
821/** @} */
822
823/** @name VM Statistics
824 * @{ */
825VBGLR3DECL(int) VbglR3StatQueryInterval(uint32_t *pu32Interval);
826# if defined(VBOX_INCLUDED_VMMDev_h) || defined(DOXYGEN_RUNNING)
827VBGLR3DECL(int) VbglR3StatReport(VMMDevReportGuestStats *pReq);
828# endif
829/** @} */
830
831/** @name Memory ballooning
832 * @{ */
833VBGLR3DECL(int) VbglR3MemBalloonRefresh(uint32_t *pcChunks, bool *pfHandleInR3);
834VBGLR3DECL(int) VbglR3MemBalloonChange(void *pv, bool fInflate);
835/** @} */
836
837/** @name Core Dump
838 * @{ */
839VBGLR3DECL(int) VbglR3WriteCoreDump(void);
840
841/** @} */
842
843/** @name DRM client handling
844 * @{ */
845/** Guest property names pattern which is used by Guest Additions DRM services. */
846# define VBGLR3DRMPROPPTR "/VirtualBox/GuestAdd/DRM*"
847/** Guest property that defines if the DRM IPC server access should be restricted to a specific user group. */
848# define VBGLR3DRMIPCPROPRESTRICT "/VirtualBox/GuestAdd/DRMIpcRestricted"
849
850VBGLR3DECL(bool) VbglR3DrmClientIsNeeded(void);
851VBGLR3DECL(bool) VbglR3DrmRestrictedIpcAccessIsNeeded(void);
852VBGLR3DECL(bool) VbglR3DrmClientIsRunning(void);
853VBGLR3DECL(int) VbglR3DrmClientStart(void);
854VBGLR3DECL(int) VbglR3DrmLegacyClientStart(void);
855VBGLR3DECL(int) VbglR3DrmLegacyX11AgentStart(void);
856/** @} */
857
858# ifdef VBOX_WITH_GUEST_PROPS
859/** @name Guest properties
860 * @{ */
861/** @todo Docs. */
862typedef struct VBGLR3GUESTPROPENUM VBGLR3GUESTPROPENUM;
863/** @todo Docs. */
864typedef VBGLR3GUESTPROPENUM *PVBGLR3GUESTPROPENUM;
865VBGLR3DECL(int) VbglR3GuestPropConnect(uint32_t *pidClient);
866VBGLR3DECL(int) VbglR3GuestPropDisconnect(HGCMCLIENTID idClient);
867VBGLR3DECL(bool) VbglR3GuestPropExist(uint32_t idClient, const char *pszPropName);
868VBGLR3DECL(int) VbglR3GuestPropWrite(HGCMCLIENTID idClient, const char *pszName, const char *pszValue, const char *pszFlags);
869VBGLR3DECL(int) VbglR3GuestPropWriteValue(HGCMCLIENTID idClient, const char *pszName, const char *pszValue);
870VBGLR3DECL(int) VbglR3GuestPropWriteValueV(HGCMCLIENTID idClient, const char *pszName,
871 const char *pszValueFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);
872VBGLR3DECL(int) VbglR3GuestPropWriteValueF(HGCMCLIENTID idClient, const char *pszName,
873 const char *pszValueFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
874VBGLR3DECL(int) VbglR3GuestPropRead(HGCMCLIENTID idClient, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue,
875 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
876VBGLR3DECL(int) VbglR3GuestPropReadEx(uint32_t u32ClientId,
877 const char *pszPropName, char **ppszValue, char **ppszFlags, uint64_t *puTimestamp);
878VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue,
879 uint32_t *pcchValueActual);
880VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(HGCMCLIENTID idClient, const char *pszName, char **ppszValue);
881VBGLR3DECL(void) VbglR3GuestPropReadValueFree(char *pszValue);
882VBGLR3DECL(int) VbglR3GuestPropEnumRaw(HGCMCLIENTID idClient, const char *paszPatterns, char *pcBuf, uint32_t cbBuf,
883 uint32_t *pcbBufActual);
884VBGLR3DECL(int) VbglR3GuestPropEnum(HGCMCLIENTID idClient, char const * const *ppaszPatterns, uint32_t cPatterns,
885 PVBGLR3GUESTPROPENUM *ppHandle, char const **ppszName, char const **ppszValue,
886 uint64_t *pu64Timestamp, char const **ppszFlags);
887VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue,
888 uint64_t *pu64Timestamp, char const **ppszFlags);
889VBGLR3DECL(void) VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle);
890VBGLR3DECL(int) VbglR3GuestPropDelete(HGCMCLIENTID idClient, const char *pszName);
891VBGLR3DECL(int) VbglR3GuestPropDelSet(HGCMCLIENTID idClient, char const * const *papszPatterns, uint32_t cPatterns);
892VBGLR3DECL(int) VbglR3GuestPropWait(HGCMCLIENTID idClient, const char *pszPatterns, void *pvBuf, uint32_t cbBuf,
893 uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue,
894 uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual, bool *pfWasDeleted);
895/** @} */
896
897/** @name Guest user handling / reporting.
898 * @{ */
899VBGLR3DECL(int) VbglR3GuestUserReportState(const char *pszUser, const char *pszDomain, VBoxGuestUserState enmState,
900 uint8_t *pbDetails, uint32_t cbDetails);
901/** @} */
902
903/** @name Host version handling
904 * @{ */
905VBGLR3DECL(int) VbglR3HostVersionCheckForUpdate(HGCMCLIENTID idClient, bool *pfUpdate, char **ppszHostVersion,
906 char **ppszGuestVersion);
907VBGLR3DECL(int) VbglR3HostVersionLastCheckedLoad(HGCMCLIENTID idClient, char **ppszVer);
908VBGLR3DECL(int) VbglR3HostVersionLastCheckedStore(HGCMCLIENTID idClient, const char *pszVer);
909/** @} */
910# endif /* VBOX_WITH_GUEST_PROPS defined */
911
912# ifdef VBOX_WITH_SHARED_FOLDERS
913/** @name Shared folders
914 * @{ */
915/**
916 * Structure containing mapping information for a shared folder.
917 */
918typedef struct VBGLR3SHAREDFOLDERMAPPING
919{
920 /** Mapping status. */
921 uint32_t u32Status;
922 /** Root handle. */
923 uint32_t u32Root;
924} VBGLR3SHAREDFOLDERMAPPING;
925/** Pointer to a shared folder mapping information structure. */
926typedef VBGLR3SHAREDFOLDERMAPPING *PVBGLR3SHAREDFOLDERMAPPING;
927/** Pointer to a const shared folder mapping information structure. */
928typedef VBGLR3SHAREDFOLDERMAPPING const *PCVBGLR3SHAREDFOLDERMAPPING;
929
930VBGLR3DECL(int) VbglR3SharedFolderConnect(uint32_t *pidClient);
931VBGLR3DECL(int) VbglR3SharedFolderDisconnect(HGCMCLIENTID idClient);
932VBGLR3DECL(bool) VbglR3SharedFolderExists(HGCMCLIENTID idClient, const char *pszShareName);
933VBGLR3DECL(int) VbglR3SharedFolderGetMappings(HGCMCLIENTID idClient, bool fAutoMountOnly,
934 PVBGLR3SHAREDFOLDERMAPPING *ppaMappings, uint32_t *pcMappings);
935VBGLR3DECL(void) VbglR3SharedFolderFreeMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings);
936VBGLR3DECL(int) VbglR3SharedFolderGetName(HGCMCLIENTID idClient,uint32_t u32Root, char **ppszName); /**< @todo r=bird: GET functions return the value, not a status code!*/
937VBGLR3DECL(int) VbglR3SharedFolderQueryFolderInfo(HGCMCLIENTID idClient, uint32_t idRoot, uint64_t fQueryFlags,
938 char **ppszName, char **ppszMountPoint,
939 uint64_t *pfFlags, uint32_t *puRootIdVersion);
940VBGLR3DECL(int) VbglR3SharedFolderWaitForMappingsChanges(HGCMCLIENTID idClient, uint32_t uPrevVersion, uint32_t *puCurVersion);
941VBGLR3DECL(int) VbglR3SharedFolderCancelMappingsChangesWaits(HGCMCLIENTID idClient);
942
943VBGLR3DECL(int) VbglR3SharedFolderGetMountPrefix(char **ppszPrefix); /**< @todo r=bird: GET functions return the value, not a status code! */
944VBGLR3DECL(int) VbglR3SharedFolderGetMountDir(char **ppszDir); /**< @todo r=bird: GET functions return the value, not a status code! */
945/** @} */
946# endif /* VBOX_WITH_SHARED_FOLDERS defined */
947
948# ifdef VBOX_WITH_GUEST_CONTROL
949/** @name Guest control
950 * @{ */
951
952/**
953 * Structure containing the context required for
954 * either retrieving or sending a HGCM guest control
955 * commands from or to the host.
956 *
957 * @note Do not change parameter order without also adapting all structure
958 * initializers.
959 */
960typedef struct VBGLR3GUESTCTRLCMDCTX
961{
962 /** @todo This struct could be handy if we want to implement
963 * a second communication channel, e.g. via TCP/IP.
964 * Use a union for the HGCM stuff then. */
965
966 /** IN: HGCM client ID to use for communication. */
967 uint32_t uClientID;
968 /** IN/OUT: Context ID to retrieve or to use. */
969 uint32_t uContextID;
970 /** IN: Protocol version to use. */
971 uint32_t uProtocol;
972 /** OUT: Number of parameters retrieved. */
973 uint32_t uNumParms;
974} VBGLR3GUESTCTRLCMDCTX, *PVBGLR3GUESTCTRLCMDCTX;
975
976/**
977 * Structure holding information for starting a guest
978 * session.
979 */
980typedef struct VBGLR3GUESTCTRLSESSIONSTARTUPINFO
981{
982 /** The session's protocol version to use. */
983 uint32_t uProtocol;
984 /** The session's ID. */
985 uint32_t uSessionID;
986 /** User name (account) to start the guest session under. */
987 char *pszUser;
988 /** Size (in bytes) of allocated pszUser. */
989 uint32_t cbUser;
990 /** Password of specified user name (account). */
991 char *pszPassword;
992 /** Size (in bytes) of allocated pszPassword. */
993 uint32_t cbPassword;
994 /** Domain of the user account. */
995 char *pszDomain;
996 /** Size (in bytes) of allocated pszDomain. */
997 uint32_t cbDomain;
998 /** Session creation flags.
999 * @sa VBOXSERVICECTRLSESSIONSTARTUPFLAG_* flags. */
1000 uint32_t fFlags;
1001} VBGLR3GUESTCTRLSESSIONSTARTUPINFO;
1002/** Pointer to a guest session startup info. */
1003typedef VBGLR3GUESTCTRLSESSIONSTARTUPINFO *PVBGLR3GUESTCTRLSESSIONSTARTUPINFO;
1004
1005/**
1006 * Structure holding information for starting a guest
1007 * process.
1008 */
1009typedef struct VBGLR3GUESTCTRLPROCSTARTUPINFO
1010{
1011 /** Full qualified path of process to start (without arguments).
1012 * Note: This is *not* argv[0]! */
1013 char *pszCmd;
1014 /** Size (in bytes) of allocated pszCmd. */
1015 uint32_t cbCmd;
1016 /** Process execution flags. @sa */
1017 uint32_t fFlags;
1018 /** Command line arguments. */
1019 char *pszArgs;
1020 /** Size (in bytes) of allocated pszArgs. */
1021 uint32_t cbArgs;
1022 /** Number of arguments specified in pszArgs. */
1023 uint32_t cArgs;
1024 /** String of environment variables ("FOO=BAR") to pass to the process
1025 * to start. */
1026 char *pszEnv;
1027 /** Size (in bytes) of environment variables block. */
1028 uint32_t cbEnv;
1029 /** Number of environment variables specified in pszEnv. */
1030 uint32_t cEnvVars;
1031 /** Optional working directory. */
1032 char *pszCwd;
1033 /** Size (in bytes) of optional working directory string. */
1034 uint32_t cbCwd;
1035 /** User name (account) to start the process under. */
1036 char *pszUser;
1037 /** Size (in bytes) of allocated pszUser. */
1038 uint32_t cbUser;
1039 /** Password of specified user name (account). */
1040 char *pszPassword;
1041 /** Size (in bytes) of allocated pszPassword. */
1042 uint32_t cbPassword;
1043 /** Domain to be used for authenticating the specified user name (account). */
1044 char *pszDomain;
1045 /** Size (in bytes) of allocated pszDomain. */
1046 uint32_t cbDomain;
1047 /** Time limit (in ms) of the process' life time. */
1048 uint32_t uTimeLimitMS;
1049 /** Process priority. */
1050 uint32_t uPriority;
1051 /** Process affinity block. At the moment we support
1052 * up to 4 blocks, that is, 4 * 64 = 256 CPUs total. */
1053 uint64_t uAffinity[4];
1054 /** Number of used process affinity blocks. */
1055 uint32_t cAffinity;
1056} VBGLR3GUESTCTRLPROCSTARTUPINFO;
1057/** Pointer to a guest process startup info. */
1058typedef VBGLR3GUESTCTRLPROCSTARTUPINFO *PVBGLR3GUESTCTRLPROCSTARTUPINFO;
1059
1060/* General message handling on the guest. */
1061VBGLR3DECL(int) VbglR3GuestCtrlConnect(uint32_t *pidClient);
1062VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t idClient);
1063VBGLR3DECL(bool) VbglR3GuestCtrlSupportsOptimizations(uint32_t idClient);
1064VBGLR3DECL(int) VbglR3GuestCtrlMakeMeMaster(uint32_t idClient);
1065VBGLR3DECL(int) VbglR3GuestCtrlReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures);
1066VBGLR3DECL(int) VbglR3GuestCtrlQueryFeatures(uint32_t idClient, uint64_t *pfHostFeatures);
1067VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove);
1068VBGLR3DECL(int) VbglR3GuestCtrlMsgReply(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc);
1069VBGLR3DECL(int) VbglR3GuestCtrlMsgReplyEx(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc, uint32_t uType,
1070 void *pvPayload, uint32_t cbPayload);
1071VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t idClient, int rcSkip, uint32_t idMsg);
1072VBGLR3DECL(int) VbglR3GuestCtrlMsgSkipOld(uint32_t uClientId);
1073VBGLR3DECL(int) VbglR3GuestCtrlMsgPeekWait(uint32_t idClient, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck);
1074VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(HGCMCLIENTID idClient);
1075/* Guest session handling. */
1076VBGLR3DECL(int) VbglR3GuestCtrlSessionStartupInfoInit(PVBGLR3GUESTCTRLSESSIONSTARTUPINFO pStartupInfo);
1077VBGLR3DECL(int) VbglR3GuestCtrlSessionStartupInfoInitEx(PVBGLR3GUESTCTRLSESSIONSTARTUPINFO pStartupInfo, size_t cbUser, size_t cbPassword, size_t cbDomain);
1078VBGLR3DECL(void) VbglR3GuestCtrlSessionStartupInfoDestroy(PVBGLR3GUESTCTRLSESSIONSTARTUPINFO pStartupInfo);
1079VBGLR3DECL(void) VbglR3GuestCtrlSessionStartupInfoFree(PVBGLR3GUESTCTRLSESSIONSTARTUPINFO pStartupInfo);
1080VBGLR3DECL(PVBGLR3GUESTCTRLSESSIONSTARTUPINFO) VbglR3GuestCtrlSessionStartupInfoDup(PVBGLR3GUESTCTRLSESSIONSTARTUPINFO pStartupInfo);
1081VBGLR3DECL(int) VbglR3GuestCtrlSessionPrepare(uint32_t idClient, uint32_t idSession, void const *pvKey, uint32_t cbKey);
1082VBGLR3DECL(int) VbglR3GuestCtrlSessionAccept(uint32_t idClient, uint32_t idSession, void const *pvKey, uint32_t cbKey);
1083VBGLR3DECL(int) VbglR3GuestCtrlSessionCancelPrepared(uint32_t idClient, uint32_t idSession);
1084VBGLR3DECL(int) VbglR3GuestCtrlSessionHasChanged(uint32_t idClient, uint64_t idNewControlSession);
1085VBGLR3DECL(int) VbglR3GuestCtrlSessionClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t fFlags);
1086VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uType, int32_t iResult);
1087VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, PVBGLR3GUESTCTRLSESSIONSTARTUPINFO *ppStartupInfo);
1088VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *pfFlags, uint32_t *pidSession);
1089VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
1090VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puToRead);
1091/* Guest path handling. */
1092VBGLR3DECL(int) VbglR3GuestCtrlPathGetRename(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszSource, uint32_t cbSource, char *pszDest,
1093 uint32_t cbDest, uint32_t *pfFlags);
1094VBGLR3DECL(int) VbglR3GuestCtrlPathGetUserDocuments(PVBGLR3GUESTCTRLCMDCTX pCtx);
1095VBGLR3DECL(int) VbglR3GuestCtrlPathGetUserHome(PVBGLR3GUESTCTRLCMDCTX pCtx);
1096# ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
1097/** @name Guest Control file system functions.
1098 * @{
1099 */
1100VBGLR3DECL(int) VbglR3GuestCtrlFsGetCreateTemp(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszTemplate, uint32_t cbTemplate, char *pszPath, uint32_t cbPath, uint32_t *pfFlags, uint32_t *pfMode);
1101VBGLR3DECL(int) VbglR3GuestCtrlFsGetQueryInfo(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath);
1102/** @} */
1103
1104/** @name Guest Control file system object functions.
1105 * @{
1106 */
1107VBGLR3DECL(int) VbglR3GuestCtrlFsObjGetQueryInfo(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, GSTCTLFSOBJATTRADD *penmAddAttrib, uint32_t *pfFlags);
1108/** @} */
1109# endif
1110
1111VBGLR3DECL(int) VbglR3GuestCtrlGetShutdown(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *pfAction);
1112/* Guest process execution. */
1113VBGLR3DECL(int) VbglR3GuestCtrlProcStartupInfoInit(PVBGLR3GUESTCTRLPROCSTARTUPINFO pStartupInfo);
1114VBGLR3DECL(int) VbglR3GuestCtrlProcStartupInfoInitEx(PVBGLR3GUESTCTRLPROCSTARTUPINFO pStartupInfo, size_t cbCmd, size_t cbArgs, size_t cbEnv, size_t cbUser, size_t cbPassword, size_t cbDomain);
1115VBGLR3DECL(void) VbglR3GuestCtrlProcStartupInfoDestroy(PVBGLR3GUESTCTRLPROCSTARTUPINFO pStartupInfo);
1116VBGLR3DECL(void) VbglR3GuestCtrlProcStartupInfoFree(PVBGLR3GUESTCTRLPROCSTARTUPINFO pStartupInfo);
1117VBGLR3DECL(PVBGLR3GUESTCTRLPROCSTARTUPINFO) VbglR3GuestCtrlProcStartupInfoDup(PVBGLR3GUESTCTRLPROCSTARTUPINFO pStartupInfo);
1118VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLCMDCTX pCtx, PVBGLR3GUESTCTRLPROCSTARTUPINFO *ppStartupInfo);
1119VBGLR3DECL(int) VbglR3GuestCtrlProcGetTerminate(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID);
1120VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *pfFlags, void *pvData,
1121 uint32_t cbData, uint32_t *pcbSize);
1122VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puHandle, uint32_t *pfFlags);
1123VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID, uint32_t *puWaitFlags,
1124 uint32_t *puTimeoutMS);
1125/* Guest native directory handling. */
1126# ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
1127/** @name Guest Control directory functions.
1128 * @{
1129 */
1130VBGLR3DECL(int) VbglR3GuestCtrlDirGetCreate(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *pfMode, uint32_t *pfFlags);
1131VBGLR3DECL(int) VbglR3GuestCtrlDirGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *pfFlags, GSTCTLDIRFILTER *penmFilter, GSTCTLFSOBJATTRADD *penmReadAttrAdd, uint32_t *pfReadFlags);
1132VBGLR3DECL(int) VbglR3GuestCtrlDirGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
1133VBGLR3DECL(int) VbglR3GuestCtrlDirGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
1134VBGLR3DECL(int) VbglR3GuestCtrlDirGetRewind(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
1135VBGLR3DECL(int) VbglR3GuestCtrlDirGetList(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *pcEntries, uint32_t *pfFlags);
1136/** @} */
1137# endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
1138VBGLR3DECL(int) VbglR3GuestCtrlDirGetRemove(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath, uint32_t *pfFlags);
1139/* Guest native file handling. */
1140VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszFileName, uint32_t cbFileName, char *pszOpenMode,
1141 uint32_t cbOpenMode, char *pszDisposition, uint32_t cbDisposition, char *pszSharing,
1142 uint32_t cbSharing, uint32_t *puCreationMode, uint64_t *puOffset);
1143VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
1144VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *puToRead);
1145VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
1146 uint32_t *puToRead, uint64_t *poffRead);
1147VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
1148 void *pvData, uint32_t cbData, uint32_t *pcbActual);
1149VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, void *pvData, uint32_t cbData,
1150 uint32_t *pcbActual, uint64_t *poffWrite);
1151VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
1152 uint32_t *puSeekMethod, uint64_t *poffSeek);
1153VBGLR3DECL(int) VbglR3GuestCtrlFileGetTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
1154VBGLR3DECL(int) VbglR3GuestCtrlFileGetSetSize(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint64_t *pcbNew);
1155# ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
1156VBGLR3DECL(int) VbglR3GuestCtrlFileGetRemove(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszFileName, uint32_t cbFileName);
1157# endif
1158
1159/* Guest -> Host. */
1160# ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
1161/** @name Guest Control directory callbacks.
1162 * @{
1163 */
1164VBGLR3DECL(int) VbglR3GuestCtrlDirCbOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uFileHandle);
1165VBGLR3DECL(int) VbglR3GuestCtrlDirCbClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
1166VBGLR3DECL(int) VbglR3GuestCtrlDirCbReadEx(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, PGSTCTLDIRENTRYEX pEntry, uint32_t cbSize, const char *pszUser, const char *pszGroups);
1167VBGLR3DECL(int) VbglR3GuestCtrlDirCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, PGSTCTLDIRENTRYEX pEntry, uint32_t cbSize);
1168VBGLR3DECL(int) VbglR3GuestCtrlDirCbRewind(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
1169VBGLR3DECL(int) VbglR3GuestCtrlDirCbList(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cEntries, void *pvBuf, uint32_t cbBuf);
1170/** @} */
1171# endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
1172
1173VBGLR3DECL(int) VbglR3GuestCtrlFileCbOpen(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t uFileHandle);
1174VBGLR3DECL(int) VbglR3GuestCtrlFileCbClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
1175VBGLR3DECL(int) VbglR3GuestCtrlFileCbError(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
1176VBGLR3DECL(int) VbglR3GuestCtrlFileCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, void *pvData, uint32_t cbData);
1177VBGLR3DECL(int) VbglR3GuestCtrlFileCbReadOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, void *pvData, uint32_t cbData, int64_t offNew);
1178VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten);
1179VBGLR3DECL(int) VbglR3GuestCtrlFileCbWriteOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten, int64_t offNew);
1180
1181VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t offCurrent);
1182VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t offCurrent);
1183VBGLR3DECL(int) VbglR3GuestCtrlFileCbSetSize(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t cbNew);
1184
1185# ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
1186/** @name Guest Control file system callbacks.
1187 * @{
1188 */
1189VBGLR3DECL(int) VbglR3GuestCtrlFsCbCreateTemp(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, const char *pszPath);
1190VBGLR3DECL(int) VbglR3GuestCtrlFsCbQueryInfo(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, PGSTCTLFSINFO pFsInfo, uint32_t cbFsInfo);
1191/** @} */
1192
1193/** @name Guest Control file system object callbacks.
1194 * @{
1195 */
1196VBGLR3DECL(int) VbglR3GuestCtrlFsObjCbQueryInfoEx(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, PGSTCTLFSOBJINFO pObjInfo, const char *pszUser, const char *pszGroups);
1197VBGLR3DECL(int) VbglR3GuestCtrlFsObjCbQueryInfo(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, PGSTCTLFSOBJINFO pObjInfo);
1198/** @} */
1199# endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
1200
1201VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uStatus, uint32_t fFlags, void *pvData, uint32_t cbData);
1202VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uPID, uint32_t uHandle, uint32_t fFlags, void *pvData, uint32_t cbData);
1203VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t u32PID, uint32_t uStatus, uint32_t fFlags, uint32_t cbWritten);
1204# endif /* VBOX_WITH_GUEST_CONTROL defined */
1205
1206/** @name Auto-logon handling
1207 * @{ */
1208VBGLR3DECL(int) VbglR3AutoLogonReportStatus(VBoxGuestFacilityStatus enmStatus);
1209VBGLR3DECL(bool) VbglR3AutoLogonIsRemoteSession(void);
1210/** @} */
1211
1212/** @name User credentials handling
1213 * @{ */
1214VBGLR3DECL(int) VbglR3CredentialsQueryAvailability(void);
1215VBGLR3DECL(int) VbglR3CredentialsRetrieve(char **ppszUser, char **ppszPassword, char **ppszDomain);
1216VBGLR3DECL(int) VbglR3CredentialsRetrieveUtf16(PRTUTF16 *ppwszUser, PRTUTF16 *ppwszPassword, PRTUTF16 *ppwszDomain);
1217VBGLR3DECL(void) VbglR3CredentialsDestroy(char *pszUser, char *pszPassword, char *pszDomain, uint32_t cPasses);
1218VBGLR3DECL(void) VbglR3CredentialsDestroyUtf16(PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTUTF16 pwszDomain,
1219 uint32_t cPasses);
1220/** @} */
1221
1222/** @name CPU hotplug monitor
1223 * @{ */
1224VBGLR3DECL(int) VbglR3CpuHotPlugInit(void);
1225VBGLR3DECL(int) VbglR3CpuHotPlugTerm(void);
1226VBGLR3DECL(int) VbglR3CpuHotPlugWaitForEvent(VMMDevCpuEventType *penmEventType, uint32_t *pidCpuCore, uint32_t *pidCpuPackage);
1227/** @} */
1228
1229/** @name Page sharing
1230 * @{ */
1231struct VMMDEVSHAREDREGIONDESC;
1232VBGLR3DECL(int) VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule,
1233 unsigned cRegions, struct VMMDEVSHAREDREGIONDESC *pRegions);
1234VBGLR3DECL(int) VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule);
1235VBGLR3DECL(int) VbglR3CheckSharedModules(void);
1236VBGLR3DECL(bool) VbglR3PageSharingIsEnabled(void);
1237VBGLR3DECL(int) VbglR3PageIsShared(RTGCPTR pPage, bool *pfShared, uint64_t *puPageFlags);
1238/** @} */
1239
1240# ifdef VBOX_WITH_DRAG_AND_DROP
1241/** @name Drag and Drop
1242 * @{ */
1243/**
1244 * Structure containing the context required for
1245 * either retrieving or sending a HGCM guest drag'n drop
1246 * commands from or to the host.
1247 *
1248 * Note: Do not change parameter order without also
1249 * adapting all structure initializers.
1250 */
1251typedef struct VBGLR3GUESTDNDCMDCTX
1252{
1253 /** @todo This struct could be handy if we want to implement
1254 * a second communication channel, e.g. via TCP/IP.
1255 * Use a union for the HGCM stuff then. */
1256
1257 /** HGCM client ID to use for communication. */
1258 uint32_t uClientID;
1259 /** The VM's current session ID. */
1260 uint64_t uSessionID;
1261 /** Protocol version to use.
1262 * Deprecated; do not used / rely on it anymore. */
1263 uint32_t uProtocolDeprecated;
1264 /** Host feature flags (VBOX_DND_HF_XXX).
1265 * This is set by VbglR3DnDConnect(). */
1266 uint64_t fHostFeatures;
1267 /** The guest feature flags reported to the host (VBOX_DND_GF_XXX).
1268 * This is set by VbglR3DnDConnect(). */
1269 uint64_t fGuestFeatures;
1270 /** Number of parameters retrieved for the current command. */
1271 uint32_t uNumParms;
1272 /** Max chunk size (in bytes) for data transfers. */
1273 uint32_t cbMaxChunkSize;
1274} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
1275
1276/**
1277 * Enumeration for specifying the DnD meta data type.
1278 */
1279typedef enum VBGLR3GUESTDNDMETADATATYPE
1280{
1281 /** Unknown meta data type; don't use. */
1282 VBGLR3GUESTDNDMETADATATYPE_UNKNOWN = 0,
1283 /** Raw meta data; can be everything. */
1284 VBGLR3GUESTDNDMETADATATYPE_RAW,
1285 /** Meta data is a transfer list, specifying objects. */
1286 VBGLR3GUESTDNDMETADATATYPE_URI_LIST,
1287 /** Blow the type up to 32-bit. */
1288 VBGLR3GUESTDNDMETADATATYPE_32BIT_HACK = 0x7fffffff
1289} VBGLR3GUESTDNDMETADATATYPE;
1290
1291/**
1292 * Structure for keeping + handling DnD meta data.
1293 */
1294typedef struct VBGLR3GUESTDNDMETADATA
1295{
1296 /** The meta data type the union contains. */
1297 VBGLR3GUESTDNDMETADATATYPE enmType;
1298 /** Union based on \a enmType. */
1299 union
1300 {
1301 struct
1302 {
1303 /** Pointer to actual meta data. */
1304 void *pvMeta;
1305 /** Size (in bytes) of meta data. */
1306 uint32_t cbMeta;
1307 } Raw;
1308 struct
1309 {
1310 DNDTRANSFERLIST Transfer;
1311 } URI;
1312 } u;
1313} VBGLR3GUESTDNDMETADATA;
1314
1315/** Pointer to VBGLR3GUESTDNDMETADATA. */
1316typedef VBGLR3GUESTDNDMETADATA *PVBGLR3GUESTDNDMETADATA;
1317
1318/** Const pointer to VBGLR3GUESTDNDMETADATA. */
1319typedef const PVBGLR3GUESTDNDMETADATA CPVBGLR3GUESTDNDMETADATA;
1320
1321/**
1322 * Enumeration specifying a DnD event type.
1323 */
1324typedef enum VBGLR3DNDEVENTTYPE
1325{
1326 VBGLR3DNDEVENTTYPE_INVALID = 0,
1327 VBGLR3DNDEVENTTYPE_CANCEL,
1328 VBGLR3DNDEVENTTYPE_HG_ERROR,
1329 VBGLR3DNDEVENTTYPE_HG_ENTER,
1330 VBGLR3DNDEVENTTYPE_HG_MOVE,
1331 VBGLR3DNDEVENTTYPE_HG_LEAVE,
1332 VBGLR3DNDEVENTTYPE_HG_DROP,
1333 VBGLR3DNDEVENTTYPE_HG_RECEIVE,
1334# ifdef VBOX_WITH_DRAG_AND_DROP_GH
1335 VBGLR3DNDEVENTTYPE_GH_ERROR,
1336 VBGLR3DNDEVENTTYPE_GH_REQ_PENDING,
1337 VBGLR3DNDEVENTTYPE_GH_DROP,
1338# endif
1339 /** Tells the caller that it has to quit operation. */
1340 VBGLR3DNDEVENTTYPE_QUIT,
1341 /** Blow the type up to 32-bit. */
1342 VBGLR3DNDEVENTTYPE_32BIT_HACK = 0x7fffffff
1343} VBGLR3DNDEVENTTYPE;
1344
1345typedef struct VBGLR3DNDEVENT
1346{
1347 /** The event type the union contains. */
1348 VBGLR3DNDEVENTTYPE enmType;
1349 union
1350 {
1351 struct
1352 {
1353 /** Screen ID this request belongs to. */
1354 uint32_t uScreenID;
1355 /** Format list (UTF-8, \r\n separated). */
1356 char *pszFormats;
1357 /** Size (in bytes) of pszFormats (\0 included). */
1358 uint32_t cbFormats;
1359 /** List of allowed DnD actions. */
1360 VBOXDNDACTIONLIST dndLstActionsAllowed;
1361 } HG_Enter;
1362 struct
1363 {
1364 /** Absolute X position of guest screen. */
1365 uint32_t uXpos;
1366 /** Absolute Y position of guest screen. */
1367 uint32_t uYpos;
1368 /** Default DnD action. */
1369 VBOXDNDACTION dndActionDefault;
1370 } HG_Move;
1371 struct
1372 {
1373 /** Absolute X position of guest screen. */
1374 uint32_t uXpos;
1375 /** Absolute Y position of guest screen. */
1376 uint32_t uYpos;
1377 /** Default DnD action. */
1378 VBOXDNDACTION dndActionDefault;
1379 } HG_Drop;
1380 struct
1381 {
1382 /** Meta data for the operation. */
1383 VBGLR3GUESTDNDMETADATA Meta;
1384 } HG_Received;
1385 struct
1386 {
1387 /** IPRT-style error code. */
1388 int rc;
1389 } HG_Error;
1390# ifdef VBOX_WITH_DRAG_AND_DROP_GH
1391 struct
1392 {
1393 /** Screen ID this request belongs to. */
1394 uint32_t uScreenID;
1395 } GH_IsPending;
1396 struct
1397 {
1398 /** Requested format by the host. */
1399 char *pszFormat;
1400 /** Size (in bytes) of pszFormat (\0 included). */
1401 uint32_t cbFormat;
1402 /** Requested DnD action. */
1403 VBOXDNDACTION dndActionRequested;
1404 } GH_Drop;
1405# endif
1406 } u;
1407} VBGLR3DNDEVENT;
1408typedef VBGLR3DNDEVENT *PVBGLR3DNDEVENT;
1409typedef const PVBGLR3DNDEVENT CPVBGLR3DNDEVENT;
1410
1411VBGLR3DECL(int) VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx);
1412VBGLR3DECL(int) VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
1413
1414VBGLR3DECL(int) VbglR3DnDReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures);
1415VBGLR3DECL(int) VbglR3DnDSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcOp);
1416
1417VBGLR3DECL(int) VbglR3DnDEventGetNext(PVBGLR3GUESTDNDCMDCTX pCtx, PVBGLR3DNDEVENT *ppEvent);
1418VBGLR3DECL(void) VbglR3DnDEventFree(PVBGLR3DNDEVENT pEvent);
1419
1420VBGLR3DECL(int) VbglR3DnDHGSendAckOp(PVBGLR3GUESTDNDCMDCTX pCtx, VBOXDNDACTION dndAction);
1421VBGLR3DECL(int) VbglR3DnDHGSendReqData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pcszFormat);
1422VBGLR3DECL(int) VbglR3DnDHGSendProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
1423# ifdef VBOX_WITH_DRAG_AND_DROP_GH
1424VBGLR3DECL(int) VbglR3DnDGHSendAckPending(PVBGLR3GUESTDNDCMDCTX pCtx, VBOXDNDACTION dndActionDefault, VBOXDNDACTIONLIST dndLstActionsAllowed, const char* pcszFormats, uint32_t cbFormats);
1425VBGLR3DECL(int) VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData);
1426# endif /* VBOX_WITH_DRAG_AND_DROP_GH */
1427/** @} */
1428# endif /* VBOX_WITH_DRAG_AND_DROP */
1429
1430/* Generic Host Channel Service. */
1431VBGLR3DECL(int) VbglR3HostChannelInit(uint32_t *pidClient);
1432VBGLR3DECL(void) VbglR3HostChannelTerm(uint32_t idClient);
1433VBGLR3DECL(int) VbglR3HostChannelAttach(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
1434 const char *pszName, uint32_t u32Flags);
1435VBGLR3DECL(void) VbglR3HostChannelDetach(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
1436VBGLR3DECL(int) VbglR3HostChannelSend(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1437 void *pvData, uint32_t cbData);
1438VBGLR3DECL(int) VbglR3HostChannelRecv(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1439 void *pvData, uint32_t cbData,
1440 uint32_t *pu32SizeReceived, uint32_t *pu32SizeRemaining);
1441VBGLR3DECL(int) VbglR3HostChannelControl(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId,
1442 uint32_t u32Code, void *pvParm, uint32_t cbParm,
1443 void *pvData, uint32_t cbData, uint32_t *pu32SizeDataReturned);
1444VBGLR3DECL(int) VbglR3HostChannelEventWait(uint32_t *pu32ChannelHandle, uint32_t u32HGCMClientId,
1445 uint32_t *pu32EventId, void *pvParm, uint32_t cbParm,
1446 uint32_t *pu32SizeReturned);
1447VBGLR3DECL(int) VbglR3HostChannelEventCancel(uint32_t u32ChannelHandle, uint32_t u32HGCMClientId);
1448VBGLR3DECL(int) VbglR3HostChannelQuery(const char *pszName, uint32_t u32HGCMClientId, uint32_t u32Code,
1449 void *pvParm, uint32_t cbParm, void *pvData, uint32_t cbData,
1450 uint32_t *pu32SizeDataReturned);
1451
1452/** @name Mode hint storage
1453 * @{ */
1454VBGLR3DECL(int) VbglR3ReadVideoMode(unsigned cDisplay, unsigned *cx,
1455 unsigned *cy, unsigned *cBPP, unsigned *x,
1456 unsigned *y, unsigned *fEnabled);
1457VBGLR3DECL(int) VbglR3WriteVideoMode(unsigned cDisplay, unsigned cx,
1458 unsigned cy, unsigned cBPP, unsigned x,
1459 unsigned y, unsigned fEnabled);
1460/** @} */
1461
1462/** @name Generic HGCM
1463 * @{ */
1464VBGLR3DECL(int) VbglR3HGCMConnect(const char *pszServiceName, HGCMCLIENTID *pidClient);
1465VBGLR3DECL(int) VbglR3HGCMDisconnect(HGCMCLIENTID idClient);
1466struct VBGLIOCHGCMCALL;
1467VBGLR3DECL(int) VbglR3HGCMCall(struct VBGLIOCHGCMCALL *pInfo, size_t cbInfo);
1468/** @} */
1469
1470#endif /* IN_RING3 */
1471/** @} */
1472
1473RT_C_DECLS_END
1474
1475/** @} */
1476
1477#endif /* !VBOX_INCLUDED_VBoxGuestLib_h */
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