VirtualBox

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

Last change on this file since 3585 was 3585, checked in by vboxsync, 18 years ago

VRDP NO_COM code.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette