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