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