VirtualBox

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

Last change on this file was 103365, checked in by vboxsync, 4 months ago

Shared Clipboard/Additions: Removed lots of code duplication for reading clipboard data from the host (partly introduced by r159772).

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

© 2023 Oracle
ContactPrivacy policyTerms of Use