1 | /** @file
|
---|
2 | * Shared Folders: Common header for host service and guest clients.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_shflsvc_h
|
---|
27 | #define ___VBox_shflsvc_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 | #include <VBox/VBoxGuest2.h>
|
---|
31 | #include <VBox/VMMDev.h>
|
---|
32 | #include <VBox/hgcmsvc.h>
|
---|
33 | #include <iprt/fs.h>
|
---|
34 |
|
---|
35 |
|
---|
36 | /** @name Some bit flag manipulation macros.
|
---|
37 | * @{ */
|
---|
38 | #ifndef BIT_FLAG
|
---|
39 | #define BIT_FLAG(__Field,__Flag) ((__Field) & (__Flag))
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #ifndef BIT_FLAG_SET
|
---|
43 | #define BIT_FLAG_SET(__Field,__Flag) ((__Field) |= (__Flag))
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #ifndef BIT_FLAG_CLEAR
|
---|
47 | #define BIT_FLAG_CLEAR(__Field,__Flag) ((__Field) &= ~(__Flag))
|
---|
48 | #endif
|
---|
49 | /** @} */
|
---|
50 |
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Structures shared between guest and the service
|
---|
54 | * can be relocated and use offsets to point to variable
|
---|
55 | * length parts.
|
---|
56 | */
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Shared folders protocol works with handles.
|
---|
60 | * Before doing any action on a file system object,
|
---|
61 | * one have to obtain the object handle via a SHFL_FN_CREATE
|
---|
62 | * request. A handle must be closed with SHFL_FN_CLOSE.
|
---|
63 | */
|
---|
64 |
|
---|
65 | /** Shared Folders service functions. (guest)
|
---|
66 | * @{
|
---|
67 | */
|
---|
68 |
|
---|
69 | /** Query mappings changes. */
|
---|
70 | #define SHFL_FN_QUERY_MAPPINGS (1)
|
---|
71 | /** Query mappings changes. */
|
---|
72 | #define SHFL_FN_QUERY_MAP_NAME (2)
|
---|
73 | /** Open/create object. */
|
---|
74 | #define SHFL_FN_CREATE (3)
|
---|
75 | /** Close object handle. */
|
---|
76 | #define SHFL_FN_CLOSE (4)
|
---|
77 | /** Read object content. */
|
---|
78 | #define SHFL_FN_READ (5)
|
---|
79 | /** Write new object content. */
|
---|
80 | #define SHFL_FN_WRITE (6)
|
---|
81 | /** Lock/unlock a range in the object. */
|
---|
82 | #define SHFL_FN_LOCK (7)
|
---|
83 | /** List object content. */
|
---|
84 | #define SHFL_FN_LIST (8)
|
---|
85 | /** Query/set object information. */
|
---|
86 | #define SHFL_FN_INFORMATION (9)
|
---|
87 | /** Remove object */
|
---|
88 | #define SHFL_FN_REMOVE (11)
|
---|
89 | /** Map folder (legacy) */
|
---|
90 | #define SHFL_FN_MAP_FOLDER_OLD (12)
|
---|
91 | /** Unmap folder */
|
---|
92 | #define SHFL_FN_UNMAP_FOLDER (13)
|
---|
93 | /** Rename object (possibly moving it to another directory) */
|
---|
94 | #define SHFL_FN_RENAME (14)
|
---|
95 | /** Flush file */
|
---|
96 | #define SHFL_FN_FLUSH (15)
|
---|
97 | /** @todo macl, a description, please. */
|
---|
98 | #define SHFL_FN_SET_UTF8 (16)
|
---|
99 | /** Map folder */
|
---|
100 | #define SHFL_FN_MAP_FOLDER (17)
|
---|
101 |
|
---|
102 | /** @} */
|
---|
103 |
|
---|
104 | /** Shared Folders service functions. (host)
|
---|
105 | * @{
|
---|
106 | */
|
---|
107 |
|
---|
108 | /** Add shared folder mapping. */
|
---|
109 | #define SHFL_FN_ADD_MAPPING (1)
|
---|
110 | /** Remove shared folder mapping. */
|
---|
111 | #define SHFL_FN_REMOVE_MAPPING (2)
|
---|
112 | /** Set the led status light address */
|
---|
113 | #define SHFL_FN_SET_STATUS_LED (3)
|
---|
114 |
|
---|
115 | /** @} */
|
---|
116 |
|
---|
117 | /** Root handle for a mapping. Root handles are unique.
|
---|
118 | * @note
|
---|
119 | * Function parameters structures consider
|
---|
120 | * the root handle as 32 bit value. If the typedef
|
---|
121 | * will be changed, then function parameters must be
|
---|
122 | * changed accordingly. All those parameters are marked
|
---|
123 | * with SHFLROOT in comments.
|
---|
124 | */
|
---|
125 | typedef uint32_t SHFLROOT;
|
---|
126 |
|
---|
127 | #define SHFL_ROOT_NIL ((SHFLROOT)~0)
|
---|
128 |
|
---|
129 |
|
---|
130 | /** A shared folders handle for an opened object. */
|
---|
131 | typedef uint64_t SHFLHANDLE;
|
---|
132 |
|
---|
133 | #define SHFL_HANDLE_NIL ((SHFLHANDLE)~0LL)
|
---|
134 | #define SHFL_HANDLE_ROOT ((SHFLHANDLE)0LL)
|
---|
135 |
|
---|
136 | /** Hardcoded maximum length (in chars) of a shared folder name. */
|
---|
137 | #define SHFL_MAX_LEN (256)
|
---|
138 | /** Hardcoded maximum number of shared folder mapping available to the guest. */
|
---|
139 | #define SHFL_MAX_MAPPINGS (64)
|
---|
140 |
|
---|
141 | /** @name Shared Folders strings. They can be either UTF-8 or UTF-16.
|
---|
142 | * @{
|
---|
143 | */
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * Shared folder string buffer structure.
|
---|
147 | */
|
---|
148 | typedef struct _SHFLSTRING
|
---|
149 | {
|
---|
150 | /** Size of the String member in bytes. */
|
---|
151 | uint16_t u16Size;
|
---|
152 |
|
---|
153 | /** Length of string without trailing nul in bytes. */
|
---|
154 | uint16_t u16Length;
|
---|
155 |
|
---|
156 | /** UTF-8 or UTF-16 string. Nul terminated. */
|
---|
157 | union
|
---|
158 | {
|
---|
159 | uint8_t utf8[1];
|
---|
160 | uint16_t ucs2[1];
|
---|
161 | } String;
|
---|
162 | } SHFLSTRING;
|
---|
163 |
|
---|
164 | /** Pointer to a shared folder string buffer. */
|
---|
165 | typedef SHFLSTRING *PSHFLSTRING;
|
---|
166 | /** Pointer to a const shared folder string buffer. */
|
---|
167 | typedef const SHFLSTRING *PCSHFLSTRING;
|
---|
168 |
|
---|
169 | /** Calculate size of the string. */
|
---|
170 | DECLINLINE(uint32_t) ShflStringSizeOfBuffer(PCSHFLSTRING pString)
|
---|
171 | {
|
---|
172 | return pString? sizeof (SHFLSTRING) - sizeof (pString->String) + pString->u16Size: 0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | DECLINLINE(uint32_t) ShflStringLength(PCSHFLSTRING pString)
|
---|
176 | {
|
---|
177 | return pString? pString->u16Length: 0;
|
---|
178 | }
|
---|
179 |
|
---|
180 | DECLINLINE(PSHFLSTRING) ShflStringInitBuffer(void *pvBuffer, uint32_t u32Size)
|
---|
181 | {
|
---|
182 | PSHFLSTRING pString = NULL;
|
---|
183 |
|
---|
184 | uint32_t u32HeaderSize = sizeof (SHFLSTRING) - sizeof (pString->String);
|
---|
185 |
|
---|
186 | /* Check that the buffer size is big enough to hold a zero sized string
|
---|
187 | * and is not too big to fit into 16 bit variables.
|
---|
188 | */
|
---|
189 | if (u32Size >= u32HeaderSize && u32Size - u32HeaderSize <= 0xFFFF)
|
---|
190 | {
|
---|
191 | pString = (PSHFLSTRING)pvBuffer;
|
---|
192 | pString->u16Size = u32Size - u32HeaderSize;
|
---|
193 | pString->u16Length = 0;
|
---|
194 | }
|
---|
195 |
|
---|
196 | return pString;
|
---|
197 | }
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * Validates a HGCM string parameter.
|
---|
201 | *
|
---|
202 | * @returns true if valid, false if not.
|
---|
203 | *
|
---|
204 | * @param pString The string buffer pointer.
|
---|
205 | * @param cbBuf The buffer size from the parameter.
|
---|
206 | */
|
---|
207 | DECLINLINE(bool) ShflStringIsValid(PCSHFLSTRING pString, uint32_t cbBuf)
|
---|
208 | {
|
---|
209 | if (RT_UNLIKELY(cbBuf <= RT_UOFFSETOF(SHFLSTRING, String)))
|
---|
210 | return false;
|
---|
211 | if (RT_UNLIKELY((uint32_t)pString->u16Size + RT_UOFFSETOF(SHFLSTRING, String) > cbBuf))
|
---|
212 | return false;
|
---|
213 | if (RT_UNLIKELY(pString->u16Length >= pString->u16Size))
|
---|
214 | return false;
|
---|
215 | return true;
|
---|
216 | }
|
---|
217 |
|
---|
218 | /**
|
---|
219 | * Validates an optional HGCM string parameter.
|
---|
220 | *
|
---|
221 | * @returns true if valid, false if not.
|
---|
222 | *
|
---|
223 | * @param pString The string buffer pointer. Can be NULL.
|
---|
224 | * @param cbBuf The buffer size from the parameter.
|
---|
225 | */
|
---|
226 | DECLINLINE(bool) ShflStringIsValidOrNull(PCSHFLSTRING pString, uint32_t cbBuf)
|
---|
227 | {
|
---|
228 | if (pString)
|
---|
229 | return ShflStringIsValid(pString, cbBuf);
|
---|
230 | if (RT_UNLIKELY(cbBuf > 0))
|
---|
231 | return false;
|
---|
232 | return true;
|
---|
233 | }
|
---|
234 |
|
---|
235 | /** @} */
|
---|
236 |
|
---|
237 |
|
---|
238 | /** Result of an open/create request.
|
---|
239 | * Along with handle value the result code
|
---|
240 | * identifies what has happened while
|
---|
241 | * trying to open the object.
|
---|
242 | */
|
---|
243 | typedef enum _SHFLCREATERESULT
|
---|
244 | {
|
---|
245 | SHFL_NO_RESULT,
|
---|
246 | /** Specified path does not exist. */
|
---|
247 | SHFL_PATH_NOT_FOUND,
|
---|
248 | /** Path to file exists, but the last component does not. */
|
---|
249 | SHFL_FILE_NOT_FOUND,
|
---|
250 | /** File already exists and either has been opened or not. */
|
---|
251 | SHFL_FILE_EXISTS,
|
---|
252 | /** New file was created. */
|
---|
253 | SHFL_FILE_CREATED,
|
---|
254 | /** Existing file was replaced or overwritten. */
|
---|
255 | SHFL_FILE_REPLACED
|
---|
256 | } SHFLCREATERESULT;
|
---|
257 |
|
---|
258 |
|
---|
259 | /** Open/create flags.
|
---|
260 | * @{
|
---|
261 | */
|
---|
262 |
|
---|
263 | /** No flags. Initialization value. */
|
---|
264 | #define SHFL_CF_NONE (0x00000000)
|
---|
265 |
|
---|
266 | /** Lookup only the object, do not return a handle. All other flags are ignored. */
|
---|
267 | #define SHFL_CF_LOOKUP (0x00000001)
|
---|
268 |
|
---|
269 | /** Open parent directory of specified object.
|
---|
270 | * Useful for the corresponding Windows FSD flag
|
---|
271 | * and for opening paths like \\dir\\*.* to search the 'dir'.
|
---|
272 | * @todo possibly not needed???
|
---|
273 | */
|
---|
274 | #define SHFL_CF_OPEN_TARGET_DIRECTORY (0x00000002)
|
---|
275 |
|
---|
276 | /** Create/open a directory. */
|
---|
277 | #define SHFL_CF_DIRECTORY (0x00000004)
|
---|
278 |
|
---|
279 | /** Open/create action to do if object exists
|
---|
280 | * and if the object does not exists.
|
---|
281 | * REPLACE file means atomically DELETE and CREATE.
|
---|
282 | * OVERWRITE file means truncating the file to 0 and
|
---|
283 | * setting new size.
|
---|
284 | * When opening an existing directory REPLACE and OVERWRITE
|
---|
285 | * actions are considered invalid, and cause returning
|
---|
286 | * FILE_EXISTS with NIL handle.
|
---|
287 | */
|
---|
288 | #define SHFL_CF_ACT_MASK_IF_EXISTS (0x000000F0)
|
---|
289 | #define SHFL_CF_ACT_MASK_IF_NEW (0x00000F00)
|
---|
290 |
|
---|
291 | /** What to do if object exists. */
|
---|
292 | #define SHFL_CF_ACT_OPEN_IF_EXISTS (0x00000000)
|
---|
293 | #define SHFL_CF_ACT_FAIL_IF_EXISTS (0x00000010)
|
---|
294 | #define SHFL_CF_ACT_REPLACE_IF_EXISTS (0x00000020)
|
---|
295 | #define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
|
---|
296 |
|
---|
297 | /** What to do if object does not exist. */
|
---|
298 | #define SHFL_CF_ACT_CREATE_IF_NEW (0x00000000)
|
---|
299 | #define SHFL_CF_ACT_FAIL_IF_NEW (0x00000100)
|
---|
300 |
|
---|
301 | /** Read/write requested access for the object. */
|
---|
302 | #define SHFL_CF_ACCESS_MASK_RW (0x00003000)
|
---|
303 |
|
---|
304 | /** No access requested. */
|
---|
305 | #define SHFL_CF_ACCESS_NONE (0x00000000)
|
---|
306 | /** Read access requested. */
|
---|
307 | #define SHFL_CF_ACCESS_READ (0x00001000)
|
---|
308 | /** Write access requested. */
|
---|
309 | #define SHFL_CF_ACCESS_WRITE (0x00002000)
|
---|
310 | /** Read/Write access requested. */
|
---|
311 | #define SHFL_CF_ACCESS_READWRITE (SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_WRITE)
|
---|
312 |
|
---|
313 | /** Requested share access for the object. */
|
---|
314 | #define SHFL_CF_ACCESS_MASK_DENY (0x0000C000)
|
---|
315 |
|
---|
316 | /** Allow any access. */
|
---|
317 | #define SHFL_CF_ACCESS_DENYNONE (0x00000000)
|
---|
318 | /** Do not allow read. */
|
---|
319 | #define SHFL_CF_ACCESS_DENYREAD (0x00004000)
|
---|
320 | /** Do not allow write. */
|
---|
321 | #define SHFL_CF_ACCESS_DENYWRITE (0x00008000)
|
---|
322 | /** Do not allow access. */
|
---|
323 | #define SHFL_CF_ACCESS_DENYALL (SHFL_CF_ACCESS_DENYREAD | SHFL_CF_ACCESS_DENYWRITE)
|
---|
324 |
|
---|
325 | /** Requested access to attributes of the object. */
|
---|
326 | #define SHFL_CF_ACCESS_MASK_ATTR (0x00030000)
|
---|
327 |
|
---|
328 | /** No access requested. */
|
---|
329 | #define SHFL_CF_ACCESS_ATTR_NONE (0x00000000)
|
---|
330 | /** Read access requested. */
|
---|
331 | #define SHFL_CF_ACCESS_ATTR_READ (0x00010000)
|
---|
332 | /** Write access requested. */
|
---|
333 | #define SHFL_CF_ACCESS_ATTR_WRITE (0x00020000)
|
---|
334 | /** Read/Write access requested. */
|
---|
335 | #define SHFL_CF_ACCESS_ATTR_READWRITE (SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_WRITE)
|
---|
336 |
|
---|
337 | /** The file is opened in append mode. Ignored if SHFL_CF_ACCESS_WRITE is not set. */
|
---|
338 | #define SHFL_CF_ACCESS_APPEND (0x00040000)
|
---|
339 |
|
---|
340 | /** @} */
|
---|
341 |
|
---|
342 | #pragma pack(1)
|
---|
343 | typedef struct _SHFLCREATEPARMS
|
---|
344 | {
|
---|
345 | /* Returned handle of opened object. */
|
---|
346 | SHFLHANDLE Handle;
|
---|
347 |
|
---|
348 | /* Returned result of the operation */
|
---|
349 | SHFLCREATERESULT Result;
|
---|
350 |
|
---|
351 | /* SHFL_CF_* */
|
---|
352 | uint32_t CreateFlags;
|
---|
353 |
|
---|
354 | /* Attributes of object to create and
|
---|
355 | * returned actual attributes of opened/created object.
|
---|
356 | */
|
---|
357 | RTFSOBJINFO Info;
|
---|
358 |
|
---|
359 | } SHFLCREATEPARMS;
|
---|
360 | #pragma pack()
|
---|
361 |
|
---|
362 | typedef SHFLCREATEPARMS *PSHFLCREATEPARMS;
|
---|
363 |
|
---|
364 |
|
---|
365 | /** Shared Folders mappings.
|
---|
366 | * @{
|
---|
367 | */
|
---|
368 |
|
---|
369 | /** The mapping has been added since last query. */
|
---|
370 | #define SHFL_MS_NEW (1)
|
---|
371 | /** The mapping has been deleted since last query. */
|
---|
372 | #define SHFL_MS_DELETED (2)
|
---|
373 |
|
---|
374 | typedef struct _SHFLMAPPING
|
---|
375 | {
|
---|
376 | /** Mapping status. */
|
---|
377 | uint32_t u32Status;
|
---|
378 | /** Root handle. */
|
---|
379 | SHFLROOT root;
|
---|
380 | } SHFLMAPPING;
|
---|
381 | /** Pointer to a SHFLMAPPING structure. */
|
---|
382 | typedef SHFLMAPPING *PSHFLMAPPING;
|
---|
383 |
|
---|
384 | /** @} */
|
---|
385 |
|
---|
386 | /** Shared Folder directory information
|
---|
387 | * @{
|
---|
388 | */
|
---|
389 |
|
---|
390 | typedef struct _SHFLDIRINFO
|
---|
391 | {
|
---|
392 | /** Full information about the object. */
|
---|
393 | RTFSOBJINFO Info;
|
---|
394 | /** The length of the short field (number of RTUTF16 chars).
|
---|
395 | * It is 16-bit for reasons of alignment. */
|
---|
396 | uint16_t cucShortName;
|
---|
397 | /** The short name for 8.3 compatability.
|
---|
398 | * Empty string if not available.
|
---|
399 | */
|
---|
400 | RTUTF16 uszShortName[14];
|
---|
401 | /** @todo malc, a description, please. */
|
---|
402 | SHFLSTRING name;
|
---|
403 | } SHFLDIRINFO, *PSHFLDIRINFO;
|
---|
404 |
|
---|
405 | typedef struct _SHFLVOLINFO
|
---|
406 | {
|
---|
407 | RTFOFF ullTotalAllocationBytes;
|
---|
408 | RTFOFF ullAvailableAllocationBytes;
|
---|
409 | uint32_t ulBytesPerAllocationUnit;
|
---|
410 | uint32_t ulBytesPerSector;
|
---|
411 | uint32_t ulSerial;
|
---|
412 | RTFSPROPERTIES fsProperties;
|
---|
413 | } SHFLVOLINFO, *PSHFLVOLINFO;
|
---|
414 |
|
---|
415 | /** @} */
|
---|
416 |
|
---|
417 | /** Function parameter structures.
|
---|
418 | * @{
|
---|
419 | */
|
---|
420 |
|
---|
421 | /**
|
---|
422 | * SHFL_FN_QUERY_MAPPINGS
|
---|
423 | */
|
---|
424 | /** Validation mask. Needs to be adjusted
|
---|
425 | * whenever a new SHFL_MF_ flag is added. */
|
---|
426 | #define SHFL_MF_MASK (0x00000011)
|
---|
427 | /** UC2 enconded strings. */
|
---|
428 | #define SHFL_MF_UCS2 (0x00000000)
|
---|
429 | /** Guest uses UTF8 strings, if not set then the strings are unicode (UCS2). */
|
---|
430 | #define SHFL_MF_UTF8 (0x00000001)
|
---|
431 | /** Just handle the auto-mounted folders. */
|
---|
432 | #define SHFL_MF_AUTOMOUNT (0x00000010)
|
---|
433 |
|
---|
434 | /** Type of guest system. For future system dependent features. */
|
---|
435 | #define SHFL_MF_SYSTEM_MASK (0x0000FF00)
|
---|
436 | #define SHFL_MF_SYSTEM_NONE (0x00000000)
|
---|
437 | #define SHFL_MF_SYSTEM_WINDOWS (0x00000100)
|
---|
438 | #define SHFL_MF_SYSTEM_LINUX (0x00000200)
|
---|
439 |
|
---|
440 | /** Parameters structure. */
|
---|
441 | typedef struct _VBoxSFQueryMappings
|
---|
442 | {
|
---|
443 | VBoxGuestHGCMCallInfo callInfo;
|
---|
444 |
|
---|
445 | /** 32bit, in:
|
---|
446 | * Flags describing various client needs.
|
---|
447 | */
|
---|
448 | HGCMFunctionParameter flags;
|
---|
449 |
|
---|
450 | /** 32bit, in/out:
|
---|
451 | * Number of mappings the client expects.
|
---|
452 | * This is the number of elements in the
|
---|
453 | * mappings array.
|
---|
454 | */
|
---|
455 | HGCMFunctionParameter numberOfMappings;
|
---|
456 |
|
---|
457 | /** pointer, in/out:
|
---|
458 | * Points to array of SHFLMAPPING structures.
|
---|
459 | */
|
---|
460 | HGCMFunctionParameter mappings;
|
---|
461 |
|
---|
462 | } VBoxSFQueryMappings;
|
---|
463 |
|
---|
464 | /** Number of parameters */
|
---|
465 | #define SHFL_CPARMS_QUERY_MAPPINGS (3)
|
---|
466 |
|
---|
467 |
|
---|
468 |
|
---|
469 | /**
|
---|
470 | * SHFL_FN_QUERY_MAP_NAME
|
---|
471 | */
|
---|
472 |
|
---|
473 | /** Parameters structure. */
|
---|
474 | typedef struct _VBoxSFQueryMapName
|
---|
475 | {
|
---|
476 | VBoxGuestHGCMCallInfo callInfo;
|
---|
477 |
|
---|
478 | /** 32bit, in: SHFLROOT
|
---|
479 | * Root handle of the mapping which name is queried.
|
---|
480 | */
|
---|
481 | HGCMFunctionParameter root;
|
---|
482 |
|
---|
483 | /** pointer, in/out:
|
---|
484 | * Points to SHFLSTRING buffer.
|
---|
485 | */
|
---|
486 | HGCMFunctionParameter name;
|
---|
487 |
|
---|
488 | } VBoxSFQueryMapName;
|
---|
489 |
|
---|
490 | /** Number of parameters */
|
---|
491 | #define SHFL_CPARMS_QUERY_MAP_NAME (2)
|
---|
492 |
|
---|
493 | /**
|
---|
494 | * SHFL_FN_MAP_FOLDER_OLD
|
---|
495 | */
|
---|
496 |
|
---|
497 | /** Parameters structure. */
|
---|
498 | typedef struct _VBoxSFMapFolder_Old
|
---|
499 | {
|
---|
500 | VBoxGuestHGCMCallInfo callInfo;
|
---|
501 |
|
---|
502 | /** pointer, in:
|
---|
503 | * Points to SHFLSTRING buffer.
|
---|
504 | */
|
---|
505 | HGCMFunctionParameter path;
|
---|
506 |
|
---|
507 | /** pointer, out: SHFLROOT
|
---|
508 | * Root handle of the mapping which name is queried.
|
---|
509 | */
|
---|
510 | HGCMFunctionParameter root;
|
---|
511 |
|
---|
512 | /** pointer, in: RTUTF16
|
---|
513 | * Path delimiter
|
---|
514 | */
|
---|
515 | HGCMFunctionParameter delimiter;
|
---|
516 |
|
---|
517 | } VBoxSFMapFolder_Old;
|
---|
518 |
|
---|
519 | /** Number of parameters */
|
---|
520 | #define SHFL_CPARMS_MAP_FOLDER_OLD (3)
|
---|
521 |
|
---|
522 | /**
|
---|
523 | * SHFL_FN_MAP_FOLDER
|
---|
524 | */
|
---|
525 |
|
---|
526 | /** Parameters structure. */
|
---|
527 | typedef struct _VBoxSFMapFolder
|
---|
528 | {
|
---|
529 | VBoxGuestHGCMCallInfo callInfo;
|
---|
530 |
|
---|
531 | /** pointer, in:
|
---|
532 | * Points to SHFLSTRING buffer.
|
---|
533 | */
|
---|
534 | HGCMFunctionParameter path;
|
---|
535 |
|
---|
536 | /** pointer, out: SHFLROOT
|
---|
537 | * Root handle of the mapping which name is queried.
|
---|
538 | */
|
---|
539 | HGCMFunctionParameter root;
|
---|
540 |
|
---|
541 | /** pointer, in: RTUTF16
|
---|
542 | * Path delimiter
|
---|
543 | */
|
---|
544 | HGCMFunctionParameter delimiter;
|
---|
545 |
|
---|
546 | /** pointer, in: SHFLROOT
|
---|
547 | * Case senstive flag
|
---|
548 | */
|
---|
549 | HGCMFunctionParameter fCaseSensitive;
|
---|
550 |
|
---|
551 | } VBoxSFMapFolder;
|
---|
552 |
|
---|
553 | /** Number of parameters */
|
---|
554 | #define SHFL_CPARMS_MAP_FOLDER (4)
|
---|
555 |
|
---|
556 | /**
|
---|
557 | * SHFL_FN_UNMAP_FOLDER
|
---|
558 | */
|
---|
559 |
|
---|
560 | /** Parameters structure. */
|
---|
561 | typedef struct _VBoxSFUnmapFolder
|
---|
562 | {
|
---|
563 | VBoxGuestHGCMCallInfo callInfo;
|
---|
564 |
|
---|
565 | /** pointer, in: SHFLROOT
|
---|
566 | * Root handle of the mapping which name is queried.
|
---|
567 | */
|
---|
568 | HGCMFunctionParameter root;
|
---|
569 |
|
---|
570 | } VBoxSFUnmapFolder;
|
---|
571 |
|
---|
572 | /** Number of parameters */
|
---|
573 | #define SHFL_CPARMS_UNMAP_FOLDER (1)
|
---|
574 |
|
---|
575 |
|
---|
576 | /**
|
---|
577 | * SHFL_FN_CREATE
|
---|
578 | */
|
---|
579 |
|
---|
580 | /** Parameters structure. */
|
---|
581 | typedef struct _VBoxSFCreate
|
---|
582 | {
|
---|
583 | VBoxGuestHGCMCallInfo callInfo;
|
---|
584 |
|
---|
585 | /** pointer, in: SHFLROOT
|
---|
586 | * Root handle of the mapping which name is queried.
|
---|
587 | */
|
---|
588 | HGCMFunctionParameter root;
|
---|
589 |
|
---|
590 | /** pointer, in:
|
---|
591 | * Points to SHFLSTRING buffer.
|
---|
592 | */
|
---|
593 | HGCMFunctionParameter path;
|
---|
594 |
|
---|
595 | /** pointer, in/out:
|
---|
596 | * Points to SHFLCREATEPARMS buffer.
|
---|
597 | */
|
---|
598 | HGCMFunctionParameter parms;
|
---|
599 |
|
---|
600 | } VBoxSFCreate;
|
---|
601 |
|
---|
602 | /** Number of parameters */
|
---|
603 | #define SHFL_CPARMS_CREATE (3)
|
---|
604 |
|
---|
605 |
|
---|
606 | /**
|
---|
607 | * SHFL_FN_CLOSE
|
---|
608 | */
|
---|
609 |
|
---|
610 | /** Parameters structure. */
|
---|
611 | typedef struct _VBoxSFClose
|
---|
612 | {
|
---|
613 | VBoxGuestHGCMCallInfo callInfo;
|
---|
614 |
|
---|
615 | /** pointer, in: SHFLROOT
|
---|
616 | * Root handle of the mapping which name is queried.
|
---|
617 | */
|
---|
618 | HGCMFunctionParameter root;
|
---|
619 |
|
---|
620 |
|
---|
621 | /** value64, in:
|
---|
622 | * SHFLHANDLE of object to close.
|
---|
623 | */
|
---|
624 | HGCMFunctionParameter handle;
|
---|
625 |
|
---|
626 | } VBoxSFClose;
|
---|
627 |
|
---|
628 | /** Number of parameters */
|
---|
629 | #define SHFL_CPARMS_CLOSE (2)
|
---|
630 |
|
---|
631 |
|
---|
632 | /**
|
---|
633 | * SHFL_FN_READ
|
---|
634 | */
|
---|
635 |
|
---|
636 | /** Parameters structure. */
|
---|
637 | typedef struct _VBoxSFRead
|
---|
638 | {
|
---|
639 | VBoxGuestHGCMCallInfo callInfo;
|
---|
640 |
|
---|
641 | /** pointer, in: SHFLROOT
|
---|
642 | * Root handle of the mapping which name is queried.
|
---|
643 | */
|
---|
644 | HGCMFunctionParameter root;
|
---|
645 |
|
---|
646 | /** value64, in:
|
---|
647 | * SHFLHANDLE of object to read from.
|
---|
648 | */
|
---|
649 | HGCMFunctionParameter handle;
|
---|
650 |
|
---|
651 | /** value64, in:
|
---|
652 | * Offset to read from.
|
---|
653 | */
|
---|
654 | HGCMFunctionParameter offset;
|
---|
655 |
|
---|
656 | /** value64, in/out:
|
---|
657 | * Bytes to read/How many were read.
|
---|
658 | */
|
---|
659 | HGCMFunctionParameter cb;
|
---|
660 |
|
---|
661 | /** pointer, out:
|
---|
662 | * Buffer to place data to.
|
---|
663 | */
|
---|
664 | HGCMFunctionParameter buffer;
|
---|
665 |
|
---|
666 | } VBoxSFRead;
|
---|
667 |
|
---|
668 | /** Number of parameters */
|
---|
669 | #define SHFL_CPARMS_READ (5)
|
---|
670 |
|
---|
671 |
|
---|
672 |
|
---|
673 | /**
|
---|
674 | * SHFL_FN_WRITE
|
---|
675 | */
|
---|
676 |
|
---|
677 | /** Parameters structure. */
|
---|
678 | typedef struct _VBoxSFWrite
|
---|
679 | {
|
---|
680 | VBoxGuestHGCMCallInfo callInfo;
|
---|
681 |
|
---|
682 | /** pointer, in: SHFLROOT
|
---|
683 | * Root handle of the mapping which name is queried.
|
---|
684 | */
|
---|
685 | HGCMFunctionParameter root;
|
---|
686 |
|
---|
687 | /** value64, in:
|
---|
688 | * SHFLHANDLE of object to write to.
|
---|
689 | */
|
---|
690 | HGCMFunctionParameter handle;
|
---|
691 |
|
---|
692 | /** value64, in:
|
---|
693 | * Offset to write to.
|
---|
694 | */
|
---|
695 | HGCMFunctionParameter offset;
|
---|
696 |
|
---|
697 | /** value64, in/out:
|
---|
698 | * Bytes to write/How many were written.
|
---|
699 | */
|
---|
700 | HGCMFunctionParameter cb;
|
---|
701 |
|
---|
702 | /** pointer, in:
|
---|
703 | * Data to write.
|
---|
704 | */
|
---|
705 | HGCMFunctionParameter buffer;
|
---|
706 |
|
---|
707 | } VBoxSFWrite;
|
---|
708 |
|
---|
709 | /** Number of parameters */
|
---|
710 | #define SHFL_CPARMS_WRITE (5)
|
---|
711 |
|
---|
712 |
|
---|
713 |
|
---|
714 | /**
|
---|
715 | * SHFL_FN_LOCK
|
---|
716 | */
|
---|
717 |
|
---|
718 | /** Lock owner is the HGCM client. */
|
---|
719 |
|
---|
720 | /** Lock mode bit mask. */
|
---|
721 | #define SHFL_LOCK_MODE_MASK (0x3)
|
---|
722 | /** Cancel lock on the given range. */
|
---|
723 | #define SHFL_LOCK_CANCEL (0x0)
|
---|
724 | /** Aquire read only lock. Prevent write to the range. */
|
---|
725 | #define SHFL_LOCK_SHARED (0x1)
|
---|
726 | /** Aquire write lock. Prevent both write and read to the range. */
|
---|
727 | #define SHFL_LOCK_EXCLUSIVE (0x2)
|
---|
728 |
|
---|
729 | /** Do not wait for lock if it can not be acquired at the time. */
|
---|
730 | #define SHFL_LOCK_NOWAIT (0x0)
|
---|
731 | /** Wait and acquire lock. */
|
---|
732 | #define SHFL_LOCK_WAIT (0x4)
|
---|
733 |
|
---|
734 | /** Lock the specified range. */
|
---|
735 | #define SHFL_LOCK_PARTIAL (0x0)
|
---|
736 | /** Lock entire object. */
|
---|
737 | #define SHFL_LOCK_ENTIRE (0x8)
|
---|
738 |
|
---|
739 | /** Parameters structure. */
|
---|
740 | typedef struct _VBoxSFLock
|
---|
741 | {
|
---|
742 | VBoxGuestHGCMCallInfo callInfo;
|
---|
743 |
|
---|
744 | /** pointer, in: SHFLROOT
|
---|
745 | * Root handle of the mapping which name is queried.
|
---|
746 | */
|
---|
747 | HGCMFunctionParameter root;
|
---|
748 |
|
---|
749 | /** value64, in:
|
---|
750 | * SHFLHANDLE of object to be locked.
|
---|
751 | */
|
---|
752 | HGCMFunctionParameter handle;
|
---|
753 |
|
---|
754 | /** value64, in:
|
---|
755 | * Starting offset of lock range.
|
---|
756 | */
|
---|
757 | HGCMFunctionParameter offset;
|
---|
758 |
|
---|
759 | /** value64, in:
|
---|
760 | * Length of range.
|
---|
761 | */
|
---|
762 | HGCMFunctionParameter length;
|
---|
763 |
|
---|
764 | /** value32, in:
|
---|
765 | * Lock flags SHFL_LOCK_*.
|
---|
766 | */
|
---|
767 | HGCMFunctionParameter flags;
|
---|
768 |
|
---|
769 | } VBoxSFLock;
|
---|
770 |
|
---|
771 | /** Number of parameters */
|
---|
772 | #define SHFL_CPARMS_LOCK (5)
|
---|
773 |
|
---|
774 |
|
---|
775 |
|
---|
776 | /**
|
---|
777 | * SHFL_FN_FLUSH
|
---|
778 | */
|
---|
779 |
|
---|
780 | /** Parameters structure. */
|
---|
781 | typedef struct _VBoxSFFlush
|
---|
782 | {
|
---|
783 | VBoxGuestHGCMCallInfo callInfo;
|
---|
784 |
|
---|
785 | /** pointer, in: SHFLROOT
|
---|
786 | * Root handle of the mapping which name is queried.
|
---|
787 | */
|
---|
788 | HGCMFunctionParameter root;
|
---|
789 |
|
---|
790 | /** value64, in:
|
---|
791 | * SHFLHANDLE of object to be locked.
|
---|
792 | */
|
---|
793 | HGCMFunctionParameter handle;
|
---|
794 |
|
---|
795 | } VBoxSFFlush;
|
---|
796 |
|
---|
797 | /** Number of parameters */
|
---|
798 | #define SHFL_CPARMS_FLUSH (2)
|
---|
799 |
|
---|
800 | /**
|
---|
801 | * SHFL_FN_LIST
|
---|
802 | */
|
---|
803 |
|
---|
804 | /** Listing information includes variable length RTDIRENTRY[EX] structures. */
|
---|
805 |
|
---|
806 | /** @todo might be necessary for future. */
|
---|
807 | #define SHFL_LIST_NONE 0
|
---|
808 | #define SHFL_LIST_RETURN_ONE 1
|
---|
809 |
|
---|
810 | /** Parameters structure. */
|
---|
811 | typedef struct _VBoxSFList
|
---|
812 | {
|
---|
813 | VBoxGuestHGCMCallInfo callInfo;
|
---|
814 |
|
---|
815 | /** pointer, in: SHFLROOT
|
---|
816 | * Root handle of the mapping which name is queried.
|
---|
817 | */
|
---|
818 | HGCMFunctionParameter root;
|
---|
819 |
|
---|
820 | /** value64, in:
|
---|
821 | * SHFLHANDLE of object to be listed.
|
---|
822 | */
|
---|
823 | HGCMFunctionParameter handle;
|
---|
824 |
|
---|
825 | /** value32, in:
|
---|
826 | * List flags SHFL_LIST_*.
|
---|
827 | */
|
---|
828 | HGCMFunctionParameter flags;
|
---|
829 |
|
---|
830 | /** value32, in/out:
|
---|
831 | * Bytes to be used for listing information/How many bytes were used.
|
---|
832 | */
|
---|
833 | HGCMFunctionParameter cb;
|
---|
834 |
|
---|
835 | /** pointer, in/optional
|
---|
836 | * Points to SHFLSTRING buffer that specifies a search path.
|
---|
837 | */
|
---|
838 | HGCMFunctionParameter path;
|
---|
839 |
|
---|
840 | /** pointer, out:
|
---|
841 | * Buffer to place listing information to. (SHFLDIRINFO)
|
---|
842 | */
|
---|
843 | HGCMFunctionParameter buffer;
|
---|
844 |
|
---|
845 | /** value32, in/out:
|
---|
846 | * Indicates a key where the listing must be resumed.
|
---|
847 | * in: 0 means start from begin of object.
|
---|
848 | * out: 0 means listing completed.
|
---|
849 | */
|
---|
850 | HGCMFunctionParameter resumePoint;
|
---|
851 |
|
---|
852 | /** pointer, out:
|
---|
853 | * Number of files returned
|
---|
854 | */
|
---|
855 | HGCMFunctionParameter cFiles;
|
---|
856 |
|
---|
857 | } VBoxSFList;
|
---|
858 |
|
---|
859 | /** Number of parameters */
|
---|
860 | #define SHFL_CPARMS_LIST (8)
|
---|
861 |
|
---|
862 |
|
---|
863 |
|
---|
864 | /**
|
---|
865 | * SHFL_FN_INFORMATION
|
---|
866 | */
|
---|
867 |
|
---|
868 | /** Mask of Set/Get bit. */
|
---|
869 | #define SHFL_INFO_MODE_MASK (0x1)
|
---|
870 | /** Get information */
|
---|
871 | #define SHFL_INFO_GET (0x0)
|
---|
872 | /** Set information */
|
---|
873 | #define SHFL_INFO_SET (0x1)
|
---|
874 |
|
---|
875 | /** Get name of the object. */
|
---|
876 | #define SHFL_INFO_NAME (0x2)
|
---|
877 | /** Set size of object (extend/trucate); only applies to file objects */
|
---|
878 | #define SHFL_INFO_SIZE (0x4)
|
---|
879 | /** Get/Set file object info. */
|
---|
880 | #define SHFL_INFO_FILE (0x8)
|
---|
881 | /** Get volume information. */
|
---|
882 | #define SHFL_INFO_VOLUME (0x10)
|
---|
883 |
|
---|
884 | /** @todo different file info structures */
|
---|
885 |
|
---|
886 |
|
---|
887 | /** Parameters structure. */
|
---|
888 | typedef struct _VBoxSFInformation
|
---|
889 | {
|
---|
890 | VBoxGuestHGCMCallInfo callInfo;
|
---|
891 |
|
---|
892 | /** pointer, in: SHFLROOT
|
---|
893 | * Root handle of the mapping which name is queried.
|
---|
894 | */
|
---|
895 | HGCMFunctionParameter root;
|
---|
896 |
|
---|
897 | /** value64, in:
|
---|
898 | * SHFLHANDLE of object to be listed.
|
---|
899 | */
|
---|
900 | HGCMFunctionParameter handle;
|
---|
901 |
|
---|
902 | /** value32, in:
|
---|
903 | * SHFL_INFO_*
|
---|
904 | */
|
---|
905 | HGCMFunctionParameter flags;
|
---|
906 |
|
---|
907 | /** value32, in/out:
|
---|
908 | * Bytes to be used for information/How many bytes were used.
|
---|
909 | */
|
---|
910 | HGCMFunctionParameter cb;
|
---|
911 |
|
---|
912 | /** pointer, in/out:
|
---|
913 | * Information to be set/get (RTFSOBJINFO or SHFLSTRING).
|
---|
914 | * Do not forget to set the RTFSOBJINFO::Attr::enmAdditional for Get operation as well.
|
---|
915 | */
|
---|
916 | HGCMFunctionParameter info;
|
---|
917 |
|
---|
918 | } VBoxSFInformation;
|
---|
919 |
|
---|
920 | /** Number of parameters */
|
---|
921 | #define SHFL_CPARMS_INFORMATION (5)
|
---|
922 |
|
---|
923 |
|
---|
924 | /**
|
---|
925 | * SHFL_FN_REMOVE
|
---|
926 | */
|
---|
927 |
|
---|
928 | #define SHFL_REMOVE_FILE (0x1)
|
---|
929 | #define SHFL_REMOVE_DIR (0x2)
|
---|
930 |
|
---|
931 | /** Parameters structure. */
|
---|
932 | typedef struct _VBoxSFRemove
|
---|
933 | {
|
---|
934 | VBoxGuestHGCMCallInfo callInfo;
|
---|
935 |
|
---|
936 | /** pointer, in: SHFLROOT
|
---|
937 | * Root handle of the mapping which name is queried.
|
---|
938 | */
|
---|
939 | HGCMFunctionParameter root;
|
---|
940 |
|
---|
941 | /** pointer, in:
|
---|
942 | * Points to SHFLSTRING buffer.
|
---|
943 | */
|
---|
944 | HGCMFunctionParameter path;
|
---|
945 |
|
---|
946 | /** value32, in:
|
---|
947 | * remove flags (file/directory)
|
---|
948 | */
|
---|
949 | HGCMFunctionParameter flags;
|
---|
950 |
|
---|
951 | } VBoxSFRemove;
|
---|
952 |
|
---|
953 | #define SHFL_CPARMS_REMOVE (3)
|
---|
954 |
|
---|
955 |
|
---|
956 | /**
|
---|
957 | * SHFL_FN_RENAME
|
---|
958 | */
|
---|
959 |
|
---|
960 | #define SHFL_RENAME_FILE (0x1)
|
---|
961 | #define SHFL_RENAME_DIR (0x2)
|
---|
962 | #define SHFL_RENAME_REPLACE_IF_EXISTS (0x4)
|
---|
963 |
|
---|
964 | /** Parameters structure. */
|
---|
965 | typedef struct _VBoxSFRename
|
---|
966 | {
|
---|
967 | VBoxGuestHGCMCallInfo callInfo;
|
---|
968 |
|
---|
969 | /** pointer, in: SHFLROOT
|
---|
970 | * Root handle of the mapping which name is queried.
|
---|
971 | */
|
---|
972 | HGCMFunctionParameter root;
|
---|
973 |
|
---|
974 | /** pointer, in:
|
---|
975 | * Points to SHFLSTRING src.
|
---|
976 | */
|
---|
977 | HGCMFunctionParameter src;
|
---|
978 |
|
---|
979 | /** pointer, in:
|
---|
980 | * Points to SHFLSTRING dest.
|
---|
981 | */
|
---|
982 | HGCMFunctionParameter dest;
|
---|
983 |
|
---|
984 | /** value32, in:
|
---|
985 | * rename flags (file/directory)
|
---|
986 | */
|
---|
987 | HGCMFunctionParameter flags;
|
---|
988 |
|
---|
989 | } VBoxSFRename;
|
---|
990 |
|
---|
991 | #define SHFL_CPARMS_RENAME (4)
|
---|
992 |
|
---|
993 | /**
|
---|
994 | * SHFL_FN_ADD_MAPPING
|
---|
995 | * Host call, no guest structure is used.
|
---|
996 | */
|
---|
997 |
|
---|
998 | #define SHFL_CPARMS_ADD_MAPPING (3)
|
---|
999 |
|
---|
1000 | /**
|
---|
1001 | * SHFL_FN_ADD_MAPPING, with auto-mount flag.
|
---|
1002 | * Host call, no guest structure is used.
|
---|
1003 | */
|
---|
1004 |
|
---|
1005 | #define SHFL_CPARMS_ADD_MAPPING2 (4)
|
---|
1006 |
|
---|
1007 | /**
|
---|
1008 | * SHFL_FN_REMOVE_MAPPING
|
---|
1009 | * Host call, no guest structure is used.
|
---|
1010 | */
|
---|
1011 |
|
---|
1012 | #define SHFL_CPARMS_REMOVE_MAPPING (1)
|
---|
1013 |
|
---|
1014 |
|
---|
1015 | /**
|
---|
1016 | * SHFL_FN_SET_STATUS_LED
|
---|
1017 | * Host call, no guest structure is used.
|
---|
1018 | */
|
---|
1019 |
|
---|
1020 | #define SHFL_CPARMS_SET_STATUS_LED (1)
|
---|
1021 |
|
---|
1022 | /** @} */
|
---|
1023 |
|
---|
1024 | #endif
|
---|