VirtualBox

source: vbox/trunk/include/VBox/shflsvc.h@ 78415

Last change on this file since 78415 was 77858, checked in by vboxsync, 6 years ago

linux/vboxsf: Cleaning up the symlink related code and making it work on 2.4.x too. Untested. bugref:9172

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 59.8 KB
Line 
1/** @file
2 * Shared Folders - Common header for host service and guest clients.
3 */
4
5/*
6 * Copyright (C) 2006-2019 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_INCLUDED_shflsvc_h
31#define VBOX_INCLUDED_shflsvc_h
32#ifndef RT_WITHOUT_PRAGMA_ONCE
33# pragma once
34#endif
35
36#ifndef IN_MODULE
37# include <VBox/VMMDevCoreTypes.h>
38# include <VBox/VBoxGuestCoreTypes.h>
39#endif
40#include <iprt/string.h>
41#include <VBox/cdefs.h>
42#include <VBox/types.h>
43#include <iprt/fs.h>
44#include <iprt/assert.h>
45#include <iprt/errcore.h>
46#if defined(IN_RING3) || (defined(IN_RING0) && defined(RT_OS_DARWIN))
47# include <iprt/mem.h>
48#endif
49#include <iprt/utf16.h>
50
51
52
53/** @defgroup grp_vbox_shfl Shared Folder Interface Definition.
54 *
55 * Structures shared between guest and the service can be relocated and use
56 * offsets to point to variable length parts.
57 *
58 * Shared folders protocol works with handles. Before doing any action on a
59 * file system object, one have to obtain the object handle via a SHFL_FN_CREATE
60 * request. A handle must be closed with SHFL_FN_CLOSE.
61 *
62 * @{
63 */
64
65/** @name Some bit flag manipulation macros.
66 * @{ */
67#ifndef BIT_FLAG
68#define BIT_FLAG(__Field,__Flag) ((__Field) & (__Flag))
69#endif
70
71#ifndef BIT_FLAG_SET
72#define BIT_FLAG_SET(__Field,__Flag) ((__Field) |= (__Flag))
73#endif
74
75#ifndef BIT_FLAG_CLEAR
76#define BIT_FLAG_CLEAR(__Field,__Flag) ((__Field) &= ~(__Flag))
77#endif
78/** @} */
79
80
81/** @name Shared Folders service functions. (guest)
82 * @{
83 */
84/** Query mappings changes.
85 * @note Description is currently misleading, it will always return all
86 * current mappings with SHFL_MS_NEW status. Only modification is the
87 * SHFL_MF_AUTOMOUNT flag that causes filtering out non-auto mounts. */
88#define SHFL_FN_QUERY_MAPPINGS (1)
89/** Query the name of a map. */
90#define SHFL_FN_QUERY_MAP_NAME (2)
91/** Open/create object. */
92#define SHFL_FN_CREATE (3)
93/** Close object handle. */
94#define SHFL_FN_CLOSE (4)
95/** Read object content. */
96#define SHFL_FN_READ (5)
97/** Write new object content. */
98#define SHFL_FN_WRITE (6)
99/** Lock/unlock a range in the object. */
100#define SHFL_FN_LOCK (7)
101/** List object content. */
102#define SHFL_FN_LIST (8)
103/** Query/set object information. */
104#define SHFL_FN_INFORMATION (9)
105/** Remove object */
106#define SHFL_FN_REMOVE (11)
107/** Map folder (legacy) */
108#define SHFL_FN_MAP_FOLDER_OLD (12)
109/** Unmap folder */
110#define SHFL_FN_UNMAP_FOLDER (13)
111/** Rename object (possibly moving it to another directory) */
112#define SHFL_FN_RENAME (14)
113/** Flush file */
114#define SHFL_FN_FLUSH (15)
115/** @todo macl, a description, please. */
116#define SHFL_FN_SET_UTF8 (16)
117/** Map folder */
118#define SHFL_FN_MAP_FOLDER (17)
119/** Read symlink destination.
120 * @since VBox 4.0 */
121#define SHFL_FN_READLINK (18) /**< @todo rename to SHFL_FN_READ_LINK (see struct capitalization) */
122/** Create symlink.
123 * @since VBox 4.0 */
124#define SHFL_FN_SYMLINK (19)
125/** Ask host to show symlinks
126 * @since VBox 4.0 */
127#define SHFL_FN_SET_SYMLINKS (20)
128/** Query information about a map.
129 * @since VBox 6.0 */
130#define SHFL_FN_QUERY_MAP_INFO (21)
131/** Wait for changes to the mappings.
132 * @since VBox 6.0 */
133#define SHFL_FN_WAIT_FOR_MAPPINGS_CHANGES (22)
134/** Cancel all waits for changes to the mappings for the calling client.
135 * The wait calls will return VERR_CANCELLED.
136 * @since VBox 6.0 */
137#define SHFL_FN_CANCEL_MAPPINGS_CHANGES_WAITS (23)
138/** Sets the file size.
139 * @since VBox 6.0 */
140#define SHFL_FN_SET_FILE_SIZE (24)
141/** Queries supported features.
142 * @since VBox 6.0.6 */
143#define SHFL_FN_QUERY_FEATURES (25)
144/** Copies a file to another.
145 * @since VBox 6.0.6 */
146#define SHFL_FN_COPY_FILE (26)
147/** Copies part of a file to another.
148 * @since VBox 6.0.6 */
149#define SHFL_FN_COPY_FILE_PART (27)
150/** The last function number. */
151#define SHFL_FN_LAST SHFL_FN_COPY_FILE_PART
152/** @} */
153
154
155/** @name Shared Folders service functions. (host)
156 * @{
157 */
158/** Add shared folder mapping. */
159#define SHFL_FN_ADD_MAPPING (1)
160/** Remove shared folder mapping. */
161#define SHFL_FN_REMOVE_MAPPING (2)
162/** Set the led status light address. */
163#define SHFL_FN_SET_STATUS_LED (3)
164/** Allow the guest to create symbolic links
165 * @since VBox 4.0 */
166#define SHFL_FN_ALLOW_SYMLINKS_CREATE (4)
167/** @} */
168
169
170/** Root handle for a mapping. Root handles are unique.
171 *
172 * @note Function parameters structures consider the root handle as 32 bit
173 * value. If the typedef will be changed, then function parameters must be
174 * changed accordingly. All those parameters are marked with SHFLROOT in
175 * comments.
176 */
177typedef uint32_t SHFLROOT;
178
179/** NIL shared folder root handle. */
180#define SHFL_ROOT_NIL ((SHFLROOT)~0)
181
182
183/** A shared folders handle for an opened object. */
184typedef uint64_t SHFLHANDLE;
185
186#define SHFL_HANDLE_NIL ((SHFLHANDLE)~0LL)
187#define SHFL_HANDLE_ROOT ((SHFLHANDLE)0LL)
188
189/** Hardcoded maximum length (in chars) of a shared folder name. */
190#define SHFL_MAX_LEN (256)
191/** Hardcoded maximum number of shared folder mapping available to the guest. */
192#define SHFL_MAX_MAPPINGS (64)
193
194
195/** @name Shared Folders strings. They can be either UTF-8 or UTF-16.
196 * @{
197 */
198
199/**
200 * Shared folder string buffer structure.
201 */
202typedef struct _SHFLSTRING
203{
204 /** Allocated size of the String member in bytes. */
205 uint16_t u16Size;
206
207 /** Length of string without trailing nul in bytes. */
208 uint16_t u16Length;
209
210 /** UTF-8 or UTF-16 string. Nul terminated. */
211 union
212 {
213#if 1
214 char ach[1]; /**< UTF-8 but with a type that makes some more sense. */
215 uint8_t utf8[1];
216 RTUTF16 utf16[1];
217 uint16_t ucs2[1]; /**< misnomer, use utf16. */
218#else
219 uint8_t utf8[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
220 RTUTF16 utf16[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
221 RTUTF16 ucs2[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION]; /**< misnomer, use utf16. */
222#endif
223 } String;
224} SHFLSTRING;
225AssertCompileSize(RTUTF16, 2);
226AssertCompileSize(SHFLSTRING, 6);
227AssertCompileMemberOffset(SHFLSTRING, String, 4);
228/** The size of SHFLSTRING w/o the string part. */
229#define SHFLSTRING_HEADER_SIZE 4
230AssertCompileMemberOffset(SHFLSTRING, String, SHFLSTRING_HEADER_SIZE);
231
232/** Pointer to a shared folder string buffer. */
233typedef SHFLSTRING *PSHFLSTRING;
234/** Pointer to a const shared folder string buffer. */
235typedef const SHFLSTRING *PCSHFLSTRING;
236
237/** Calculate size of the string. */
238DECLINLINE(uint32_t) ShflStringSizeOfBuffer(PCSHFLSTRING pString)
239{
240 return pString ? (uint32_t)(SHFLSTRING_HEADER_SIZE + pString->u16Size) : 0;
241}
242
243DECLINLINE(uint32_t) ShflStringLength(PCSHFLSTRING pString)
244{
245 return pString ? pString->u16Length : 0;
246}
247
248DECLINLINE(PSHFLSTRING) ShflStringInitBuffer(void *pvBuffer, uint32_t u32Size)
249{
250 PSHFLSTRING pString = NULL;
251 const uint32_t u32HeaderSize = SHFLSTRING_HEADER_SIZE;
252
253 /*
254 * Check that the buffer size is big enough to hold a zero sized string
255 * and is not too big to fit into 16 bit variables.
256 */
257 if (u32Size >= u32HeaderSize && u32Size - u32HeaderSize <= 0xFFFF)
258 {
259 pString = (PSHFLSTRING)pvBuffer;
260 pString->u16Size = (uint16_t)(u32Size - u32HeaderSize);
261 pString->u16Length = 0;
262 if (pString->u16Size >= sizeof(pString->String.ucs2[0]))
263 pString->String.ucs2[0] = 0;
264 else if (pString->u16Size >= sizeof(pString->String.utf8[0]))
265 pString->String.utf8[0] = 0;
266 }
267
268 return pString;
269}
270
271/**
272 * Helper for copying one string into another.
273 *
274 * @returns IPRT status code.
275 * @retval VERR_BUFFER_OVERFLOW and pDst->u16Length set to source length.
276 * @param pDst The destination string.
277 * @param pSrc The source string.
278 * @param cbTerm The size of the string terminator.
279 */
280DECLINLINE(int) ShflStringCopy(PSHFLSTRING pDst, PCSHFLSTRING pSrc, size_t cbTerm)
281{
282 int rc = VINF_SUCCESS;
283 if (pDst->u16Size >= pSrc->u16Length + cbTerm)
284 {
285 memcpy(&pDst->String, &pSrc->String, pSrc->u16Length);
286 switch (cbTerm)
287 {
288 default:
289 case 2: pDst->String.ach[pSrc->u16Length + 1] = '\0'; RT_FALL_THROUGH();
290 case 1: pDst->String.ach[pSrc->u16Length + 0] = '\0'; break;
291 case 0: break;
292 }
293 }
294 else
295 rc = VERR_BUFFER_OVERFLOW;
296 pDst->u16Length = pSrc->u16Length;
297 return rc;
298}
299
300#if defined(IN_RING3) \
301 || (defined(IN_RING0) && defined(RT_OS_DARWIN))
302
303/**
304 * Duplicates a string using RTMemAlloc as allocator.
305 *
306 * @returns Copy, NULL if out of memory.
307 * @param pSrc The source string.
308 */
309DECLINLINE(PSHFLSTRING) ShflStringDup(PCSHFLSTRING pSrc)
310{
311 PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + pSrc->u16Size);
312 if (pDst)
313 {
314 pDst->u16Length = pSrc->u16Length;
315 pDst->u16Size = pSrc->u16Size;
316 memcpy(&pDst->String, &pSrc->String, pSrc->u16Size);
317 }
318 return pDst;
319}
320
321/**
322 * Duplicates a UTF-16 string using RTMemAlloc as allocator.
323 *
324 * The returned string will be using UTF-16 encoding too.
325 *
326 * @returns Pointer to copy on success - pass to RTMemFree to free.
327 * NULL if out of memory.
328 * @param pwszSrc The source string. Encoding is not checked.
329 */
330DECLINLINE(PSHFLSTRING) ShflStringDupUtf16(PCRTUTF16 pwszSrc)
331{
332 size_t cwcSrc = RTUtf16Len(pwszSrc);
333 if (cwcSrc < UINT16_MAX / sizeof(RTUTF16))
334 {
335 PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + (cwcSrc + 1) * sizeof(RTUTF16));
336 if (pDst)
337 {
338 pDst->u16Length = (uint16_t)(cwcSrc * sizeof(RTUTF16));
339 pDst->u16Size = (uint16_t)((cwcSrc + 1) * sizeof(RTUTF16));
340 memcpy(&pDst->String, pwszSrc, (cwcSrc + 1) * sizeof(RTUTF16));
341 return pDst;
342 }
343 }
344 AssertFailed();
345 return NULL;
346}
347
348/**
349 * Duplicates a UTF-8 string using RTMemAlloc as allocator.
350 *
351 * The returned string will be using UTF-8 encoding too.
352 *
353 * @returns Pointer to copy on success - pass to RTMemFree to free.
354 * NULL if out of memory.
355 * @param pszSrc The source string. Encoding is not checked.
356 */
357DECLINLINE(PSHFLSTRING) ShflStringDupUtf8(const char *pszSrc)
358{
359 size_t cchSrc = strlen(pszSrc);
360 if (cchSrc < UINT16_MAX)
361 {
362 PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + cchSrc + 1);
363 if (pDst)
364 {
365 pDst->u16Length = (uint16_t)cchSrc;
366 pDst->u16Size = (uint16_t)(cchSrc + 1);
367 memcpy(&pDst->String, pszSrc, cchSrc + 1);
368 return pDst;
369 }
370 }
371 AssertFailed();
372 return NULL;
373}
374
375/**
376 * Creates a UTF-16 duplicate of the UTF-8 string @a pszSrc using RTMemAlloc as
377 * allocator.
378 *
379 * @returns Pointer to copy on success - pass to RTMemFree to free.
380 * NULL if out of memory or invalid UTF-8 encoding.
381 * @param pszSrc The source string.
382 */
383DECLINLINE(PSHFLSTRING) ShflStringDupUtf8AsUtf16(const char *pszSrc)
384{
385 size_t cwcConversion = 0;
386 int rc = RTStrCalcUtf16LenEx(pszSrc, RTSTR_MAX, &cwcConversion);
387 if ( RT_SUCCESS(rc)
388 && cwcConversion < UINT16_MAX / sizeof(RTUTF16))
389 {
390 PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + (cwcConversion + 1) * sizeof(RTUTF16));
391 if (pDst)
392 {
393 PRTUTF16 pwszDst = pDst->String.ucs2;
394 pDst->u16Size = (uint16_t)((cwcConversion + 1) * sizeof(RTUTF16));
395 rc = RTStrToUtf16Ex(pszSrc, RTSTR_MAX, &pwszDst, cwcConversion + 1, &cwcConversion);
396 AssertRC(rc);
397 if (RT_SUCCESS(rc))
398 {
399 pDst->u16Length = (uint16_t)(cwcConversion * sizeof(RTUTF16));
400 return pDst;
401 }
402 RTMemFree(pDst);
403 }
404 }
405 AssertMsgFailed(("rc=%Rrc cwcConversion=%#x\n", rc, cwcConversion));
406 return NULL;
407}
408
409/**
410 * Copies a UTF-8 string to a buffer as UTF-16.
411 *
412 * @returns IPRT status code.
413 * @param pDst The destination buffer.
414 * @param pszSrc The source string.
415 * @param cchSrc The source string length, or RTSTR_MAX.
416 */
417DECLINLINE(int) ShflStringCopyUtf8AsUtf16(PSHFLSTRING pDst, const char *pszSrc, size_t cchSrc)
418{
419 int rc;
420 size_t cwcDst = 0;
421 if (pDst->u16Size >= sizeof(RTUTF16))
422 {
423 PRTUTF16 pwszDst = pDst->String.utf16;
424 rc = RTStrToUtf16Ex(pszSrc, cchSrc, &pwszDst, pDst->u16Size / sizeof(RTUTF16), &cwcDst);
425 }
426 else
427 {
428 RTStrCalcUtf16LenEx(pszSrc, cchSrc, &cwcDst);
429 rc = VERR_BUFFER_OVERFLOW;
430 }
431 pDst->u16Length = (uint16_t)(cwcDst * sizeof(RTUTF16));
432 return rc != VERR_BUFFER_OVERFLOW || cwcDst < UINT16_MAX / sizeof(RTUTF16) ? rc : VERR_TOO_MUCH_DATA;
433}
434
435/**
436 * Copies a UTF-8 string buffer to another buffer as UTF-16
437 *
438 * @returns IPRT status code.
439 * @param pDst The destination buffer (UTF-16).
440 * @param pSrc The source buffer (UTF-8).
441 */
442DECLINLINE(int) ShflStringCopyUtf8BufAsUtf16(PSHFLSTRING pDst, PCSHFLSTRING pSrc)
443{
444 return ShflStringCopyUtf8AsUtf16(pDst, pSrc->String.ach, pSrc->u16Length);
445}
446
447/**
448 * Copies a UTF-16 string to a buffer as UTF-8
449 *
450 * @returns IPRT status code.
451 * @param pDst The destination buffer.
452 * @param pwszSrc The source string.
453 * @param cwcSrc The source string length, or RTSTR_MAX.
454 */
455DECLINLINE(int) ShflStringCopyUtf16AsUtf8(PSHFLSTRING pDst, PCRTUTF16 pwszSrc, size_t cwcSrc)
456{
457 int rc;
458 size_t cchDst = 0;
459 if (pDst->u16Size > 0)
460 {
461 char *pszDst = pDst->String.ach;
462 rc = RTUtf16ToUtf8Ex(pwszSrc, cwcSrc, &pszDst, pDst->u16Size, &cchDst);
463 }
464 else
465 {
466 RTUtf16CalcUtf8LenEx(pwszSrc, cwcSrc, &cchDst);
467 rc = VERR_BUFFER_OVERFLOW;
468 }
469 pDst->u16Length = (uint16_t)cchDst;
470 return rc != VERR_BUFFER_OVERFLOW || cchDst < UINT16_MAX ? rc : VERR_TOO_MUCH_DATA;
471}
472
473/**
474 * Copies a UTF-16 string buffer to another buffer as UTF-8
475 *
476 * @returns IPRT status code.
477 * @param pDst The destination buffer (UTF-8).
478 * @param pSrc The source buffer (UTF-16).
479 */
480DECLINLINE(int) ShflStringCopyUtf16BufAsUtf8(PSHFLSTRING pDst, PCSHFLSTRING pSrc)
481{
482 return ShflStringCopyUtf16AsUtf8(pDst, pSrc->String.utf16, pSrc->u16Length / sizeof(RTUTF16));
483}
484
485#endif /* IN_RING3 */
486
487/**
488 * Validates a HGCM string output parameter.
489 *
490 * @returns true if valid, false if not.
491 *
492 * @param pString The string buffer pointer.
493 * @param cbBuf The buffer size from the parameter.
494 */
495DECLINLINE(bool) ShflStringIsValidOut(PCSHFLSTRING pString, uint32_t cbBuf)
496{
497 if (RT_LIKELY(cbBuf > RT_UOFFSETOF(SHFLSTRING, String)))
498 if (RT_LIKELY((uint32_t)pString->u16Size + RT_UOFFSETOF(SHFLSTRING, String) <= cbBuf))
499 if (RT_LIKELY(pString->u16Length < pString->u16Size))
500 return true;
501 return false;
502}
503
504/**
505 * Validates a HGCM string input parameter.
506 *
507 * @returns true if valid, false if not.
508 *
509 * @param pString The string buffer pointer.
510 * @param cbBuf The buffer size from the parameter.
511 * @param fUtf8Not16 Set if UTF-8 encoding, clear if UTF-16 encoding.
512 */
513DECLINLINE(bool) ShflStringIsValidIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16)
514{
515 int rc;
516 if (RT_LIKELY(cbBuf > RT_UOFFSETOF(SHFLSTRING, String)))
517 {
518 if (RT_LIKELY((uint32_t)pString->u16Size + RT_UOFFSETOF(SHFLSTRING, String) <= cbBuf))
519 {
520 if (fUtf8Not16)
521 {
522 /* UTF-8: */
523 if (RT_LIKELY(pString->u16Length < pString->u16Size))
524 {
525 rc = RTStrValidateEncodingEx((const char *)&pString->String.utf8[0], pString->u16Length + 1,
526 RTSTR_VALIDATE_ENCODING_EXACT_LENGTH | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
527 if (RT_SUCCESS(rc))
528 return true;
529 }
530 }
531 else
532 {
533 /* UTF-16: */
534 if (RT_LIKELY(!(pString->u16Length & 1)))
535 {
536 if (RT_LIKELY((uint32_t)sizeof(RTUTF16) + pString->u16Length <= pString->u16Size))
537 {
538 rc = RTUtf16ValidateEncodingEx(&pString->String.ucs2[0], pString->u16Length / 2 + 1,
539 RTSTR_VALIDATE_ENCODING_EXACT_LENGTH
540 | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
541 if (RT_SUCCESS(rc))
542 return true;
543 }
544 }
545 }
546 }
547 }
548 return false;
549}
550
551/**
552 * Validates an optional HGCM string input parameter.
553 *
554 * @returns true if valid, false if not.
555 *
556 * @param pString The string buffer pointer. Can be NULL.
557 * @param cbBuf The buffer size from the parameter.
558 * @param fUtf8Not16 Set if UTF-8 encoding, clear if UTF-16 encoding.
559 */
560DECLINLINE(bool) ShflStringIsValidOrNullIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16)
561{
562 if (pString)
563 return ShflStringIsValidIn(pString, cbBuf, fUtf8Not16);
564 if (RT_LIKELY(cbBuf == 0))
565 return true;
566 return false;
567}
568
569/** Macro for passing as string as a HGCM parmeter (pointer) */
570#define SHFLSTRING_TO_HGMC_PARAM(a_pParam, a_pString) \
571 do { \
572 (a_pParam)->type = VBOX_HGCM_SVC_PARM_PTR; \
573 (a_pParam)->u.pointer.addr = (a_pString); \
574 (a_pParam)->u.pointer.size = ShflStringSizeOfBuffer(a_pString); \
575 } while (0)
576
577/** @} */
578
579
580/**
581 * The available additional information in a SHFLFSOBJATTR object.
582 */
583typedef enum SHFLFSOBJATTRADD
584{
585 /** No additional information is available / requested. */
586 SHFLFSOBJATTRADD_NOTHING = 1,
587 /** The additional unix attributes (SHFLFSOBJATTR::u::Unix) are
588 * available / requested. */
589 SHFLFSOBJATTRADD_UNIX,
590 /** The additional extended attribute size (SHFLFSOBJATTR::u::EASize) is
591 * available / requested. */
592 SHFLFSOBJATTRADD_EASIZE,
593 /** The last valid item (inclusive).
594 * The valid range is SHFLFSOBJATTRADD_NOTHING thru
595 * SHFLFSOBJATTRADD_LAST. */
596 SHFLFSOBJATTRADD_LAST = SHFLFSOBJATTRADD_EASIZE,
597
598 /** The usual 32-bit hack. */
599 SHFLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
600} SHFLFSOBJATTRADD;
601
602
603/* Assert sizes of the IRPT types we're using below. */
604AssertCompileSize(RTFMODE, 4);
605AssertCompileSize(RTFOFF, 8);
606AssertCompileSize(RTINODE, 8);
607AssertCompileSize(RTTIMESPEC, 8);
608AssertCompileSize(RTDEV, 4);
609AssertCompileSize(RTUID, 4);
610
611/**
612 * Shared folder filesystem object attributes.
613 */
614#pragma pack(1)
615typedef struct SHFLFSOBJATTR
616{
617 /** Mode flags (st_mode). RTFS_UNIX_*, RTFS_TYPE_*, and RTFS_DOS_*.
618 * @remarks We depend on a number of RTFS_ defines to remain unchanged.
619 * Fortuntately, these are depending on windows, dos and unix
620 * standard values, so this shouldn't be much of a pain. */
621 RTFMODE fMode;
622
623 /** The additional attributes available. */
624 SHFLFSOBJATTRADD enmAdditional;
625
626 /**
627 * Additional attributes.
628 *
629 * Unless explicitly specified to an API, the API can provide additional
630 * data as it is provided by the underlying OS.
631 */
632 union SHFLFSOBJATTRUNION
633 {
634 /** Additional Unix Attributes
635 * These are available when SHFLFSOBJATTRADD is set in fUnix.
636 */
637 struct SHFLFSOBJATTRUNIX
638 {
639 /** The user owning the filesystem object (st_uid).
640 * This field is ~0U if not supported. */
641 RTUID uid;
642
643 /** The group the filesystem object is assigned (st_gid).
644 * This field is ~0U if not supported. */
645 RTGID gid;
646
647 /** Number of hard links to this filesystem object (st_nlink).
648 * This field is 1 if the filesystem doesn't support hardlinking or
649 * the information isn't available.
650 */
651 uint32_t cHardlinks;
652
653 /** The device number of the device which this filesystem object resides on (st_dev).
654 * This field is 0 if this information is not available. */
655 RTDEV INodeIdDevice;
656
657 /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
658 * Together with INodeIdDevice, this field can be used as a OS wide unique id
659 * when both their values are not 0.
660 * This field is 0 if the information is not available. */
661 RTINODE INodeId;
662
663 /** User flags (st_flags).
664 * This field is 0 if this information is not available. */
665 uint32_t fFlags;
666
667 /** The current generation number (st_gen).
668 * This field is 0 if this information is not available. */
669 uint32_t GenerationId;
670
671 /** The device number of a character or block device type object (st_rdev).
672 * This field is 0 if the file isn't of a character or block device type and
673 * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
674 RTDEV Device;
675 } Unix;
676
677 /**
678 * Extended attribute size.
679 */
680 struct SHFLFSOBJATTREASIZE
681 {
682 /** Size of EAs. */
683 RTFOFF cb;
684 } EASize;
685 } u;
686} SHFLFSOBJATTR;
687#pragma pack()
688AssertCompileSize(SHFLFSOBJATTR, 44);
689/** Pointer to a shared folder filesystem object attributes structure. */
690typedef SHFLFSOBJATTR *PSHFLFSOBJATTR;
691/** Pointer to a const shared folder filesystem object attributes structure. */
692typedef const SHFLFSOBJATTR *PCSHFLFSOBJATTR;
693
694
695/**
696 * Filesystem object information structure.
697 */
698#pragma pack(1)
699typedef struct SHFLFSOBJINFO
700{
701 /** Logical size (st_size).
702 * For normal files this is the size of the file.
703 * For symbolic links, this is the length of the path name contained
704 * in the symbolic link.
705 * For other objects this fields needs to be specified.
706 */
707 RTFOFF cbObject;
708
709 /** Disk allocation size (st_blocks * DEV_BSIZE). */
710 RTFOFF cbAllocated;
711
712 /** Time of last access (st_atime).
713 * @remarks Here (and other places) we depend on the IPRT timespec to
714 * remain unchanged. */
715 RTTIMESPEC AccessTime;
716
717 /** Time of last data modification (st_mtime). */
718 RTTIMESPEC ModificationTime;
719
720 /** Time of last status change (st_ctime).
721 * If not available this is set to ModificationTime.
722 */
723 RTTIMESPEC ChangeTime;
724
725 /** Time of file birth (st_birthtime).
726 * If not available this is set to ChangeTime.
727 */
728 RTTIMESPEC BirthTime;
729
730 /** Attributes. */
731 SHFLFSOBJATTR Attr;
732
733} SHFLFSOBJINFO;
734#pragma pack()
735AssertCompileSize(SHFLFSOBJINFO, 92);
736/** Pointer to a shared folder filesystem object information structure. */
737typedef SHFLFSOBJINFO *PSHFLFSOBJINFO;
738/** Pointer to a const shared folder filesystem object information
739 * structure. */
740typedef const SHFLFSOBJINFO *PCSHFLFSOBJINFO;
741
742
743/**
744 * Copy file system objinfo from IPRT to shared folder format.
745 *
746 * @param pDst The shared folder structure.
747 * @param pSrc The IPRT structure.
748 */
749DECLINLINE(void) vbfsCopyFsObjInfoFromIprt(PSHFLFSOBJINFO pDst, PCRTFSOBJINFO pSrc)
750{
751 pDst->cbObject = pSrc->cbObject;
752 pDst->cbAllocated = pSrc->cbAllocated;
753 pDst->AccessTime = pSrc->AccessTime;
754 pDst->ModificationTime = pSrc->ModificationTime;
755 pDst->ChangeTime = pSrc->ChangeTime;
756 pDst->BirthTime = pSrc->BirthTime;
757 pDst->Attr.fMode = pSrc->Attr.fMode;
758 /* Clear bits which we don't pass through for security reasons. */
759 pDst->Attr.fMode &= ~(RTFS_UNIX_ISUID | RTFS_UNIX_ISGID | RTFS_UNIX_ISTXT);
760 RT_ZERO(pDst->Attr.u);
761 switch (pSrc->Attr.enmAdditional)
762 {
763 default:
764 case RTFSOBJATTRADD_NOTHING:
765 pDst->Attr.enmAdditional = SHFLFSOBJATTRADD_NOTHING;
766 break;
767
768 case RTFSOBJATTRADD_UNIX:
769 pDst->Attr.enmAdditional = SHFLFSOBJATTRADD_UNIX;
770 pDst->Attr.u.Unix.uid = pSrc->Attr.u.Unix.uid;
771 pDst->Attr.u.Unix.gid = pSrc->Attr.u.Unix.gid;
772 pDst->Attr.u.Unix.cHardlinks = pSrc->Attr.u.Unix.cHardlinks;
773 pDst->Attr.u.Unix.INodeIdDevice = pSrc->Attr.u.Unix.INodeIdDevice;
774 pDst->Attr.u.Unix.INodeId = pSrc->Attr.u.Unix.INodeId;
775 pDst->Attr.u.Unix.fFlags = pSrc->Attr.u.Unix.fFlags;
776 pDst->Attr.u.Unix.GenerationId = pSrc->Attr.u.Unix.GenerationId;
777 pDst->Attr.u.Unix.Device = pSrc->Attr.u.Unix.Device;
778 break;
779
780 case RTFSOBJATTRADD_EASIZE:
781 pDst->Attr.enmAdditional = SHFLFSOBJATTRADD_EASIZE;
782 pDst->Attr.u.EASize.cb = pSrc->Attr.u.EASize.cb;
783 break;
784 }
785}
786
787
788/** Result of an open/create request.
789 * Along with handle value the result code
790 * identifies what has happened while
791 * trying to open the object.
792 */
793typedef enum _SHFLCREATERESULT
794{
795 SHFL_NO_RESULT,
796 /** Specified path does not exist. */
797 SHFL_PATH_NOT_FOUND,
798 /** Path to file exists, but the last component does not. */
799 SHFL_FILE_NOT_FOUND,
800 /** File already exists and either has been opened or not. */
801 SHFL_FILE_EXISTS,
802 /** New file was created. */
803 SHFL_FILE_CREATED,
804 /** Existing file was replaced or overwritten. */
805 SHFL_FILE_REPLACED,
806 /** Blow the type up to 32-bit. */
807 SHFL_32BIT_HACK = 0x7fffffff
808} SHFLCREATERESULT;
809AssertCompile(SHFL_NO_RESULT == 0);
810AssertCompileSize(SHFLCREATERESULT, 4);
811
812
813/** @name Open/create flags.
814 * @{
815 */
816
817/** No flags. Initialization value. */
818#define SHFL_CF_NONE (0x00000000)
819
820/** Lookup only the object, do not return a handle. All other flags are ignored. */
821#define SHFL_CF_LOOKUP (0x00000001)
822
823/** Open parent directory of specified object.
824 * Useful for the corresponding Windows FSD flag
825 * and for opening paths like \\dir\\*.* to search the 'dir'.
826 * @todo possibly not needed???
827 */
828#define SHFL_CF_OPEN_TARGET_DIRECTORY (0x00000002)
829
830/** Create/open a directory. */
831#define SHFL_CF_DIRECTORY (0x00000004)
832
833/** Open/create action to do if object exists
834 * and if the object does not exists.
835 * REPLACE file means atomically DELETE and CREATE.
836 * OVERWRITE file means truncating the file to 0 and
837 * setting new size.
838 * When opening an existing directory REPLACE and OVERWRITE
839 * actions are considered invalid, and cause returning
840 * FILE_EXISTS with NIL handle.
841 */
842#define SHFL_CF_ACT_MASK_IF_EXISTS (0x000000F0)
843#define SHFL_CF_ACT_MASK_IF_NEW (0x00000F00)
844
845/** What to do if object exists. */
846#define SHFL_CF_ACT_OPEN_IF_EXISTS (0x00000000)
847#define SHFL_CF_ACT_FAIL_IF_EXISTS (0x00000010)
848#define SHFL_CF_ACT_REPLACE_IF_EXISTS (0x00000020)
849#define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
850
851/** What to do if object does not exist. */
852#define SHFL_CF_ACT_CREATE_IF_NEW (0x00000000)
853#define SHFL_CF_ACT_FAIL_IF_NEW (0x00000100)
854
855/** Read/write requested access for the object. */
856#define SHFL_CF_ACCESS_MASK_RW (0x00003000)
857
858/** No access requested. */
859#define SHFL_CF_ACCESS_NONE (0x00000000)
860/** Read access requested. */
861#define SHFL_CF_ACCESS_READ (0x00001000)
862/** Write access requested. */
863#define SHFL_CF_ACCESS_WRITE (0x00002000)
864/** Read/Write access requested. */
865#define SHFL_CF_ACCESS_READWRITE (SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_WRITE)
866
867/** Requested share access for the object. */
868#define SHFL_CF_ACCESS_MASK_DENY (0x0000C000)
869
870/** Allow any access. */
871#define SHFL_CF_ACCESS_DENYNONE (0x00000000)
872/** Do not allow read. */
873#define SHFL_CF_ACCESS_DENYREAD (0x00004000)
874/** Do not allow write. */
875#define SHFL_CF_ACCESS_DENYWRITE (0x00008000)
876/** Do not allow access. */
877#define SHFL_CF_ACCESS_DENYALL (SHFL_CF_ACCESS_DENYREAD | SHFL_CF_ACCESS_DENYWRITE)
878
879/** Requested access to attributes of the object. */
880#define SHFL_CF_ACCESS_MASK_ATTR (0x00030000)
881
882/** No access requested. */
883#define SHFL_CF_ACCESS_ATTR_NONE (0x00000000)
884/** Read access requested. */
885#define SHFL_CF_ACCESS_ATTR_READ (0x00010000)
886/** Write access requested. */
887#define SHFL_CF_ACCESS_ATTR_WRITE (0x00020000)
888/** Read/Write access requested. */
889#define SHFL_CF_ACCESS_ATTR_READWRITE (SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_ATTR_WRITE)
890
891/** The file is opened in append mode. Ignored if SHFL_CF_ACCESS_WRITE is not set. */
892#define SHFL_CF_ACCESS_APPEND (0x00040000)
893
894/** @} */
895
896#pragma pack(1)
897typedef struct _SHFLCREATEPARMS
898{
899 /* Returned handle of opened object. */
900 SHFLHANDLE Handle;
901
902 /* Returned result of the operation */
903 SHFLCREATERESULT Result;
904
905 /* SHFL_CF_* */
906 uint32_t CreateFlags;
907
908 /* Attributes of object to create and
909 * returned actual attributes of opened/created object.
910 */
911 SHFLFSOBJINFO Info;
912
913} SHFLCREATEPARMS;
914#pragma pack()
915
916typedef SHFLCREATEPARMS *PSHFLCREATEPARMS;
917
918
919/** @name Shared Folders mappings.
920 * @{
921 */
922
923/** The mapping has been added since last query. */
924#define SHFL_MS_NEW (1)
925/** The mapping has been deleted since last query. */
926#define SHFL_MS_DELETED (2)
927
928typedef struct _SHFLMAPPING
929{
930 /** Mapping status.
931 * @note Currently always set to SHFL_MS_NEW. */
932 uint32_t u32Status;
933 /** Root handle. */
934 SHFLROOT root;
935} SHFLMAPPING;
936/** Pointer to a SHFLMAPPING structure. */
937typedef SHFLMAPPING *PSHFLMAPPING;
938
939/** @} */
940
941
942/** @name Shared Folder directory information
943 * @{
944 */
945
946typedef struct _SHFLDIRINFO
947{
948 /** Full information about the object. */
949 SHFLFSOBJINFO Info;
950 /** The length of the short field (number of RTUTF16 chars).
951 * It is 16-bit for reasons of alignment. */
952 uint16_t cucShortName;
953 /** The short name for 8.3 compatibility.
954 * Empty string if not available.
955 */
956 RTUTF16 uszShortName[14];
957 /** @todo malc, a description, please. */
958 SHFLSTRING name;
959} SHFLDIRINFO, *PSHFLDIRINFO;
960
961
962/**
963 * Shared folder filesystem properties.
964 */
965typedef struct SHFLFSPROPERTIES
966{
967 /** The maximum size of a filesystem object name.
968 * This does not include the '\\0'. */
969 uint32_t cbMaxComponent;
970
971 /** True if the filesystem is remote.
972 * False if the filesystem is local. */
973 bool fRemote;
974
975 /** True if the filesystem is case sensitive.
976 * False if the filesystem is case insensitive. */
977 bool fCaseSensitive;
978
979 /** True if the filesystem is mounted read only.
980 * False if the filesystem is mounted read write. */
981 bool fReadOnly;
982
983 /** True if the filesystem can encode unicode object names.
984 * False if it can't. */
985 bool fSupportsUnicode;
986
987 /** True if the filesystem is compresses.
988 * False if it isn't or we don't know. */
989 bool fCompressed;
990
991 /** True if the filesystem compresses of individual files.
992 * False if it doesn't or we don't know. */
993 bool fFileCompression;
994
995 /** @todo more? */
996} SHFLFSPROPERTIES;
997AssertCompileSize(SHFLFSPROPERTIES, 12);
998/** Pointer to a shared folder filesystem properties structure. */
999typedef SHFLFSPROPERTIES *PSHFLFSPROPERTIES;
1000/** Pointer to a const shared folder filesystem properties structure. */
1001typedef SHFLFSPROPERTIES const *PCSHFLFSPROPERTIES;
1002
1003
1004/**
1005 * Copy file system properties from IPRT to shared folder format.
1006 *
1007 * @param pDst The shared folder structure.
1008 * @param pSrc The IPRT structure.
1009 */
1010DECLINLINE(void) vbfsCopyFsPropertiesFromIprt(PSHFLFSPROPERTIES pDst, PCRTFSPROPERTIES pSrc)
1011{
1012 RT_ZERO(*pDst); /* zap the implicit padding. */
1013 pDst->cbMaxComponent = pSrc->cbMaxComponent;
1014 pDst->fRemote = pSrc->fRemote;
1015 pDst->fCaseSensitive = pSrc->fCaseSensitive;
1016 pDst->fReadOnly = pSrc->fReadOnly;
1017 pDst->fSupportsUnicode = pSrc->fSupportsUnicode;
1018 pDst->fCompressed = pSrc->fCompressed;
1019 pDst->fFileCompression = pSrc->fFileCompression;
1020}
1021
1022
1023typedef struct _SHFLVOLINFO
1024{
1025 RTFOFF ullTotalAllocationBytes;
1026 RTFOFF ullAvailableAllocationBytes;
1027 uint32_t ulBytesPerAllocationUnit;
1028 uint32_t ulBytesPerSector;
1029 uint32_t ulSerial;
1030 SHFLFSPROPERTIES fsProperties;
1031} SHFLVOLINFO, *PSHFLVOLINFO;
1032
1033/** @} */
1034
1035
1036/** @defgroup grp_vbox_shfl_params Function parameter structures.
1037 * @{
1038 */
1039
1040/** @name SHFL_FN_QUERY_MAPPINGS
1041 * @{
1042 */
1043/** Validation mask. Needs to be adjusted
1044 * whenever a new SHFL_MF_ flag is added. */
1045#define SHFL_MF_MASK (0x00000011)
1046/** UTF-16 enconded strings. */
1047#define SHFL_MF_UCS2 (0x00000000)
1048/** Guest uses UTF8 strings, if not set then the strings are unicode (UCS2). */
1049#define SHFL_MF_UTF8 (0x00000001)
1050/** Just handle the auto-mounted folders. */
1051#define SHFL_MF_AUTOMOUNT (0x00000010)
1052
1053/** Parameters structure. */
1054typedef struct _VBoxSFQueryMappings
1055{
1056 VBGLIOCHGCMCALL callInfo;
1057
1058 /** 32bit, in:
1059 * Flags describing various client needs.
1060 */
1061 HGCMFunctionParameter flags;
1062
1063 /** 32bit, in/out:
1064 * Number of mappings the client expects.
1065 * This is the number of elements in the
1066 * mappings array.
1067 */
1068 HGCMFunctionParameter numberOfMappings;
1069
1070 /** pointer, in/out:
1071 * Points to array of SHFLMAPPING structures.
1072 */
1073 HGCMFunctionParameter mappings;
1074
1075} VBoxSFQueryMappings;
1076
1077/** Number of parameters */
1078#define SHFL_CPARMS_QUERY_MAPPINGS (3)
1079/** @} */
1080
1081
1082/** @name SHFL_FN_QUERY_MAP_NAME
1083 * @{
1084 */
1085
1086/** Parameters structure. */
1087typedef struct _VBoxSFQueryMapName
1088{
1089 VBGLIOCHGCMCALL callInfo;
1090
1091 /** 32bit, in: SHFLROOT
1092 * Root handle of the mapping which name is queried.
1093 */
1094 HGCMFunctionParameter root;
1095
1096 /** pointer, in/out:
1097 * Points to SHFLSTRING buffer.
1098 */
1099 HGCMFunctionParameter name;
1100
1101} VBoxSFQueryMapName;
1102
1103/** Number of parameters */
1104#define SHFL_CPARMS_QUERY_MAP_NAME (2)
1105/** @} */
1106
1107
1108/** @name SHFL_FN_MAP_FOLDER_OLD
1109 * @{
1110 */
1111
1112/** Parameters structure. */
1113typedef struct _VBoxSFMapFolder_Old
1114{
1115 VBGLIOCHGCMCALL callInfo;
1116
1117 /** pointer, in:
1118 * Points to SHFLSTRING buffer.
1119 */
1120 HGCMFunctionParameter path;
1121
1122 /** pointer, out: SHFLROOT
1123 * Root handle of the mapping which name is queried.
1124 */
1125 HGCMFunctionParameter root;
1126
1127 /** pointer, in: RTUTF16
1128 * Path delimiter
1129 */
1130 HGCMFunctionParameter delimiter;
1131
1132} VBoxSFMapFolder_Old;
1133
1134/** Number of parameters */
1135#define SHFL_CPARMS_MAP_FOLDER_OLD (3)
1136/** @} */
1137
1138
1139/** @name SHFL_FN_MAP_FOLDER
1140 * @{
1141 */
1142
1143/** SHFL_FN_MAP_FOLDER parameters. */
1144typedef struct VBoxSFParmMapFolder
1145{
1146 /** pointer, in: SHFLSTRING with the name of the folder to map. */
1147 HGCMFunctionParameter pStrName;
1148 /** value32, out: The root ID (SHFLROOT) of the mapping. */
1149 HGCMFunctionParameter id32Root;
1150 /** value32, in: Path delimiter code point. */
1151 HGCMFunctionParameter uc32Delimiter;
1152 /** value32, in: case senstive flag */
1153 HGCMFunctionParameter fCaseSensitive;
1154} VBoxSFParmMapFolder;
1155
1156/** Parameters structure. */
1157typedef struct _VBoxSFMapFolder
1158{
1159 VBGLIOCHGCMCALL callInfo;
1160
1161 /** pointer, in:
1162 * Points to SHFLSTRING buffer.
1163 */
1164 HGCMFunctionParameter path;
1165
1166 /** pointer, out: SHFLROOT
1167 * Root handle of the mapping which name is queried.
1168 */
1169 HGCMFunctionParameter root;
1170
1171 /** pointer, in: RTUTF16
1172 * Path delimiter
1173 */
1174 HGCMFunctionParameter delimiter;
1175
1176 /** pointer, in: SHFLROOT
1177 * Case senstive flag
1178 */
1179 HGCMFunctionParameter fCaseSensitive;
1180
1181} VBoxSFMapFolder;
1182
1183/** Number of parameters */
1184#define SHFL_CPARMS_MAP_FOLDER (4)
1185/** @} */
1186
1187
1188/** @name SHFL_FN_UNMAP_FOLDER
1189 * @{
1190 */
1191
1192/** SHFL_FN_UNMAP_FOLDER parameters. */
1193typedef struct VBoxSFParmUnmapFolder
1194{
1195 /** value32, in: SHFLROOT of the mapping to unmap */
1196 HGCMFunctionParameter id32Root;
1197} VBoxSFParmUnmapFolder;
1198
1199/** Parameters structure. */
1200typedef struct _VBoxSFUnmapFolder
1201{
1202 VBGLIOCHGCMCALL callInfo;
1203
1204 /** pointer, in: SHFLROOT
1205 * Root handle of the mapping which name is queried.
1206 */
1207 HGCMFunctionParameter root;
1208
1209} VBoxSFUnmapFolder;
1210
1211/** Number of parameters */
1212#define SHFL_CPARMS_UNMAP_FOLDER (1)
1213/** @} */
1214
1215
1216/** @name SHFL_FN_CREATE
1217 * @{
1218 */
1219
1220/** SHFL_FN_CREATE parameters. */
1221typedef struct VBoxSFParmCreate
1222{
1223 /** value32, in: SHFLROOT
1224 * Root handle of the mapping which name is queried. */
1225 HGCMFunctionParameter id32Root;
1226 /** pointer, in: Points to SHFLSTRING buffer. */
1227 HGCMFunctionParameter pStrPath;
1228 /** pointer, in/out: Points to SHFLCREATEPARMS buffer. */
1229 HGCMFunctionParameter pCreateParms;
1230} VBoxSFParmCreate;
1231
1232/** Parameters structure. */
1233typedef struct _VBoxSFCreate
1234{
1235 VBGLIOCHGCMCALL callInfo;
1236
1237 /** pointer, in: SHFLROOT
1238 * Root handle of the mapping which name is queried.
1239 */
1240 HGCMFunctionParameter root;
1241
1242 /** pointer, in:
1243 * Points to SHFLSTRING buffer.
1244 */
1245 HGCMFunctionParameter path;
1246
1247 /** pointer, in/out:
1248 * Points to SHFLCREATEPARMS buffer.
1249 */
1250 HGCMFunctionParameter parms;
1251
1252} VBoxSFCreate;
1253
1254/** Number of parameters */
1255#define SHFL_CPARMS_CREATE (3)
1256/** @} */
1257
1258
1259/** @name SHFL_FN_CLOSE
1260 * @{
1261 */
1262
1263/** SHFL_FN_CLOSE parameters. */
1264typedef struct VBoxSFParmClose
1265{
1266 /** value32, in: SHFLROOT of the mapping with the handle. */
1267 HGCMFunctionParameter id32Root;
1268 /** value64, in: SHFLHANDLE of object to close. */
1269 HGCMFunctionParameter u64Handle;
1270} VBoxSFParmClose;
1271
1272/** Parameters structure. */
1273typedef struct _VBoxSFClose
1274{
1275 VBGLIOCHGCMCALL callInfo;
1276
1277 /** pointer, in: SHFLROOT
1278 * Root handle of the mapping which name is queried.
1279 */
1280 HGCMFunctionParameter root;
1281
1282
1283 /** value64, in:
1284 * SHFLHANDLE of object to close.
1285 */
1286 HGCMFunctionParameter handle;
1287
1288} VBoxSFClose;
1289
1290/** Number of parameters */
1291#define SHFL_CPARMS_CLOSE (2)
1292/** @} */
1293
1294
1295/** @name SHFL_FN_READ
1296 * @{
1297 */
1298
1299/** SHFL_FN_READ parameters. */
1300typedef struct VBoxSFParmRead
1301{
1302 /** value32, in: SHFLROOT of the mapping with the handle. */
1303 HGCMFunctionParameter id32Root;
1304 /** value64, in: SHFLHANDLE of object to read from . */
1305 HGCMFunctionParameter u64Handle;
1306 /** value64, in: Offset to start reading from. */
1307 HGCMFunctionParameter off64Read;
1308 /** value32, in/out: How much to try read / Actually read. */
1309 HGCMFunctionParameter cb32Read;
1310 /** pointer, out: Buffer to return the data in. */
1311 HGCMFunctionParameter pBuf;
1312} VBoxSFParmRead;
1313
1314/** Parameters structure. */
1315typedef struct _VBoxSFRead
1316{
1317 VBGLIOCHGCMCALL callInfo;
1318
1319 /** pointer, in: SHFLROOT
1320 * Root handle of the mapping which name is queried.
1321 */
1322 HGCMFunctionParameter root;
1323
1324 /** value64, in:
1325 * SHFLHANDLE of object to read from.
1326 */
1327 HGCMFunctionParameter handle;
1328
1329 /** value64, in:
1330 * Offset to read from.
1331 */
1332 HGCMFunctionParameter offset;
1333
1334 /** value64, in/out:
1335 * Bytes to read/How many were read.
1336 */
1337 HGCMFunctionParameter cb;
1338
1339 /** pointer, out:
1340 * Buffer to place data to.
1341 */
1342 HGCMFunctionParameter buffer;
1343
1344} VBoxSFRead;
1345
1346/** Number of parameters */
1347#define SHFL_CPARMS_READ (5)
1348/** @} */
1349
1350
1351/** @name SHFL_FN_WRITE
1352 * @{
1353 */
1354
1355/** SHFL_FN_WRITE parameters. */
1356typedef struct VBoxSFParmWrite
1357{
1358 /** value32, in: SHFLROOT of the mapping with the handle. */
1359 HGCMFunctionParameter id32Root;
1360 /** value64, in: SHFLHANDLE of object to write to. */
1361 HGCMFunctionParameter u64Handle;
1362 /** value64, in/out: Offset to start writing at / New offset.
1363 * @note The new offset isn't necessarily off + cb for files opened with
1364 * SHFL_CF_ACCESS_APPEND since other parties (host programs, other VMs,
1365 * other computers) could have extended the file since the last time the
1366 * guest got a fresh size statistic. So, this helps the guest avoiding
1367 * a stat call to check the actual size. */
1368 HGCMFunctionParameter off64Write;
1369 /** value32, in/out: How much to try write / Actually written. */
1370 HGCMFunctionParameter cb32Write;
1371 /** pointer, out: Buffer to return the data in. */
1372 HGCMFunctionParameter pBuf;
1373} VBoxSFParmWrite;
1374
1375/** Parameters structure. */
1376typedef struct _VBoxSFWrite
1377{
1378 VBGLIOCHGCMCALL callInfo;
1379
1380 /** pointer, in: SHFLROOT
1381 * Root handle of the mapping which name is queried.
1382 */
1383 HGCMFunctionParameter root;
1384
1385 /** value64, in:
1386 * SHFLHANDLE of object to write to.
1387 */
1388 HGCMFunctionParameter handle;
1389
1390 /** value64, in/out:
1391 * Offset to write to/New offset.
1392 * @note The new offset isn't necessarily off + cb for files opened with
1393 * SHFL_CF_ACCESS_APPEND since other parties (host programs, other VMs,
1394 * other computers) could have extended the file since the last time the
1395 * guest got a fresh size statistic. So, this helps the guest avoiding
1396 * a stat call to check the actual size.
1397 */
1398 HGCMFunctionParameter offset;
1399
1400 /** value64, in/out:
1401 * Bytes to write/How many were written.
1402 */
1403 HGCMFunctionParameter cb;
1404
1405 /** pointer, in:
1406 * Data to write.
1407 */
1408 HGCMFunctionParameter buffer;
1409
1410} VBoxSFWrite;
1411
1412/** Number of parameters */
1413#define SHFL_CPARMS_WRITE (5)
1414/** @} */
1415
1416
1417/** @name SHFL_FN_LOCK
1418 * @remarks Lock owner is the HGCM client.
1419 * @{
1420 */
1421
1422/** Lock mode bit mask. */
1423#define SHFL_LOCK_MODE_MASK (0x3)
1424/** Cancel lock on the given range. */
1425#define SHFL_LOCK_CANCEL (0x0)
1426/** Acquire read only lock. Prevent write to the range. */
1427#define SHFL_LOCK_SHARED (0x1)
1428/** Acquire write lock. Prevent both write and read to the range. */
1429#define SHFL_LOCK_EXCLUSIVE (0x2)
1430
1431/** Do not wait for lock if it can not be acquired at the time. */
1432#define SHFL_LOCK_NOWAIT (0x0)
1433/** Wait and acquire lock. */
1434#define SHFL_LOCK_WAIT (0x4)
1435
1436/** Lock the specified range. */
1437#define SHFL_LOCK_PARTIAL (0x0)
1438/** Lock entire object. */
1439#define SHFL_LOCK_ENTIRE (0x8)
1440
1441/** Parameters structure. */
1442typedef struct _VBoxSFLock
1443{
1444 VBGLIOCHGCMCALL callInfo;
1445
1446 /** pointer, in: SHFLROOT
1447 * Root handle of the mapping which name is queried.
1448 */
1449 HGCMFunctionParameter root;
1450
1451 /** value64, in:
1452 * SHFLHANDLE of object to be locked.
1453 */
1454 HGCMFunctionParameter handle;
1455
1456 /** value64, in:
1457 * Starting offset of lock range.
1458 */
1459 HGCMFunctionParameter offset;
1460
1461 /** value64, in:
1462 * Length of range.
1463 */
1464 HGCMFunctionParameter length;
1465
1466 /** value32, in:
1467 * Lock flags SHFL_LOCK_*.
1468 */
1469 HGCMFunctionParameter flags;
1470
1471} VBoxSFLock;
1472
1473/** Number of parameters */
1474#define SHFL_CPARMS_LOCK (5)
1475/** @} */
1476
1477
1478/** @name SHFL_FN_FLUSH
1479 * @{
1480 */
1481
1482/** SHFL_FN_FLUSH parameters. */
1483typedef struct VBoxSFParmFlush
1484{
1485 /** value32, in: SHFLROOT of the mapping with the handle. */
1486 HGCMFunctionParameter id32Root;
1487 /** value64, in: SHFLHANDLE of object to flush. */
1488 HGCMFunctionParameter u64Handle;
1489} VBoxSFParmFlush;
1490
1491/** Parameters structure. */
1492typedef struct _VBoxSFFlush
1493{
1494 VBGLIOCHGCMCALL callInfo;
1495
1496 /** pointer, in: SHFLROOT
1497 * Root handle of the mapping which name is queried.
1498 */
1499 HGCMFunctionParameter root;
1500
1501 /** value64, in:
1502 * SHFLHANDLE of object to be locked.
1503 */
1504 HGCMFunctionParameter handle;
1505
1506} VBoxSFFlush;
1507
1508/** Number of parameters */
1509#define SHFL_CPARMS_FLUSH (2)
1510/** @} */
1511
1512
1513/** @name SHFL_FN_SET_UTF8
1514 * @{ */
1515/** NUmber of parameters for SHFL_FN_SET_UTF8. */
1516#define SHFL_CPARMS_SET_UTF8 (0)
1517/** @} */
1518
1519
1520/** @name SHFL_FN_LIST
1521 * @remarks Listing information includes variable length RTDIRENTRY[EX]
1522 * structures.
1523 * @{
1524 */
1525
1526/** @todo might be necessary for future. */
1527#define SHFL_LIST_NONE 0
1528#define SHFL_LIST_RETURN_ONE 1
1529#define SHFL_LIST_RESTART 2
1530
1531/** SHFL_FN_LIST parameters. */
1532typedef struct VBoxSFParmList
1533{
1534 /** value32, in: SHFLROOT of the mapping the handle belongs to. */
1535 HGCMFunctionParameter id32Root;
1536 /** value64, in: SHFLHANDLE of the directory. */
1537 HGCMFunctionParameter u64Handle;
1538 /** value32, in: List flags SHFL_LIST_XXX. */
1539 HGCMFunctionParameter f32Flags;
1540 /** value32, in/out: Input buffer size / Returned bytes count. */
1541 HGCMFunctionParameter cb32Buffer;
1542 /** pointer, in[optional]: SHFLSTRING filter string (full path). */
1543 HGCMFunctionParameter pStrFilter;
1544 /** pointer, out: Buffer to return listing information in (SHFLDIRINFO).
1545 * When SHFL_LIST_RETURN_ONE is not specfied, multiple record may be
1546 * returned, deriving the entry size using SHFLDIRINFO::name.u16Size. */
1547 HGCMFunctionParameter pBuffer;
1548 /** value32, out: Set to 0 if the listing is done, 1 if there are more entries.
1549 * @note Must be set to zero on call as it was declared in/out parameter and
1550 * may be used as such again. */
1551 HGCMFunctionParameter f32More;
1552 /** value32, out: Number of entries returned. */
1553 HGCMFunctionParameter c32Entries;
1554} VBoxSFParmList;
1555
1556
1557/** Parameters structure. */
1558typedef struct _VBoxSFList
1559{
1560 VBGLIOCHGCMCALL callInfo;
1561
1562 /** pointer, in: SHFLROOT
1563 * Root handle of the mapping which name is queried.
1564 */
1565 HGCMFunctionParameter root;
1566
1567 /** value64, in:
1568 * SHFLHANDLE of object to be listed.
1569 */
1570 HGCMFunctionParameter handle;
1571
1572 /** value32, in:
1573 * List flags SHFL_LIST_*.
1574 */
1575 HGCMFunctionParameter flags;
1576
1577 /** value32, in/out:
1578 * Bytes to be used for listing information/How many bytes were used.
1579 */
1580 HGCMFunctionParameter cb;
1581
1582 /** pointer, in/optional
1583 * Points to SHFLSTRING buffer that specifies a search path.
1584 */
1585 HGCMFunctionParameter path;
1586
1587 /** pointer, out:
1588 * Buffer to place listing information to. (SHFLDIRINFO)
1589 */
1590 HGCMFunctionParameter buffer;
1591
1592 /** value32, in/out:
1593 * Indicates a key where the listing must be resumed.
1594 * in: 0 means start from begin of object.
1595 * out: 0 means listing completed.
1596 */
1597 HGCMFunctionParameter resumePoint;
1598
1599 /** pointer, out:
1600 * Number of files returned
1601 */
1602 HGCMFunctionParameter cFiles;
1603
1604} VBoxSFList;
1605
1606/** Number of parameters */
1607#define SHFL_CPARMS_LIST (8)
1608/** @} */
1609
1610
1611/** @name SHFL_FN_READLINK
1612 * @{
1613 */
1614
1615/** SHFL_FN_READLINK parameters. */
1616typedef struct VBoxSFParmReadLink
1617{
1618 /** value32, in: SHFLROOT of the mapping which the symlink is read. */
1619 HGCMFunctionParameter id32Root;
1620 /** pointer, in: SHFLSTRING full path to the symlink. */
1621 HGCMFunctionParameter pStrPath;
1622 /** pointer, out: Buffer to place the symlink target into.
1623 * @note Buffer contains UTF-8 characters on success, regardless of the
1624 * UTF-8/UTF-16 setting of the connection. Will be zero terminated.
1625 *
1626 * @todo r=bird: This should've been a string!
1627 * @todo r=bird: There should've been a byte count returned! */
1628 HGCMFunctionParameter pBuffer;
1629} VBoxSFParmReadLink;
1630
1631/** Parameters structure. */
1632typedef struct _VBoxSFReadLink
1633{
1634 VBGLIOCHGCMCALL callInfo;
1635
1636 /** pointer, in: SHFLROOT
1637 * Root handle of the mapping which name is queried.
1638 */
1639 HGCMFunctionParameter root;
1640
1641 /** pointer, in:
1642 * Points to SHFLSTRING buffer.
1643 */
1644 HGCMFunctionParameter path;
1645
1646 /** pointer, out:
1647 * Buffer to place data to.
1648 * @note Buffer contains UTF-8 characters on success, regardless of the
1649 * UTF-8/UTF-16 setting of the connection. Will be zero terminated.
1650 */
1651 HGCMFunctionParameter buffer;
1652
1653} VBoxSFReadLink;
1654
1655/** Number of parameters */
1656#define SHFL_CPARMS_READLINK (3)
1657/** @} */
1658
1659
1660/** @name SHFL_FN_INFORMATION
1661 * @{
1662 */
1663
1664/** Mask of Set/Get bit. */
1665#define SHFL_INFO_MODE_MASK (0x1)
1666/** Get information */
1667#define SHFL_INFO_GET (0x0)
1668/** Set information */
1669#define SHFL_INFO_SET (0x1)
1670
1671/** Get name of the object. */
1672#define SHFL_INFO_NAME (0x2)
1673/** Set size of object (extend/trucate); only applies to file objects */
1674#define SHFL_INFO_SIZE (0x4)
1675/** Get/Set file object info. */
1676#define SHFL_INFO_FILE (0x8)
1677/** Get volume information. */
1678#define SHFL_INFO_VOLUME (0x10)
1679
1680/** @todo different file info structures */
1681
1682/** SHFL_FN_INFORMATION parameters. */
1683typedef struct VBoxSFParmInformation
1684{
1685 /** value32, in: SHFLROOT of the mapping the handle belongs to. */
1686 HGCMFunctionParameter id32Root;
1687 /** value64, in: SHFLHANDLE of object to be queried/set. */
1688 HGCMFunctionParameter u64Handle;
1689 /** value32, in: SHFL_INFO_XXX */
1690 HGCMFunctionParameter f32Flags;
1691 /** value32, in/out: Bytes to be used for information/How many bytes were used. */
1692 HGCMFunctionParameter cb32;
1693 /** pointer, in/out: Information to be set/get (SHFLFSOBJINFO, SHFLVOLINFO, or SHFLSTRING).
1694 * Do not forget to set the SHFLFSOBJINFO::Attr::enmAdditional for Get operation as well. */
1695 HGCMFunctionParameter pInfo;
1696} VBoxSFParmInformation;
1697
1698
1699/** Parameters structure. */
1700typedef struct _VBoxSFInformation
1701{
1702 VBGLIOCHGCMCALL callInfo;
1703
1704 /** pointer, in: SHFLROOT
1705 * Root handle of the mapping which name is queried.
1706 */
1707 HGCMFunctionParameter root;
1708
1709 /** value64, in:
1710 * SHFLHANDLE of object to be listed.
1711 */
1712 HGCMFunctionParameter handle;
1713
1714 /** value32, in:
1715 * SHFL_INFO_*
1716 */
1717 HGCMFunctionParameter flags;
1718
1719 /** value32, in/out:
1720 * Bytes to be used for information/How many bytes were used.
1721 */
1722 HGCMFunctionParameter cb;
1723
1724 /** pointer, in/out:
1725 * Information to be set/get (SHFLFSOBJINFO or SHFLSTRING). Do not forget
1726 * to set the SHFLFSOBJINFO::Attr::enmAdditional for Get operation as well.
1727 */
1728 HGCMFunctionParameter info;
1729
1730} VBoxSFInformation;
1731
1732/** Number of parameters */
1733#define SHFL_CPARMS_INFORMATION (5)
1734/** @} */
1735
1736
1737/** @name SHFL_FN_REMOVE
1738 * @{
1739 */
1740
1741#define SHFL_REMOVE_FILE (0x1)
1742#define SHFL_REMOVE_DIR (0x2)
1743#define SHFL_REMOVE_SYMLINK (0x4)
1744
1745/** SHFL_FN_REMOVE parameters. */
1746typedef struct VBoxSFParmRemove
1747{
1748 /** value32, in: SHFLROOT of the mapping the path is relative to. */
1749 HGCMFunctionParameter id32Root;
1750 /** pointer, in: Points to SHFLSTRING buffer. */
1751 HGCMFunctionParameter pStrPath;
1752 /** value32, in: SHFL_REMOVE_XXX */
1753 HGCMFunctionParameter f32Flags;
1754} VBoxSFParmRemove;
1755
1756/** Parameters structure. */
1757typedef struct _VBoxSFRemove
1758{
1759 VBGLIOCHGCMCALL callInfo;
1760
1761 /** pointer, in: SHFLROOT
1762 * Root handle of the mapping which name is queried.
1763 */
1764 HGCMFunctionParameter root;
1765
1766 /** pointer, in:
1767 * Points to SHFLSTRING buffer.
1768 */
1769 HGCMFunctionParameter path;
1770
1771 /** value32, in:
1772 * remove flags (file/directory)
1773 */
1774 HGCMFunctionParameter flags;
1775
1776} VBoxSFRemove;
1777
1778#define SHFL_CPARMS_REMOVE (3)
1779/** @} */
1780
1781
1782/** @name SHFL_FN_RENAME
1783 * @{
1784 */
1785
1786#define SHFL_RENAME_FILE (0x1)
1787#define SHFL_RENAME_DIR (0x2)
1788#define SHFL_RENAME_REPLACE_IF_EXISTS (0x4)
1789
1790/** SHFL_FN_RENAME parameters. */
1791typedef struct VBoxSFParmRename
1792{
1793 /** value32, in: SHFLROOT of the mapping the paths are relative to. */
1794 HGCMFunctionParameter id32Root;
1795 /** pointer, in: SHFLSTRING giving the source (old) path. */
1796 HGCMFunctionParameter pStrSrcPath;
1797 /** pointer, in: SHFLSTRING giving the destination (new) path. */
1798 HGCMFunctionParameter pStrDstPath;
1799 /** value32, in: SHFL_RENAME_XXX */
1800 HGCMFunctionParameter f32Flags;
1801} VBoxSFParmRename;
1802
1803/** Parameters structure. */
1804typedef struct _VBoxSFRename
1805{
1806 VBGLIOCHGCMCALL callInfo;
1807
1808 /** pointer, in: SHFLROOT
1809 * Root handle of the mapping which name is queried.
1810 */
1811 HGCMFunctionParameter root;
1812
1813 /** pointer, in:
1814 * Points to SHFLSTRING src.
1815 */
1816 HGCMFunctionParameter src;
1817
1818 /** pointer, in:
1819 * Points to SHFLSTRING dest.
1820 */
1821 HGCMFunctionParameter dest;
1822
1823 /** value32, in:
1824 * rename flags (file/directory)
1825 */
1826 HGCMFunctionParameter flags;
1827
1828} VBoxSFRename;
1829
1830#define SHFL_CPARMS_RENAME (4)
1831/** @} */
1832
1833
1834/** @name SHFL_FN_SYMLINK
1835 * @{
1836 */
1837
1838/** Parameters structure. */
1839typedef struct VBoxSFParmCreateSymlink
1840{
1841 /** value32, in: SHFLROOT of the mapping the symlink should be created on. */
1842 HGCMFunctionParameter id32Root;
1843 /** pointer, in: SHFLSTRING giving the path to the symlink. */
1844 HGCMFunctionParameter pStrSymlink;
1845 /** pointer, in: SHFLSTRING giving the target. */
1846 HGCMFunctionParameter pStrTarget;
1847 /** pointer, out: SHFLFSOBJINFO buffer to be filled with info about the created symlink. */
1848 HGCMFunctionParameter pInfo;
1849} VBoxSFParmCreateSymlink;
1850
1851/** Parameters structure. */
1852typedef struct _VBoxSFSymlink
1853{
1854 VBGLIOCHGCMCALL callInfo;
1855
1856 /** pointer, in: SHFLROOT
1857 * Root handle of the mapping which name is queried.
1858 */
1859 HGCMFunctionParameter root;
1860
1861 /** pointer, in:
1862 * Points to SHFLSTRING of path for the new symlink.
1863 */
1864 HGCMFunctionParameter newPath;
1865
1866 /** pointer, in:
1867 * Points to SHFLSTRING of destination for symlink.
1868 */
1869 HGCMFunctionParameter oldPath;
1870
1871 /** pointer, out:
1872 * Information about created symlink.
1873 */
1874 HGCMFunctionParameter info;
1875
1876} VBoxSFSymlink;
1877
1878#define SHFL_CPARMS_SYMLINK (4)
1879/** @} */
1880
1881
1882/** @name SHFL_FN_SET_SYMLINKS
1883 * @{ */
1884/** NUmber of parameters for SHFL_FN_SET_SYMLINKS. */
1885#define SHFL_CPARMS_SET_SYMLINKS (0)
1886/** @} */
1887
1888
1889/** @name SHFL_FN_QUERY_MAP_INFO
1890 * @{
1891 */
1892/** Query flag: Guest prefers drive letters as mount points. */
1893#define SHFL_MIQF_DRIVE_LETTER RT_BIT_64(0)
1894/** Query flag: Guest prefers paths as mount points. */
1895#define SHFL_MIQF_PATH RT_BIT_64(1)
1896
1897/** Set if writable. */
1898#define SHFL_MIF_WRITABLE RT_BIT_64(0)
1899/** Indicates that the mapping should be auto-mounted. */
1900#define SHFL_MIF_AUTO_MOUNT RT_BIT_64(1)
1901/** Set if host is case insensitive. */
1902#define SHFL_MIF_HOST_ICASE RT_BIT_64(2)
1903/** Set if guest is case insensitive. */
1904#define SHFL_MIF_GUEST_ICASE RT_BIT_64(3)
1905/** Symbolic link creation is allowed. */
1906#define SHFL_MIF_SYMLINK_CREATION RT_BIT_64(4)
1907
1908/** Parameters structure. */
1909typedef struct VBoxSFQueryMapInfo
1910{
1911 /** Common header. */
1912 VBGLIOCHGCMCALL callInfo;
1913 /** 32-bit, in: SHFLROOT - root handle of the mapping to query. */
1914 HGCMFunctionParameter root;
1915 /** pointer, in/out: SHFLSTRING buffer for the name. */
1916 HGCMFunctionParameter name;
1917 /** pointer, in/out: SHFLSTRING buffer for the auto mount point. */
1918 HGCMFunctionParameter mountPoint;
1919 /** 64-bit, in: SHFL_MIQF_XXX; out: SHFL_MIF_XXX. */
1920 HGCMFunctionParameter flags;
1921 /** 32-bit, out: Root ID version number - root handle reuse guard. */
1922 HGCMFunctionParameter rootIdVersion;
1923} VBoxSFQueryMapInfo;
1924/** Number of parameters */
1925#define SHFL_CPARMS_QUERY_MAP_INFO (5)
1926/** @} */
1927
1928
1929/** @name SHFL_FN_WAIT_FOR_MAPPINGS_CHANGES
1930 *
1931 * Returns VINF_SUCCESS on change and VINF_TRY_AGAIN when restored from saved
1932 * state. If the guest makes too many calls (max 64) VERR_OUT_OF_RESOURCES will
1933 * be returned.
1934 *
1935 * @{
1936 */
1937/** Parameters structure. */
1938typedef struct VBoxSFWaitForMappingsChanges
1939{
1940 /** Common header. */
1941 VBGLIOCHGCMCALL callInfo;
1942 /** 32-bit, in/out: The mappings configuration version.
1943 * On input the client sets it to the last config it knows about, on return
1944 * it holds the current version. */
1945 HGCMFunctionParameter version;
1946} VBoxSFWaitForMappingsChanges;
1947/** Number of parameters */
1948#define SHFL_CPARMS_WAIT_FOR_MAPPINGS_CHANGES (1)
1949/** @} */
1950
1951
1952/** @name SHFL_FN_CANCEL_MAPPINGS_CHANGES_WAITS
1953 * @{
1954 */
1955/** Number of parameters */
1956#define SHFL_CPARMS_CANCEL_MAPPINGS_CHANGES_WAITS (0)
1957/** @} */
1958
1959
1960/** @name SHFL_FN_SET_FILE_SIZE
1961 * @{
1962 */
1963/** SHFL_FN_SET_FILE_SIZE parameters. */
1964typedef struct VBoxSFParmSetFileSize
1965{
1966 /** value32, in: SHFLROOT of the mapping the handle belongs to. */
1967 HGCMFunctionParameter id32Root;
1968 /** value64, in: SHFLHANDLE of the file to change the size of. */
1969 HGCMFunctionParameter u64Handle;
1970 /** value64, in: The new file size. */
1971 HGCMFunctionParameter cb64NewSize;
1972} VBoxSFParmSetFileSize;
1973/** Number of parameters */
1974#define SHFL_CPARMS_SET_FILE_SIZE (3)
1975/** @} */
1976
1977
1978/** @name SHFL_FN_QUERY_FEATURES
1979 * @{ */
1980/** SHFL_FN_QUERY_FEATURES parameters. */
1981typedef struct VBoxSFParmQueryFeatures
1982{
1983 /** value64, out: Feature flags, SHFL_FEATURE_XXX. */
1984 HGCMFunctionParameter f64Features;
1985 /** value32, out: The ordinal of the last valid function */
1986 HGCMFunctionParameter u32LastFunction;
1987} VBoxSFParmQueryFeatures;
1988/** Number of parameters for SHFL_FN_QUERY_FEATURES. */
1989#define SHFL_CPARMS_QUERY_FEATURES (2)
1990
1991/** The write functions updates the file offset upon return.
1992 * This can be helpful for files open in append mode. */
1993#define SHFL_FEATURE_WRITE_UPDATES_OFFSET RT_BIT_64(0)
1994/** @} */
1995
1996
1997/** @name SHFL_FN_COPY_FILE
1998 * @{ */
1999/** SHFL_FN_COPY_FILE parameters. */
2000typedef struct VBoxSFParmCopyFile
2001{
2002 /** value32, in: SHFLROOT of the mapping the source handle belongs to. */
2003 HGCMFunctionParameter id32RootSrc;
2004 /** pointer, in: SHFLSTRING giving the source file path. */
2005 HGCMFunctionParameter pStrPathSrc;
2006
2007 /** value32, in: SHFLROOT of the mapping the destination handle belongs to. */
2008 HGCMFunctionParameter id32RootDst;
2009 /** pointer, in: SHFLSTRING giving the destination file path. */
2010 HGCMFunctionParameter pStrPathDst;
2011
2012 /** value32, in: Reserved for the future, must be zero. */
2013 HGCMFunctionParameter f32Flags;
2014} VBoxSFParmCopyFile;
2015/** Number of parameters for SHFL_FN_COPY_FILE. */
2016#define SHFL_CPARMS_COPY_FILE (5)
2017/** @} */
2018
2019
2020/** @name SHFL_FN_COPY_FILE_PART
2021 * @{ */
2022/** SHFL_FN_COPY_FILE_PART parameters. */
2023typedef struct VBoxSFParmCopyFilePar
2024{
2025 /** value32, in: SHFLROOT of the mapping the source handle belongs to. */
2026 HGCMFunctionParameter id32RootSrc;
2027 /** value64, in: SHFLHANDLE of the source file. */
2028 HGCMFunctionParameter u64HandleSrc;
2029 /** value64, in: The source file offset. */
2030 HGCMFunctionParameter off64Src;
2031
2032 /** value32, in: SHFLROOT of the mapping the destination handle belongs to. */
2033 HGCMFunctionParameter id32RootDst;
2034 /** value64, in: SHFLHANDLE of the destination file. */
2035 HGCMFunctionParameter u64HandleDst;
2036 /** value64, in: The destination file offset. */
2037 HGCMFunctionParameter off64Dst;
2038
2039 /** value64, in/out: The number of bytes to copy on input / bytes actually copied. */
2040 HGCMFunctionParameter cb64ToCopy;
2041 /** value32, in: Reserved for the future, must be zero. */
2042 HGCMFunctionParameter f32Flags;
2043} VBoxSFParmCopyFilePart;
2044/** Number of parameters for SHFL_FN_COPY_FILE_PART. */
2045#define SHFL_CPARMS_COPY_FILE_PART (8)
2046/** @} */
2047
2048
2049
2050/** @name SHFL_FN_ADD_MAPPING
2051 * @note Host call, no guest structure is used.
2052 * @{
2053 */
2054
2055/** mapping is writable */
2056#define SHFL_ADD_MAPPING_F_WRITABLE (RT_BIT_32(0))
2057/** mapping is automounted by the guest */
2058#define SHFL_ADD_MAPPING_F_AUTOMOUNT (RT_BIT_32(1))
2059/** allow the guest to create symlinks */
2060#define SHFL_ADD_MAPPING_F_CREATE_SYMLINKS (RT_BIT_32(2))
2061/** mapping is actually missing on the host */
2062#define SHFL_ADD_MAPPING_F_MISSING (RT_BIT_32(3))
2063
2064#define SHFL_CPARMS_ADD_MAPPING (4)
2065/** @} */
2066
2067
2068/** @name SHFL_FN_REMOVE_MAPPING
2069 * @note Host call, no guest structure is used.
2070 * @{
2071 */
2072
2073#define SHFL_CPARMS_REMOVE_MAPPING (1)
2074/** @} */
2075
2076
2077/** @name SHFL_FN_SET_STATUS_LED
2078 * @note Host call, no guest structure is used.
2079 * @{
2080 */
2081
2082#define SHFL_CPARMS_SET_STATUS_LED (1)
2083/** @} */
2084
2085
2086/** @} */
2087/** @} */
2088
2089#endif /* !VBOX_INCLUDED_shflsvc_h */
2090
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette