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