VirtualBox

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

Last change on this file since 4337 was 4110, checked in by vboxsync, 17 years ago

Added locked pointer types

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 41.5 KB
Line 
1/** @file
2 * VBoxGuest - VirtualBox Guest Additions interface
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef ___VBox_VBoxGuest_h
18#define ___VBox_VBoxGuest_h
19
20#include <iprt/cdefs.h>
21#include <iprt/types.h>
22#include <VBox/err.h>
23#include <VBox/ostypes.h>
24
25/*******************************************************************************
26* Defined Constants And Macros *
27*******************************************************************************/
28
29/** @todo The following is a temporary fix for the problem of accessing
30 hypervisor pointers from within guest additions */
31
32/** Hypervisor linear pointer size type */
33typedef uint32_t vmmDevHypPtr;
34/** Hypervisor physical pointer size type */
35typedef uint32_t vmmDevHypPhys;
36
37#if defined(RT_OS_LINUX)
38/** The support device name. */
39# define VBOXGUEST_DEVICE_NAME "/dev/vboxadd"
40
41#elif defined(RT_OS_OS2)
42/** The support device name. */
43# define VBOXGUEST_DEVICE_NAME "\\Dev\\VBoxGst$"
44
45#elif defined(RT_OS_WINDOWS)
46/** The support service name. */
47# define VBOXGUEST_SERVICE_NAME "VBoxGuest"
48/** Win32 Device name. */
49# define VBOXGUEST_DEVICE_NAME "\\\\.\\VBoxGuest"
50/** Global name for Win2k+ */
51# define VBOXGUEST_DEVICE_NAME_GLOBAL "\\\\.\\Global\\VBoxGuest"
52/** Win32 driver name */
53# define VBOXGUEST_DEVICE_NAME_NT L"\\Device\\VBoxGuest"
54/** device name */
55# define VBOXGUEST_DEVICE_NAME_DOS L"\\DosDevices\\VBoxGuest"
56
57#else
58/* PORTME */
59#endif
60
61/** VirtualBox vendor ID */
62#define VBOX_PCI_VENDORID (0x80ee)
63
64/** VMMDev PCI card identifiers */
65#define VMMDEV_VENDORID VBOX_PCI_VENDORID
66#define VMMDEV_DEVICEID (0xcafe)
67
68/** VirtualBox graphics card identifiers */
69#define VBOX_VENDORID VBOX_PCI_VENDORID
70#define VBOX_VESA_VENDORID VBOX_PCI_VENDORID
71#define VBOX_DEVICEID (0xbeef)
72#define VBOX_VESA_DEVICEID (0xbeef)
73
74/**
75 * VBoxGuest port definitions
76 * @{
77 */
78
79/** guest can (== wants to) handle absolute coordinates */
80#define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE BIT(0)
81/** host can (== wants to) send absolute coordinates */
82#define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE BIT(1)
83/** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
84#define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR BIT(2)
85/** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
86#define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER BIT(3)
87
88/** fictive start address of the hypervisor physical memory for MmMapIoSpace */
89#define HYPERVISOR_PHYSICAL_START 0xf8000000
90
91/*
92 * VMMDev Generic Request Interface
93 */
94
95/** port for generic request interface */
96#define PORT_VMMDEV_REQUEST_OFFSET 0
97
98/** Current version of the VMMDev interface.
99 *
100 * Additions are allowed to work only if
101 * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
102 * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
103 *
104 * @remark These defines also live in the 16-bit and assembly versions of this header.
105 */
106#define VMMDEV_VERSION_MAJOR (0x1)
107#define VMMDEV_VERSION_MINOR (0x4)
108#define VMMDEV_VERSION ((VMMDEV_VERSION_MAJOR << 16) | VMMDEV_VERSION_MINOR)
109
110/**
111 * VMMDev request types.
112 * @note when updating this, adjust vmmdevGetRequestSize() as well
113 */
114typedef enum
115{
116 VMMDevReq_InvalidRequest = 0,
117 VMMDevReq_GetMouseStatus = 1,
118 VMMDevReq_SetMouseStatus = 2,
119 VMMDevReq_SetPointerShape = 3,
120 /** @todo implement on host side */
121 VMMDevReq_GetHostVersion = 4,
122 VMMDevReq_Idle = 5,
123 VMMDevReq_GetHostTime = 10,
124 VMMDevReq_GetHypervisorInfo = 20,
125 VMMDevReq_SetHypervisorInfo = 21,
126 VMMDevReq_SetPowerStatus = 30,
127 VMMDevReq_AcknowledgeEvents = 41,
128 VMMDevReq_CtlGuestFilterMask = 42,
129 VMMDevReq_ReportGuestInfo = 50,
130 VMMDevReq_GetDisplayChangeRequest = 51,
131 VMMDevReq_VideoModeSupported = 52,
132 VMMDevReq_GetHeightReduction = 53,
133 VMMDevReq_GetDisplayChangeRequest2 = 54,
134 VMMDevReq_ReportGuestCapabilities = 55,
135#ifdef VBOX_HGCM
136 VMMDevReq_HGCMConnect = 60,
137 VMMDevReq_HGCMDisconnect = 61,
138 VMMDevReq_HGCMCall = 62,
139#endif
140 VMMDevReq_VideoAccelEnable = 70,
141 VMMDevReq_VideoAccelFlush = 71,
142 VMMDevReq_VideoSetVisibleRegion = 72,
143 VMMDevReq_GetSeamlessChangeRequest = 73,
144 VMMDevReq_QueryCredentials = 100,
145 VMMDevReq_ReportCredentialsJudgement = 101,
146 VMMDevReq_LogString = 200,
147 VMMDevReq_SizeHack = 0x7fffffff
148} VMMDevRequestType;
149
150/** Version of VMMDevRequestHeader structure. */
151#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
152
153#pragma pack(4)
154/** generic VMMDev request header */
155typedef struct
156{
157 /** size of the structure in bytes (including body). Filled by caller */
158 uint32_t size;
159 /** version of the structure. Filled by caller */
160 uint32_t version;
161 /** type of the request */
162 VMMDevRequestType requestType;
163 /** return code. Filled by VMMDev */
164 int32_t rc;
165 /** reserved fields */
166 uint32_t reserved1;
167 uint32_t reserved2;
168} VMMDevRequestHeader;
169
170/** mouse status request structure */
171typedef struct
172{
173 /** header */
174 VMMDevRequestHeader header;
175 /** mouse feature mask */
176 uint32_t mouseFeatures;
177 /** mouse x position */
178 uint32_t pointerXPos;
179 /** mouse y position */
180 uint32_t pointerYPos;
181} VMMDevReqMouseStatus;
182
183/** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
184 * values must be <= 0x8000 and must not be changed.
185 */
186
187/** pointer is visible */
188#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
189/** pointer has alpha channel */
190#define VBOX_MOUSE_POINTER_ALPHA (0x0002)
191/** pointerData contains new pointer shape */
192#define VBOX_MOUSE_POINTER_SHAPE (0x0004)
193
194/** mouse pointer shape/visibility change request */
195typedef struct
196{
197 /** header */
198 VMMDevRequestHeader header;
199 /** VBOX_MOUSE_POINTER_* bit flags */
200 uint32_t fFlags;
201 /** x coordinate of hot spot */
202 uint32_t xHot;
203 /** y coordinate of hot spot */
204 uint32_t yHot;
205 /** width of the pointer in pixels */
206 uint32_t width;
207 /** height of the pointer in scanlines */
208 uint32_t height;
209 /** Pointer data.
210 *
211 ****
212 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
213 *
214 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
215 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
216 *
217 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
218 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
219 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
220 *
221 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
222 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
223 * end of any scanline are undefined.
224 *
225 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
226 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
227 * Bytes in the gap between the AND and the XOR mask are undefined.
228 * XOR mask scanlines have no gap between them and size of XOR mask is:
229 * cXor = width * 4 * height.
230 ****
231 *
232 * Preallocate 4 bytes for accessing actual data as p->pointerData
233 */
234 char pointerData[4];
235} VMMDevReqMousePointer;
236
237/** string log request structure */
238typedef struct
239{
240 /** header */
241 VMMDevRequestHeader header;
242 /** variable length string data */
243 char szString[1];
244} VMMDevReqLogString;
245
246/** host version request structure */
247typedef struct
248{
249 /** header */
250 VMMDevRequestHeader header;
251 /** major version */
252 uint32_t major;
253 /** minor version */
254 uint32_t minor;
255 /** build number */
256 uint32_t build;
257} VMMDevReqHostVersion;
258
259/** guest capabilites structure */
260typedef struct
261{
262 /** header */
263 VMMDevRequestHeader header;
264 /** capabilities (VMMDEV_GUEST_*) */
265 uint32_t caps;
266} VMMDevReqGuestCapabilities;
267
268/** idle request structure */
269typedef struct
270{
271 /** header */
272 VMMDevRequestHeader header;
273} VMMDevReqIdle;
274
275/** host time request structure */
276typedef struct
277{
278 /** header */
279 VMMDevRequestHeader header;
280 /** time in milliseconds since unix epoch. Filled by VMMDev. */
281 uint64_t time;
282} VMMDevReqHostTime;
283
284/** hypervisor info structure */
285typedef struct
286{
287 /** header */
288 VMMDevRequestHeader header;
289 /** guest virtual address of proposed hypervisor start */
290 vmmDevHypPtr hypervisorStart;
291 /** hypervisor size in bytes */
292 uint32_t hypervisorSize;
293} VMMDevReqHypervisorInfo;
294
295/** system power requests */
296typedef enum
297{
298 VMMDevPowerState_Invalid = 0,
299 VMMDevPowerState_Pause = 1,
300 VMMDevPowerState_PowerOff = 2,
301 VMMDevPowerState_SaveState = 3,
302 VMMDevPowerState_SizeHack = 0x7fffffff
303} VMMDevPowerState;
304
305/** system power status structure */
306typedef struct
307{
308 /** header */
309 VMMDevRequestHeader header;
310 /** power state request */
311 VMMDevPowerState powerState;
312} VMMDevPowerStateRequest;
313
314/** pending events structure */
315typedef struct
316{
317 /** header */
318 VMMDevRequestHeader header;
319 /** pending event bitmap */
320 uint32_t events;
321} VMMDevEvents;
322
323/** guest filter mask control */
324typedef struct
325{
326 /** header */
327 VMMDevRequestHeader header;
328 /** mask of events to be added to filter */
329 uint32_t u32OrMask;
330 /** mask of events to be removed from filter */
331 uint32_t u32NotMask;
332} VMMDevCtlGuestFilterMask;
333
334/** guest information structure */
335typedef struct VBoxGuestInfo
336{
337 /** The VMMDev interface version expected by additions. */
338 uint32_t additionsVersion;
339 /** guest OS type */
340 OSType osType;
341 /** @todo */
342} VBoxGuestInfo;
343
344/** guest information structure */
345typedef struct
346{
347 /** header */
348 VMMDevRequestHeader header;
349 /** Guest information. */
350 VBoxGuestInfo guestInfo;
351} VMMDevReportGuestInfo;
352
353/** display change request structure */
354typedef struct
355{
356 /** header */
357 VMMDevRequestHeader header;
358 /** horizontal pixel resolution (0 = do not change) */
359 uint32_t xres;
360 /** vertical pixel resolution (0 = do not change) */
361 uint32_t yres;
362 /** bits per pixel (0 = do not change) */
363 uint32_t bpp;
364 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
365 * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
366 */
367 uint32_t eventAck;
368} VMMDevDisplayChangeRequest;
369
370typedef struct
371{
372 /** header */
373 VMMDevRequestHeader header;
374 /** horizontal pixel resolution (0 = do not change) */
375 uint32_t xres;
376 /** vertical pixel resolution (0 = do not change) */
377 uint32_t yres;
378 /** bits per pixel (0 = do not change) */
379 uint32_t bpp;
380 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
381 * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
382 */
383 uint32_t eventAck;
384 /** 0 for primary display, 1 for the first secondary, etc. */
385 uint32_t display;
386} VMMDevDisplayChangeRequest2;
387
388/** video mode supported request structure */
389typedef struct
390{
391 /** header */
392 VMMDevRequestHeader header;
393 /** horizontal pixel resolution (input) */
394 uint32_t width;
395 /** vertical pixel resolution (input) */
396 uint32_t height;
397 /** bits per pixel (input) */
398 uint32_t bpp;
399 /** supported flag (output) */
400 bool fSupported;
401} VMMDevVideoModeSupportedRequest;
402
403/** video modes height reduction request structure */
404typedef struct
405{
406 /** header */
407 VMMDevRequestHeader header;
408 /** height reduction in pixels (output) */
409 uint32_t heightReduction;
410} VMMDevGetHeightReductionRequest;
411
412#pragma pack()
413
414#ifdef VBOX_HGCM
415
416/** HGCM flags.
417 * @{
418 */
419#define VBOX_HGCM_REQ_DONE (0x1)
420#define VBOX_HGCM_REQ_CANCELLED (0x2)
421/** @} */
422
423#pragma pack(4)
424typedef struct _VMMDevHGCMRequestHeader
425{
426 /** Request header. */
427 VMMDevRequestHeader header;
428
429 /** HGCM flags. */
430 uint32_t fu32Flags;
431
432 /** Result code. */
433 int32_t result;
434} VMMDevHGCMRequestHeader;
435
436/** HGCM service location types. */
437typedef enum
438{
439 VMMDevHGCMLoc_Invalid = 0,
440 VMMDevHGCMLoc_LocalHost = 1,
441 VMMDevHGCMLoc_LocalHost_Existing = 2,
442 VMMDevHGCMLoc_SizeHack = 0x7fffffff
443} HGCMServiceLocationType;
444
445typedef struct
446{
447 char achName[128];
448} HGCMServiceLocationHost;
449
450typedef struct HGCMSERVICELOCATION
451{
452 /** Type of the location. */
453 HGCMServiceLocationType type;
454
455 union
456 {
457 HGCMServiceLocationHost host;
458 } u;
459} HGCMServiceLocation;
460
461typedef struct
462{
463 /* request header */
464 VMMDevHGCMRequestHeader header;
465
466 /** IN: Description of service to connect to. */
467 HGCMServiceLocation loc;
468
469 /** OUT: Client identifier assigned by local instance of HGCM. */
470 uint32_t u32ClientID;
471} VMMDevHGCMConnect;
472
473typedef struct
474{
475 /* request header */
476 VMMDevHGCMRequestHeader header;
477
478 /** IN: Client identifier. */
479 uint32_t u32ClientID;
480} VMMDevHGCMDisconnect;
481
482typedef enum
483{
484 VMMDevHGCMParmType_Invalid = 0,
485 VMMDevHGCMParmType_32bit = 1,
486 VMMDevHGCMParmType_64bit = 2,
487 VMMDevHGCMParmType_PhysAddr = 3,
488 VMMDevHGCMParmType_LinAddr = 4, /**< In and Out */
489 VMMDevHGCMParmType_LinAddr_In = 5, /**< In (read; host<-guest) */
490 VMMDevHGCMParmType_LinAddr_Out = 6, /**< Out (write; host->guest) */
491 VMMDevHGCMParmType_LinAddr_Locked = 7, /**< Locked In and Out */
492 VMMDevHGCMParmType_LinAddr_Locked_In = 8, /**< Locked In (read; host<-guest) */
493 VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
494 VMMDevHGCMParmType_SizeHack = 0x7fffffff
495} HGCMFunctionParameterType;
496
497typedef struct _HGCMFUNCTIONPARAMETER
498{
499 HGCMFunctionParameterType type;
500 union
501 {
502 uint32_t value32;
503 uint64_t value64;
504 struct
505 {
506 uint32_t size;
507
508 union
509 {
510 vmmDevHypPhys physAddr;
511 vmmDevHypPtr linearAddr;
512 } u;
513 } Pointer;
514 } u;
515} HGCMFunctionParameter;
516
517typedef struct
518{
519 /* request header */
520 VMMDevHGCMRequestHeader header;
521
522 /** IN: Client identifier. */
523 uint32_t u32ClientID;
524 /** IN: Service function number. */
525 uint32_t u32Function;
526 /** IN: Number of parameters. */
527 uint32_t cParms;
528 /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
529} VMMDevHGCMCall;
530#pragma pack()
531
532#define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((char *)a + sizeof (VMMDevHGCMCall)))
533
534#define VBOX_HGCM_MAX_PARMS 32
535
536#endif /* VBOX_HGCM */
537
538
539#define VBVA_F_STATUS_ACCEPTED (0x01)
540#define VBVA_F_STATUS_ENABLED (0x02)
541
542#pragma pack(4)
543
544typedef struct _VMMDevVideoAccelEnable
545{
546 /* request header */
547 VMMDevRequestHeader header;
548
549 /** 0 - disable, !0 - enable. */
550 uint32_t u32Enable;
551
552 /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
553 * The host will refuse to enable VBVA if the size is not equal to
554 * VBVA_RING_BUFFER_SIZE.
555 */
556 uint32_t cbRingBuffer;
557
558 /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
559 uint32_t fu32Status;
560
561} VMMDevVideoAccelEnable;
562
563typedef struct _VMMDevVideoAccelFlush
564{
565 /* request header */
566 VMMDevRequestHeader header;
567
568} VMMDevVideoAccelFlush;
569
570
571typedef struct _VMMDevVideoSetVisibleRegion
572{
573 /* request header */
574 VMMDevRequestHeader header;
575
576 /** Number of rectangles */
577 uint32_t cRect;
578
579 /** Rectangle array */
580 RTRECT Rect;
581} VMMDevVideoSetVisibleRegion;
582
583
584/** Seamless mode */
585typedef enum
586{
587 VMMDev_Seamless_Disabled = 0, /* normal mode; entire guest desktop displayed */
588 VMMDev_Seamless_Visible_Region = 1, /* visible region mode; only top-level guest windows displayed */
589 VMMDev_Seamless_Host_Window = 2 /* windowed mode; each top-level guest window is represented in a host window */
590} VMMDevSeamlessMode;
591
592typedef struct
593{
594 /** header */
595 VMMDevRequestHeader header;
596
597 /** New seamless mode */
598 VMMDevSeamlessMode mode;
599 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
600 * Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
601 */
602 uint32_t eventAck;
603} VMMDevSeamlessChangeRequest;
604
605#pragma pack()
606
607#pragma pack(1)
608
609/** VBVA command header. */
610typedef struct _VBVACMDHDR
611{
612 /** Coordinates of affected rectangle. */
613 int16_t x;
614 int16_t y;
615 uint16_t w;
616 uint16_t h;
617} VBVACMDHDR;
618
619/* VBVA order codes. Must be >= 0, because the VRDP server internally
620 * uses negative values to mark some operations.
621 * Values are important since they are used as an index in the
622 * "supported orders" bit mask.
623 */
624#define VBVA_VRDP_DIRTY_RECT (0)
625#define VBVA_VRDP_SOLIDRECT (1)
626#define VBVA_VRDP_SOLIDBLT (2)
627#define VBVA_VRDP_DSTBLT (3)
628#define VBVA_VRDP_SCREENBLT (4)
629#define VBVA_VRDP_PATBLTBRUSH (5)
630#define VBVA_VRDP_MEMBLT (6)
631#define VBVA_VRDP_CACHED_BITMAP (7)
632#define VBVA_VRDP_DELETED_BITMAP (8)
633#define VBVA_VRDP_LINE (9)
634#define VBVA_VRDP_BOUNDS (10)
635#define VBVA_VRDP_REPEAT (11)
636#define VBVA_VRDP_POLYLINE (12)
637#define VBVA_VRDP_ELLIPSE (13)
638#define VBVA_VRDP_SAVESCREEN (14)
639
640#define VBVA_VRDP_INDEX_TO_BIT(__index) (1 << (__index))
641
642#ifndef VRDP_NO_COM
643/* 128 bit bitmap hash. */
644typedef uint8_t VRDPBITMAPHASH[16];
645
646typedef struct _VRDPORDERPOINT
647{
648 int16_t x;
649 int16_t y;
650} VRDPORDERPOINT;
651
652typedef struct _VRDPORDERPOLYPOINTS
653{
654 uint8_t c;
655 VRDPORDERPOINT a[16];
656} VRDPORDERPOLYPOINTS;
657
658typedef struct _VRDPORDERAREA
659{
660 int16_t x;
661 int16_t y;
662 uint16_t w;
663 uint16_t h;
664} VRDPORDERAREA;
665
666typedef struct _VRDPORDERBOUNDS
667{
668 VRDPORDERPOINT pt1;
669 VRDPORDERPOINT pt2;
670} VRDPORDERBOUNDS;
671
672typedef struct _VRDPORDERREPEAT
673{
674 VRDPORDERBOUNDS bounds;
675} VRDPORDERREPEAT;
676
677
678/* Header for bitmap bits in VBVA VRDP operations. */
679typedef struct _VRDPDATABITS
680{
681 /* Size of bitmap data without the header. */
682 uint32_t cb;
683 int16_t x;
684 int16_t y;
685 uint16_t cWidth;
686 uint16_t cHeight;
687 uint8_t cbPixel;
688} VRDPDATABITS;
689
690typedef struct _VRDPORDERSOLIDRECT
691{
692 int16_t x;
693 int16_t y;
694 uint16_t w;
695 uint16_t h;
696 uint32_t rgb;
697} VRDPORDERSOLIDRECT;
698
699typedef struct _VRDPORDERSOLIDBLT
700{
701 int16_t x;
702 int16_t y;
703 uint16_t w;
704 uint16_t h;
705 uint32_t rgb;
706 uint8_t rop;
707} VRDPORDERSOLIDBLT;
708
709typedef struct _VRDPORDERDSTBLT
710{
711 int16_t x;
712 int16_t y;
713 uint16_t w;
714 uint16_t h;
715 uint8_t rop;
716} VRDPORDERDSTBLT;
717
718typedef struct _VRDPORDERSCREENBLT
719{
720 int16_t x;
721 int16_t y;
722 uint16_t w;
723 uint16_t h;
724 int16_t xSrc;
725 int16_t ySrc;
726 uint8_t rop;
727} VRDPORDERSCREENBLT;
728
729typedef struct _VRDPORDERPATBLTBRUSH
730{
731 int16_t x;
732 int16_t y;
733 uint16_t w;
734 uint16_t h;
735 int8_t xSrc;
736 int8_t ySrc;
737 uint32_t rgbFG;
738 uint32_t rgbBG;
739 uint8_t rop;
740 uint8_t pattern[8];
741} VRDPORDERPATBLTBRUSH;
742
743typedef struct _VRDPORDERMEMBLT
744{
745 int16_t x;
746 int16_t y;
747 uint16_t w;
748 uint16_t h;
749 int16_t xSrc;
750 int16_t ySrc;
751 uint8_t rop;
752 VRDPBITMAPHASH hash;
753} VRDPORDERMEMBLT;
754
755typedef struct _VRDPORDERCACHEDBITMAP
756{
757 VRDPBITMAPHASH hash;
758 /* VRDPDATABITS and the bitmap data follows. */
759} VRDPORDERCACHEDBITMAP;
760
761typedef struct _VRDPORDERDELETEDBITMAP
762{
763 VRDPBITMAPHASH hash;
764} VRDPORDERDELETEDBITMAP;
765
766typedef struct _VRDPORDERLINE
767{
768 int16_t x1;
769 int16_t y1;
770 int16_t x2;
771 int16_t y2;
772 int16_t xBounds1;
773 int16_t yBounds1;
774 int16_t xBounds2;
775 int16_t yBounds2;
776 uint8_t mix;
777 uint32_t rgb;
778} VRDPORDERLINE;
779
780typedef struct _VRDPORDERPOLYLINE
781{
782 VRDPORDERPOINT ptStart;
783 uint8_t mix;
784 uint32_t rgb;
785 VRDPORDERPOLYPOINTS points;
786} VRDPORDERPOLYLINE;
787
788typedef struct _VRDPORDERELLIPSE
789{
790 VRDPORDERPOINT pt1;
791 VRDPORDERPOINT pt2;
792 uint8_t mix;
793 uint8_t fillMode;
794 uint32_t rgb;
795} VRDPORDERELLIPSE;
796
797typedef struct _VRDPORDERSAVESCREEN
798{
799 VRDPORDERPOINT pt1;
800 VRDPORDERPOINT pt2;
801 uint8_t ident;
802 uint8_t restore;
803} VRDPORDERSAVESCREEN;
804#endif /* VRDP_NO_COM */
805#pragma pack()
806
807/* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
808 * For example big bitmaps which do not fit to the buffer.
809 *
810 * Guest starts writing to the buffer by initializing a record entry in the
811 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
812 * written. As data is written to the ring buffer, the guest increases off32End
813 * for the record.
814 *
815 * The host reads the aRecords on flushes and processes all completed records.
816 * When host encounters situation when only a partial record presents and
817 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
818 * the host fetched all record data and updates off32Head. After that on each flush
819 * the host continues fetching the data until the record is completed.
820 *
821 */
822
823#define VBVA_RING_BUFFER_SIZE (_4M - _1K)
824#define VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
825
826#define VBVA_MAX_RECORDS (64)
827
828#define VBVA_F_MODE_ENABLED (0x00000001)
829#define VBVA_F_MODE_VRDP (0x00000002)
830#define VBVA_F_MODE_VRDP_RESET (0x00000004)
831#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
832
833#define VBVA_F_RECORD_PARTIAL (0x80000000)
834
835#pragma pack(1)
836typedef struct _VBVARECORD
837{
838 /** The length of the record. Changed by guest. */
839 uint32_t cbRecord;
840} VBVARECORD;
841
842typedef struct _VBVAMEMORY
843{
844 /** VBVA_F_MODE_* */
845 uint32_t fu32ModeFlags;
846
847 /** The offset where the data start in the buffer. */
848 uint32_t off32Data;
849 /** The offset where next data must be placed in the buffer. */
850 uint32_t off32Free;
851
852 /** The ring buffer for data. */
853 uint8_t au8RingBuffer[VBVA_RING_BUFFER_SIZE];
854
855 /** The queue of record descriptions. */
856 VBVARECORD aRecords[VBVA_MAX_RECORDS];
857 uint32_t indexRecordFirst;
858 uint32_t indexRecordFree;
859
860 /* RDP orders supported by the client. The guest reports only them
861 * and falls back to DIRTY rects for not supported ones.
862 *
863 * (1 << VBVA_VRDP_*)
864 */
865 uint32_t fu32SupportedOrders;
866
867} VBVAMEMORY;
868#pragma pack()
869
870/** @} */
871
872
873/**
874 * VMMDev RAM
875 * @{
876 */
877
878#pragma pack(1)
879/** Layout of VMMDEV RAM region that contains information for guest */
880typedef struct
881{
882 /** size */
883 uint32_t u32Size;
884 /** version */
885 uint32_t u32Version;
886
887 union {
888 /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
889 struct {
890 bool fHaveEvents;
891 } V1_04;
892
893 struct {
894 /** Pending events flags, set by host. */
895 uint32_t u32HostEvents;
896 /** Mask of events the guest wants to see, set by guest. */
897 uint32_t u32GuestEventMask;
898 } V1_03;
899 } V;
900
901 VBVAMEMORY vbvaMemory;
902
903} VMMDevMemory;
904#pragma pack()
905
906/** Version of VMMDevMemory structure. */
907#define VMMDEV_MEMORY_VERSION (1)
908
909/** @} */
910
911
912/**
913 * VMMDev events.
914 * @{
915 */
916
917/** Host mouse capabilities has been changed. */
918#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED BIT(0)
919/** HGCM event. */
920#define VMMDEV_EVENT_HGCM BIT(1)
921/** A display change request has been issued. */
922#define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST BIT(2)
923/** Credentials are available for judgement. */
924#define VMMDEV_EVENT_JUDGE_CREDENTIALS BIT(3)
925/** The guest has been restored. */
926#define VMMDEV_EVENT_RESTORED BIT(4)
927/** Seamless mode state changed */
928#define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST BIT(5)
929
930
931/** @} */
932
933
934/**
935 * VBoxGuest IOCTL codes and structures.
936 *
937 * The range 0..15 is for basic driver communication.
938 * The range 16..31 is for HGCM communcation.
939 * The range 32..47 is reserved for future use.
940 * The range 48..63 is for OS specific communcation.
941 * The 7th bit is reserved for future hacks.
942 * The 8th bit is reserved for distinguishing between 32-bit and 64-bit
943 * processes in future 64-bit guest additions.
944 *
945 * While windows IOCTL function number has to start at 2048 and stop at 4096 there
946 * never was any need to do this for everyone. A simple ((Function) | 0x800) would
947 * have sufficed. On Linux we're now intruding upon the type field. Fortunately
948 * this hasn't caused any trouble because the FILE_DEVICE_UNKNOWN value was set
949 * to 0x22 (if it were 0x2C it would not have worked soo smoothly). The situation
950 * would've been the same for *BSD and Darwin since they seems to share common
951 * _IOC() heritage.
952 *
953 * However, on good old OS/2 we only have 8-bit handy for the function number. The
954 * result from using the old IOCTL function numbers her would've been overlapping
955 * between the two ranges.
956 *
957 * To fix this problem and get rid of all the unnecessary windowsy crap that I
958 * bet was copied from my SUPDRVIOC.h once upon a time (although the concept of
959 * prefixing macros with the purpose of avoid clashes with system stuff and
960 * to indicate exactly how owns them seems to have been lost somewhere along
961 * the way), I've introduced a VBOXGUEST_IOCTL_CODE for defining generic IN/OUT
962 * IOCtls on new ports of the additions.
963 *
964 * @remark When creating new IOCtl interfaces keep in mind that not all OSes supports
965 * reporting back the output size. (This got messed up a little bit in VBoxDrv.)
966 *
967 * OS/2 restricts the in/out data size to 64KB, while Linux, BSD and Darwin are
968 * limited by a 14 bits size field (16KB). So, special considerations need to
969 * be taken if more input/output needs to be passed around.
970 *
971 * When passing variable sized input/output special care need to be taken on
972 * Unix platforms (if we're going to play by the rules) since the size is
973 * passed as part of the IOCtl code there. IIRC Darwin will use the size to
974 * perform locking and in/out copying, I don't quite know about linux and *BSD.
975 *
976 * @remark If adding interfaces that only has input or only has output, some new macros
977 * needs to be created so the most efficient IOCtl data buffering method can be
978 * used.
979 *
980 * @{
981 */
982#ifdef RT_ARCH_AMD64
983# define VBOXGUEST_IOCTL_FLAG 128
984#elif defined(RT_ARCH_X86)
985# define VBOXGUEST_IOCTL_FLAG 0
986#else
987# error "dunno which arch this is!"
988#endif
989
990#if defined(RT_OS_WINDOWS)
991# define IOCTL_CODE(DeviceType, Function, Method, Access, DataSize_ignored) \
992 ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
993
994#elif defined(RT_OS_OS2)
995# define VBOXGUEST_IOCTL_CATEGORY 0xc2
996# define VBOXGUEST_IOCTL_CODE(Function, Size) ((unsigned char)(Function))
997# define VBOXGUEST_IOCTL_CATEGORY_FAST 0xc3 /**< Also defined in VBoxGuestA-os2.asm. */
998# define VBOXGUEST_IOCTL_CODE_FAST(Function) ((unsigned char)(Function))
999
1000#elif defined(RT_OS_LINUX)
1001# define IOCTL_CODE(DeviceType, Function, Method_ignored, Access_ignored, DataSize) \
1002 ( (3 << 30) | ((DeviceType) << 8) | (Function) | ((DataSize) << 16) )
1003# define METHOD_BUFFERED 0
1004# define FILE_WRITE_ACCESS 0x0002
1005# define FILE_DEVICE_UNKNOWN 0x00000022
1006
1007#elif 0 /* BSD style - needs some adjusting _IORW takes a type and not a size. */
1008# include <sys/ioccom.h>
1009# define VBOXGUEST_IOCTL_CODE(Function, Size) _IORW('V', (Function) | VBOXGUEST_IOCTL_FLAG, (Size))
1010# define VBOXGUEST_IOCTL_CODE_FAST(Function) _IO( 'V', (Function) | VBOXGUEST_IOCTL_FLAG)
1011
1012#else
1013/* PORTME */
1014#endif
1015
1016/** IOCTL to VBoxGuest to query the VMMDev IO port region start. */
1017#ifdef VBOXGUEST_IOCTL_CODE
1018# define VBOXGUEST_IOCTL_GETVMMDEVPORT VBOXGUEST_IOCTL_CODE(1, sizeof(VBoxGuestPortInfo))
1019# define IOCTL_VBOXGUEST_GETVMMDEVPORT VBOXGUEST_IOCTL_GETVMMDEVPORT
1020#else
1021# define IOCTL_VBOXGUEST_GETVMMDEVPORT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2048, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestPortInfo))
1022#endif
1023
1024#pragma pack(4)
1025typedef struct _VBoxGuestPortInfo
1026{
1027 uint32_t portAddress;
1028 VMMDevMemory *pVMMDevMemory;
1029} VBoxGuestPortInfo;
1030
1031/** IOCTL to VBoxGuest to wait for a VMMDev host notification */
1032#ifdef VBOXGUEST_IOCTL_CODE
1033# define VBOXGUEST_IOCTL_WAITEVENT VBOXGUEST_IOCTL_CODE(2, sizeof(VBoxGuestWaitEventInfo))
1034# define IOCTL_VBOXGUEST_WAITEVENT VBOXGUEST_IOCTL_WAITEVENT
1035#else
1036# define IOCTL_VBOXGUEST_WAITEVENT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2049, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestWaitEventInfo))
1037#endif
1038
1039/**
1040 * Result codes for VBoxGuestWaitEventInfo::u32Result
1041 * @{
1042 */
1043/** Successful completion, an event occured. */
1044#define VBOXGUEST_WAITEVENT_OK (0)
1045/** Successful completion, timed out. */
1046#define VBOXGUEST_WAITEVENT_TIMEOUT (1)
1047/** Wait was interrupted. */
1048#define VBOXGUEST_WAITEVENT_INTERRUPTED (2)
1049/** An error occured while processing the request. */
1050#define VBOXGUEST_WAITEVENT_ERROR (3)
1051/** @} */
1052
1053/** Input and output buffers layout of the IOCTL_VBOXGUEST_WAITEVENT */
1054typedef struct _VBoxGuestWaitEventInfo
1055{
1056 /** timeout in milliseconds */
1057 uint32_t u32TimeoutIn;
1058 /** events to wait for */
1059 uint32_t u32EventMaskIn;
1060 /** result code */
1061 uint32_t u32Result;
1062 /** events occured */
1063 uint32_t u32EventFlagsOut;
1064} VBoxGuestWaitEventInfo;
1065
1066/** IOCTL to VBoxGuest to perform a VMM request
1067 * @remark The data buffer for this IOCtl has an variable size, keep this in mind
1068 * on systems where this matters. */
1069#ifdef VBOXGUEST_IOCTL_CODE
1070# define VBOXGUEST_IOCTL_VMMREQUEST(Size) VBOXGUEST_IOCTL_CODE(3, sizeof(VMMDevRequestHeader))
1071# define IOCTL_VBOXGUEST_VMMREQUEST VBOXGUEST_IOCTL_VMMREQUEST(sizeof(VMMDevRequestHeader))
1072#else
1073# define IOCTL_VBOXGUEST_VMMREQUEST IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2050, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VMMDevRequestHeader))
1074#endif
1075
1076/** Input and output buffer layout of the IOCTL_VBOXGUEST_CTL_FILTER_MASK. */
1077typedef struct _VBoxGuestFilterMaskInfo
1078{
1079 uint32_t u32OrMask;
1080 uint32_t u32NotMask;
1081} VBoxGuestFilterMaskInfo;
1082#pragma pack()
1083
1084/** IOCTL to VBoxGuest to control event filter mask */
1085#ifdef VBOXGUEST_IOCTL_CODE
1086# define VBOXGUEST_IOCTL_CTL_FILTER_MASK VBOXGUEST_IOCTL_CODE(4, sizeof(VBoxGuestFilterMaskInfo))
1087# define IOCTL_VBOXGUEST_CTL_FILTER_MASK VBOXGUEST_IOCTL_CTL_FILTER_MASK
1088#else
1089# define IOCTL_VBOXGUEST_CTL_FILTER_MASK IOCTL_CODE(FILE_DEVICE_UNKNOWN, 2051, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof (VBoxGuestFilterMaskInfo))
1090#endif
1091
1092#ifdef VBOX_HGCM
1093/* These structures are shared between the driver and other binaries,
1094 * therefore packing must be defined explicitely.
1095 */
1096#pragma pack(1)
1097typedef struct _VBoxGuestHGCMConnectInfo
1098{
1099 uint32_t result; /**< OUT */
1100 HGCMServiceLocation Loc; /**< IN */
1101 uint32_t u32ClientID; /**< OUT */
1102} VBoxGuestHGCMConnectInfo;
1103
1104typedef struct _VBoxGuestHGCMDisconnectInfo
1105{
1106 uint32_t result; /**< OUT */
1107 uint32_t u32ClientID; /**< IN */
1108} VBoxGuestHGCMDisconnectInfo;
1109
1110typedef struct _VBoxGuestHGCMCallInfo
1111{
1112 uint32_t result; /**< OUT Host HGCM return code.*/
1113 uint32_t u32ClientID; /**< IN The id of the caller. */
1114 uint32_t u32Function; /**< IN Function number. */
1115 uint32_t cParms; /**< IN How many parms. */
1116 /* Parameters follow in form HGCMFunctionParameter aParms[cParms] */
1117} VBoxGuestHGCMCallInfo;
1118#pragma pack()
1119
1120#ifdef VBOXGUEST_IOCTL_CODE
1121# define VBOXGUEST_IOCTL_HGCM_CONNECT VBOXGUEST_IOCTL_CODE(16, sizeof(VBoxGuestHGCMConnectInfo))
1122# define IOCTL_VBOXGUEST_HGCM_CONNECT VBOXGUEST_IOCTL_HGCM_CONNECT
1123# define VBOXGUEST_IOCTL_HGCM_DISCONNECT VBOXGUEST_IOCTL_CODE(17, sizeof(VBoxGuestHGCMDisconnectInfo))
1124# define IOCTL_VBOXGUEST_HGCM_DISCONNECT VBOXGUEST_IOCTL_HGCM_DISCONNECT
1125# define VBOXGUEST_IOCTL_HGCM_CALL(Size) VBOXGUEST_IOCTL_CODE(18, (Size))
1126# define IOCTL_VBOXGUEST_HGCM_CALL VBOXGUEST_IOCTL_HGCM_CALL(sizeof(VBoxGuestHGCMCallInfo))
1127# define VBOXGUEST_IOCTL_CLIPBOARD_CONNECT VBOXGUEST_IOCTL_CODE(19, sizeof(uint32_t))
1128# define IOCTL_VBOXGUEST_CLIPBOARD_CONNECT VBOXGUEST_IOCTL_CLIPBOARD_CONNECT
1129#else
1130# define IOCTL_VBOXGUEST_HGCM_CONNECT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3072, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestHGCMConnectInfo))
1131# define IOCTL_VBOXGUEST_HGCM_DISCONNECT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3073, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestHGCMDisconnectInfo))
1132# define IOCTL_VBOXGUEST_HGCM_CALL IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3074, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(VBoxGuestHGCMCallInfo))
1133# define IOCTL_VBOXGUEST_CLIPBOARD_CONNECT IOCTL_CODE(FILE_DEVICE_UNKNOWN, 3075, METHOD_BUFFERED, FILE_WRITE_ACCESS, sizeof(uint32_t))
1134#endif
1135
1136#define VBOXGUEST_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VBoxGuestHGCMCallInfo)))
1137
1138#endif /* VBOX_HGCM */
1139
1140/*
1141 * Credentials request flags and structure
1142 */
1143
1144#define VMMDEV_CREDENTIALS_STRLEN 128
1145
1146/** query from host whether credentials are present */
1147#define VMMDEV_CREDENTIALS_QUERYPRESENCE BIT(1)
1148/** read credentials from host (can be combined with clear) */
1149#define VMMDEV_CREDENTIALS_READ BIT(2)
1150/** clear credentials on host (can be combined with read) */
1151#define VMMDEV_CREDENTIALS_CLEAR BIT(3)
1152/** read credentials for judgement in the guest */
1153#define VMMDEV_CREDENTIALS_READJUDGE BIT(8)
1154/** clear credentials for judegement on the host */
1155#define VMMDEV_CREDENTIALS_CLEARJUDGE BIT(9)
1156/** report credentials acceptance by guest */
1157#define VMMDEV_CREDENTIALS_JUDGE_OK BIT(10)
1158/** report credentials denial by guest */
1159#define VMMDEV_CREDENTIALS_JUDGE_DENY BIT(11)
1160/** report that no judgement could be made by guest */
1161#define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT BIT(12)
1162
1163/** flag telling the guest that credentials are present */
1164#define VMMDEV_CREDENTIALS_PRESENT BIT(16)
1165/** flag telling guest that local logons should be prohibited */
1166#define VMMDEV_CREDENTIALS_NOLOCALLOGON BIT(17)
1167
1168/** credentials request structure */
1169#pragma pack(4)
1170typedef struct _VMMDevCredentials
1171{
1172 /* request header */
1173 VMMDevRequestHeader header;
1174 /* request flags (in/out) */
1175 uint32_t u32Flags;
1176 /* user name (UTF-8) (out) */
1177 char szUserName[VMMDEV_CREDENTIALS_STRLEN];
1178 /* password (UTF-8) (out) */
1179 char szPassword[VMMDEV_CREDENTIALS_STRLEN];
1180 /* domain name (UTF-8) (out) */
1181 char szDomain[VMMDEV_CREDENTIALS_STRLEN];
1182} VMMDevCredentials;
1183#pragma pack()
1184
1185/** inline helper to determine the request size for the given operation */
1186DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
1187{
1188 switch (requestType)
1189 {
1190 case VMMDevReq_GetMouseStatus:
1191 case VMMDevReq_SetMouseStatus:
1192 return sizeof(VMMDevReqMouseStatus);
1193 case VMMDevReq_SetPointerShape:
1194 return sizeof(VMMDevReqMousePointer);
1195 case VMMDevReq_GetHostVersion:
1196 return sizeof(VMMDevReqHostVersion);
1197 case VMMDevReq_Idle:
1198 return sizeof(VMMDevReqIdle);
1199 case VMMDevReq_GetHostTime:
1200 return sizeof(VMMDevReqHostTime);
1201 case VMMDevReq_GetHypervisorInfo:
1202 case VMMDevReq_SetHypervisorInfo:
1203 return sizeof(VMMDevReqHypervisorInfo);
1204 case VMMDevReq_SetPowerStatus:
1205 return sizeof(VMMDevPowerStateRequest);
1206 case VMMDevReq_AcknowledgeEvents:
1207 return sizeof(VMMDevEvents);
1208 case VMMDevReq_ReportGuestInfo:
1209 return sizeof(VMMDevReportGuestInfo);
1210 case VMMDevReq_GetDisplayChangeRequest:
1211 return sizeof(VMMDevDisplayChangeRequest);
1212 case VMMDevReq_GetDisplayChangeRequest2:
1213 return sizeof(VMMDevDisplayChangeRequest2);
1214 case VMMDevReq_VideoModeSupported:
1215 return sizeof(VMMDevVideoModeSupportedRequest);
1216 case VMMDevReq_GetHeightReduction:
1217 return sizeof(VMMDevGetHeightReductionRequest);
1218 case VMMDevReq_ReportGuestCapabilities:
1219 return sizeof(VMMDevReqGuestCapabilities);
1220#ifdef VBOX_HGCM
1221 case VMMDevReq_HGCMConnect:
1222 return sizeof(VMMDevHGCMConnect);
1223 case VMMDevReq_HGCMDisconnect:
1224 return sizeof(VMMDevHGCMDisconnect);
1225 case VMMDevReq_HGCMCall:
1226 return sizeof(VMMDevHGCMCall);
1227#endif
1228 case VMMDevReq_VideoAccelEnable:
1229 return sizeof(VMMDevVideoAccelEnable);
1230 case VMMDevReq_VideoAccelFlush:
1231 return sizeof(VMMDevVideoAccelFlush);
1232 case VMMDevReq_VideoSetVisibleRegion:
1233 return sizeof(VMMDevVideoSetVisibleRegion);
1234 case VMMDevReq_GetSeamlessChangeRequest:
1235 return sizeof(VMMDevSeamlessChangeRequest);
1236 case VMMDevReq_QueryCredentials:
1237 return sizeof(VMMDevCredentials);
1238 case VMMDevReq_LogString:
1239 return sizeof(VMMDevReqLogString);
1240 default:
1241 return 0;
1242 }
1243}
1244
1245/**
1246 * Initializes a request structure.
1247 *
1248 */
1249DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
1250{
1251 uint32_t requestSize;
1252 if (!req)
1253 return VERR_INVALID_PARAMETER;
1254 requestSize = (uint32_t)vmmdevGetRequestSize(type);
1255 if (!requestSize)
1256 return VERR_INVALID_PARAMETER;
1257 req->size = requestSize;
1258 req->version = VMMDEV_REQUEST_HEADER_VERSION;
1259 req->requestType = type;
1260 req->rc = VERR_GENERAL_FAILURE;
1261 req->reserved1 = 0;
1262 req->reserved2 = 0;
1263 return VINF_SUCCESS;
1264}
1265
1266
1267#ifdef RT_OS_OS2
1268
1269/**
1270 * The data buffer layout for the IDC entry point (AttachDD).
1271 *
1272 * @remark This is defined in multiple 16-bit headers / sources.
1273 * Some places it's called VBGOS2IDC to short things a bit.
1274 */
1275typedef struct VBOXGUESTOS2IDCCONNECT
1276{
1277 /** VMMDEV_VERSION. */
1278 uint32_t u32Version;
1279 /** Opaque session handle. */
1280 uint32_t u32Session;
1281
1282 /**
1283 * The 32-bit service entry point.
1284 *
1285 * @returns VBox status code.
1286 * @param u32Session The above session handle.
1287 * @param iFunction The requested function.
1288 * @param pvData The input/output data buffer. The caller ensures that this
1289 * cannot be swapped out, or that it's acceptable to take a
1290 * page in fault in the current context. If the request doesn't
1291 * take input or produces output, apssing NULL is okay.
1292 * @param cbData The size of the data buffer.
1293 * @param pcbDataReturned Where to store the amount of data that's returned.
1294 * This can be NULL if pvData is NULL.
1295 */
1296 DECLCALLBACKMEMBER(int, pfnServiceEP)(uint32_t u32Session, unsigned iFunction, void *pvData, size_t cbData, size_t *pcbDataReturned);
1297
1298 /** The 16-bit service entry point for C code (cdecl).
1299 *
1300 * It's the same as the 32-bit entry point, but the types has
1301 * changed to 16-bit equivalents.
1302 *
1303 * @code
1304 * int far cdecl
1305 * VBoxGuestOs2IDCService16(uint32_t u32Session, uint16_t iFunction,
1306 * void far *fpvData, uint16_t cbData, uint16_t far *pcbDataReturned);
1307 * @endcode
1308 */
1309 RTFAR16 fpfnServiceEP;
1310
1311 /** The 16-bit service entry point for Assembly code (register).
1312 *
1313 * This is just a wrapper around fpfnServiceEP to simplify calls
1314 * from 16-bit assembly code.
1315 *
1316 * @returns (e)ax: VBox status code; cx: The amount of data returned.
1317 *
1318 * @param u32Session eax - The above session handle.
1319 * @param iFunction dl - The requested function.
1320 * @param pvData es:bx - The input/output data buffer.
1321 * @param cbData cx - The size of the data buffer.
1322 */
1323 RTFAR16 fpfnServiceAsmEP;
1324} VBOXGUESTOS2IDCCONNECT;
1325/** Pointer to VBOXGUESTOS2IDCCONNECT buffer. */
1326typedef VBOXGUESTOS2IDCCONNECT *PVBOXGUESTOS2IDCCONNECT;
1327
1328/** OS/2 specific: IDC client disconnect request.
1329 *
1330 * This takes no input and it doesn't return anything. Obviously this
1331 * is only recognized if it arrives thru the IDC service EP.
1332 */
1333#define VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT VBOXGUEST_IOCTL_CODE(48, sizeof(uint32_t))
1334
1335#endif /* RT_OS_OS2 */
1336
1337/** @} */
1338
1339
1340#ifdef IN_RING3
1341
1342/** @def VBGLR3DECL
1343 * Ring 3 VBGL declaration.
1344 * @param type The return type of the function declaration.
1345 */
1346#define VBGLR3DECL(type) type VBOXCALL
1347
1348__BEGIN_DECLS
1349VBGLR3DECL(int) VbglR3Init(void);
1350VBGLR3DECL(void) VbglR3Term(void);
1351VBGLR3DECL(int) VbglR3GRPerform(VMMDevRequestHeader *pReq);
1352# ifdef __iprt_time_h__
1353VBGLR3DECL(int) VbglR3GetHostTime(PRTTIMESPEC pTime);
1354# endif
1355
1356VBGLR3DECL(int) VbglR3ClipboardConnect(uint32_t *pu32ClientId);
1357VBGLR3DECL(int) VbglR3ClipboardDisconnect(uint32_t u32ClientId);
1358VBGLR3DECL(int) VbglR3ClipboardGetHostMsg(uint32_t u32ClientId, uint32_t *pMsg, uint32_t *pfFormats);
1359VBGLR3DECL(int) VbglR3ClipboardReadData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb);
1360VBGLR3DECL(int) VbglR3ClipboardReportFormats(uint32_t u32ClientId, uint32_t fFormats);
1361VBGLR3DECL(int) VbglR3ClipboardWriteData(uint32_t u32ClientId, uint32_t fFormat, void *pv, uint32_t cb);
1362
1363__END_DECLS
1364
1365#endif /* IN_RING3 */
1366
1367#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