VirtualBox

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

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

AMD64 -> RT_ARCH_AMD64; X86 -> RT_ARCH_X86; [OS] -> RT_OS_[OS].

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