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