VirtualBox

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

Last change on this file since 3741 was 3738, checked in by vboxsync, 17 years ago

Convenient to be able to send log string in release builds too.

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