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