VirtualBox

source: vbox/trunk/include/VBox/VBoxGuest.h@ 17661

Last change on this file since 17661 was 17196, checked in by vboxsync, 16 years ago

Additions, VBoxGuestR3Lib: 32-bit ioctl handling for 64-bit guest driver. This fixes broken additions on S10 u6.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 58.6 KB
Line 
1/** @file
2 * VBoxGuest - VirtualBox Guest Additions interface
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_VBoxGuest_h
31#define ___VBox_VBoxGuest_h
32
33#include <iprt/cdefs.h>
34#include <iprt/types.h>
35#ifdef IN_RING3
36# include <iprt/stdarg.h>
37#endif
38#include <iprt/assert.h>
39#include <VBox/err.h>
40#include <VBox/ostypes.h>
41
42/*******************************************************************************
43* Defined Constants And Macros *
44*******************************************************************************/
45
46/** @todo The following is a temporary fix for the problem of accessing
47 hypervisor pointers from within guest additions */
48
49/** Hypervisor linear pointer size type */
50typedef RTGCPTR32 VMMDEVHYPPTR32;
51typedef RTGCPTR64 VMMDEVHYPPTR64;
52/** Hypervisor physical pointer size type */
53typedef RTGCPHYS32 VMMDEVHYPPHYS32;
54typedef RTGCPHYS64 VMMDEVHYPPHYS64;
55
56#if defined(VBOX_WITH_64_BITS_GUESTS) && ARCH_BITS == 64
57# define VMMDEVHYPPTR VMMDEVHYPPTR64
58# define VMMDEVHYPPHYS VMMDEVHYPPHYS64
59# else
60# define VMMDEVHYPPTR VMMDEVHYPPTR32
61# define VMMDEVHYPPHYS VMMDEVHYPPHYS32
62#endif
63
64#if defined(RT_OS_LINUX)
65/** The support device name. */
66# define VBOXGUEST_DEVICE_NAME "/dev/vboxadd"
67
68#elif defined(RT_OS_OS2)
69/** The support device name. */
70# define VBOXGUEST_DEVICE_NAME "\\Dev\\VBoxGst$"
71
72#elif defined(RT_OS_SOLARIS)
73/** The support device name. */
74# define VBOXGUEST_DEVICE_NAME "/dev/vboxguest"
75
76#elif defined(RT_OS_WINDOWS)
77/** The support service name. */
78# define VBOXGUEST_SERVICE_NAME "VBoxGuest"
79/** Win32 Device name. */
80# define VBOXGUEST_DEVICE_NAME "\\\\.\\VBoxGuest"
81/** Global name for Win2k+ */
82# define VBOXGUEST_DEVICE_NAME_GLOBAL "\\\\.\\Global\\VBoxGuest"
83/** Win32 driver name */
84# define VBOXGUEST_DEVICE_NAME_NT L"\\Device\\VBoxGuest"
85/** device name */
86# define VBOXGUEST_DEVICE_NAME_DOS L"\\DosDevices\\VBoxGuest"
87
88#elif defined(RT_OS_FREEBSD)
89/** The support device name. */
90# define VBOXGUEST_DEVICE_NAME "/dev/vboxguest"
91
92#else
93/* PORTME */
94#endif
95
96/** VirtualBox vendor ID */
97#define VBOX_PCI_VENDORID (0x80ee)
98
99/** VMMDev PCI card identifiers */
100#define VMMDEV_VENDORID VBOX_PCI_VENDORID
101#define VMMDEV_DEVICEID (0xcafe)
102
103/** VirtualBox graphics card identifiers */
104#define VBOX_VENDORID VBOX_PCI_VENDORID
105#define VBOX_VESA_VENDORID VBOX_PCI_VENDORID
106#define VBOX_DEVICEID (0xbeef)
107#define VBOX_VESA_DEVICEID (0xbeef)
108
109/**
110 * VBoxGuest port definitions
111 * @{
112 */
113
114/** guest can (== wants to) handle absolute coordinates */
115#define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0)
116/** host can (== wants to) send absolute coordinates */
117#define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE RT_BIT(1)
118/** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
119#define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
120/** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
121#define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER RT_BIT(3)
122
123/** fictive start address of the hypervisor physical memory for MmMapIoSpace */
124#define HYPERVISOR_PHYSICAL_START 0xf8000000
125
126/*
127 * VMMDev Generic Request Interface
128 */
129
130/** port for generic request interface */
131#define PORT_VMMDEV_REQUEST_OFFSET 0
132
133/** Current version of the VMMDev interface.
134 *
135 * Additions are allowed to work only if
136 * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
137 * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
138 *
139 * @remark These defines also live in the 16-bit and assembly versions of this header.
140 */
141#define VMMDEV_VERSION 0x00010004
142#define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
143#define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
144
145/* Maximum request packet size */
146#define VMMDEV_MAX_VMMDEVREQ_SIZE _1M
147
148/**
149 * VMMDev request types.
150 * @note when updating this, adjust vmmdevGetRequestSize() as well
151 */
152typedef enum
153{
154 VMMDevReq_InvalidRequest = 0,
155 VMMDevReq_GetMouseStatus = 1,
156 VMMDevReq_SetMouseStatus = 2,
157 VMMDevReq_SetPointerShape = 3,
158 /** @todo implement on host side */
159 VMMDevReq_GetHostVersion = 4,
160 VMMDevReq_Idle = 5,
161 VMMDevReq_GetHostTime = 10,
162 VMMDevReq_GetHypervisorInfo = 20,
163 VMMDevReq_SetHypervisorInfo = 21,
164 VMMDevReq_SetPowerStatus = 30,
165 VMMDevReq_AcknowledgeEvents = 41,
166 VMMDevReq_CtlGuestFilterMask = 42,
167 VMMDevReq_ReportGuestInfo = 50,
168 VMMDevReq_GetDisplayChangeRequest = 51,
169 VMMDevReq_VideoModeSupported = 52,
170 VMMDevReq_GetHeightReduction = 53,
171 VMMDevReq_GetDisplayChangeRequest2 = 54,
172 VMMDevReq_ReportGuestCapabilities = 55,
173 VMMDevReq_SetGuestCapabilities = 56,
174#ifdef VBOX_WITH_HGCM
175 VMMDevReq_HGCMConnect = 60,
176 VMMDevReq_HGCMDisconnect = 61,
177#ifdef VBOX_WITH_64_BITS_GUESTS
178 VMMDevReq_HGCMCall32 = 62,
179 VMMDevReq_HGCMCall64 = 63,
180#else
181 VMMDevReq_HGCMCall = 62,
182#endif /* VBOX_WITH_64_BITS_GUESTS */
183 VMMDevReq_HGCMCancel = 64,
184#endif
185 VMMDevReq_VideoAccelEnable = 70,
186 VMMDevReq_VideoAccelFlush = 71,
187 VMMDevReq_VideoSetVisibleRegion = 72,
188 VMMDevReq_GetSeamlessChangeRequest = 73,
189 VMMDevReq_QueryCredentials = 100,
190 VMMDevReq_ReportCredentialsJudgement = 101,
191 VMMDevReq_ReportGuestStats = 110,
192 VMMDevReq_GetMemBalloonChangeRequest = 111,
193 VMMDevReq_GetStatisticsChangeRequest = 112,
194 VMMDevReq_ChangeMemBalloon = 113,
195 VMMDevReq_GetVRDPChangeRequest = 150,
196 VMMDevReq_LogString = 200,
197 VMMDevReq_SizeHack = 0x7fffffff
198} VMMDevRequestType;
199
200#ifdef VBOX_WITH_64_BITS_GUESTS
201/*
202 * Constants and structures are redefined for the guest.
203 *
204 * Host code MUST always use either *32 or *64 variant explicitely.
205 * Host source code will use VBOX_HGCM_HOST_CODE define to catch undefined
206 * data types and constants.
207 *
208 * This redefinition means that the new additions builds will use
209 * the *64 or *32 variants depending on the current architecture bit count (ARCH_BITS).
210 */
211# ifndef VBOX_HGCM_HOST_CODE
212# if ARCH_BITS == 64
213# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall64
214# elif ARCH_BITS == 32
215# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall32
216# else
217# error "Unsupported ARCH_BITS"
218# endif
219# endif /* !VBOX_HGCM_HOST_CODE */
220#endif /* VBOX_WITH_64_BITS_GUESTS */
221
222/** Version of VMMDevRequestHeader structure. */
223#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
224
225#pragma pack(4)
226/** generic VMMDev request header */
227typedef struct
228{
229 /** size of the structure in bytes (including body). Filled by caller */
230 uint32_t size;
231 /** version of the structure. Filled by caller */
232 uint32_t version;
233 /** type of the request */
234 VMMDevRequestType requestType;
235 /** return code. Filled by VMMDev */
236 int32_t rc;
237 /** reserved fields */
238 uint32_t reserved1;
239 uint32_t reserved2;
240} VMMDevRequestHeader;
241AssertCompileSize(VMMDevRequestHeader, 24);
242
243/** mouse status request structure */
244typedef struct
245{
246 /** header */
247 VMMDevRequestHeader header;
248 /** mouse feature mask */
249 uint32_t mouseFeatures;
250 /** mouse x position */
251 uint32_t pointerXPos;
252 /** mouse y position */
253 uint32_t pointerYPos;
254} VMMDevReqMouseStatus;
255
256/** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
257 * values must be <= 0x8000 and must not be changed.
258 */
259
260/** pointer is visible */
261#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
262/** pointer has alpha channel */
263#define VBOX_MOUSE_POINTER_ALPHA (0x0002)
264/** pointerData contains new pointer shape */
265#define VBOX_MOUSE_POINTER_SHAPE (0x0004)
266
267/** mouse pointer shape/visibility change request */
268typedef struct
269{
270 /** header */
271 VMMDevRequestHeader header;
272 /** VBOX_MOUSE_POINTER_* bit flags */
273 uint32_t fFlags;
274 /** x coordinate of hot spot */
275 uint32_t xHot;
276 /** y coordinate of hot spot */
277 uint32_t yHot;
278 /** width of the pointer in pixels */
279 uint32_t width;
280 /** height of the pointer in scanlines */
281 uint32_t height;
282 /** Pointer data.
283 *
284 ****
285 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
286 *
287 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
288 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
289 *
290 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
291 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
292 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
293 *
294 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
295 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
296 * end of any scanline are undefined.
297 *
298 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
299 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
300 * Bytes in the gap between the AND and the XOR mask are undefined.
301 * XOR mask scanlines have no gap between them and size of XOR mask is:
302 * cXor = width * 4 * height.
303 ****
304 *
305 * Preallocate 4 bytes for accessing actual data as p->pointerData
306 */
307 char pointerData[4];
308} VMMDevReqMousePointer;
309
310/** string log request structure */
311typedef struct
312{
313 /** header */
314 VMMDevRequestHeader header;
315 /** variable length string data */
316 char szString[1];
317} VMMDevReqLogString;
318
319/** host version request structure */
320typedef struct
321{
322 /** header */
323 VMMDevRequestHeader header;
324 /** major version */
325 uint32_t major;
326 /** minor version */
327 uint32_t minor;
328 /** build number */
329 uint32_t build;
330} VMMDevReqHostVersion;
331
332/** guest capabilites structure */
333typedef struct
334{
335 /** header */
336 VMMDevRequestHeader header;
337 /** capabilities (VMMDEV_GUEST_*) */
338 uint32_t caps;
339} VMMDevReqGuestCapabilities;
340
341/** guest capabilites structure */
342typedef struct
343{
344 /** header */
345 VMMDevRequestHeader header;
346 /** mask of capabilities to be added */
347 uint32_t u32OrMask;
348 /** mask of capabilities to be removed */
349 uint32_t u32NotMask;
350} VMMDevReqGuestCapabilities2;
351
352/** idle request structure */
353typedef struct
354{
355 /** header */
356 VMMDevRequestHeader header;
357} VMMDevReqIdle;
358
359/** host time request structure */
360typedef struct
361{
362 /** header */
363 VMMDevRequestHeader header;
364 /** time in milliseconds since unix epoch. Filled by VMMDev. */
365 uint64_t time;
366} VMMDevReqHostTime;
367
368/** hypervisor info structure */
369typedef struct
370{
371 /** header */
372 VMMDevRequestHeader header;
373 /** guest virtual address of proposed hypervisor start */
374 /** TODO: Make this 64-bit compatible */
375 VMMDEVHYPPTR32 hypervisorStart;
376 /** hypervisor size in bytes */
377 uint32_t hypervisorSize;
378} VMMDevReqHypervisorInfo;
379
380/** system power requests */
381typedef enum
382{
383 VMMDevPowerState_Invalid = 0,
384 VMMDevPowerState_Pause = 1,
385 VMMDevPowerState_PowerOff = 2,
386 VMMDevPowerState_SaveState = 3,
387 VMMDevPowerState_SizeHack = 0x7fffffff
388} VMMDevPowerState;
389
390/** system power status structure */
391typedef struct
392{
393 /** header */
394 VMMDevRequestHeader header;
395 /** power state request */
396 VMMDevPowerState powerState;
397} VMMDevPowerStateRequest;
398
399/** pending events structure */
400typedef struct
401{
402 /** header */
403 VMMDevRequestHeader header;
404 /** pending event bitmap */
405 uint32_t events;
406} VMMDevEvents;
407
408/** guest filter mask control */
409typedef struct
410{
411 /** header */
412 VMMDevRequestHeader header;
413 /** mask of events to be added to filter */
414 uint32_t u32OrMask;
415 /** mask of events to be removed from filter */
416 uint32_t u32NotMask;
417} VMMDevCtlGuestFilterMask;
418
419/** guest information structure */
420typedef struct VBoxGuestInfo
421{
422 /** The VMMDev interface version expected by additions. */
423 uint32_t additionsVersion;
424 /** guest OS type */
425 VBOXOSTYPE osType;
426 /** @todo */
427} VBoxGuestInfo;
428
429/** guest information structure */
430typedef struct
431{
432 /** header */
433 VMMDevRequestHeader header;
434 /** Guest information. */
435 VBoxGuestInfo guestInfo;
436} VMMDevReportGuestInfo;
437
438/** guest statistics values */
439#define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
440#define VBOX_GUEST_STAT_CPU_LOAD_KERNEL RT_BIT(1)
441#define VBOX_GUEST_STAT_CPU_LOAD_USER RT_BIT(2)
442#define VBOX_GUEST_STAT_THREADS RT_BIT(3)
443#define VBOX_GUEST_STAT_PROCESSES RT_BIT(4)
444#define VBOX_GUEST_STAT_HANDLES RT_BIT(5)
445#define VBOX_GUEST_STAT_MEMORY_LOAD RT_BIT(6)
446#define VBOX_GUEST_STAT_PHYS_MEM_TOTAL RT_BIT(7)
447#define VBOX_GUEST_STAT_PHYS_MEM_AVAIL RT_BIT(8)
448#define VBOX_GUEST_STAT_PHYS_MEM_BALLOON RT_BIT(9)
449#define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL RT_BIT(10)
450#define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL RT_BIT(11)
451#define VBOX_GUEST_STAT_MEM_KERNEL_PAGED RT_BIT(12)
452#define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
453#define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE RT_BIT(14)
454#define VBOX_GUEST_STAT_PAGE_FILE_SIZE RT_BIT(15)
455
456
457/** guest statistics structure */
458typedef struct VBoxGuestStatistics
459{
460 /** Virtual CPU id */
461 uint32_t u32CpuId;
462 /** Reported statistics */
463 uint32_t u32StatCaps;
464 /** Idle CPU load (0-100) for last interval */
465 uint32_t u32CpuLoad_Idle;
466 /** Kernel CPU load (0-100) for last interval */
467 uint32_t u32CpuLoad_Kernel;
468 /** User CPU load (0-100) for last interval */
469 uint32_t u32CpuLoad_User;
470 /** Nr of threads */
471 uint32_t u32Threads;
472 /** Nr of processes */
473 uint32_t u32Processes;
474 /** Nr of handles */
475 uint32_t u32Handles;
476 /** Memory load (0-100) */
477 uint32_t u32MemoryLoad;
478 /** Page size of guest system */
479 uint32_t u32PageSize;
480 /** Total physical memory (in 4kb pages) */
481 uint32_t u32PhysMemTotal;
482 /** Available physical memory (in 4kb pages) */
483 uint32_t u32PhysMemAvail;
484 /** Ballooned physical memory (in 4kb pages) */
485 uint32_t u32PhysMemBalloon;
486 /** Total number of committed memory (which is not necessarily in-use) (in 4kb pages) */
487 uint32_t u32MemCommitTotal;
488 /** Total amount of memory used by the kernel (in 4kb pages) */
489 uint32_t u32MemKernelTotal;
490 /** Total amount of paged memory used by the kernel (in 4kb pages) */
491 uint32_t u32MemKernelPaged;
492 /** Total amount of nonpaged memory used by the kernel (in 4kb pages) */
493 uint32_t u32MemKernelNonPaged;
494 /** Total amount of memory used for the system cache (in 4kb pages) */
495 uint32_t u32MemSystemCache;
496 /** Pagefile size (in 4kb pages) */
497 uint32_t u32PageFileSize;
498} VBoxGuestStatistics;
499
500/** guest statistics command structure */
501typedef struct
502{
503 /** header */
504 VMMDevRequestHeader header;
505 /** Guest information. */
506 VBoxGuestStatistics guestStats;
507} VMMDevReportGuestStats;
508
509/** memory balloon change request structure */
510#define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal) ((90*PhysMemTotal)/100)
511
512typedef struct
513{
514 /** header */
515 VMMDevRequestHeader header;
516 uint32_t u32BalloonSize; /* balloon size in megabytes */
517 uint32_t u32PhysMemSize; /* guest ram size in megabytes */
518 uint32_t eventAck;
519} VMMDevGetMemBalloonChangeRequest;
520
521/** inflate/deflate memory balloon structure */
522#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (_1M/4096)
523#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
524
525typedef struct
526{
527 /** header */
528 VMMDevRequestHeader header;
529 uint32_t cPages;
530 uint32_t fInflate; /* true = inflate, false = defalte */
531 /** Physical address (RTGCPHYS) of each page, variable size. */
532 RTGCPHYS aPhysPage[1];
533} VMMDevChangeMemBalloon;
534
535/** guest statistics interval change request structure */
536typedef struct
537{
538 /** header */
539 VMMDevRequestHeader header;
540 uint32_t u32StatInterval; /* interval in seconds */
541 uint32_t eventAck;
542} VMMDevGetStatisticsChangeRequest;
543
544/** display change request structure */
545typedef struct
546{
547 /** header */
548 VMMDevRequestHeader header;
549 /** horizontal pixel resolution (0 = do not change) */
550 uint32_t xres;
551 /** vertical pixel resolution (0 = do not change) */
552 uint32_t yres;
553 /** bits per pixel (0 = do not change) */
554 uint32_t bpp;
555 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
556 * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
557 */
558 uint32_t eventAck;
559} VMMDevDisplayChangeRequest;
560
561typedef struct
562{
563 /** header */
564 VMMDevRequestHeader header;
565 /** horizontal pixel resolution (0 = do not change) */
566 uint32_t xres;
567 /** vertical pixel resolution (0 = do not change) */
568 uint32_t yres;
569 /** bits per pixel (0 = do not change) */
570 uint32_t bpp;
571 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
572 * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
573 */
574 uint32_t eventAck;
575 /** 0 for primary display, 1 for the first secondary, etc. */
576 uint32_t display;
577} VMMDevDisplayChangeRequest2;
578
579/** video mode supported request structure */
580typedef struct
581{
582 /** header */
583 VMMDevRequestHeader header;
584 /** horizontal pixel resolution (input) */
585 uint32_t width;
586 /** vertical pixel resolution (input) */
587 uint32_t height;
588 /** bits per pixel (input) */
589 uint32_t bpp;
590 /** supported flag (output) */
591 bool fSupported;
592} VMMDevVideoModeSupportedRequest;
593
594/** video modes height reduction request structure */
595typedef struct
596{
597 /** header */
598 VMMDevRequestHeader header;
599 /** height reduction in pixels (output) */
600 uint32_t heightReduction;
601} VMMDevGetHeightReductionRequest;
602
603#define VRDP_EXPERIENCE_LEVEL_ZERO 0 /* Theming disabled. */
604#define VRDP_EXPERIENCE_LEVEL_LOW 1 /* Full window dragging and desktop wallpaper disabled. */
605#define VRDP_EXPERIENCE_LEVEL_MEDIUM 2 /* Font smoothing, gradients. */
606#define VRDP_EXPERIENCE_LEVEL_HIGH 3 /* Animation effects disabled. */
607#define VRDP_EXPERIENCE_LEVEL_FULL 4 /* Everything enabled. */
608
609typedef struct
610{
611 /** header */
612 VMMDevRequestHeader header;
613 /** Whether VRDP is active or not */
614 uint8_t u8VRDPActive;
615 /** The configured experience level for active VRDP. */
616 uint32_t u32VRDPExperienceLevel;
617} VMMDevVRDPChangeRequest;
618
619
620
621#pragma pack()
622
623#ifdef VBOX_WITH_HGCM
624
625/** HGCM flags.
626 * @{
627 */
628#define VBOX_HGCM_REQ_DONE (0x1)
629#define VBOX_HGCM_REQ_CANCELLED (0x2)
630/** @} */
631
632#pragma pack(4)
633typedef struct _VMMDevHGCMRequestHeader
634{
635 /** Request header. */
636 VMMDevRequestHeader header;
637
638 /** HGCM flags. */
639 uint32_t fu32Flags;
640
641 /** Result code. */
642 int32_t result;
643} VMMDevHGCMRequestHeader;
644AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
645
646/** HGCM service location types. */
647typedef enum
648{
649 VMMDevHGCMLoc_Invalid = 0,
650 VMMDevHGCMLoc_LocalHost = 1,
651 VMMDevHGCMLoc_LocalHost_Existing = 2,
652 VMMDevHGCMLoc_SizeHack = 0x7fffffff
653} HGCMServiceLocationType;
654
655typedef struct
656{
657 char achName[128]; /**< This is really szName. */
658} HGCMServiceLocationHost;
659
660typedef struct HGCMSERVICELOCATION
661{
662 /** Type of the location. */
663 HGCMServiceLocationType type;
664
665 union
666 {
667 HGCMServiceLocationHost host;
668 } u;
669} HGCMServiceLocation;
670
671typedef struct
672{
673 /* request header */
674 VMMDevHGCMRequestHeader header;
675
676 /** IN: Description of service to connect to. */
677 HGCMServiceLocation loc;
678
679 /** OUT: Client identifier assigned by local instance of HGCM. */
680 uint32_t u32ClientID;
681} VMMDevHGCMConnect;
682
683typedef struct
684{
685 /* request header */
686 VMMDevHGCMRequestHeader header;
687
688 /** IN: Client identifier. */
689 uint32_t u32ClientID;
690} VMMDevHGCMDisconnect;
691
692typedef enum
693{
694 VMMDevHGCMParmType_Invalid = 0,
695 VMMDevHGCMParmType_32bit = 1,
696 VMMDevHGCMParmType_64bit = 2,
697 VMMDevHGCMParmType_PhysAddr = 3,
698 VMMDevHGCMParmType_LinAddr = 4, /**< In and Out */
699 VMMDevHGCMParmType_LinAddr_In = 5, /**< In (read; host<-guest) */
700 VMMDevHGCMParmType_LinAddr_Out = 6, /**< Out (write; host->guest) */
701 VMMDevHGCMParmType_LinAddr_Locked = 7, /**< Locked In and Out */
702 VMMDevHGCMParmType_LinAddr_Locked_In = 8, /**< Locked In (read; host<-guest) */
703 VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
704 VMMDevHGCMParmType_SizeHack = 0x7fffffff
705} HGCMFunctionParameterType;
706
707#ifdef VBOX_WITH_64_BITS_GUESTS
708typedef struct _HGCMFUNCTIONPARAMETER32
709{
710 HGCMFunctionParameterType type;
711 union
712 {
713 uint32_t value32;
714 uint64_t value64;
715 struct
716 {
717 uint32_t size;
718
719 union
720 {
721 VMMDEVHYPPHYS32 physAddr;
722 VMMDEVHYPPTR32 linearAddr;
723 } u;
724 } Pointer;
725 } u;
726#ifdef __cplusplus
727 void SetUInt32(uint32_t u32)
728 {
729 type = VMMDevHGCMParmType_32bit;
730 u.value64 = 0; /* init unused bits to 0 */
731 u.value32 = u32;
732 }
733
734 int GetUInt32(uint32_t *pu32)
735 {
736 if (type == VMMDevHGCMParmType_32bit)
737 {
738 *pu32 = u.value32;
739 return VINF_SUCCESS;
740 }
741 return VERR_INVALID_PARAMETER;
742 }
743
744 void SetUInt64(uint64_t u64)
745 {
746 type = VMMDevHGCMParmType_64bit;
747 u.value64 = u64;
748 }
749
750 int GetUInt64(uint64_t *pu64)
751 {
752 if (type == VMMDevHGCMParmType_64bit)
753 {
754 *pu64 = u.value64;
755 return VINF_SUCCESS;
756 }
757 return VERR_INVALID_PARAMETER;
758 }
759
760 void SetPtr(void *pv, uint32_t cb)
761 {
762 type = VMMDevHGCMParmType_LinAddr;
763 u.Pointer.size = cb;
764 u.Pointer.u.linearAddr = (VMMDEVHYPPTR32)(uintptr_t)pv;
765 }
766#endif
767} HGCMFunctionParameter32;
768
769typedef struct _HGCMFUNCTIONPARAMETER64
770{
771 HGCMFunctionParameterType type;
772 union
773 {
774 uint32_t value32;
775 uint64_t value64;
776 struct
777 {
778 uint32_t size;
779
780 union
781 {
782 VMMDEVHYPPHYS64 physAddr;
783 VMMDEVHYPPTR64 linearAddr;
784 } u;
785 } Pointer;
786 } u;
787#ifdef __cplusplus
788 void SetUInt32(uint32_t u32)
789 {
790 type = VMMDevHGCMParmType_32bit;
791 u.value64 = 0; /* init unused bits to 0 */
792 u.value32 = u32;
793 }
794
795 int GetUInt32(uint32_t *pu32)
796 {
797 if (type == VMMDevHGCMParmType_32bit)
798 {
799 *pu32 = u.value32;
800 return VINF_SUCCESS;
801 }
802 return VERR_INVALID_PARAMETER;
803 }
804
805 void SetUInt64(uint64_t u64)
806 {
807 type = VMMDevHGCMParmType_64bit;
808 u.value64 = u64;
809 }
810
811 int GetUInt64(uint64_t *pu64)
812 {
813 if (type == VMMDevHGCMParmType_64bit)
814 {
815 *pu64 = u.value64;
816 return VINF_SUCCESS;
817 }
818 return VERR_INVALID_PARAMETER;
819 }
820
821 void SetPtr(void *pv, uint32_t cb)
822 {
823 type = VMMDevHGCMParmType_LinAddr;
824 u.Pointer.size = cb;
825 u.Pointer.u.linearAddr = (uintptr_t)pv;
826 }
827#endif
828} HGCMFunctionParameter64;
829#else /* !VBOX_WITH_64_BITS_GUESTS */
830typedef struct _HGCMFUNCTIONPARAMETER
831{
832 HGCMFunctionParameterType type;
833 union
834 {
835 uint32_t value32;
836 uint64_t value64;
837 struct
838 {
839 uint32_t size;
840
841 union
842 {
843 VMMDEVHYPPHYS32 physAddr;
844 VMMDEVHYPPTR32 linearAddr;
845 } u;
846 } Pointer;
847 } u;
848#ifdef __cplusplus
849 void SetUInt32(uint32_t u32)
850 {
851 type = VMMDevHGCMParmType_32bit;
852 u.value64 = 0; /* init unused bits to 0 */
853 u.value32 = u32;
854 }
855
856 int GetUInt32(uint32_t *pu32)
857 {
858 if (type == VMMDevHGCMParmType_32bit)
859 {
860 *pu32 = u.value32;
861 return VINF_SUCCESS;
862 }
863 return VERR_INVALID_PARAMETER;
864 }
865
866 void SetUInt64(uint64_t u64)
867 {
868 type = VMMDevHGCMParmType_64bit;
869 u.value64 = u64;
870 }
871
872 int GetUInt64(uint64_t *pu64)
873 {
874 if (type == VMMDevHGCMParmType_64bit)
875 {
876 *pu64 = u.value64;
877 return VINF_SUCCESS;
878 }
879 return VERR_INVALID_PARAMETER;
880 }
881
882 void SetPtr(void *pv, uint32_t cb)
883 {
884 type = VMMDevHGCMParmType_LinAddr;
885 u.Pointer.size = cb;
886 u.Pointer.u.linearAddr = (uintptr_t)pv;
887 }
888#endif
889} HGCMFunctionParameter;
890#endif /* !VBOX_WITH_64_BITS_GUESTS */
891
892
893#ifdef VBOX_WITH_64_BITS_GUESTS
894/* Redefine the structure type for the guest code. */
895# ifndef VBOX_HGCM_HOST_CODE
896# if ARCH_BITS == 64
897# define HGCMFunctionParameter HGCMFunctionParameter64
898# elif ARCH_BITS == 32
899# define HGCMFunctionParameter HGCMFunctionParameter32
900# else
901# error "Unsupported sizeof (void *)"
902# endif
903# endif /* !VBOX_HGCM_HOST_CODE */
904#endif /* VBOX_WITH_64_BITS_GUESTS */
905
906typedef struct
907{
908 /* request header */
909 VMMDevHGCMRequestHeader header;
910
911 /** IN: Client identifier. */
912 uint32_t u32ClientID;
913 /** IN: Service function number. */
914 uint32_t u32Function;
915 /** IN: Number of parameters. */
916 uint32_t cParms;
917 /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
918} VMMDevHGCMCall;
919#pragma pack()
920
921#define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
922#define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
923
924#ifdef VBOX_WITH_64_BITS_GUESTS
925/* Explicit defines for the host code. */
926# ifdef VBOX_HGCM_HOST_CODE
927# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
928# define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
929# endif /* VBOX_HGCM_HOST_CODE */
930#endif /* VBOX_WITH_64_BITS_GUESTS */
931
932#define VBOX_HGCM_MAX_PARMS 32
933
934/* The Cancel request is issued using the same physical memory address
935 * as was used for the corresponding initial HGCMCall.
936 */
937typedef struct
938{
939 /* request header */
940 VMMDevHGCMRequestHeader header;
941} VMMDevHGCMCancel;
942
943#endif /* VBOX_WITH_HGCM */
944
945
946#define VBVA_F_STATUS_ACCEPTED (0x01)
947#define VBVA_F_STATUS_ENABLED (0x02)
948
949#pragma pack(4)
950
951typedef struct _VMMDevVideoAccelEnable
952{
953 /* request header */
954 VMMDevRequestHeader header;
955
956 /** 0 - disable, !0 - enable. */
957 uint32_t u32Enable;
958
959 /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
960 * The host will refuse to enable VBVA if the size is not equal to
961 * VBVA_RING_BUFFER_SIZE.
962 */
963 uint32_t cbRingBuffer;
964
965 /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
966 uint32_t fu32Status;
967
968} VMMDevVideoAccelEnable;
969
970typedef struct _VMMDevVideoAccelFlush
971{
972 /* request header */
973 VMMDevRequestHeader header;
974
975} VMMDevVideoAccelFlush;
976
977
978typedef struct _VMMDevVideoSetVisibleRegion
979{
980 /* request header */
981 VMMDevRequestHeader header;
982
983 /** Number of rectangles */
984 uint32_t cRect;
985
986 /** Rectangle array */
987 RTRECT Rect;
988} VMMDevVideoSetVisibleRegion;
989
990
991/** Seamless mode */
992typedef enum
993{
994 VMMDev_Seamless_Disabled = 0, /* normal mode; entire guest desktop displayed */
995 VMMDev_Seamless_Visible_Region = 1, /* visible region mode; only top-level guest windows displayed */
996 VMMDev_Seamless_Host_Window = 2 /* windowed mode; each top-level guest window is represented in a host window */
997} VMMDevSeamlessMode;
998
999typedef struct
1000{
1001 /** header */
1002 VMMDevRequestHeader header;
1003
1004 /** New seamless mode */
1005 VMMDevSeamlessMode mode;
1006 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
1007 * Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
1008 */
1009 uint32_t eventAck;
1010} VMMDevSeamlessChangeRequest;
1011
1012#pragma pack()
1013
1014#pragma pack(1)
1015/** VBVA command header. */
1016typedef struct _VBVACMDHDR
1017{
1018 /** Coordinates of affected rectangle. */
1019 int16_t x;
1020 int16_t y;
1021 uint16_t w;
1022 uint16_t h;
1023} VBVACMDHDR;
1024#pragma pack()
1025
1026/* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
1027 * For example big bitmaps which do not fit to the buffer.
1028 *
1029 * Guest starts writing to the buffer by initializing a record entry in the
1030 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
1031 * written. As data is written to the ring buffer, the guest increases off32End
1032 * for the record.
1033 *
1034 * The host reads the aRecords on flushes and processes all completed records.
1035 * When host encounters situation when only a partial record presents and
1036 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
1037 * the host fetched all record data and updates off32Head. After that on each flush
1038 * the host continues fetching the data until the record is completed.
1039 *
1040 */
1041
1042#define VBVA_RING_BUFFER_SIZE (_4M - _1K)
1043#define VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
1044
1045#define VBVA_MAX_RECORDS (64)
1046
1047#define VBVA_F_MODE_ENABLED (0x00000001)
1048#define VBVA_F_MODE_VRDP (0x00000002)
1049#define VBVA_F_MODE_VRDP_RESET (0x00000004)
1050#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
1051
1052#define VBVA_F_RECORD_PARTIAL (0x80000000)
1053
1054#pragma pack(1)
1055typedef struct _VBVARECORD
1056{
1057 /** The length of the record. Changed by guest. */
1058 uint32_t cbRecord;
1059} VBVARECORD;
1060
1061typedef struct _VBVAMEMORY
1062{
1063 /** VBVA_F_MODE_* */
1064 uint32_t fu32ModeFlags;
1065
1066 /** The offset where the data start in the buffer. */
1067 uint32_t off32Data;
1068 /** The offset where next data must be placed in the buffer. */
1069 uint32_t off32Free;
1070
1071 /** The ring buffer for data. */
1072 uint8_t au8RingBuffer[VBVA_RING_BUFFER_SIZE];
1073
1074 /** The queue of record descriptions. */
1075 VBVARECORD aRecords[VBVA_MAX_RECORDS];
1076 uint32_t indexRecordFirst;
1077 uint32_t indexRecordFree;
1078
1079 /* RDP orders supported by the client. The guest reports only them
1080 * and falls back to DIRTY rects for not supported ones.
1081 *
1082 * (1 << VBVA_VRDP_*)
1083 */
1084 uint32_t fu32SupportedOrders;
1085
1086} VBVAMEMORY;
1087#pragma pack()
1088
1089/** @} */
1090
1091
1092/**
1093 * VMMDev RAM
1094 * @{
1095 */
1096
1097#pragma pack(1)
1098/** Layout of VMMDEV RAM region that contains information for guest */
1099typedef struct
1100{
1101 /** size */
1102 uint32_t u32Size;
1103 /** version */
1104 uint32_t u32Version;
1105
1106 union {
1107 /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
1108 struct {
1109 bool fHaveEvents;
1110 } V1_04;
1111
1112 struct {
1113 /** Pending events flags, set by host. */
1114 uint32_t u32HostEvents;
1115 /** Mask of events the guest wants to see, set by guest. */
1116 uint32_t u32GuestEventMask;
1117 } V1_03;
1118 } V;
1119
1120 VBVAMEMORY vbvaMemory;
1121
1122} VMMDevMemory;
1123#pragma pack()
1124
1125/** Version of VMMDevMemory structure. */
1126#define VMMDEV_MEMORY_VERSION (1)
1127
1128/** @} */
1129
1130
1131/**
1132 * VMMDev events.
1133 * @{
1134 */
1135
1136/** Host mouse capabilities has been changed. */
1137#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0)
1138/** HGCM event. */
1139#define VMMDEV_EVENT_HGCM RT_BIT(1)
1140/** A display change request has been issued. */
1141#define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST RT_BIT(2)
1142/** Credentials are available for judgement. */
1143#define VMMDEV_EVENT_JUDGE_CREDENTIALS RT_BIT(3)
1144/** The guest has been restored. */
1145#define VMMDEV_EVENT_RESTORED RT_BIT(4)
1146/** Seamless mode state changed */
1147#define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST RT_BIT(5)
1148/** Memory balloon size changed */
1149#define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST RT_BIT(6)
1150/** Statistics interval changed */
1151#define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST RT_BIT(7)
1152/** VRDP status changed. */
1153#define VMMDEV_EVENT_VRDP RT_BIT(8)
1154/** New mouse position data available */
1155#define VMMDEV_EVENT_MOUSE_POSITION_CHANGED RT_BIT(9)
1156
1157/** @} */
1158
1159
1160#if !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT)
1161/** @name VBoxGuest IOCTL codes and structures.
1162 *
1163 * The range 0..15 is for basic driver communication.
1164 * The range 16..31 is for HGCM communcation.
1165 * The range 32..47 is reserved for future use.
1166 * The range 48..63 is for OS specific communcation.
1167 * The 7th bit is reserved for future hacks.
1168 * The 8th bit is reserved for distinguishing between 32-bit and 64-bit
1169 * processes in future 64-bit guest additions.
1170 *
1171 * While windows IOCTL function number has to start at 2048 and stop at 4096 there
1172 * never was any need to do this for everyone. A simple ((Function) | 0x800) would
1173 * have sufficed. On Linux we're now intruding upon the type field. Fortunately
1174 * this hasn't caused any trouble because the FILE_DEVICE_UNKNOWN value was set
1175 * to 0x22 (if it were 0x2C it would not have worked soo smoothly). The situation
1176 * would've been the same for *BSD and Darwin since they seems to share common
1177 * _IOC() heritage.
1178 *
1179 * However, on good old OS/2 we only have 8-bit handy for the function number. The
1180 * result from using the old IOCTL function numbers her would've been overlapping
1181 * between the two ranges.
1182 *
1183 * To fix this problem and get rid of all the unnecessary windowsy crap that I
1184 * bet was copied from my SUPDRVIOC.h once upon a time (although the concept of
1185 * prefixing macros with the purpose of avoid clashes with system stuff and
1186 * to indicate exactly how owns them seems to have been lost somewhere along
1187 * the way), I've introduced a VBOXGUEST_IOCTL_CODE for defining generic IN/OUT
1188 * IOCtls on new ports of the additions.
1189 *
1190 * @remarks When creating new IOCtl interfaces keep in mind that not all OSes supports
1191 * reporting back the output size. (This got messed up a little bit in VBoxDrv.)
1192 *
1193 * The request size is also a little bit tricky as it's passed as part of the
1194 * request code on unix. The size field is 14 bits on Linux, 12 bits on *BSD,
1195 * 13 bits Darwin, and 8-bits on Solaris. All the BSDs and Darwin kernels
1196 * will make use of the size field, while Linux and Solaris will not. We're of
1197 * course using the size to validate and/or map/lock the request, so it has
1198 * to be valid.
1199 *
1200 * For Solaris we will have to do something special though, 255 isn't
1201 * sufficent for all we need. A 4KB restriction (BSD) is probably not
1202 * too problematic (yet) as a general one.
1203 *
1204 * More info can be found in SUPDRVIOC.h and related sources.
1205 *
1206 * @remarks If adding interfaces that only has input or only has output, some new macros
1207 * needs to be created so the most efficient IOCtl data buffering method can be
1208 * used.
1209 * @{
1210 */
1211#ifdef RT_ARCH_AMD64
1212# define VBOXGUEST_IOCTL_FLAG 128
1213#elif defined(RT_ARCH_X86)
1214# define VBOXGUEST_IOCTL_FLAG 0
1215#else
1216# error "dunno which arch this is!"
1217#endif
1218
1219/** Ring-3 request wrapper for big requests.
1220 *
1221 * This is necessary because the ioctl number scheme on many Unixy OSes (esp. Solaris)
1222 * only allows a relatively small size to be encoded into the request. So, for big
1223 * request this generic form is used instead. */
1224typedef struct VBGLBIGREQ
1225{
1226 /** Magic value (VBGLBIGREQ_MAGIC). */
1227 uint32_t u32Magic;
1228 /** The size of the data buffer. */
1229 uint32_t cbData;
1230 /** The user address of the data buffer. */
1231 RTR3PTR pvDataR3;
1232#if HC_ARCH_BITS == 32
1233 uint32_t u32Padding;
1234#endif
1235} VBGLBIGREQ;
1236/** Pointer to a request wrapper for solaris guests. */
1237typedef VBGLBIGREQ *PVBGLBIGREQ;
1238/** Pointer to a const request wrapper for solaris guests. */
1239typedef const VBGLBIGREQ *PCVBGLBIGREQ;
1240
1241/** The VBGLBIGREQ::u32Magic value (Ryuu Murakami). */
1242#define VBGLBIGREQ_MAGIC 0x19520219
1243
1244
1245#if defined(RT_OS_WINDOWS)
1246/* @todo Remove IOCTL_CODE later! Integrate it in VBOXGUEST_IOCTL_CODE below. */
1247/** @todo r=bird: IOCTL_CODE is supposedly defined in some header included by Windows.h or ntddk.h, which is why it wasn't in the #if 0 earlier. See HostDrivers/Support/SUPDrvIOC.h... */
1248# define IOCTL_CODE(DeviceType, Function, Method, Access, DataSize_ignored) \
1249 ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1250# define VBOXGUEST_IOCTL_CODE_(Function, Size) IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2048 + (Function), METHOD_BUFFERED, FILE_WRITE_ACCESS, 0)
1251# define VBOXGUEST_IOCTL_STRIP_SIZE_(Code) (Code)
1252
1253#elif defined(RT_OS_OS2)
1254 /* No automatic buffering, size not encoded. */
1255# define VBOXGUEST_IOCTL_CATEGORY 0xc2
1256# define VBOXGUEST_IOCTL_CODE_(Function, Size) ((unsigned char)(Function))
1257# define VBOXGUEST_IOCTL_CATEGORY_FAST 0xc3 /**< Also defined in VBoxGuestA-os2.asm. */
1258# define VBOXGUEST_IOCTL_CODE_FAST_(Function) ((unsigned char)(Function))
1259# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) (Code)
1260
1261#elif defined(RT_OS_SOLARIS)
1262 /* No automatic buffering, size limited to 255 bytes => use VBGLBIGREQ for everything. */
1263# include <sys/ioccom.h>
1264# define VBOXGUEST_IOCTL_CODE_(Function, Size) _IOWRN('V', (Function), sizeof(VBGLBIGREQ))
1265# define VBOXGUEST_IOCTL_CODE_FAST_(Function) _IO( 'V', (Function))
1266# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) (Code)
1267
1268#elif defined(RT_OS_LINUX)
1269 /* No automatic buffering, size limited to 16KB. */
1270# include <linux/ioctl.h>
1271# define VBOXGUEST_IOCTL_CODE_(Function, Size) _IOC(_IOC_READ|_IOC_WRITE, 'V', (Function), (Size))
1272# define VBOXGUEST_IOCTL_CODE_FAST_(Function) _IO( 'V', (Function))
1273# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) VBOXGUEST_IOCTL_CODE_(_IOC_NR((Code)), 0)
1274
1275#elif defined(RT_OS_FREEBSD) /** @todo r=bird: Please do it like SUPDRVIOC to keep it as similar as possible. */
1276# include <sys/ioccom.h>
1277
1278# define VBOXGUEST_IOCTL_CODE_(Function, Size) _IOWR('V', (Function), VBGLBIGREQ)
1279# define VBOXGUEST_IOCTL_CODE_FAST_(Function) _IO( 'V', (Function))
1280# define VBOXGUEST_IOCTL_STRIP_SIZE(Code) IOCBASECMD(Code)
1281
1282#else
1283/* PORTME */
1284#endif
1285
1286#define VBOXGUEST_IOCTL_CODE(Function, Size) VBOXGUEST_IOCTL_CODE_((Function) | VBOXGUEST_IOCTL_FLAG, Size)
1287#define VBOXGUEST_IOCTL_CODE_FAST(Function) VBOXGUEST_IOCTL_CODE_FAST_((Function) | VBOXGUEST_IOCTL_FLAG)
1288
1289/* Define 32 bit codes to support 32 bit applications requests in the 64 bit guest driver. */
1290#ifdef RT_ARCH_AMD64
1291# define VBOXGUEST_IOCTL_CODE_32(Function, Size) VBOXGUEST_IOCTL_CODE_(Function, Size)
1292# define VBOXGUEST_IOCTL_CODE_FAST_32(Function) VBOXGUEST_IOCTL_CODE_FAST_(Function)
1293#endif /* RT_ARCH_AMD64 */
1294
1295/** IOCTL to VBoxGuest to query the VMMDev IO port region start.
1296 * @remarks Ring-0 only. */
1297#define VBOXGUEST_IOCTL_GETVMMDEVPORT VBOXGUEST_IOCTL_CODE(1, sizeof(VBoxGuestPortInfo))
1298
1299#pragma pack(4)
1300typedef struct _VBoxGuestPortInfo
1301{
1302 uint32_t portAddress;
1303 VMMDevMemory *pVMMDevMemory;
1304} VBoxGuestPortInfo;
1305
1306/** IOCTL to VBoxGuest to wait for a VMMDev host notification */
1307#define VBOXGUEST_IOCTL_WAITEVENT VBOXGUEST_IOCTL_CODE_(2, sizeof(VBoxGuestWaitEventInfo))
1308
1309/** IOCTL to VBoxGuest to interrupt (cancel) any pending WAITEVENTs and return.
1310 * Handled inside the guest additions and not seen by the host at all.
1311 * @see VBOXGUEST_IOCTL_WAITEVENT */
1312#define VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS VBOXGUEST_IOCTL_CODE_(5, 0)
1313
1314/** @name Result codes for VBoxGuestWaitEventInfo::u32Result
1315 * @{
1316 */
1317/** Successful completion, an event occured. */
1318#define VBOXGUEST_WAITEVENT_OK (0)
1319/** Successful completion, timed out. */
1320#define VBOXGUEST_WAITEVENT_TIMEOUT (1)
1321/** Wait was interrupted. */
1322#define VBOXGUEST_WAITEVENT_INTERRUPTED (2)
1323/** An error occured while processing the request. */
1324#define VBOXGUEST_WAITEVENT_ERROR (3)
1325/** @} */
1326
1327/** Input and output buffers layout of the IOCTL_VBOXGUEST_WAITEVENT */
1328typedef struct _VBoxGuestWaitEventInfo
1329{
1330 /** timeout in milliseconds */
1331 uint32_t u32TimeoutIn;
1332 /** events to wait for */
1333 uint32_t u32EventMaskIn;
1334 /** result code */
1335 uint32_t u32Result;
1336 /** events occured */
1337 uint32_t u32EventFlagsOut;
1338} VBoxGuestWaitEventInfo;
1339AssertCompileSize(VBoxGuestWaitEventInfo, 16);
1340
1341/** IOCTL to VBoxGuest to perform a VMM request
1342 * @remark The data buffer for this IOCtl has an variable size, keep this in mind
1343 * on systems where this matters. */
1344#define VBOXGUEST_IOCTL_VMMREQUEST(Size) VBOXGUEST_IOCTL_CODE_(3, (Size))
1345
1346/** Input and output buffer layout of the IOCTL_VBOXGUEST_CTL_FILTER_MASK. */
1347typedef struct _VBoxGuestFilterMaskInfo
1348{
1349 uint32_t u32OrMask;
1350 uint32_t u32NotMask;
1351} VBoxGuestFilterMaskInfo;
1352AssertCompileSize(VBoxGuestFilterMaskInfo, 8);
1353#pragma pack()
1354
1355/** IOCTL to VBoxGuest to control event filter mask. */
1356#define VBOXGUEST_IOCTL_CTL_FILTER_MASK VBOXGUEST_IOCTL_CODE_(4, sizeof(VBoxGuestFilterMaskInfo))
1357
1358/** IOCTL to VBoxGuest to check memory ballooning. */
1359#define VBOXGUEST_IOCTL_CTL_CHECK_BALLOON_MASK VBOXGUEST_IOCTL_CODE_(7, 100)
1360
1361/** IOCTL to VBoxGuest to perform backdoor logging. */
1362#define VBOXGUEST_IOCTL_LOG(Size) VBOXGUEST_IOCTL_CODE_(6, (Size))
1363
1364
1365#ifdef VBOX_WITH_HGCM
1366/* These structures are shared between the driver and other binaries,
1367 * therefore packing must be defined explicitely.
1368 */
1369# pragma pack(1)
1370typedef struct _VBoxGuestHGCMConnectInfo
1371{
1372 uint32_t result; /**< OUT */
1373 HGCMServiceLocation Loc; /**< IN */
1374 uint32_t u32ClientID; /**< OUT */
1375} VBoxGuestHGCMConnectInfo;
1376AssertCompileSize(VBoxGuestHGCMConnectInfo, 4+4+128+4);
1377
1378typedef struct _VBoxGuestHGCMDisconnectInfo
1379{
1380 uint32_t result; /**< OUT */
1381 uint32_t u32ClientID; /**< IN */
1382} VBoxGuestHGCMDisconnectInfo;
1383AssertCompileSize(VBoxGuestHGCMDisconnectInfo, 8);
1384
1385typedef struct _VBoxGuestHGCMCallInfo
1386{
1387 uint32_t result; /**< OUT Host HGCM return code.*/
1388 uint32_t u32ClientID; /**< IN The id of the caller. */
1389 uint32_t u32Function; /**< IN Function number. */
1390 uint32_t cParms; /**< IN How many parms. */
1391 /* Parameters follow in form HGCMFunctionParameter aParms[cParms] */
1392} VBoxGuestHGCMCallInfo;
1393AssertCompileSize(VBoxGuestHGCMCallInfo, 16);
1394
1395typedef struct _VBoxGuestHGCMCallInfoTimed
1396{
1397 uint32_t u32Timeout; /**< IN How long to wait for completion before cancelling the call */
1398 uint32_t fInterruptible; /**< IN Is this request interruptible? */
1399 VBoxGuestHGCMCallInfo info; /**< IN/OUT The rest of the call information. Placed after the timeout
1400 * so that the parameters follow as they would for a normal call. */
1401 /* Parameters follow in form HGCMFunctionParameter aParms[cParms] */
1402} VBoxGuestHGCMCallInfoTimed;
1403AssertCompileSize(VBoxGuestHGCMCallInfoTimed, 8+16);
1404# pragma pack()
1405
1406# define VBOXGUEST_IOCTL_HGCM_CONNECT VBOXGUEST_IOCTL_CODE(16, sizeof(VBoxGuestHGCMConnectInfo))
1407# define VBOXGUEST_IOCTL_HGCM_DISCONNECT VBOXGUEST_IOCTL_CODE(17, sizeof(VBoxGuestHGCMDisconnectInfo))
1408# define VBOXGUEST_IOCTL_HGCM_CALL(Size) VBOXGUEST_IOCTL_CODE(18, (Size))
1409# define VBOXGUEST_IOCTL_HGCM_CALL_TIMED(Size) VBOXGUEST_IOCTL_CODE(20, (Size))
1410# define VBOXGUEST_IOCTL_CLIPBOARD_CONNECT VBOXGUEST_IOCTL_CODE_(19, sizeof(uint32_t))
1411# ifdef RT_ARCH_AMD64
1412/* Following HGCM IOCtls can be used by a 32 bit application on a 64 bit guest (Windows OpenGL guest driver). */
1413# define VBOXGUEST_IOCTL_HGCM_CONNECT_32 VBOXGUEST_IOCTL_CODE_32(16, sizeof(VBoxGuestHGCMConnectInfo))
1414# define VBOXGUEST_IOCTL_HGCM_DISCONNECT_32 VBOXGUEST_IOCTL_CODE_32(17, sizeof(VBoxGuestHGCMDisconnectInfo))
1415# define VBOXGUEST_IOCTL_HGCM_CALL_32(Size) VBOXGUEST_IOCTL_CODE_32(18, (Size))
1416# define VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(Size) VBOXGUEST_IOCTL_CODE_32(20, (Size))
1417# endif /* RT_ARCH_AMD64 */
1418
1419# define VBOXGUEST_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VBoxGuestHGCMCallInfo)))
1420# define VBOXGUEST_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VBoxGuestHGCMCallInfo)))
1421
1422#endif /* VBOX_WITH_HGCM */
1423
1424/*
1425 * Credentials request flags and structure
1426 */
1427
1428#define VMMDEV_CREDENTIALS_STRLEN 128
1429
1430/** query from host whether credentials are present */
1431#define VMMDEV_CREDENTIALS_QUERYPRESENCE RT_BIT(1)
1432/** read credentials from host (can be combined with clear) */
1433#define VMMDEV_CREDENTIALS_READ RT_BIT(2)
1434/** clear credentials on host (can be combined with read) */
1435#define VMMDEV_CREDENTIALS_CLEAR RT_BIT(3)
1436/** read credentials for judgement in the guest */
1437#define VMMDEV_CREDENTIALS_READJUDGE RT_BIT(8)
1438/** clear credentials for judegement on the host */
1439#define VMMDEV_CREDENTIALS_CLEARJUDGE RT_BIT(9)
1440/** report credentials acceptance by guest */
1441#define VMMDEV_CREDENTIALS_JUDGE_OK RT_BIT(10)
1442/** report credentials denial by guest */
1443#define VMMDEV_CREDENTIALS_JUDGE_DENY RT_BIT(11)
1444/** report that no judgement could be made by guest */
1445#define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
1446
1447/** flag telling the guest that credentials are present */
1448#define VMMDEV_CREDENTIALS_PRESENT RT_BIT(16)
1449/** flag telling guest that local logons should be prohibited */
1450#define VMMDEV_CREDENTIALS_NOLOCALLOGON RT_BIT(17)
1451
1452/** credentials request structure */
1453#pragma pack(4)
1454typedef struct _VMMDevCredentials
1455{
1456 /* request header */
1457 VMMDevRequestHeader header;
1458 /* request flags (in/out) */
1459 uint32_t u32Flags;
1460 /* user name (UTF-8) (out) */
1461 char szUserName[VMMDEV_CREDENTIALS_STRLEN];
1462 /* password (UTF-8) (out) */
1463 char szPassword[VMMDEV_CREDENTIALS_STRLEN];
1464 /* domain name (UTF-8) (out) */
1465 char szDomain[VMMDEV_CREDENTIALS_STRLEN];
1466} VMMDevCredentials;
1467#pragma pack()
1468
1469/** inline helper to determine the request size for the given operation */
1470DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
1471{
1472 switch (requestType)
1473 {
1474 case VMMDevReq_GetMouseStatus:
1475 case VMMDevReq_SetMouseStatus:
1476 return sizeof(VMMDevReqMouseStatus);
1477 case VMMDevReq_SetPointerShape:
1478 return sizeof(VMMDevReqMousePointer);
1479 case VMMDevReq_GetHostVersion:
1480 return sizeof(VMMDevReqHostVersion);
1481 case VMMDevReq_Idle:
1482 return sizeof(VMMDevReqIdle);
1483 case VMMDevReq_GetHostTime:
1484 return sizeof(VMMDevReqHostTime);
1485 case VMMDevReq_GetHypervisorInfo:
1486 case VMMDevReq_SetHypervisorInfo:
1487 return sizeof(VMMDevReqHypervisorInfo);
1488 case VMMDevReq_SetPowerStatus:
1489 return sizeof(VMMDevPowerStateRequest);
1490 case VMMDevReq_AcknowledgeEvents:
1491 return sizeof(VMMDevEvents);
1492 case VMMDevReq_ReportGuestInfo:
1493 return sizeof(VMMDevReportGuestInfo);
1494 case VMMDevReq_GetDisplayChangeRequest:
1495 return sizeof(VMMDevDisplayChangeRequest);
1496 case VMMDevReq_GetDisplayChangeRequest2:
1497 return sizeof(VMMDevDisplayChangeRequest2);
1498 case VMMDevReq_VideoModeSupported:
1499 return sizeof(VMMDevVideoModeSupportedRequest);
1500 case VMMDevReq_GetHeightReduction:
1501 return sizeof(VMMDevGetHeightReductionRequest);
1502 case VMMDevReq_ReportGuestCapabilities:
1503 return sizeof(VMMDevReqGuestCapabilities);
1504 case VMMDevReq_SetGuestCapabilities:
1505 return sizeof(VMMDevReqGuestCapabilities2);
1506#ifdef VBOX_WITH_HGCM
1507 case VMMDevReq_HGCMConnect:
1508 return sizeof(VMMDevHGCMConnect);
1509 case VMMDevReq_HGCMDisconnect:
1510 return sizeof(VMMDevHGCMDisconnect);
1511#ifdef VBOX_WITH_64_BITS_GUESTS
1512 case VMMDevReq_HGCMCall32:
1513 return sizeof(VMMDevHGCMCall);
1514 case VMMDevReq_HGCMCall64:
1515 return sizeof(VMMDevHGCMCall);
1516#else
1517 case VMMDevReq_HGCMCall:
1518 return sizeof(VMMDevHGCMCall);
1519#endif /* VBOX_WITH_64_BITS_GUESTS */
1520 case VMMDevReq_HGCMCancel:
1521 return sizeof(VMMDevHGCMCancel);
1522#endif /* VBOX_WITH_HGCM */
1523 case VMMDevReq_VideoAccelEnable:
1524 return sizeof(VMMDevVideoAccelEnable);
1525 case VMMDevReq_VideoAccelFlush:
1526 return sizeof(VMMDevVideoAccelFlush);
1527 case VMMDevReq_VideoSetVisibleRegion:
1528 return sizeof(VMMDevVideoSetVisibleRegion);
1529 case VMMDevReq_GetSeamlessChangeRequest:
1530 return sizeof(VMMDevSeamlessChangeRequest);
1531 case VMMDevReq_QueryCredentials:
1532 return sizeof(VMMDevCredentials);
1533 case VMMDevReq_ReportGuestStats:
1534 return sizeof(VMMDevReportGuestStats);
1535 case VMMDevReq_GetMemBalloonChangeRequest:
1536 return sizeof(VMMDevGetMemBalloonChangeRequest);
1537 case VMMDevReq_GetStatisticsChangeRequest:
1538 return sizeof(VMMDevGetStatisticsChangeRequest);
1539 case VMMDevReq_ChangeMemBalloon:
1540 return sizeof(VMMDevChangeMemBalloon);
1541 case VMMDevReq_GetVRDPChangeRequest:
1542 return sizeof(VMMDevVRDPChangeRequest);
1543 case VMMDevReq_LogString:
1544 return sizeof(VMMDevReqLogString);
1545 default:
1546 return 0;
1547 }
1548}
1549
1550/**
1551 * Initializes a request structure.
1552 *
1553 */
1554DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
1555{
1556 uint32_t requestSize;
1557 if (!req)
1558 return VERR_INVALID_PARAMETER;
1559 requestSize = (uint32_t)vmmdevGetRequestSize(type);
1560 if (!requestSize)
1561 return VERR_INVALID_PARAMETER;
1562 req->size = requestSize;
1563 req->version = VMMDEV_REQUEST_HEADER_VERSION;
1564 req->requestType = type;
1565 req->rc = VERR_GENERAL_FAILURE;
1566 req->reserved1 = 0;
1567 req->reserved2 = 0;
1568 return VINF_SUCCESS;
1569}
1570
1571
1572#ifdef RT_OS_OS2
1573
1574/**
1575 * The data buffer layout for the IDC entry point (AttachDD).
1576 *
1577 * @remark This is defined in multiple 16-bit headers / sources.
1578 * Some places it's called VBGOS2IDC to short things a bit.
1579 */
1580typedef struct VBOXGUESTOS2IDCCONNECT
1581{
1582 /** VMMDEV_VERSION. */
1583 uint32_t u32Version;
1584 /** Opaque session handle. */
1585 uint32_t u32Session;
1586
1587 /**
1588 * The 32-bit service entry point.
1589 *
1590 * @returns VBox status code.
1591 * @param u32Session The above session handle.
1592 * @param iFunction The requested function.
1593 * @param pvData The input/output data buffer. The caller ensures that this
1594 * cannot be swapped out, or that it's acceptable to take a
1595 * page in fault in the current context. If the request doesn't
1596 * take input or produces output, apssing NULL is okay.
1597 * @param cbData The size of the data buffer.
1598 * @param pcbDataReturned Where to store the amount of data that's returned.
1599 * This can be NULL if pvData is NULL.
1600 */
1601 DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned);
1602
1603 /** The 16-bit service entry point for C code (cdecl).
1604 *
1605 * It's the same as the 32-bit entry point, but the types has
1606 * changed to 16-bit equivalents.
1607 *
1608 * @code
1609 * int far cdecl
1610 * VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
1611 * void far *fpvData, uint16_t cbData, uint16_t far *pcbDataReturned);
1612 * @endcode
1613 */
1614 RTFAR16 fpfnServiceEP;
1615
1616 /** The 16-bit service entry point for Assembly code (register).
1617 *
1618 * This is just a wrapper around fpfnServiceEP to simplify calls
1619 * from 16-bit assembly code.
1620 *
1621 * @returns (e)ax: VBox status code; cx: The amount of data returned.
1622 *
1623 * @param u32Session eax - The above session handle.
1624 * @param iFunction dl - The requested function.
1625 * @param pvData es:bx - The input/output data buffer.
1626 * @param cbData cx - The size of the data buffer.
1627 */
1628 RTFAR16 fpfnServiceAsmEP;
1629} VBOXGUESTOS2IDCCONNECT;
1630/** Pointer to VBOXGUESTOS2IDCCONNECT buffer. */
1631typedef VBOXGUESTOS2IDCCONNECT *PVBOXGUESTOS2IDCCONNECT;
1632
1633/** OS/2 specific: IDC client disconnect request.
1634 *
1635 * This takes no input and it doesn't return anything. Obviously this
1636 * is only recognized if it arrives thru the IDC service EP.
1637 */
1638#define VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT VBOXGUEST_IOCTL_CODE(48, sizeof(uint32_t))
1639
1640#endif /* RT_OS_OS2 */
1641
1642/** @} */
1643#endif /* !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT) */
1644
1645
1646#ifdef IN_RING3
1647
1648/** @def VBGLR3DECL
1649 * Ring 3 VBGL declaration.
1650 * @param type The return type of the function declaration.
1651 */
1652#define VBGLR3DECL(type) type VBOXCALL
1653
1654/* General-purpose functions */
1655
1656__BEGIN_DECLS
1657VBGLR3DECL(int) VbglR3Init(void);
1658VBGLR3DECL(void) VbglR3Term(void);
1659# ifdef ___iprt_time_h
1660VBGLR3DECL(int) VbglR3GetHostTime(PRTTIMESPEC pTime);
1661# endif
1662VBGLR3DECL(int) VbglR3InterruptEventWaits(void);
1663VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cb);
1664VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot);
1665VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, char const *pszPidfile);
1666VBGLR3DECL(int) VbglR3SetGuestCaps(uint32_t fOr, uint32_t fNot);
1667
1668/** @name Shared clipboard
1669 * @{ */
1670VBGLR3DECL(int) VbglR3ClipboardConnect(uint32_t *pu32ClientId);
1671VBGLR3DECL(int) VbglR3ClipboardDisconnect(uint32_t u32ClientId);
1672VBGLR3DECL(int) VbglR3ClipboardGetHostMsg(uint32_t u32ClientId, uint32_t *pMsg, uint32_t *pfFormats);
1673VBGLR3DECL(int) VbglR3ClipboardReadData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
1674VBGLR3DECL(int) VbglR3ClipboardReportFormats(uint32_t u32ClientId, uint32_t fFormats);
1675VBGLR3DECL(int) VbglR3ClipboardWriteData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb);
1676/** @} */
1677
1678/** @name Seamless mode
1679 * @{ */
1680VBGLR3DECL(int) VbglR3SeamlessSetCap(bool fState);
1681VBGLR3DECL(int) VbglR3SeamlessWaitEvent(VMMDevSeamlessMode *pMode);
1682VBGLR3DECL(int) VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects);
1683/** @} */
1684
1685/** @name Mouse
1686 * @{ */
1687VBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py);
1688VBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures);
1689/** @} */
1690
1691/** @name Video
1692 * @{ */
1693VBGLR3DECL(int) VbglR3VideoAccelEnable(bool fEnable);
1694VBGLR3DECL(int) VbglR3VideoAccelFlush(void);
1695VBGLR3DECL(int) VbglR3SetPointerShape(uint32_t fFlags, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvImg, size_t cbImg);
1696VBGLR3DECL(int) VbglR3SetPointerShapeReq(VMMDevReqMousePointer *pReq);
1697/** @} */
1698
1699/** @name Display
1700 * @{ */
1701VBGLR3DECL(int) VbglR3GetLastDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay);
1702VBGLR3DECL(int) VbglR3DisplayChangeWaitEvent(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay);
1703VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits);
1704VBGLR3DECL(int) VbglR3SaveVideoMode(const char *pszName, uint32_t cx, uint32_t cy, uint32_t cBits);
1705VBGLR3DECL(int) VbglR3RetrieveVideoMode(const char *pszName, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits);
1706/** @} */
1707
1708#ifdef VBOX_WITH_GUEST_PROPS
1709/** @name Guest properties
1710 * @{ */
1711typedef struct VBGLR3GUESTPROPENUM VBGLR3GUESTPROPENUM, *PVBGLR3GUESTPROPENUM;
1712VBGLR3DECL(int) VbglR3GuestPropConnect(uint32_t *pu32ClientId);
1713VBGLR3DECL(int) VbglR3GuestPropDisconnect(uint32_t u32ClientId);
1714VBGLR3DECL(int) VbglR3GuestPropWrite(uint32_t u32ClientId, const char *pszName, const char *pszValue, const char *pszFlags);
1715VBGLR3DECL(int) VbglR3GuestPropWriteValue(uint32_t u32ClientId, const char *pszName, const char *pszValue);
1716VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, va_list va);
1717VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...);
1718VBGLR3DECL(int) VbglR3GuestPropRead(uint32_t u32ClientId, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
1719VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue, uint32_t *pcchValueActual);
1720VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(uint32_t u32ClientId, const char *pszName, char **ppszValue);
1721VBGLR3DECL(void) VbglR3GuestPropReadValueFree(char *pszValue);
1722VBGLR3DECL(int) VbglR3GuestPropEnumRaw(uint32_t u32ClientId, const char *paszPatterns, char *pcBuf, uint32_t cbBuf, uint32_t *pcbBufActual);
1723VBGLR3DECL(int) VbglR3GuestPropEnum(uint32_t u32ClientId, char const * const *ppaszPatterns, uint32_t cPatterns, PVBGLR3GUESTPROPENUM *ppHandle,
1724 char const **ppszName, char const **ppszValue, uint64_t *pu64Timestamp, char const **ppszFlags);
1725VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, char const **ppszName, char const **ppszValue, uint64_t *pu64Timestamp,
1726 char const **ppszFlags);
1727VBGLR3DECL(void) VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle);
1728VBGLR3DECL(int) VbglR3GuestPropDelSet(uint32_t u32ClientId, char const * const *papszPatterns, uint32_t cPatterns);
1729VBGLR3DECL(int) VbglR3GuestPropWait(uint32_t u32ClientId, const char *pszPatterns, void *pvBuf, uint32_t cbBuf, uint64_t u64Timestamp, uint32_t u32Timeout, char ** ppszName, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
1730/** @} */
1731#endif /* VBOX_WITH_GUEST_PROPS defined */
1732
1733
1734__END_DECLS
1735
1736#endif /* IN_RING3 */
1737
1738#endif
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