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