VirtualBox

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

Last change on this file since 78570 was 78479, checked in by vboxsync, 6 years ago

winnt/vboxsf: Build fix for new close+remove request code (clang). bugref:9172

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

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