VirtualBox

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

Last change on this file since 105016 was 105016, checked in by vboxsync, 2 months ago

doc/manual,include/VBox,Frontends/VBoxManage,HostServices/SharedFolders,
Main/{include,SharedFolder,Console,Machine,VirtualBox.xidl}: Add a
new attribute to ISharedFolder for specifying a symbolic link creation
policy to restrict the source pathname when creating symbolic links
within a guest. The symbolic link policies are represented by a new
enumeration of type SymlinkPolicy_T which includes values for no
restrictions ('any'), symlink sources only within the subtree of the
share ('subtree'), symlink sources as any relative path ('relative'),
and no symlinks allowed ('forbidden'). The symlink policy can only be
applied to permanent shared folders at this stage. bugref:10619

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

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use