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