1 | /** @file
|
---|
2 | * Drag and Drop service - Common header for host service and guest clients.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2011-2015 Oracle Corporation
|
---|
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 |
|
---|
26 | #ifndef ___VBox_HostService_DragAndDropSvc_h
|
---|
27 | #define ___VBox_HostService_DragAndDropSvc_h
|
---|
28 |
|
---|
29 | #include <VBox/hgcmsvc.h>
|
---|
30 | #include <VBox/VMMDev.h>
|
---|
31 | #include <VBox/VBoxGuest2.h>
|
---|
32 |
|
---|
33 | /*
|
---|
34 | * The mode of operations.
|
---|
35 | */
|
---|
36 | #define VBOX_DRAG_AND_DROP_MODE_OFF 0
|
---|
37 | #define VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST 1
|
---|
38 | #define VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST 2
|
---|
39 | #define VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL 3
|
---|
40 |
|
---|
41 | #define DND_IGNORE_ACTION UINT32_C(0)
|
---|
42 | #define DND_COPY_ACTION RT_BIT_32(0)
|
---|
43 | #define DND_MOVE_ACTION RT_BIT_32(1)
|
---|
44 | #define DND_LINK_ACTION RT_BIT_32(2)
|
---|
45 |
|
---|
46 | #define hasDnDCopyAction(a) ((a) & DND_COPY_ACTION)
|
---|
47 | #define hasDnDMoveAction(a) ((a) & DND_MOVE_ACTION)
|
---|
48 | #define hasDnDLinkAction(a) ((a) & DND_LINK_ACTION)
|
---|
49 |
|
---|
50 | #define isDnDIgnoreAction(a) ((a) == DND_IGNORE_ACTION)
|
---|
51 | #define isDnDCopyAction(a) ((a) == DND_COPY_ACTION)
|
---|
52 | #define isDnDMoveAction(a) ((a) == DND_MOVE_ACTION)
|
---|
53 | #define isDnDLinkAction(a) ((a) == DND_LINK_ACTION)
|
---|
54 |
|
---|
55 | /** @def VBOX_DND_FORMATS_DEFAULT
|
---|
56 | * Default drag'n drop formats.
|
---|
57 | * Note: If you add new entries here, make sure you test those
|
---|
58 | * with all supported guest OSes!
|
---|
59 | */
|
---|
60 | #define VBOX_DND_FORMATS_DEFAULT \
|
---|
61 | "text/uri-list", \
|
---|
62 | /* Text. */ \
|
---|
63 | "text/html", \
|
---|
64 | "text/plain;charset=utf-8", \
|
---|
65 | "text/plain;charset=utf-16", \
|
---|
66 | "text/plain", \
|
---|
67 | "text/richtext", \
|
---|
68 | "UTF8_STRING", \
|
---|
69 | "TEXT", \
|
---|
70 | "STRING", \
|
---|
71 | /* OpenOffice formats. */ \
|
---|
72 | /* See: https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Common_Application_Features#OpenOffice.org_Clipboard_Data_Formats */ \
|
---|
73 | "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", \
|
---|
74 | "application/x-openoffice;windows_formatname=\"Bitmap\""
|
---|
75 |
|
---|
76 | namespace DragAndDropSvc {
|
---|
77 |
|
---|
78 | /******************************************************************************
|
---|
79 | * Typedefs, constants and inlines *
|
---|
80 | ******************************************************************************/
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * The service functions which are callable by host.
|
---|
84 | * Note: When adding new functions to this table, make sure that the actual ID
|
---|
85 | * does *not* overlap with the eGuestFn enumeration below!
|
---|
86 | */
|
---|
87 | enum eHostFn
|
---|
88 | {
|
---|
89 | /** The host just has set a new DnD mode. */
|
---|
90 | HOST_DND_SET_MODE = 100,
|
---|
91 |
|
---|
92 | /*
|
---|
93 | * Host -> Guest messages
|
---|
94 | */
|
---|
95 |
|
---|
96 | /** The host entered the VM window for starting an actual
|
---|
97 | * DnD operation. */
|
---|
98 | HOST_DND_HG_EVT_ENTER = 200,
|
---|
99 | /** The host's DnD cursor moved within the VM window. */
|
---|
100 | HOST_DND_HG_EVT_MOVE = 201,
|
---|
101 | /** The host left the guest VM window. */
|
---|
102 | HOST_DND_HG_EVT_LEAVE = 202,
|
---|
103 | /** The host issued a "drop" event, meaning that the host is
|
---|
104 | * ready to transfer data over to the guest. */
|
---|
105 | HOST_DND_HG_EVT_DROPPED = 203,
|
---|
106 | /** The host requested to cancel the current DnD operation. */
|
---|
107 | HOST_DND_HG_EVT_CANCEL = 204,
|
---|
108 | /** Gets the actual MIME data, based on
|
---|
109 | * the format(s) specified by HOST_DND_HG_EVT_ENTER. If the guest
|
---|
110 | * supplied buffer too small to send the actual data, the host
|
---|
111 | * will send a HOST_DND_HG_SND_MORE_DATA message as follow-up. */
|
---|
112 | HOST_DND_HG_SND_DATA = 205,
|
---|
113 | /** Sent when the actual buffer for HOST_DND_HG_SND_DATA
|
---|
114 | * was too small, issued by the DnD host service. */
|
---|
115 | HOST_DND_HG_SND_MORE_DATA = 206,
|
---|
116 | /** Directory entry to be sent to the guest. */
|
---|
117 | HOST_DND_HG_SND_DIR = 207,
|
---|
118 | /** File data chunk to send to the guest. */
|
---|
119 | HOST_DND_HG_SND_FILE_DATA = 208,
|
---|
120 | /** File header to send to the guest.
|
---|
121 | * Note: Only for protocol version 2 and up (>= VBox 5.0). */
|
---|
122 | HOST_DND_HG_SND_FILE_HDR = 209,
|
---|
123 |
|
---|
124 | /*
|
---|
125 | * Guest -> Host messages
|
---|
126 | */
|
---|
127 |
|
---|
128 | /** The host asks the guest whether a DnD operation
|
---|
129 | * is in progress when the mouse leaves the guest window. */
|
---|
130 | HOST_DND_GH_REQ_PENDING = 600,
|
---|
131 | /** The host informs the guest that a DnD drop operation
|
---|
132 | * has been started and that the host wants the data in
|
---|
133 | * a specific MIME type. */
|
---|
134 | HOST_DND_GH_EVT_DROPPED = 601,
|
---|
135 | /** Creates a directory on the guest. */
|
---|
136 | HOST_DND_GH_RECV_DIR = 650,
|
---|
137 | /** Retrieves file data from the guest. */
|
---|
138 | HOST_DND_GH_RECV_FILE_DATA = 670,
|
---|
139 | /** Retrieves a file header from the guest.
|
---|
140 | * Note: Only for protocol version 2 and up (>= VBox 5.0). */
|
---|
141 | HOST_DND_GH_RECV_FILE_HDR = 671,
|
---|
142 | /** Blow the type up to 32-bit. */
|
---|
143 | HOST_DND_32BIT_HACK = 0x7fffffff
|
---|
144 | };
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * The service functions which are called by guest.
|
---|
148 | * Note: When adding new functions to this table, make sure that the actual ID
|
---|
149 | * does *not* overlap with the eHostFn enumeration above!
|
---|
150 | */
|
---|
151 | enum eGuestFn
|
---|
152 | {
|
---|
153 | /* Guest sends a connection request to the HGCM service.
|
---|
154 | * Note: New since protocol version 2. */
|
---|
155 | GUEST_DND_CONNECT = 10,
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * Guest waits for a new message the host wants to process
|
---|
159 | * on the guest side. This can be a blocking call.
|
---|
160 | */
|
---|
161 | GUEST_DND_GET_NEXT_HOST_MSG = 300,
|
---|
162 |
|
---|
163 | /*
|
---|
164 | * Host -> Guest operation messages.
|
---|
165 | */
|
---|
166 |
|
---|
167 | /** The guest acknowledges that the pending DnD data from
|
---|
168 | * the host can be dropped on the currently selected source
|
---|
169 | * on the guest. */
|
---|
170 | GUEST_DND_HG_ACK_OP = 400,
|
---|
171 | /** The guest requests the actual DnD data to be sent
|
---|
172 | * from the host. */
|
---|
173 | GUEST_DND_HG_REQ_DATA = 401,
|
---|
174 | /** Reports back the guest's progress on a host -> guest operation. */
|
---|
175 | GUEST_DND_HG_EVT_PROGRESS = 402,
|
---|
176 |
|
---|
177 | /*
|
---|
178 | * Guest -> Host operation messages.
|
---|
179 | */
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * The guests acknowledges that it currently has a drag'n drop
|
---|
183 | * operation in progress on the guest, which eventually could be
|
---|
184 | * dragged over to the host.
|
---|
185 | */
|
---|
186 | GUEST_DND_GH_ACK_PENDING = 500,
|
---|
187 | /**
|
---|
188 | * Sends data of the requested format to the host. There can
|
---|
189 | * be more than one message if the actual data does not fit
|
---|
190 | * into one.
|
---|
191 | */
|
---|
192 | GUEST_DND_GH_SND_DATA = 501,
|
---|
193 | /** Reports an error back to the host. */
|
---|
194 | GUEST_DND_GH_EVT_ERROR = 502,
|
---|
195 | /** Guest sends a directory entry to the host. */
|
---|
196 | GUEST_DND_GH_SND_DIR = 700,
|
---|
197 | /** Guest sends file data to the host. */
|
---|
198 | /* Note: On protocol version 1 this also contains the file name
|
---|
199 | * and other attributes. */
|
---|
200 | GUEST_DND_GH_SND_FILE_DATA = 701,
|
---|
201 | /** Guest sends a file header to the host, marking the
|
---|
202 | * beginning of a (new) file transfer.
|
---|
203 | * Note: Available since protocol version 2 (VBox 5.0). */
|
---|
204 | GUEST_DND_GH_SND_FILE_HDR = 702,
|
---|
205 | /** Blow the type up to 32-bit. */
|
---|
206 | GUEST_DND_32BIT_HACK = 0x7fffffff
|
---|
207 | };
|
---|
208 |
|
---|
209 | /**
|
---|
210 | * DnD operation progress states.
|
---|
211 | */
|
---|
212 | typedef enum DNDPROGRESS
|
---|
213 | {
|
---|
214 | DND_PROGRESS_UNKNOWN = 0,
|
---|
215 | DND_PROGRESS_RUNNING = 1,
|
---|
216 | DND_PROGRESS_COMPLETE,
|
---|
217 | DND_PROGRESS_CANCELLED,
|
---|
218 | DND_PROGRESS_ERROR,
|
---|
219 | /** Blow the type up to 32-bit. */
|
---|
220 | DND_PROGRESS_32BIT_HACK = 0x7fffffff
|
---|
221 | } DNDPROGRESS, *PDNDPROGRESS;
|
---|
222 |
|
---|
223 | #pragma pack (1)
|
---|
224 |
|
---|
225 | /*
|
---|
226 | * Host events
|
---|
227 | */
|
---|
228 |
|
---|
229 | typedef struct VBOXDNDHGACTIONMSG
|
---|
230 | {
|
---|
231 | VBoxGuestHGCMCallInfo hdr;
|
---|
232 |
|
---|
233 | /**
|
---|
234 | * HG Action event.
|
---|
235 | *
|
---|
236 | * Used by:
|
---|
237 | * HOST_DND_HG_EVT_ENTER
|
---|
238 | * HOST_DND_HG_EVT_MOVE
|
---|
239 | * HOST_DND_HG_EVT_DROPPED
|
---|
240 | */
|
---|
241 | HGCMFunctionParameter uScreenId; /* OUT uint32_t */
|
---|
242 | HGCMFunctionParameter uX; /* OUT uint32_t */
|
---|
243 | HGCMFunctionParameter uY; /* OUT uint32_t */
|
---|
244 | HGCMFunctionParameter uDefAction; /* OUT uint32_t */
|
---|
245 | HGCMFunctionParameter uAllActions; /* OUT uint32_t */
|
---|
246 | HGCMFunctionParameter pvFormats; /* OUT ptr */
|
---|
247 | HGCMFunctionParameter cFormats; /* OUT uint32_t */
|
---|
248 | } VBOXDNDHGACTIONMSG;
|
---|
249 |
|
---|
250 | typedef struct VBOXDNDHGLEAVEMSG
|
---|
251 | {
|
---|
252 | VBoxGuestHGCMCallInfo hdr;
|
---|
253 | /**
|
---|
254 | * HG Leave event.
|
---|
255 | *
|
---|
256 | * Used by:
|
---|
257 | * HOST_DND_HG_EVT_LEAVE
|
---|
258 | */
|
---|
259 | } VBOXDNDHGLEAVEMSG;
|
---|
260 |
|
---|
261 | typedef struct VBOXDNDHGCANCELMSG
|
---|
262 | {
|
---|
263 | VBoxGuestHGCMCallInfo hdr;
|
---|
264 |
|
---|
265 | /**
|
---|
266 | * HG Cancel return event.
|
---|
267 | *
|
---|
268 | * Used by:
|
---|
269 | * HOST_DND_HG_EVT_CANCEL
|
---|
270 | */
|
---|
271 | } VBOXDNDHGCANCELMSG;
|
---|
272 |
|
---|
273 | typedef struct VBOXDNDHGSENDDATAMSG
|
---|
274 | {
|
---|
275 | VBoxGuestHGCMCallInfo hdr;
|
---|
276 |
|
---|
277 | /**
|
---|
278 | * HG Send Data event.
|
---|
279 | *
|
---|
280 | * Used by:
|
---|
281 | * HOST_DND_HG_SND_DATA
|
---|
282 | */
|
---|
283 | HGCMFunctionParameter uScreenId; /* OUT uint32_t */
|
---|
284 | HGCMFunctionParameter pvFormat; /* OUT ptr */
|
---|
285 | HGCMFunctionParameter cFormat; /* OUT uint32_t */
|
---|
286 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
287 | HGCMFunctionParameter cbData; /* OUT uint32_t */
|
---|
288 | } VBOXDNDHGSENDDATAMSG;
|
---|
289 |
|
---|
290 | typedef struct VBOXDNDHGSENDMOREDATAMSG
|
---|
291 | {
|
---|
292 | VBoxGuestHGCMCallInfo hdr;
|
---|
293 |
|
---|
294 | /**
|
---|
295 | * HG Send More Data event.
|
---|
296 | *
|
---|
297 | * Used by:
|
---|
298 | * HOST_DND_HG_SND_MORE_DATA
|
---|
299 | */
|
---|
300 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
301 | HGCMFunctionParameter cbData; /* OUT uint32_t */
|
---|
302 | } VBOXDNDHGSENDMOREDATAMSG;
|
---|
303 |
|
---|
304 | typedef struct VBOXDNDHGSENDDIRMSG
|
---|
305 | {
|
---|
306 | VBoxGuestHGCMCallInfo hdr;
|
---|
307 |
|
---|
308 | /**
|
---|
309 | * HG Directory event.
|
---|
310 | *
|
---|
311 | * Used by:
|
---|
312 | * HOST_DND_HG_SND_DIR
|
---|
313 | */
|
---|
314 | HGCMFunctionParameter pvName; /* OUT ptr */
|
---|
315 | HGCMFunctionParameter cbName; /* OUT uint32_t */
|
---|
316 | HGCMFunctionParameter fMode; /* OUT uint32_t */
|
---|
317 | } VBOXDNDHGSENDDIRMSG;
|
---|
318 |
|
---|
319 | /**
|
---|
320 | * File header event.
|
---|
321 | * Note: Only for protocol version 2 and up.
|
---|
322 | *
|
---|
323 | * Used by:
|
---|
324 | * HOST_DND_HG_SND_FILE_HDR
|
---|
325 | * HOST_DND_GH_SND_FILE_HDR
|
---|
326 | */
|
---|
327 | typedef struct VBOXDNDHGSENDFILEHDRMSG
|
---|
328 | {
|
---|
329 | VBoxGuestHGCMCallInfo hdr;
|
---|
330 |
|
---|
331 | /** Context ID. Unused at the moment. */
|
---|
332 | HGCMFunctionParameter uContext; /* OUT uint32_t */
|
---|
333 | /** File path. */
|
---|
334 | HGCMFunctionParameter pvName; /* OUT ptr */
|
---|
335 | /** Size (in bytes) of file path. */
|
---|
336 | HGCMFunctionParameter cbName; /* OUT uint32_t */
|
---|
337 | /** Optional flags; unused at the moment. */
|
---|
338 | HGCMFunctionParameter uFlags; /* OUT uint32_t */
|
---|
339 | /** File creation mode. */
|
---|
340 | HGCMFunctionParameter fMode; /* OUT uint32_t */
|
---|
341 | /** Total size (in bytes). */
|
---|
342 | HGCMFunctionParameter cbTotal; /* OUT uint64_t */
|
---|
343 |
|
---|
344 | } VBOXDNDHGSENDFILEHDRMSG;
|
---|
345 |
|
---|
346 | /**
|
---|
347 | * HG: File data (chunk) event.
|
---|
348 | *
|
---|
349 | * Used by:
|
---|
350 | * HOST_DND_HG_SND_FILE
|
---|
351 | */
|
---|
352 | typedef struct VBOXDNDHGSENDFILEDATAMSG
|
---|
353 | {
|
---|
354 | VBoxGuestHGCMCallInfo hdr;
|
---|
355 |
|
---|
356 | union
|
---|
357 | {
|
---|
358 | /* Note: Protocol v1 sends the file name + file mode
|
---|
359 | * every time a file data chunk is being sent. */
|
---|
360 | struct
|
---|
361 | {
|
---|
362 | HGCMFunctionParameter pvName; /* OUT ptr */
|
---|
363 | HGCMFunctionParameter cbName; /* OUT uint32_t */
|
---|
364 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
365 | HGCMFunctionParameter cbData; /* OUT uint32_t */
|
---|
366 | HGCMFunctionParameter fMode; /* OUT uint32_t */
|
---|
367 | } v1;
|
---|
368 | struct
|
---|
369 | {
|
---|
370 | /** Note: pvName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
|
---|
371 | /** Note: cbName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
|
---|
372 | /** Context ID. Unused at the moment. */
|
---|
373 | HGCMFunctionParameter uContext; /* OUT uint32_t */
|
---|
374 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
375 | HGCMFunctionParameter cbData; /* OUT uint32_t */
|
---|
376 | /** Note: fMode is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
|
---|
377 | } v2;
|
---|
378 | } u;
|
---|
379 |
|
---|
380 | } VBOXDNDHGSENDFILEDATAMSG;
|
---|
381 |
|
---|
382 | typedef struct VBOXDNDGHREQPENDINGMSG
|
---|
383 | {
|
---|
384 | VBoxGuestHGCMCallInfo hdr;
|
---|
385 |
|
---|
386 | /**
|
---|
387 | * GH Request Pending event.
|
---|
388 | *
|
---|
389 | * Used by:
|
---|
390 | * HOST_DND_GH_REQ_PENDING
|
---|
391 | */
|
---|
392 | HGCMFunctionParameter uScreenId; /* OUT uint32_t */
|
---|
393 | } VBOXDNDGHREQPENDINGMSG;
|
---|
394 |
|
---|
395 | typedef struct VBOXDNDGHDROPPEDMSG
|
---|
396 | {
|
---|
397 | VBoxGuestHGCMCallInfo hdr;
|
---|
398 |
|
---|
399 | /**
|
---|
400 | * GH Dropped event.
|
---|
401 | *
|
---|
402 | * Used by:
|
---|
403 | * HOST_DND_GH_EVT_DROPPED
|
---|
404 | */
|
---|
405 | HGCMFunctionParameter pvFormat; /* OUT ptr */
|
---|
406 | HGCMFunctionParameter cFormat; /* OUT uint32_t */
|
---|
407 | HGCMFunctionParameter uAction; /* OUT uint32_t */
|
---|
408 | } VBOXDNDGHDROPPEDMSG;
|
---|
409 |
|
---|
410 | /*
|
---|
411 | * Guest events
|
---|
412 | */
|
---|
413 |
|
---|
414 | /**
|
---|
415 | * The returned command the host wants to
|
---|
416 | * run on the guest.
|
---|
417 | *
|
---|
418 | * Used by:
|
---|
419 | * GUEST_DND_GET_NEXT_HOST_MSG
|
---|
420 | */
|
---|
421 | typedef struct VBOXDNDNEXTMSGMSG
|
---|
422 | {
|
---|
423 | VBoxGuestHGCMCallInfo hdr;
|
---|
424 |
|
---|
425 | HGCMFunctionParameter msg; /* OUT uint32_t */
|
---|
426 | /** Number of parameters the message needs. */
|
---|
427 | HGCMFunctionParameter num_parms; /* OUT uint32_t */
|
---|
428 | /** Whether or not to block (wait) for a
|
---|
429 | * new message to arrive. */
|
---|
430 | HGCMFunctionParameter block; /* OUT uint32_t */
|
---|
431 |
|
---|
432 | } VBOXDNDNEXTMSGMSG;
|
---|
433 |
|
---|
434 | /**
|
---|
435 | * Connection request. Used to tell the DnD protocol
|
---|
436 | * version to the (host) service.
|
---|
437 | *
|
---|
438 | * Used by:
|
---|
439 | * GUEST_DND_CONNECT
|
---|
440 | */
|
---|
441 | typedef struct VBOXDNDCONNECTPMSG
|
---|
442 | {
|
---|
443 | VBoxGuestHGCMCallInfo hdr;
|
---|
444 |
|
---|
445 | /** Protocol version to use. */
|
---|
446 | HGCMFunctionParameter uProtocol; /* OUT uint32_t */
|
---|
447 | /** Connection flags. Optional. */
|
---|
448 | HGCMFunctionParameter uFlags; /* OUT uint32_t */
|
---|
449 |
|
---|
450 | } VBOXDNDCONNECTPMSG;
|
---|
451 |
|
---|
452 | /**
|
---|
453 | * HG Acknowledge Operation event.
|
---|
454 | *
|
---|
455 | * Used by:
|
---|
456 | * GUEST_DND_HG_ACK_OP
|
---|
457 | */
|
---|
458 | typedef struct VBOXDNDHGACKOPMSG
|
---|
459 | {
|
---|
460 | VBoxGuestHGCMCallInfo hdr;
|
---|
461 |
|
---|
462 | HGCMFunctionParameter uAction; /* OUT uint32_t */
|
---|
463 | } VBOXDNDHGACKOPMSG;
|
---|
464 |
|
---|
465 | /**
|
---|
466 | * HG request for data event.
|
---|
467 | *
|
---|
468 | * Used by:
|
---|
469 | * GUEST_DND_HG_REQ_DATA
|
---|
470 | */
|
---|
471 | typedef struct VBOXDNDHGREQDATAMSG
|
---|
472 | {
|
---|
473 | VBoxGuestHGCMCallInfo hdr;
|
---|
474 |
|
---|
475 | HGCMFunctionParameter pFormat; /* OUT ptr */
|
---|
476 | } VBOXDNDHGREQDATAMSG;
|
---|
477 |
|
---|
478 | typedef struct VBOXDNDHGEVTPROGRESSMSG
|
---|
479 | {
|
---|
480 | VBoxGuestHGCMCallInfo hdr;
|
---|
481 |
|
---|
482 | HGCMFunctionParameter uStatus;
|
---|
483 | HGCMFunctionParameter uPercent;
|
---|
484 | HGCMFunctionParameter rc;
|
---|
485 | } VBOXDNDHGEVTPROGRESSMSG;
|
---|
486 |
|
---|
487 | /**
|
---|
488 | * GH Acknowledge Pending event.
|
---|
489 | *
|
---|
490 | * Used by:
|
---|
491 | * GUEST_DND_GH_ACK_PENDING
|
---|
492 | */
|
---|
493 | typedef struct VBOXDNDGHACKPENDINGMSG
|
---|
494 | {
|
---|
495 | VBoxGuestHGCMCallInfo hdr;
|
---|
496 |
|
---|
497 | HGCMFunctionParameter uDefAction; /* OUT uint32_t */
|
---|
498 | HGCMFunctionParameter uAllActions; /* OUT uint32_t */
|
---|
499 | HGCMFunctionParameter pFormat; /* OUT ptr */
|
---|
500 | } VBOXDNDGHACKPENDINGMSG;
|
---|
501 |
|
---|
502 | /**
|
---|
503 | * GH Send Data event.
|
---|
504 | *
|
---|
505 | * Used by:
|
---|
506 | * GUEST_DND_GH_SND_DATA
|
---|
507 | */
|
---|
508 | typedef struct VBOXDNDGHSENDDATAMSG
|
---|
509 | {
|
---|
510 | VBoxGuestHGCMCallInfo hdr;
|
---|
511 |
|
---|
512 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
513 | /** Total bytes to send. This can be more than
|
---|
514 | * the data block specified in pvData above, e.g.
|
---|
515 | * when sending over file objects afterwards. */
|
---|
516 | HGCMFunctionParameter cbTotalBytes; /* OUT uint32_t */
|
---|
517 | } VBOXDNDGHSENDDATAMSG;
|
---|
518 |
|
---|
519 | /**
|
---|
520 | * GH Directory event.
|
---|
521 | *
|
---|
522 | * Used by:
|
---|
523 | * GUEST_DND_GH_SND_DIR
|
---|
524 | */
|
---|
525 | typedef struct VBOXDNDGHSENDDIRMSG
|
---|
526 | {
|
---|
527 | VBoxGuestHGCMCallInfo hdr;
|
---|
528 |
|
---|
529 | HGCMFunctionParameter pvName; /* OUT ptr */
|
---|
530 | HGCMFunctionParameter cbName; /* OUT uint32_t */
|
---|
531 | HGCMFunctionParameter fMode; /* OUT uint32_t */
|
---|
532 | } VBOXDNDGHSENDDIRMSG;
|
---|
533 |
|
---|
534 | /**
|
---|
535 | * GH File header event.
|
---|
536 | * Note: Only for protocol version 2 and up.
|
---|
537 | *
|
---|
538 | * Used by:
|
---|
539 | * HOST_DND_GH_SND_FILE_HDR
|
---|
540 | */
|
---|
541 | typedef struct VBOXDNDHGSENDFILEHDRMSG VBOXDNDGHSENDFILEHDRMSG;
|
---|
542 |
|
---|
543 | /**
|
---|
544 | * GH File data event.
|
---|
545 | *
|
---|
546 | * Used by:
|
---|
547 | * GUEST_DND_HG_SND_FILE_DATA
|
---|
548 | */
|
---|
549 | typedef struct VBOXDNDGHSENDFILEDATAMSG
|
---|
550 | {
|
---|
551 | VBoxGuestHGCMCallInfo hdr;
|
---|
552 |
|
---|
553 | union
|
---|
554 | {
|
---|
555 | /* Note: Protocol v1 sends the file name + file mode
|
---|
556 | * every time a file data chunk is being sent. */
|
---|
557 | struct
|
---|
558 | {
|
---|
559 | HGCMFunctionParameter pvName; /* OUT ptr */
|
---|
560 | HGCMFunctionParameter cbName; /* OUT uint32_t */
|
---|
561 | HGCMFunctionParameter fMode; /* OUT uint32_t */
|
---|
562 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
563 | HGCMFunctionParameter cbData; /* OUT uint32_t */
|
---|
564 | } v1;
|
---|
565 | struct
|
---|
566 | {
|
---|
567 | /** Note: pvName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
|
---|
568 | /** Note: cbName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
|
---|
569 | /** Context ID. Unused at the moment. */
|
---|
570 | HGCMFunctionParameter uContext; /* OUT uint32_t */
|
---|
571 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
572 | HGCMFunctionParameter cbData; /* OUT uint32_t */
|
---|
573 | /** Note: fMode is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
|
---|
574 | } v2;
|
---|
575 | } u;
|
---|
576 |
|
---|
577 | } VBOXDNDGHSENDFILEDATAMSG;
|
---|
578 |
|
---|
579 | /**
|
---|
580 | * GH Error event.
|
---|
581 | *
|
---|
582 | * Used by:
|
---|
583 | * GUEST_DND_GH_EVT_ERROR
|
---|
584 | */
|
---|
585 | typedef struct VBOXDNDGHEVTERRORMSG
|
---|
586 | {
|
---|
587 | VBoxGuestHGCMCallInfo hdr;
|
---|
588 |
|
---|
589 | HGCMFunctionParameter rc; /* OUT uint32_t */
|
---|
590 | } VBOXDNDGHEVTERRORMSG;
|
---|
591 |
|
---|
592 | #pragma pack()
|
---|
593 |
|
---|
594 | /*
|
---|
595 | * Callback data magics.
|
---|
596 | */
|
---|
597 | enum
|
---|
598 | {
|
---|
599 | CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG = 0x19820126,
|
---|
600 | CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG_DATA = 0x19850630,
|
---|
601 | CB_MAGIC_DND_HG_ACK_OP = 0xe2100b93,
|
---|
602 | CB_MAGIC_DND_HG_REQ_DATA = 0x5cb3faf9,
|
---|
603 | CB_MAGIC_DND_HG_EVT_PROGRESS = 0x8c8a6956,
|
---|
604 | CB_MAGIC_DND_GH_ACK_PENDING = 0xbe975a14,
|
---|
605 | CB_MAGIC_DND_GH_SND_DATA = 0x4eb61bff,
|
---|
606 | CB_MAGIC_DND_GH_SND_DIR = 0x411ca754,
|
---|
607 | CB_MAGIC_DND_GH_SND_FILE_HDR = 0x65e35eaf,
|
---|
608 | CB_MAGIC_DND_GH_SND_FILE_DATA = 0x19840804,
|
---|
609 | CB_MAGIC_DND_GH_EVT_ERROR = 0x117a87c4
|
---|
610 | };
|
---|
611 |
|
---|
612 | typedef struct VBOXDNDCBHEADERDATA
|
---|
613 | {
|
---|
614 | /** Magic number to identify the structure. */
|
---|
615 | uint32_t u32Magic;
|
---|
616 | /** Context ID to identify callback data. */
|
---|
617 | uint32_t u32ContextID;
|
---|
618 | } VBOXDNDCBHEADERDATA, *PVBOXDNDCBHEADERDATA;
|
---|
619 |
|
---|
620 | typedef struct VBOXDNDCBHGGETNEXTHOSTMSG
|
---|
621 | {
|
---|
622 | /** Callback data header. */
|
---|
623 | VBOXDNDCBHEADERDATA hdr;
|
---|
624 | uint32_t uMsg;
|
---|
625 | uint32_t cParms;
|
---|
626 | } VBOXDNDCBHGGETNEXTHOSTMSG, *PVBOXDNDCBHGGETNEXTHOSTMSG;
|
---|
627 |
|
---|
628 | typedef struct VBOXDNDCBHGGETNEXTHOSTMSGDATA
|
---|
629 | {
|
---|
630 | /** Callback data header. */
|
---|
631 | VBOXDNDCBHEADERDATA hdr;
|
---|
632 | uint32_t uMsg;
|
---|
633 | uint32_t cParms;
|
---|
634 | PVBOXHGCMSVCPARM paParms;
|
---|
635 | } VBOXDNDCBHGGETNEXTHOSTMSGDATA, *PVBOXDNDCBHGGETNEXTHOSTMSGDATA;
|
---|
636 |
|
---|
637 | typedef struct VBOXDNDCBHGACKOPDATA
|
---|
638 | {
|
---|
639 | /** Callback data header. */
|
---|
640 | VBOXDNDCBHEADERDATA hdr;
|
---|
641 | uint32_t uAction;
|
---|
642 | } VBOXDNDCBHGACKOPDATA, *PVBOXDNDCBHGACKOPDATA;
|
---|
643 |
|
---|
644 | typedef struct VBOXDNDCBHGREQDATADATA
|
---|
645 | {
|
---|
646 | /** Callback data header. */
|
---|
647 | VBOXDNDCBHEADERDATA hdr;
|
---|
648 | char *pszFormat;
|
---|
649 | uint32_t cbFormat;
|
---|
650 | } VBOXDNDCBHGREQDATADATA, *PVBOXDNDCBHGREQDATADATA;
|
---|
651 |
|
---|
652 | typedef struct VBOXDNDCBHGEVTPROGRESSDATA
|
---|
653 | {
|
---|
654 | /** Callback data header. */
|
---|
655 | VBOXDNDCBHEADERDATA hdr;
|
---|
656 | uint32_t uPercentage;
|
---|
657 | uint32_t uStatus;
|
---|
658 | uint32_t rc;
|
---|
659 | } VBOXDNDCBHGEVTPROGRESSDATA, *PVBOXDNDCBHGEVTPROGRESSDATA;
|
---|
660 |
|
---|
661 | typedef struct VBOXDNDCBGHACKPENDINGDATA
|
---|
662 | {
|
---|
663 | /** Callback data header. */
|
---|
664 | VBOXDNDCBHEADERDATA hdr;
|
---|
665 | uint32_t uDefAction;
|
---|
666 | uint32_t uAllActions;
|
---|
667 | char *pszFormat;
|
---|
668 | uint32_t cbFormat;
|
---|
669 | } VBOXDNDCBGHACKPENDINGDATA, *PVBOXDNDCBGHACKPENDINGDATA;
|
---|
670 |
|
---|
671 | typedef struct VBOXDNDCBSNDDATADATA
|
---|
672 | {
|
---|
673 | /** Callback data header. */
|
---|
674 | VBOXDNDCBHEADERDATA hdr;
|
---|
675 | void *pvData;
|
---|
676 | uint32_t cbData;
|
---|
677 | /** Total metadata size (in bytes). This is transmitted
|
---|
678 | * with every message because the size can change. */
|
---|
679 | uint32_t cbTotalSize;
|
---|
680 | } VBOXDNDCBSNDDATADATA, *PVBOXDNDCBSNDDATADATA;
|
---|
681 |
|
---|
682 | typedef struct VBOXDNDCBSNDDIRDATA
|
---|
683 | {
|
---|
684 | /** Callback data header. */
|
---|
685 | VBOXDNDCBHEADERDATA hdr;
|
---|
686 | char *pszPath;
|
---|
687 | uint32_t cbPath;
|
---|
688 | uint32_t fMode;
|
---|
689 | } VBOXDNDCBSNDDIRDATA, *PVBOXDNDCBSNDDIRDATA;
|
---|
690 |
|
---|
691 | /* Note: Only for protocol version 2 and up (>= VBox 5.0). */
|
---|
692 | typedef struct VBOXDNDCBSNDFILEHDRDATA
|
---|
693 | {
|
---|
694 | /** Callback data header. */
|
---|
695 | VBOXDNDCBHEADERDATA hdr;
|
---|
696 | /** File path (name). */
|
---|
697 | char *pszFilePath;
|
---|
698 | /** Size (in bytes) of file path. */
|
---|
699 | uint32_t cbFilePath;
|
---|
700 | /** Total size (in bytes) of this file. */
|
---|
701 | uint64_t cbSize;
|
---|
702 | /** File (creation) mode. */
|
---|
703 | uint32_t fMode;
|
---|
704 | /** Additional flags. Not used at the moment. */
|
---|
705 | uint32_t fFlags;
|
---|
706 | } VBOXDNDCBSNDFILEHDRDATA, *PVBOXDNDCBSNDFILEHDRDATA;
|
---|
707 |
|
---|
708 | typedef struct VBOXDNDCBSNDFILEDATADATA
|
---|
709 | {
|
---|
710 | /** Callback data header. */
|
---|
711 | VBOXDNDCBHEADERDATA hdr;
|
---|
712 | /** Current file data chunk. */
|
---|
713 | void *pvData;
|
---|
714 | /** Size (in bytes) of current data chunk. */
|
---|
715 | uint32_t cbData;
|
---|
716 | union
|
---|
717 | {
|
---|
718 | struct
|
---|
719 | {
|
---|
720 | /** File path (name). */
|
---|
721 | char *pszFilePath;
|
---|
722 | /** Size (in bytes) of file path. */
|
---|
723 | uint32_t cbFilePath;
|
---|
724 | /** File (creation) mode. */
|
---|
725 | uint32_t fMode;
|
---|
726 | } v1;
|
---|
727 | /* Note: Protocol version 2 has the file attributes (name, size,
|
---|
728 | mode, ...) in the VBOXDNDCBSNDFILEHDRDATA structure. */
|
---|
729 | } u;
|
---|
730 | } VBOXDNDCBSNDFILEDATADATA, *PVBOXDNDCBSNDFILEDATADATA;
|
---|
731 |
|
---|
732 | typedef struct VBOXDNDCBEVTERRORDATA
|
---|
733 | {
|
---|
734 | /** Callback data header. */
|
---|
735 | VBOXDNDCBHEADERDATA hdr;
|
---|
736 | int32_t rc;
|
---|
737 | } VBOXDNDCBEVTERRORDATA, *PVBOXDNDCBEVTERRORDATA;
|
---|
738 |
|
---|
739 | } /* namespace DragAndDropSvc */
|
---|
740 |
|
---|
741 | #endif /* !___VBox_HostService_DragAndDropSvc_h */
|
---|
742 |
|
---|