1 | /** @file
|
---|
2 | * Shared Folders: Common header for host service and guest clients.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2013 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_shflsvc_h
|
---|
27 | #define ___VBox_shflsvc_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 | #include <VBox/VBoxGuest2.h>
|
---|
31 | #include <VBox/VMMDev.h>
|
---|
32 | #include <VBox/hgcmsvc.h>
|
---|
33 | #include <iprt/fs.h>
|
---|
34 |
|
---|
35 |
|
---|
36 | /** @name Some bit flag manipulation macros.
|
---|
37 | * @{ */
|
---|
38 | #ifndef BIT_FLAG
|
---|
39 | #define BIT_FLAG(__Field,__Flag) ((__Field) & (__Flag))
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #ifndef BIT_FLAG_SET
|
---|
43 | #define BIT_FLAG_SET(__Field,__Flag) ((__Field) |= (__Flag))
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #ifndef BIT_FLAG_CLEAR
|
---|
47 | #define BIT_FLAG_CLEAR(__Field,__Flag) ((__Field) &= ~(__Flag))
|
---|
48 | #endif
|
---|
49 | /** @} */
|
---|
50 |
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Structures shared between guest and the service
|
---|
54 | * can be relocated and use offsets to point to variable
|
---|
55 | * length parts.
|
---|
56 | */
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Shared folders protocol works with handles.
|
---|
60 | * Before doing any action on a file system object,
|
---|
61 | * one have to obtain the object handle via a SHFL_FN_CREATE
|
---|
62 | * request. A handle must be closed with SHFL_FN_CLOSE.
|
---|
63 | */
|
---|
64 |
|
---|
65 | /** Shared Folders service functions. (guest)
|
---|
66 | * @{
|
---|
67 | */
|
---|
68 |
|
---|
69 | /** Query mappings changes. */
|
---|
70 | #define SHFL_FN_QUERY_MAPPINGS (1)
|
---|
71 | /** Query mappings changes. */
|
---|
72 | #define SHFL_FN_QUERY_MAP_NAME (2)
|
---|
73 | /** Open/create object. */
|
---|
74 | #define SHFL_FN_CREATE (3)
|
---|
75 | /** Close object handle. */
|
---|
76 | #define SHFL_FN_CLOSE (4)
|
---|
77 | /** Read object content. */
|
---|
78 | #define SHFL_FN_READ (5)
|
---|
79 | /** Write new object content. */
|
---|
80 | #define SHFL_FN_WRITE (6)
|
---|
81 | /** Lock/unlock a range in the object. */
|
---|
82 | #define SHFL_FN_LOCK (7)
|
---|
83 | /** List object content. */
|
---|
84 | #define SHFL_FN_LIST (8)
|
---|
85 | /** Query/set object information. */
|
---|
86 | #define SHFL_FN_INFORMATION (9)
|
---|
87 | /** Remove object */
|
---|
88 | #define SHFL_FN_REMOVE (11)
|
---|
89 | /** Map folder (legacy) */
|
---|
90 | #define SHFL_FN_MAP_FOLDER_OLD (12)
|
---|
91 | /** Unmap folder */
|
---|
92 | #define SHFL_FN_UNMAP_FOLDER (13)
|
---|
93 | /** Rename object (possibly moving it to another directory) */
|
---|
94 | #define SHFL_FN_RENAME (14)
|
---|
95 | /** Flush file */
|
---|
96 | #define SHFL_FN_FLUSH (15)
|
---|
97 | /** @todo macl, a description, please. */
|
---|
98 | #define SHFL_FN_SET_UTF8 (16)
|
---|
99 | /** Map folder */
|
---|
100 | #define SHFL_FN_MAP_FOLDER (17)
|
---|
101 | /** Read symlink destination (as of VBox 4.0) */
|
---|
102 | #define SHFL_FN_READLINK (18)
|
---|
103 | /** Create symlink (as of VBox 4.0) */
|
---|
104 | #define SHFL_FN_SYMLINK (19)
|
---|
105 | /** Ask host to show symlinks (as of VBox 4.0) */
|
---|
106 | #define SHFL_FN_SET_SYMLINKS (20)
|
---|
107 |
|
---|
108 | /** @} */
|
---|
109 |
|
---|
110 | /** Shared Folders service functions. (host)
|
---|
111 | * @{
|
---|
112 | */
|
---|
113 |
|
---|
114 | /** Add shared folder mapping. */
|
---|
115 | #define SHFL_FN_ADD_MAPPING (1)
|
---|
116 | /** Remove shared folder mapping. */
|
---|
117 | #define SHFL_FN_REMOVE_MAPPING (2)
|
---|
118 | /** Set the led status light address. */
|
---|
119 | #define SHFL_FN_SET_STATUS_LED (3)
|
---|
120 | /** Allow the guest to create symbolic links (as of VBox 4.0) */
|
---|
121 | #define SHFL_FN_ALLOW_SYMLINKS_CREATE (4)
|
---|
122 | /** @} */
|
---|
123 |
|
---|
124 | /** Root handle for a mapping. Root handles are unique.
|
---|
125 | * @note
|
---|
126 | * Function parameters structures consider
|
---|
127 | * the root handle as 32 bit value. If the typedef
|
---|
128 | * will be changed, then function parameters must be
|
---|
129 | * changed accordingly. All those parameters are marked
|
---|
130 | * with SHFLROOT in comments.
|
---|
131 | */
|
---|
132 | typedef uint32_t SHFLROOT;
|
---|
133 |
|
---|
134 | #define SHFL_ROOT_NIL ((SHFLROOT)~0)
|
---|
135 |
|
---|
136 |
|
---|
137 | /** A shared folders handle for an opened object. */
|
---|
138 | typedef uint64_t SHFLHANDLE;
|
---|
139 |
|
---|
140 | #define SHFL_HANDLE_NIL ((SHFLHANDLE)~0LL)
|
---|
141 | #define SHFL_HANDLE_ROOT ((SHFLHANDLE)0LL)
|
---|
142 |
|
---|
143 | /** Hardcoded maximum length (in chars) of a shared folder name. */
|
---|
144 | #define SHFL_MAX_LEN (256)
|
---|
145 | /** Hardcoded maximum number of shared folder mapping available to the guest. */
|
---|
146 | #define SHFL_MAX_MAPPINGS (64)
|
---|
147 |
|
---|
148 | /** @name Shared Folders strings. They can be either UTF-8 or UTF-16.
|
---|
149 | * @{
|
---|
150 | */
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * Shared folder string buffer structure.
|
---|
154 | */
|
---|
155 | typedef struct _SHFLSTRING
|
---|
156 | {
|
---|
157 | /** Size of the String member in bytes. */
|
---|
158 | uint16_t u16Size;
|
---|
159 |
|
---|
160 | /** Length of string without trailing nul in bytes. */
|
---|
161 | uint16_t u16Length;
|
---|
162 |
|
---|
163 | /** UTF-8 or UTF-16 string. Nul terminated. */
|
---|
164 | union
|
---|
165 | {
|
---|
166 | uint8_t utf8[1];
|
---|
167 | uint16_t ucs2[1];
|
---|
168 | } String;
|
---|
169 | } SHFLSTRING;
|
---|
170 |
|
---|
171 | /** Pointer to a shared folder string buffer. */
|
---|
172 | typedef SHFLSTRING *PSHFLSTRING;
|
---|
173 | /** Pointer to a const shared folder string buffer. */
|
---|
174 | typedef const SHFLSTRING *PCSHFLSTRING;
|
---|
175 |
|
---|
176 | /** Calculate size of the string. */
|
---|
177 | DECLINLINE(uint32_t) ShflStringSizeOfBuffer(PCSHFLSTRING pString)
|
---|
178 | {
|
---|
179 | return pString ? sizeof(SHFLSTRING) - sizeof(pString->String) + pString->u16Size : 0;
|
---|
180 | }
|
---|
181 |
|
---|
182 | DECLINLINE(uint32_t) ShflStringLength(PCSHFLSTRING pString)
|
---|
183 | {
|
---|
184 | return pString ? pString->u16Length : 0;
|
---|
185 | }
|
---|
186 |
|
---|
187 | DECLINLINE(PSHFLSTRING) ShflStringInitBuffer(void *pvBuffer, uint32_t u32Size)
|
---|
188 | {
|
---|
189 | PSHFLSTRING pString = NULL;
|
---|
190 | const uint32_t u32HeaderSize = sizeof(SHFLSTRING);
|
---|
191 |
|
---|
192 | /*
|
---|
193 | * Check that the buffer size is big enough to hold a zero sized string
|
---|
194 | * and is not too big to fit into 16 bit variables.
|
---|
195 | */
|
---|
196 | if (u32Size >= u32HeaderSize && u32Size - u32HeaderSize <= 0xFFFF)
|
---|
197 | {
|
---|
198 | pString = (PSHFLSTRING)pvBuffer;
|
---|
199 | pString->u16Size = u32Size - u32HeaderSize;
|
---|
200 | pString->u16Length = 0;
|
---|
201 | }
|
---|
202 |
|
---|
203 | return pString;
|
---|
204 | }
|
---|
205 |
|
---|
206 | /**
|
---|
207 | * Validates a HGCM string output parameter.
|
---|
208 | *
|
---|
209 | * @returns true if valid, false if not.
|
---|
210 | *
|
---|
211 | * @param pString The string buffer pointer.
|
---|
212 | * @param cbBuf The buffer size from the parameter.
|
---|
213 | */
|
---|
214 | DECLINLINE(bool) ShflStringIsValidOut(PCSHFLSTRING pString, uint32_t cbBuf)
|
---|
215 | {
|
---|
216 | if (RT_UNLIKELY(cbBuf <= RT_UOFFSETOF(SHFLSTRING, String)))
|
---|
217 | return false;
|
---|
218 | if (RT_UNLIKELY((uint32_t)pString->u16Size + RT_UOFFSETOF(SHFLSTRING, String) > cbBuf))
|
---|
219 | return false;
|
---|
220 | if (RT_UNLIKELY(pString->u16Length >= pString->u16Size))
|
---|
221 | return false;
|
---|
222 | return true;
|
---|
223 | }
|
---|
224 |
|
---|
225 | /**
|
---|
226 | * Validates a HGCM string input parameter.
|
---|
227 | *
|
---|
228 | * @returns true if valid, false if not.
|
---|
229 | *
|
---|
230 | * @param pString The string buffer pointer.
|
---|
231 | * @param cbBuf The buffer size from the parameter.
|
---|
232 | * @param fUtf8Not16 Set if UTF-8 encoding, clear if UTF-16 encoding.
|
---|
233 | */
|
---|
234 | DECLINLINE(bool) ShflStringIsValidIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16)
|
---|
235 | {
|
---|
236 | int rc;
|
---|
237 | if (RT_UNLIKELY(cbBuf <= RT_UOFFSETOF(SHFLSTRING, String)))
|
---|
238 | return false;
|
---|
239 | if (RT_UNLIKELY((uint32_t)pString->u16Size + RT_UOFFSETOF(SHFLSTRING, String) > cbBuf))
|
---|
240 | return false;
|
---|
241 | if (fUtf8Not16)
|
---|
242 | {
|
---|
243 | /* UTF-8: */
|
---|
244 | if (RT_UNLIKELY(pString->u16Length >= pString->u16Size))
|
---|
245 | return false;
|
---|
246 | rc = RTStrValidateEncodingEx((const char *)&pString->String.utf8[0], pString->u16Length + 1,
|
---|
247 | RTSTR_VALIDATE_ENCODING_EXACT_LENGTH | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
|
---|
248 | }
|
---|
249 | else
|
---|
250 | {
|
---|
251 | /* UTF-16: */
|
---|
252 | if (RT_UNLIKELY(pString->u16Length & 1))
|
---|
253 | return false;
|
---|
254 | if (RT_UNLIKELY((uint32_t)sizeof(RTUTF16) + pString->u16Length > pString->u16Size))
|
---|
255 | return false;
|
---|
256 | rc = RTUtf16ValidateEncodingEx(&pString->String.ucs2[0], pString->u16Length / 2 + 1,
|
---|
257 | RTSTR_VALIDATE_ENCODING_EXACT_LENGTH | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
|
---|
258 | }
|
---|
259 | if (RT_FAILURE(rc))
|
---|
260 | return false;
|
---|
261 | return true;
|
---|
262 | }
|
---|
263 |
|
---|
264 | /**
|
---|
265 | * Validates an optional HGCM string input parameter.
|
---|
266 | *
|
---|
267 | * @returns true if valid, false if not.
|
---|
268 | *
|
---|
269 | * @param pString The string buffer pointer. Can be NULL.
|
---|
270 | * @param cbBuf The buffer size from the parameter.
|
---|
271 | * @param fUtf8Not16 Set if UTF-8 encoding, clear if UTF-16 encoding.
|
---|
272 | */
|
---|
273 | DECLINLINE(bool) ShflStringIsValidOrNullIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16)
|
---|
274 | {
|
---|
275 | if (pString)
|
---|
276 | return ShflStringIsValidIn(pString, cbBuf, fUtf8Not16);
|
---|
277 | if (RT_UNLIKELY(cbBuf > 0))
|
---|
278 | return false;
|
---|
279 | return true;
|
---|
280 | }
|
---|
281 |
|
---|
282 | /** @} */
|
---|
283 |
|
---|
284 |
|
---|
285 | /**
|
---|
286 | * The available additional information in a SHFLFSOBJATTR object.
|
---|
287 | */
|
---|
288 | typedef enum SHFLFSOBJATTRADD
|
---|
289 | {
|
---|
290 | /** No additional information is available / requested. */
|
---|
291 | SHFLFSOBJATTRADD_NOTHING = 1,
|
---|
292 | /** The additional unix attributes (SHFLFSOBJATTR::u::Unix) are
|
---|
293 | * available / requested. */
|
---|
294 | SHFLFSOBJATTRADD_UNIX,
|
---|
295 | /** The additional extended attribute size (SHFLFSOBJATTR::u::EASize) is
|
---|
296 | * available / requested. */
|
---|
297 | SHFLFSOBJATTRADD_EASIZE,
|
---|
298 | /** The last valid item (inclusive).
|
---|
299 | * The valid range is SHFLFSOBJATTRADD_NOTHING thru
|
---|
300 | * SHFLFSOBJATTRADD_LAST. */
|
---|
301 | SHFLFSOBJATTRADD_LAST = SHFLFSOBJATTRADD_EASIZE,
|
---|
302 |
|
---|
303 | /** The usual 32-bit hack. */
|
---|
304 | SHFLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
|
---|
305 | } SHFLFSOBJATTRADD;
|
---|
306 |
|
---|
307 |
|
---|
308 | /* Assert sizes of the IRPT types we're using below. */
|
---|
309 | AssertCompileSize(RTFMODE, 4);
|
---|
310 | AssertCompileSize(RTFOFF, 8);
|
---|
311 | AssertCompileSize(RTINODE, 8);
|
---|
312 | AssertCompileSize(RTTIMESPEC, 8);
|
---|
313 | AssertCompileSize(RTDEV, 4);
|
---|
314 | AssertCompileSize(RTUID, 4);
|
---|
315 |
|
---|
316 | /**
|
---|
317 | * Shared folder filesystem object attributes.
|
---|
318 | */
|
---|
319 | #pragma pack(1)
|
---|
320 | typedef struct SHFLFSOBJATTR
|
---|
321 | {
|
---|
322 | /** Mode flags (st_mode). RTFS_UNIX_*, RTFS_TYPE_*, and RTFS_DOS_*.
|
---|
323 | * @remarks We depend on a number of RTFS_ defines to remain unchanged.
|
---|
324 | * Fortuntately, these are depending on windows, dos and unix
|
---|
325 | * standard values, so this shouldn't be much of a pain. */
|
---|
326 | RTFMODE fMode;
|
---|
327 |
|
---|
328 | /** The additional attributes available. */
|
---|
329 | SHFLFSOBJATTRADD enmAdditional;
|
---|
330 |
|
---|
331 | /**
|
---|
332 | * Additional attributes.
|
---|
333 | *
|
---|
334 | * Unless explicitly specified to an API, the API can provide additional
|
---|
335 | * data as it is provided by the underlying OS.
|
---|
336 | */
|
---|
337 | union SHFLFSOBJATTRUNION
|
---|
338 | {
|
---|
339 | /** Additional Unix Attributes
|
---|
340 | * These are available when SHFLFSOBJATTRADD is set in fUnix.
|
---|
341 | */
|
---|
342 | struct SHFLFSOBJATTRUNIX
|
---|
343 | {
|
---|
344 | /** The user owning the filesystem object (st_uid).
|
---|
345 | * This field is ~0U if not supported. */
|
---|
346 | RTUID uid;
|
---|
347 |
|
---|
348 | /** The group the filesystem object is assigned (st_gid).
|
---|
349 | * This field is ~0U if not supported. */
|
---|
350 | RTGID gid;
|
---|
351 |
|
---|
352 | /** Number of hard links to this filesystem object (st_nlink).
|
---|
353 | * This field is 1 if the filesystem doesn't support hardlinking or
|
---|
354 | * the information isn't available.
|
---|
355 | */
|
---|
356 | uint32_t cHardlinks;
|
---|
357 |
|
---|
358 | /** The device number of the device which this filesystem object resides on (st_dev).
|
---|
359 | * This field is 0 if this information is not available. */
|
---|
360 | RTDEV INodeIdDevice;
|
---|
361 |
|
---|
362 | /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
|
---|
363 | * Together with INodeIdDevice, this field can be used as a OS wide unique id
|
---|
364 | * when both their values are not 0.
|
---|
365 | * This field is 0 if the information is not available. */
|
---|
366 | RTINODE INodeId;
|
---|
367 |
|
---|
368 | /** User flags (st_flags).
|
---|
369 | * This field is 0 if this information is not available. */
|
---|
370 | uint32_t fFlags;
|
---|
371 |
|
---|
372 | /** The current generation number (st_gen).
|
---|
373 | * This field is 0 if this information is not available. */
|
---|
374 | uint32_t GenerationId;
|
---|
375 |
|
---|
376 | /** The device number of a character or block device type object (st_rdev).
|
---|
377 | * This field is 0 if the file isn't of a character or block device type and
|
---|
378 | * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
|
---|
379 | RTDEV Device;
|
---|
380 | } Unix;
|
---|
381 |
|
---|
382 | /**
|
---|
383 | * Extended attribute size.
|
---|
384 | */
|
---|
385 | struct SHFLFSOBJATTREASIZE
|
---|
386 | {
|
---|
387 | /** Size of EAs. */
|
---|
388 | RTFOFF cb;
|
---|
389 | } EASize;
|
---|
390 | } u;
|
---|
391 | } SHFLFSOBJATTR;
|
---|
392 | #pragma pack()
|
---|
393 | AssertCompileSize(SHFLFSOBJATTR, 44);
|
---|
394 | /** Pointer to a shared folder filesystem object attributes structure. */
|
---|
395 | typedef SHFLFSOBJATTR *PSHFLFSOBJATTR;
|
---|
396 | /** Pointer to a const shared folder filesystem object attributes structure. */
|
---|
397 | typedef const SHFLFSOBJATTR *PCSHFLFSOBJATTR;
|
---|
398 |
|
---|
399 |
|
---|
400 | /**
|
---|
401 | * Filesystem object information structure.
|
---|
402 | */
|
---|
403 | #pragma pack(1)
|
---|
404 | typedef struct SHFLFSOBJINFO
|
---|
405 | {
|
---|
406 | /** Logical size (st_size).
|
---|
407 | * For normal files this is the size of the file.
|
---|
408 | * For symbolic links, this is the length of the path name contained
|
---|
409 | * in the symbolic link.
|
---|
410 | * For other objects this fields needs to be specified.
|
---|
411 | */
|
---|
412 | RTFOFF cbObject;
|
---|
413 |
|
---|
414 | /** Disk allocation size (st_blocks * DEV_BSIZE). */
|
---|
415 | RTFOFF cbAllocated;
|
---|
416 |
|
---|
417 | /** Time of last access (st_atime).
|
---|
418 | * @remarks Here (and other places) we depend on the IPRT timespec to
|
---|
419 | * remain unchanged. */
|
---|
420 | RTTIMESPEC AccessTime;
|
---|
421 |
|
---|
422 | /** Time of last data modification (st_mtime). */
|
---|
423 | RTTIMESPEC ModificationTime;
|
---|
424 |
|
---|
425 | /** Time of last status change (st_ctime).
|
---|
426 | * If not available this is set to ModificationTime.
|
---|
427 | */
|
---|
428 | RTTIMESPEC ChangeTime;
|
---|
429 |
|
---|
430 | /** Time of file birth (st_birthtime).
|
---|
431 | * If not available this is set to ChangeTime.
|
---|
432 | */
|
---|
433 | RTTIMESPEC BirthTime;
|
---|
434 |
|
---|
435 | /** Attributes. */
|
---|
436 | SHFLFSOBJATTR Attr;
|
---|
437 |
|
---|
438 | } SHFLFSOBJINFO;
|
---|
439 | #pragma pack()
|
---|
440 | AssertCompileSize(SHFLFSOBJINFO, 92);
|
---|
441 | /** Pointer to a shared folder filesystem object information structure. */
|
---|
442 | typedef SHFLFSOBJINFO *PSHFLFSOBJINFO;
|
---|
443 | /** Pointer to a const shared folder filesystem object information
|
---|
444 | * structure. */
|
---|
445 | typedef const SHFLFSOBJINFO *PCSHFLFSOBJINFO;
|
---|
446 |
|
---|
447 |
|
---|
448 | /**
|
---|
449 | * Copy file system objinfo from IPRT to shared folder format.
|
---|
450 | *
|
---|
451 | * @param pDst The shared folder structure.
|
---|
452 | * @param pSrc The IPRT structure.
|
---|
453 | */
|
---|
454 | DECLINLINE(void) vbfsCopyFsObjInfoFromIprt(PSHFLFSOBJINFO pDst, PCRTFSOBJINFO pSrc)
|
---|
455 | {
|
---|
456 | pDst->cbObject = pSrc->cbObject;
|
---|
457 | pDst->cbAllocated = pSrc->cbAllocated;
|
---|
458 | pDst->AccessTime = pSrc->AccessTime;
|
---|
459 | pDst->ModificationTime = pSrc->ModificationTime;
|
---|
460 | pDst->ChangeTime = pSrc->ChangeTime;
|
---|
461 | pDst->BirthTime = pSrc->BirthTime;
|
---|
462 | pDst->Attr.fMode = pSrc->Attr.fMode;
|
---|
463 | RT_ZERO(pDst->Attr.u);
|
---|
464 | switch (pSrc->Attr.enmAdditional)
|
---|
465 | {
|
---|
466 | default:
|
---|
467 | case RTFSOBJATTRADD_NOTHING:
|
---|
468 | pDst->Attr.enmAdditional = SHFLFSOBJATTRADD_NOTHING;
|
---|
469 | break;
|
---|
470 |
|
---|
471 | case RTFSOBJATTRADD_UNIX:
|
---|
472 | pDst->Attr.enmAdditional = SHFLFSOBJATTRADD_UNIX;
|
---|
473 | pDst->Attr.u.Unix.uid = pSrc->Attr.u.Unix.uid;
|
---|
474 | pDst->Attr.u.Unix.gid = pSrc->Attr.u.Unix.gid;
|
---|
475 | pDst->Attr.u.Unix.cHardlinks = pSrc->Attr.u.Unix.cHardlinks;
|
---|
476 | pDst->Attr.u.Unix.INodeIdDevice = pSrc->Attr.u.Unix.INodeIdDevice;
|
---|
477 | pDst->Attr.u.Unix.INodeId = pSrc->Attr.u.Unix.INodeId;
|
---|
478 | pDst->Attr.u.Unix.fFlags = pSrc->Attr.u.Unix.fFlags;
|
---|
479 | pDst->Attr.u.Unix.GenerationId = pSrc->Attr.u.Unix.GenerationId;
|
---|
480 | pDst->Attr.u.Unix.Device = pSrc->Attr.u.Unix.Device;
|
---|
481 | break;
|
---|
482 |
|
---|
483 | case RTFSOBJATTRADD_EASIZE:
|
---|
484 | pDst->Attr.enmAdditional = SHFLFSOBJATTRADD_EASIZE;
|
---|
485 | pDst->Attr.u.EASize.cb = pSrc->Attr.u.EASize.cb;
|
---|
486 | break;
|
---|
487 | }
|
---|
488 | }
|
---|
489 |
|
---|
490 |
|
---|
491 | /** Result of an open/create request.
|
---|
492 | * Along with handle value the result code
|
---|
493 | * identifies what has happened while
|
---|
494 | * trying to open the object.
|
---|
495 | */
|
---|
496 | typedef enum _SHFLCREATERESULT
|
---|
497 | {
|
---|
498 | SHFL_NO_RESULT,
|
---|
499 | /** Specified path does not exist. */
|
---|
500 | SHFL_PATH_NOT_FOUND,
|
---|
501 | /** Path to file exists, but the last component does not. */
|
---|
502 | SHFL_FILE_NOT_FOUND,
|
---|
503 | /** File already exists and either has been opened or not. */
|
---|
504 | SHFL_FILE_EXISTS,
|
---|
505 | /** New file was created. */
|
---|
506 | SHFL_FILE_CREATED,
|
---|
507 | /** Existing file was replaced or overwritten. */
|
---|
508 | SHFL_FILE_REPLACED
|
---|
509 | } SHFLCREATERESULT;
|
---|
510 |
|
---|
511 |
|
---|
512 | /** Open/create flags.
|
---|
513 | * @{
|
---|
514 | */
|
---|
515 |
|
---|
516 | /** No flags. Initialization value. */
|
---|
517 | #define SHFL_CF_NONE (0x00000000)
|
---|
518 |
|
---|
519 | /** Lookup only the object, do not return a handle. All other flags are ignored. */
|
---|
520 | #define SHFL_CF_LOOKUP (0x00000001)
|
---|
521 |
|
---|
522 | /** Open parent directory of specified object.
|
---|
523 | * Useful for the corresponding Windows FSD flag
|
---|
524 | * and for opening paths like \\dir\\*.* to search the 'dir'.
|
---|
525 | * @todo possibly not needed???
|
---|
526 | */
|
---|
527 | #define SHFL_CF_OPEN_TARGET_DIRECTORY (0x00000002)
|
---|
528 |
|
---|
529 | /** Create/open a directory. */
|
---|
530 | #define SHFL_CF_DIRECTORY (0x00000004)
|
---|
531 |
|
---|
532 | /** Open/create action to do if object exists
|
---|
533 | * and if the object does not exists.
|
---|
534 | * REPLACE file means atomically DELETE and CREATE.
|
---|
535 | * OVERWRITE file means truncating the file to 0 and
|
---|
536 | * setting new size.
|
---|
537 | * When opening an existing directory REPLACE and OVERWRITE
|
---|
538 | * actions are considered invalid, and cause returning
|
---|
539 | * FILE_EXISTS with NIL handle.
|
---|
540 | */
|
---|
541 | #define SHFL_CF_ACT_MASK_IF_EXISTS (0x000000F0)
|
---|
542 | #define SHFL_CF_ACT_MASK_IF_NEW (0x00000F00)
|
---|
543 |
|
---|
544 | /** What to do if object exists. */
|
---|
545 | #define SHFL_CF_ACT_OPEN_IF_EXISTS (0x00000000)
|
---|
546 | #define SHFL_CF_ACT_FAIL_IF_EXISTS (0x00000010)
|
---|
547 | #define SHFL_CF_ACT_REPLACE_IF_EXISTS (0x00000020)
|
---|
548 | #define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
|
---|
549 |
|
---|
550 | /** What to do if object does not exist. */
|
---|
551 | #define SHFL_CF_ACT_CREATE_IF_NEW (0x00000000)
|
---|
552 | #define SHFL_CF_ACT_FAIL_IF_NEW (0x00000100)
|
---|
553 |
|
---|
554 | /** Read/write requested access for the object. */
|
---|
555 | #define SHFL_CF_ACCESS_MASK_RW (0x00003000)
|
---|
556 |
|
---|
557 | /** No access requested. */
|
---|
558 | #define SHFL_CF_ACCESS_NONE (0x00000000)
|
---|
559 | /** Read access requested. */
|
---|
560 | #define SHFL_CF_ACCESS_READ (0x00001000)
|
---|
561 | /** Write access requested. */
|
---|
562 | #define SHFL_CF_ACCESS_WRITE (0x00002000)
|
---|
563 | /** Read/Write access requested. */
|
---|
564 | #define SHFL_CF_ACCESS_READWRITE (SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_WRITE)
|
---|
565 |
|
---|
566 | /** Requested share access for the object. */
|
---|
567 | #define SHFL_CF_ACCESS_MASK_DENY (0x0000C000)
|
---|
568 |
|
---|
569 | /** Allow any access. */
|
---|
570 | #define SHFL_CF_ACCESS_DENYNONE (0x00000000)
|
---|
571 | /** Do not allow read. */
|
---|
572 | #define SHFL_CF_ACCESS_DENYREAD (0x00004000)
|
---|
573 | /** Do not allow write. */
|
---|
574 | #define SHFL_CF_ACCESS_DENYWRITE (0x00008000)
|
---|
575 | /** Do not allow access. */
|
---|
576 | #define SHFL_CF_ACCESS_DENYALL (SHFL_CF_ACCESS_DENYREAD | SHFL_CF_ACCESS_DENYWRITE)
|
---|
577 |
|
---|
578 | /** Requested access to attributes of the object. */
|
---|
579 | #define SHFL_CF_ACCESS_MASK_ATTR (0x00030000)
|
---|
580 |
|
---|
581 | /** No access requested. */
|
---|
582 | #define SHFL_CF_ACCESS_ATTR_NONE (0x00000000)
|
---|
583 | /** Read access requested. */
|
---|
584 | #define SHFL_CF_ACCESS_ATTR_READ (0x00010000)
|
---|
585 | /** Write access requested. */
|
---|
586 | #define SHFL_CF_ACCESS_ATTR_WRITE (0x00020000)
|
---|
587 | /** Read/Write access requested. */
|
---|
588 | #define SHFL_CF_ACCESS_ATTR_READWRITE (SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_WRITE)
|
---|
589 |
|
---|
590 | /** The file is opened in append mode. Ignored if SHFL_CF_ACCESS_WRITE is not set. */
|
---|
591 | #define SHFL_CF_ACCESS_APPEND (0x00040000)
|
---|
592 |
|
---|
593 | /** @} */
|
---|
594 |
|
---|
595 | #pragma pack(1)
|
---|
596 | typedef struct _SHFLCREATEPARMS
|
---|
597 | {
|
---|
598 | /* Returned handle of opened object. */
|
---|
599 | SHFLHANDLE Handle;
|
---|
600 |
|
---|
601 | /* Returned result of the operation */
|
---|
602 | SHFLCREATERESULT Result;
|
---|
603 |
|
---|
604 | /* SHFL_CF_* */
|
---|
605 | uint32_t CreateFlags;
|
---|
606 |
|
---|
607 | /* Attributes of object to create and
|
---|
608 | * returned actual attributes of opened/created object.
|
---|
609 | */
|
---|
610 | SHFLFSOBJINFO Info;
|
---|
611 |
|
---|
612 | } SHFLCREATEPARMS;
|
---|
613 | #pragma pack()
|
---|
614 |
|
---|
615 | typedef SHFLCREATEPARMS *PSHFLCREATEPARMS;
|
---|
616 |
|
---|
617 |
|
---|
618 | /** Shared Folders mappings.
|
---|
619 | * @{
|
---|
620 | */
|
---|
621 |
|
---|
622 | /** The mapping has been added since last query. */
|
---|
623 | #define SHFL_MS_NEW (1)
|
---|
624 | /** The mapping has been deleted since last query. */
|
---|
625 | #define SHFL_MS_DELETED (2)
|
---|
626 |
|
---|
627 | typedef struct _SHFLMAPPING
|
---|
628 | {
|
---|
629 | /** Mapping status. */
|
---|
630 | uint32_t u32Status;
|
---|
631 | /** Root handle. */
|
---|
632 | SHFLROOT root;
|
---|
633 | } SHFLMAPPING;
|
---|
634 | /** Pointer to a SHFLMAPPING structure. */
|
---|
635 | typedef SHFLMAPPING *PSHFLMAPPING;
|
---|
636 |
|
---|
637 | /** @} */
|
---|
638 |
|
---|
639 | /** Shared Folder directory information
|
---|
640 | * @{
|
---|
641 | */
|
---|
642 |
|
---|
643 | typedef struct _SHFLDIRINFO
|
---|
644 | {
|
---|
645 | /** Full information about the object. */
|
---|
646 | SHFLFSOBJINFO Info;
|
---|
647 | /** The length of the short field (number of RTUTF16 chars).
|
---|
648 | * It is 16-bit for reasons of alignment. */
|
---|
649 | uint16_t cucShortName;
|
---|
650 | /** The short name for 8.3 compatibility.
|
---|
651 | * Empty string if not available.
|
---|
652 | */
|
---|
653 | RTUTF16 uszShortName[14];
|
---|
654 | /** @todo malc, a description, please. */
|
---|
655 | SHFLSTRING name;
|
---|
656 | } SHFLDIRINFO, *PSHFLDIRINFO;
|
---|
657 |
|
---|
658 |
|
---|
659 | /**
|
---|
660 | * Shared folder filesystem properties.
|
---|
661 | */
|
---|
662 | typedef struct SHFLFSPROPERTIES
|
---|
663 | {
|
---|
664 | /** The maximum size of a filesystem object name.
|
---|
665 | * This does not include the '\\0'. */
|
---|
666 | uint32_t cbMaxComponent;
|
---|
667 |
|
---|
668 | /** True if the filesystem is remote.
|
---|
669 | * False if the filesystem is local. */
|
---|
670 | bool fRemote;
|
---|
671 |
|
---|
672 | /** True if the filesystem is case sensitive.
|
---|
673 | * False if the filesystem is case insensitive. */
|
---|
674 | bool fCaseSensitive;
|
---|
675 |
|
---|
676 | /** True if the filesystem is mounted read only.
|
---|
677 | * False if the filesystem is mounted read write. */
|
---|
678 | bool fReadOnly;
|
---|
679 |
|
---|
680 | /** True if the filesystem can encode unicode object names.
|
---|
681 | * False if it can't. */
|
---|
682 | bool fSupportsUnicode;
|
---|
683 |
|
---|
684 | /** True if the filesystem is compresses.
|
---|
685 | * False if it isn't or we don't know. */
|
---|
686 | bool fCompressed;
|
---|
687 |
|
---|
688 | /** True if the filesystem compresses of individual files.
|
---|
689 | * False if it doesn't or we don't know. */
|
---|
690 | bool fFileCompression;
|
---|
691 |
|
---|
692 | /** @todo more? */
|
---|
693 | } SHFLFSPROPERTIES;
|
---|
694 | AssertCompileSize(SHFLFSPROPERTIES, 12);
|
---|
695 | /** Pointer to a shared folder filesystem properties structure. */
|
---|
696 | typedef SHFLFSPROPERTIES *PSHFLFSPROPERTIES;
|
---|
697 | /** Pointer to a const shared folder filesystem properties structure. */
|
---|
698 | typedef SHFLFSPROPERTIES const *PCSHFLFSPROPERTIES;
|
---|
699 |
|
---|
700 |
|
---|
701 | /**
|
---|
702 | * Copy file system properties from IPRT to shared folder format.
|
---|
703 | *
|
---|
704 | * @param pDst The shared folder structure.
|
---|
705 | * @param pSrc The IPRT structure.
|
---|
706 | */
|
---|
707 | DECLINLINE(void) vbfsCopyFsPropertiesFromIprt(PSHFLFSPROPERTIES pDst, PCRTFSPROPERTIES pSrc)
|
---|
708 | {
|
---|
709 | RT_ZERO(*pDst); /* zap the implicit padding. */
|
---|
710 | pDst->cbMaxComponent = pSrc->cbMaxComponent;
|
---|
711 | pDst->fRemote = pSrc->fRemote;
|
---|
712 | pDst->fCaseSensitive = pSrc->fCaseSensitive;
|
---|
713 | pDst->fReadOnly = pSrc->fReadOnly;
|
---|
714 | pDst->fSupportsUnicode = pSrc->fSupportsUnicode;
|
---|
715 | pDst->fCompressed = pSrc->fCompressed;
|
---|
716 | pDst->fFileCompression = pSrc->fFileCompression;
|
---|
717 | }
|
---|
718 |
|
---|
719 |
|
---|
720 | typedef struct _SHFLVOLINFO
|
---|
721 | {
|
---|
722 | RTFOFF ullTotalAllocationBytes;
|
---|
723 | RTFOFF ullAvailableAllocationBytes;
|
---|
724 | uint32_t ulBytesPerAllocationUnit;
|
---|
725 | uint32_t ulBytesPerSector;
|
---|
726 | uint32_t ulSerial;
|
---|
727 | SHFLFSPROPERTIES fsProperties;
|
---|
728 | } SHFLVOLINFO, *PSHFLVOLINFO;
|
---|
729 |
|
---|
730 | /** @} */
|
---|
731 |
|
---|
732 | /** Function parameter structures.
|
---|
733 | * @{
|
---|
734 | */
|
---|
735 |
|
---|
736 | /**
|
---|
737 | * SHFL_FN_QUERY_MAPPINGS
|
---|
738 | */
|
---|
739 | /** Validation mask. Needs to be adjusted
|
---|
740 | * whenever a new SHFL_MF_ flag is added. */
|
---|
741 | #define SHFL_MF_MASK (0x00000011)
|
---|
742 | /** UC2 enconded strings. */
|
---|
743 | #define SHFL_MF_UCS2 (0x00000000)
|
---|
744 | /** Guest uses UTF8 strings, if not set then the strings are unicode (UCS2). */
|
---|
745 | #define SHFL_MF_UTF8 (0x00000001)
|
---|
746 | /** Just handle the auto-mounted folders. */
|
---|
747 | #define SHFL_MF_AUTOMOUNT (0x00000010)
|
---|
748 |
|
---|
749 | /** Type of guest system. For future system dependent features. */
|
---|
750 | #define SHFL_MF_SYSTEM_MASK (0x0000FF00)
|
---|
751 | #define SHFL_MF_SYSTEM_NONE (0x00000000)
|
---|
752 | #define SHFL_MF_SYSTEM_WINDOWS (0x00000100)
|
---|
753 | #define SHFL_MF_SYSTEM_LINUX (0x00000200)
|
---|
754 |
|
---|
755 | /** Parameters structure. */
|
---|
756 | typedef struct _VBoxSFQueryMappings
|
---|
757 | {
|
---|
758 | VBoxGuestHGCMCallInfo callInfo;
|
---|
759 |
|
---|
760 | /** 32bit, in:
|
---|
761 | * Flags describing various client needs.
|
---|
762 | */
|
---|
763 | HGCMFunctionParameter flags;
|
---|
764 |
|
---|
765 | /** 32bit, in/out:
|
---|
766 | * Number of mappings the client expects.
|
---|
767 | * This is the number of elements in the
|
---|
768 | * mappings array.
|
---|
769 | */
|
---|
770 | HGCMFunctionParameter numberOfMappings;
|
---|
771 |
|
---|
772 | /** pointer, in/out:
|
---|
773 | * Points to array of SHFLMAPPING structures.
|
---|
774 | */
|
---|
775 | HGCMFunctionParameter mappings;
|
---|
776 |
|
---|
777 | } VBoxSFQueryMappings;
|
---|
778 |
|
---|
779 | /** Number of parameters */
|
---|
780 | #define SHFL_CPARMS_QUERY_MAPPINGS (3)
|
---|
781 |
|
---|
782 |
|
---|
783 |
|
---|
784 | /**
|
---|
785 | * SHFL_FN_QUERY_MAP_NAME
|
---|
786 | */
|
---|
787 |
|
---|
788 | /** Parameters structure. */
|
---|
789 | typedef struct _VBoxSFQueryMapName
|
---|
790 | {
|
---|
791 | VBoxGuestHGCMCallInfo callInfo;
|
---|
792 |
|
---|
793 | /** 32bit, in: SHFLROOT
|
---|
794 | * Root handle of the mapping which name is queried.
|
---|
795 | */
|
---|
796 | HGCMFunctionParameter root;
|
---|
797 |
|
---|
798 | /** pointer, in/out:
|
---|
799 | * Points to SHFLSTRING buffer.
|
---|
800 | */
|
---|
801 | HGCMFunctionParameter name;
|
---|
802 |
|
---|
803 | } VBoxSFQueryMapName;
|
---|
804 |
|
---|
805 | /** Number of parameters */
|
---|
806 | #define SHFL_CPARMS_QUERY_MAP_NAME (2)
|
---|
807 |
|
---|
808 | /**
|
---|
809 | * SHFL_FN_MAP_FOLDER_OLD
|
---|
810 | */
|
---|
811 |
|
---|
812 | /** Parameters structure. */
|
---|
813 | typedef struct _VBoxSFMapFolder_Old
|
---|
814 | {
|
---|
815 | VBoxGuestHGCMCallInfo callInfo;
|
---|
816 |
|
---|
817 | /** pointer, in:
|
---|
818 | * Points to SHFLSTRING buffer.
|
---|
819 | */
|
---|
820 | HGCMFunctionParameter path;
|
---|
821 |
|
---|
822 | /** pointer, out: SHFLROOT
|
---|
823 | * Root handle of the mapping which name is queried.
|
---|
824 | */
|
---|
825 | HGCMFunctionParameter root;
|
---|
826 |
|
---|
827 | /** pointer, in: RTUTF16
|
---|
828 | * Path delimiter
|
---|
829 | */
|
---|
830 | HGCMFunctionParameter delimiter;
|
---|
831 |
|
---|
832 | } VBoxSFMapFolder_Old;
|
---|
833 |
|
---|
834 | /** Number of parameters */
|
---|
835 | #define SHFL_CPARMS_MAP_FOLDER_OLD (3)
|
---|
836 |
|
---|
837 | /**
|
---|
838 | * SHFL_FN_MAP_FOLDER
|
---|
839 | */
|
---|
840 |
|
---|
841 | /** Parameters structure. */
|
---|
842 | typedef struct _VBoxSFMapFolder
|
---|
843 | {
|
---|
844 | VBoxGuestHGCMCallInfo callInfo;
|
---|
845 |
|
---|
846 | /** pointer, in:
|
---|
847 | * Points to SHFLSTRING buffer.
|
---|
848 | */
|
---|
849 | HGCMFunctionParameter path;
|
---|
850 |
|
---|
851 | /** pointer, out: SHFLROOT
|
---|
852 | * Root handle of the mapping which name is queried.
|
---|
853 | */
|
---|
854 | HGCMFunctionParameter root;
|
---|
855 |
|
---|
856 | /** pointer, in: RTUTF16
|
---|
857 | * Path delimiter
|
---|
858 | */
|
---|
859 | HGCMFunctionParameter delimiter;
|
---|
860 |
|
---|
861 | /** pointer, in: SHFLROOT
|
---|
862 | * Case senstive flag
|
---|
863 | */
|
---|
864 | HGCMFunctionParameter fCaseSensitive;
|
---|
865 |
|
---|
866 | } VBoxSFMapFolder;
|
---|
867 |
|
---|
868 | /** Number of parameters */
|
---|
869 | #define SHFL_CPARMS_MAP_FOLDER (4)
|
---|
870 |
|
---|
871 | /**
|
---|
872 | * SHFL_FN_UNMAP_FOLDER
|
---|
873 | */
|
---|
874 |
|
---|
875 | /** Parameters structure. */
|
---|
876 | typedef struct _VBoxSFUnmapFolder
|
---|
877 | {
|
---|
878 | VBoxGuestHGCMCallInfo callInfo;
|
---|
879 |
|
---|
880 | /** pointer, in: SHFLROOT
|
---|
881 | * Root handle of the mapping which name is queried.
|
---|
882 | */
|
---|
883 | HGCMFunctionParameter root;
|
---|
884 |
|
---|
885 | } VBoxSFUnmapFolder;
|
---|
886 |
|
---|
887 | /** Number of parameters */
|
---|
888 | #define SHFL_CPARMS_UNMAP_FOLDER (1)
|
---|
889 |
|
---|
890 |
|
---|
891 | /**
|
---|
892 | * SHFL_FN_CREATE
|
---|
893 | */
|
---|
894 |
|
---|
895 | /** Parameters structure. */
|
---|
896 | typedef struct _VBoxSFCreate
|
---|
897 | {
|
---|
898 | VBoxGuestHGCMCallInfo callInfo;
|
---|
899 |
|
---|
900 | /** pointer, in: SHFLROOT
|
---|
901 | * Root handle of the mapping which name is queried.
|
---|
902 | */
|
---|
903 | HGCMFunctionParameter root;
|
---|
904 |
|
---|
905 | /** pointer, in:
|
---|
906 | * Points to SHFLSTRING buffer.
|
---|
907 | */
|
---|
908 | HGCMFunctionParameter path;
|
---|
909 |
|
---|
910 | /** pointer, in/out:
|
---|
911 | * Points to SHFLCREATEPARMS buffer.
|
---|
912 | */
|
---|
913 | HGCMFunctionParameter parms;
|
---|
914 |
|
---|
915 | } VBoxSFCreate;
|
---|
916 |
|
---|
917 | /** Number of parameters */
|
---|
918 | #define SHFL_CPARMS_CREATE (3)
|
---|
919 |
|
---|
920 |
|
---|
921 | /**
|
---|
922 | * SHFL_FN_CLOSE
|
---|
923 | */
|
---|
924 |
|
---|
925 | /** Parameters structure. */
|
---|
926 | typedef struct _VBoxSFClose
|
---|
927 | {
|
---|
928 | VBoxGuestHGCMCallInfo callInfo;
|
---|
929 |
|
---|
930 | /** pointer, in: SHFLROOT
|
---|
931 | * Root handle of the mapping which name is queried.
|
---|
932 | */
|
---|
933 | HGCMFunctionParameter root;
|
---|
934 |
|
---|
935 |
|
---|
936 | /** value64, in:
|
---|
937 | * SHFLHANDLE of object to close.
|
---|
938 | */
|
---|
939 | HGCMFunctionParameter handle;
|
---|
940 |
|
---|
941 | } VBoxSFClose;
|
---|
942 |
|
---|
943 | /** Number of parameters */
|
---|
944 | #define SHFL_CPARMS_CLOSE (2)
|
---|
945 |
|
---|
946 |
|
---|
947 | /**
|
---|
948 | * SHFL_FN_READ
|
---|
949 | */
|
---|
950 |
|
---|
951 | /** Parameters structure. */
|
---|
952 | typedef struct _VBoxSFRead
|
---|
953 | {
|
---|
954 | VBoxGuestHGCMCallInfo callInfo;
|
---|
955 |
|
---|
956 | /** pointer, in: SHFLROOT
|
---|
957 | * Root handle of the mapping which name is queried.
|
---|
958 | */
|
---|
959 | HGCMFunctionParameter root;
|
---|
960 |
|
---|
961 | /** value64, in:
|
---|
962 | * SHFLHANDLE of object to read from.
|
---|
963 | */
|
---|
964 | HGCMFunctionParameter handle;
|
---|
965 |
|
---|
966 | /** value64, in:
|
---|
967 | * Offset to read from.
|
---|
968 | */
|
---|
969 | HGCMFunctionParameter offset;
|
---|
970 |
|
---|
971 | /** value64, in/out:
|
---|
972 | * Bytes to read/How many were read.
|
---|
973 | */
|
---|
974 | HGCMFunctionParameter cb;
|
---|
975 |
|
---|
976 | /** pointer, out:
|
---|
977 | * Buffer to place data to.
|
---|
978 | */
|
---|
979 | HGCMFunctionParameter buffer;
|
---|
980 |
|
---|
981 | } VBoxSFRead;
|
---|
982 |
|
---|
983 | /** Number of parameters */
|
---|
984 | #define SHFL_CPARMS_READ (5)
|
---|
985 |
|
---|
986 |
|
---|
987 |
|
---|
988 | /**
|
---|
989 | * SHFL_FN_WRITE
|
---|
990 | */
|
---|
991 |
|
---|
992 | /** Parameters structure. */
|
---|
993 | typedef struct _VBoxSFWrite
|
---|
994 | {
|
---|
995 | VBoxGuestHGCMCallInfo callInfo;
|
---|
996 |
|
---|
997 | /** pointer, in: SHFLROOT
|
---|
998 | * Root handle of the mapping which name is queried.
|
---|
999 | */
|
---|
1000 | HGCMFunctionParameter root;
|
---|
1001 |
|
---|
1002 | /** value64, in:
|
---|
1003 | * SHFLHANDLE of object to write to.
|
---|
1004 | */
|
---|
1005 | HGCMFunctionParameter handle;
|
---|
1006 |
|
---|
1007 | /** value64, in:
|
---|
1008 | * Offset to write to.
|
---|
1009 | */
|
---|
1010 | HGCMFunctionParameter offset;
|
---|
1011 |
|
---|
1012 | /** value64, in/out:
|
---|
1013 | * Bytes to write/How many were written.
|
---|
1014 | */
|
---|
1015 | HGCMFunctionParameter cb;
|
---|
1016 |
|
---|
1017 | /** pointer, in:
|
---|
1018 | * Data to write.
|
---|
1019 | */
|
---|
1020 | HGCMFunctionParameter buffer;
|
---|
1021 |
|
---|
1022 | } VBoxSFWrite;
|
---|
1023 |
|
---|
1024 | /** Number of parameters */
|
---|
1025 | #define SHFL_CPARMS_WRITE (5)
|
---|
1026 |
|
---|
1027 |
|
---|
1028 |
|
---|
1029 | /**
|
---|
1030 | * SHFL_FN_LOCK
|
---|
1031 | */
|
---|
1032 |
|
---|
1033 | /** Lock owner is the HGCM client. */
|
---|
1034 |
|
---|
1035 | /** Lock mode bit mask. */
|
---|
1036 | #define SHFL_LOCK_MODE_MASK (0x3)
|
---|
1037 | /** Cancel lock on the given range. */
|
---|
1038 | #define SHFL_LOCK_CANCEL (0x0)
|
---|
1039 | /** Acquire read only lock. Prevent write to the range. */
|
---|
1040 | #define SHFL_LOCK_SHARED (0x1)
|
---|
1041 | /** Acquire write lock. Prevent both write and read to the range. */
|
---|
1042 | #define SHFL_LOCK_EXCLUSIVE (0x2)
|
---|
1043 |
|
---|
1044 | /** Do not wait for lock if it can not be acquired at the time. */
|
---|
1045 | #define SHFL_LOCK_NOWAIT (0x0)
|
---|
1046 | /** Wait and acquire lock. */
|
---|
1047 | #define SHFL_LOCK_WAIT (0x4)
|
---|
1048 |
|
---|
1049 | /** Lock the specified range. */
|
---|
1050 | #define SHFL_LOCK_PARTIAL (0x0)
|
---|
1051 | /** Lock entire object. */
|
---|
1052 | #define SHFL_LOCK_ENTIRE (0x8)
|
---|
1053 |
|
---|
1054 | /** Parameters structure. */
|
---|
1055 | typedef struct _VBoxSFLock
|
---|
1056 | {
|
---|
1057 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1058 |
|
---|
1059 | /** pointer, in: SHFLROOT
|
---|
1060 | * Root handle of the mapping which name is queried.
|
---|
1061 | */
|
---|
1062 | HGCMFunctionParameter root;
|
---|
1063 |
|
---|
1064 | /** value64, in:
|
---|
1065 | * SHFLHANDLE of object to be locked.
|
---|
1066 | */
|
---|
1067 | HGCMFunctionParameter handle;
|
---|
1068 |
|
---|
1069 | /** value64, in:
|
---|
1070 | * Starting offset of lock range.
|
---|
1071 | */
|
---|
1072 | HGCMFunctionParameter offset;
|
---|
1073 |
|
---|
1074 | /** value64, in:
|
---|
1075 | * Length of range.
|
---|
1076 | */
|
---|
1077 | HGCMFunctionParameter length;
|
---|
1078 |
|
---|
1079 | /** value32, in:
|
---|
1080 | * Lock flags SHFL_LOCK_*.
|
---|
1081 | */
|
---|
1082 | HGCMFunctionParameter flags;
|
---|
1083 |
|
---|
1084 | } VBoxSFLock;
|
---|
1085 |
|
---|
1086 | /** Number of parameters */
|
---|
1087 | #define SHFL_CPARMS_LOCK (5)
|
---|
1088 |
|
---|
1089 |
|
---|
1090 |
|
---|
1091 | /**
|
---|
1092 | * SHFL_FN_FLUSH
|
---|
1093 | */
|
---|
1094 |
|
---|
1095 | /** Parameters structure. */
|
---|
1096 | typedef struct _VBoxSFFlush
|
---|
1097 | {
|
---|
1098 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1099 |
|
---|
1100 | /** pointer, in: SHFLROOT
|
---|
1101 | * Root handle of the mapping which name is queried.
|
---|
1102 | */
|
---|
1103 | HGCMFunctionParameter root;
|
---|
1104 |
|
---|
1105 | /** value64, in:
|
---|
1106 | * SHFLHANDLE of object to be locked.
|
---|
1107 | */
|
---|
1108 | HGCMFunctionParameter handle;
|
---|
1109 |
|
---|
1110 | } VBoxSFFlush;
|
---|
1111 |
|
---|
1112 | /** Number of parameters */
|
---|
1113 | #define SHFL_CPARMS_FLUSH (2)
|
---|
1114 |
|
---|
1115 | /**
|
---|
1116 | * SHFL_FN_LIST
|
---|
1117 | */
|
---|
1118 |
|
---|
1119 | /** Listing information includes variable length RTDIRENTRY[EX] structures. */
|
---|
1120 |
|
---|
1121 | /** @todo might be necessary for future. */
|
---|
1122 | #define SHFL_LIST_NONE 0
|
---|
1123 | #define SHFL_LIST_RETURN_ONE 1
|
---|
1124 |
|
---|
1125 | /** Parameters structure. */
|
---|
1126 | typedef struct _VBoxSFList
|
---|
1127 | {
|
---|
1128 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1129 |
|
---|
1130 | /** pointer, in: SHFLROOT
|
---|
1131 | * Root handle of the mapping which name is queried.
|
---|
1132 | */
|
---|
1133 | HGCMFunctionParameter root;
|
---|
1134 |
|
---|
1135 | /** value64, in:
|
---|
1136 | * SHFLHANDLE of object to be listed.
|
---|
1137 | */
|
---|
1138 | HGCMFunctionParameter handle;
|
---|
1139 |
|
---|
1140 | /** value32, in:
|
---|
1141 | * List flags SHFL_LIST_*.
|
---|
1142 | */
|
---|
1143 | HGCMFunctionParameter flags;
|
---|
1144 |
|
---|
1145 | /** value32, in/out:
|
---|
1146 | * Bytes to be used for listing information/How many bytes were used.
|
---|
1147 | */
|
---|
1148 | HGCMFunctionParameter cb;
|
---|
1149 |
|
---|
1150 | /** pointer, in/optional
|
---|
1151 | * Points to SHFLSTRING buffer that specifies a search path.
|
---|
1152 | */
|
---|
1153 | HGCMFunctionParameter path;
|
---|
1154 |
|
---|
1155 | /** pointer, out:
|
---|
1156 | * Buffer to place listing information to. (SHFLDIRINFO)
|
---|
1157 | */
|
---|
1158 | HGCMFunctionParameter buffer;
|
---|
1159 |
|
---|
1160 | /** value32, in/out:
|
---|
1161 | * Indicates a key where the listing must be resumed.
|
---|
1162 | * in: 0 means start from begin of object.
|
---|
1163 | * out: 0 means listing completed.
|
---|
1164 | */
|
---|
1165 | HGCMFunctionParameter resumePoint;
|
---|
1166 |
|
---|
1167 | /** pointer, out:
|
---|
1168 | * Number of files returned
|
---|
1169 | */
|
---|
1170 | HGCMFunctionParameter cFiles;
|
---|
1171 |
|
---|
1172 | } VBoxSFList;
|
---|
1173 |
|
---|
1174 | /** Number of parameters */
|
---|
1175 | #define SHFL_CPARMS_LIST (8)
|
---|
1176 |
|
---|
1177 |
|
---|
1178 |
|
---|
1179 | /**
|
---|
1180 | * SHFL_FN_READLINK
|
---|
1181 | */
|
---|
1182 |
|
---|
1183 | /** Parameters structure. */
|
---|
1184 | typedef struct _VBoxSFReadLink
|
---|
1185 | {
|
---|
1186 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1187 |
|
---|
1188 | /** pointer, in: SHFLROOT
|
---|
1189 | * Root handle of the mapping which name is queried.
|
---|
1190 | */
|
---|
1191 | HGCMFunctionParameter root;
|
---|
1192 |
|
---|
1193 | /** pointer, in:
|
---|
1194 | * Points to SHFLSTRING buffer.
|
---|
1195 | */
|
---|
1196 | HGCMFunctionParameter path;
|
---|
1197 |
|
---|
1198 | /** pointer, out:
|
---|
1199 | * Buffer to place data to.
|
---|
1200 | */
|
---|
1201 | HGCMFunctionParameter buffer;
|
---|
1202 |
|
---|
1203 | } VBoxSFReadLink;
|
---|
1204 |
|
---|
1205 | /** Number of parameters */
|
---|
1206 | #define SHFL_CPARMS_READLINK (3)
|
---|
1207 |
|
---|
1208 |
|
---|
1209 |
|
---|
1210 | /**
|
---|
1211 | * SHFL_FN_INFORMATION
|
---|
1212 | */
|
---|
1213 |
|
---|
1214 | /** Mask of Set/Get bit. */
|
---|
1215 | #define SHFL_INFO_MODE_MASK (0x1)
|
---|
1216 | /** Get information */
|
---|
1217 | #define SHFL_INFO_GET (0x0)
|
---|
1218 | /** Set information */
|
---|
1219 | #define SHFL_INFO_SET (0x1)
|
---|
1220 |
|
---|
1221 | /** Get name of the object. */
|
---|
1222 | #define SHFL_INFO_NAME (0x2)
|
---|
1223 | /** Set size of object (extend/trucate); only applies to file objects */
|
---|
1224 | #define SHFL_INFO_SIZE (0x4)
|
---|
1225 | /** Get/Set file object info. */
|
---|
1226 | #define SHFL_INFO_FILE (0x8)
|
---|
1227 | /** Get volume information. */
|
---|
1228 | #define SHFL_INFO_VOLUME (0x10)
|
---|
1229 |
|
---|
1230 | /** @todo different file info structures */
|
---|
1231 |
|
---|
1232 |
|
---|
1233 | /** Parameters structure. */
|
---|
1234 | typedef struct _VBoxSFInformation
|
---|
1235 | {
|
---|
1236 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1237 |
|
---|
1238 | /** pointer, in: SHFLROOT
|
---|
1239 | * Root handle of the mapping which name is queried.
|
---|
1240 | */
|
---|
1241 | HGCMFunctionParameter root;
|
---|
1242 |
|
---|
1243 | /** value64, in:
|
---|
1244 | * SHFLHANDLE of object to be listed.
|
---|
1245 | */
|
---|
1246 | HGCMFunctionParameter handle;
|
---|
1247 |
|
---|
1248 | /** value32, in:
|
---|
1249 | * SHFL_INFO_*
|
---|
1250 | */
|
---|
1251 | HGCMFunctionParameter flags;
|
---|
1252 |
|
---|
1253 | /** value32, in/out:
|
---|
1254 | * Bytes to be used for information/How many bytes were used.
|
---|
1255 | */
|
---|
1256 | HGCMFunctionParameter cb;
|
---|
1257 |
|
---|
1258 | /** pointer, in/out:
|
---|
1259 | * Information to be set/get (SHFLFSOBJINFO or SHFLSTRING). Do not forget
|
---|
1260 | * to set the SHFLFSOBJINFO::Attr::enmAdditional for Get operation as well.
|
---|
1261 | */
|
---|
1262 | HGCMFunctionParameter info;
|
---|
1263 |
|
---|
1264 | } VBoxSFInformation;
|
---|
1265 |
|
---|
1266 | /** Number of parameters */
|
---|
1267 | #define SHFL_CPARMS_INFORMATION (5)
|
---|
1268 |
|
---|
1269 |
|
---|
1270 | /**
|
---|
1271 | * SHFL_FN_REMOVE
|
---|
1272 | */
|
---|
1273 |
|
---|
1274 | #define SHFL_REMOVE_FILE (0x1)
|
---|
1275 | #define SHFL_REMOVE_DIR (0x2)
|
---|
1276 | #define SHFL_REMOVE_SYMLINK (0x4)
|
---|
1277 |
|
---|
1278 | /** Parameters structure. */
|
---|
1279 | typedef struct _VBoxSFRemove
|
---|
1280 | {
|
---|
1281 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1282 |
|
---|
1283 | /** pointer, in: SHFLROOT
|
---|
1284 | * Root handle of the mapping which name is queried.
|
---|
1285 | */
|
---|
1286 | HGCMFunctionParameter root;
|
---|
1287 |
|
---|
1288 | /** pointer, in:
|
---|
1289 | * Points to SHFLSTRING buffer.
|
---|
1290 | */
|
---|
1291 | HGCMFunctionParameter path;
|
---|
1292 |
|
---|
1293 | /** value32, in:
|
---|
1294 | * remove flags (file/directory)
|
---|
1295 | */
|
---|
1296 | HGCMFunctionParameter flags;
|
---|
1297 |
|
---|
1298 | } VBoxSFRemove;
|
---|
1299 |
|
---|
1300 | #define SHFL_CPARMS_REMOVE (3)
|
---|
1301 |
|
---|
1302 |
|
---|
1303 | /**
|
---|
1304 | * SHFL_FN_RENAME
|
---|
1305 | */
|
---|
1306 |
|
---|
1307 | #define SHFL_RENAME_FILE (0x1)
|
---|
1308 | #define SHFL_RENAME_DIR (0x2)
|
---|
1309 | #define SHFL_RENAME_REPLACE_IF_EXISTS (0x4)
|
---|
1310 |
|
---|
1311 | /** Parameters structure. */
|
---|
1312 | typedef struct _VBoxSFRename
|
---|
1313 | {
|
---|
1314 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1315 |
|
---|
1316 | /** pointer, in: SHFLROOT
|
---|
1317 | * Root handle of the mapping which name is queried.
|
---|
1318 | */
|
---|
1319 | HGCMFunctionParameter root;
|
---|
1320 |
|
---|
1321 | /** pointer, in:
|
---|
1322 | * Points to SHFLSTRING src.
|
---|
1323 | */
|
---|
1324 | HGCMFunctionParameter src;
|
---|
1325 |
|
---|
1326 | /** pointer, in:
|
---|
1327 | * Points to SHFLSTRING dest.
|
---|
1328 | */
|
---|
1329 | HGCMFunctionParameter dest;
|
---|
1330 |
|
---|
1331 | /** value32, in:
|
---|
1332 | * rename flags (file/directory)
|
---|
1333 | */
|
---|
1334 | HGCMFunctionParameter flags;
|
---|
1335 |
|
---|
1336 | } VBoxSFRename;
|
---|
1337 |
|
---|
1338 | #define SHFL_CPARMS_RENAME (4)
|
---|
1339 |
|
---|
1340 |
|
---|
1341 | /**
|
---|
1342 | * SHFL_FN_SYMLINK
|
---|
1343 | */
|
---|
1344 |
|
---|
1345 | /** Parameters structure. */
|
---|
1346 | typedef struct _VBoxSFSymlink
|
---|
1347 | {
|
---|
1348 | VBoxGuestHGCMCallInfo callInfo;
|
---|
1349 |
|
---|
1350 | /** pointer, in: SHFLROOT
|
---|
1351 | * Root handle of the mapping which name is queried.
|
---|
1352 | */
|
---|
1353 | HGCMFunctionParameter root;
|
---|
1354 |
|
---|
1355 | /** pointer, in:
|
---|
1356 | * Points to SHFLSTRING of path for the new symlink.
|
---|
1357 | */
|
---|
1358 | HGCMFunctionParameter newPath;
|
---|
1359 |
|
---|
1360 | /** pointer, in:
|
---|
1361 | * Points to SHFLSTRING of destination for symlink.
|
---|
1362 | */
|
---|
1363 | HGCMFunctionParameter oldPath;
|
---|
1364 |
|
---|
1365 | /** pointer, out:
|
---|
1366 | * Information about created symlink.
|
---|
1367 | */
|
---|
1368 | HGCMFunctionParameter info;
|
---|
1369 |
|
---|
1370 | } VBoxSFSymlink;
|
---|
1371 |
|
---|
1372 | #define SHFL_CPARMS_SYMLINK (4)
|
---|
1373 |
|
---|
1374 |
|
---|
1375 |
|
---|
1376 | /**
|
---|
1377 | * SHFL_FN_ADD_MAPPING
|
---|
1378 | * Host call, no guest structure is used.
|
---|
1379 | */
|
---|
1380 |
|
---|
1381 | /** mapping is writable */
|
---|
1382 | #define SHFL_ADD_MAPPING_F_WRITABLE (RT_BIT_32(0))
|
---|
1383 | /** mapping is automounted by the guest */
|
---|
1384 | #define SHFL_ADD_MAPPING_F_AUTOMOUNT (RT_BIT_32(1))
|
---|
1385 | /** allow the guest to create symlinks */
|
---|
1386 | #define SHFL_ADD_MAPPING_F_CREATE_SYMLINKS (RT_BIT_32(2))
|
---|
1387 | /** mapping is actually missing on the host */
|
---|
1388 | #define SHFL_ADD_MAPPING_F_MISSING (RT_BIT_32(3))
|
---|
1389 |
|
---|
1390 | #define SHFL_CPARMS_ADD_MAPPING (3)
|
---|
1391 |
|
---|
1392 | /**
|
---|
1393 | * SHFL_FN_REMOVE_MAPPING
|
---|
1394 | * Host call, no guest structure is used.
|
---|
1395 | */
|
---|
1396 |
|
---|
1397 | #define SHFL_CPARMS_REMOVE_MAPPING (1)
|
---|
1398 |
|
---|
1399 |
|
---|
1400 | /**
|
---|
1401 | * SHFL_FN_SET_STATUS_LED
|
---|
1402 | * Host call, no guest structure is used.
|
---|
1403 | */
|
---|
1404 |
|
---|
1405 | #define SHFL_CPARMS_SET_STATUS_LED (1)
|
---|
1406 |
|
---|
1407 | /** @} */
|
---|
1408 |
|
---|
1409 | #endif
|
---|