shflsvc.h revision 35552ddafb570c069e1960bc17e19ccff2d99083
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** @file
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Shared Folders:
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Common header for host service and guest clients.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/*
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Copyright (C) 2006-2007 innotek GmbH
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * available from http://www.virtualbox.org. This file is free software;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * General Public License (GPL) as published by the Free Software
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * The contents of this file may alternatively be used under the terms
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * of the Common Development and Distribution License Version 1.0
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox OSE distribution, in which case the provisions of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * CDDL are applicable instead of those of the GPL.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * You may elect to license modified versions of this file under the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * terms and conditions of either the GPL or the CDDL or both.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync#ifndef ___VBox_shflsvc_h
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define ___VBox_shflsvc_h
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync#include <VBox/types.h>
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsync#include <VBox/VBoxGuest.h>
f2490dbf97c8247439446844458461b00e50beb0vboxsync#include <VBox/hgcmsvc.h>
482a222498aae619afda0255a7edf4ebda97268cvboxsync#include <iprt/fs.h>
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync/** Some bit flag manipulation macros. to be moved to VBox/cdefs.h? */
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#ifndef BIT_FLAG
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#define BIT_FLAG(__Field,__Flag) ((__Field) & (__Flag))
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#endif
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#ifndef BIT_FLAG_SET
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#define BIT_FLAG_SET(__Field,__Flag) ((__Field) |= (__Flag))
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#endif
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync#ifndef BIT_FLAG_CLEAR
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync#define BIT_FLAG_CLEAR(__Field,__Flag) ((__Field) &= ~(__Flag))
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync#endif
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/**
eeb2d581c99b451fb1a26a5870af65981dc9cd5dvboxsync * Structures shared between guest and the service
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync * can be relocated and use offsets to point to variable
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync * length parts.
0ce6ae9d6efed5d54222a13bbdabce9e688e4447vboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/**
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Shared folders protocol works with handles.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Before doing any action on a file system object,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * one have to obtain the object handle via a SHFL_FN_CREATE
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * request. A handle must be closed with SHFL_FN_CLOSE.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Shared Folders service functions. (guest)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @{
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Query mappings changes. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_QUERY_MAPPINGS (1)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Query mappings changes. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_QUERY_MAP_NAME (2)
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Open/create object. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync#define SHFL_FN_CREATE (3)
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Close object handle. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync#define SHFL_FN_CLOSE (4)
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Read object content. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync#define SHFL_FN_READ (5)
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Write new object content. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_WRITE (6)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Lock/unlock a range in the object. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_LOCK (7)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** List object content. */
e52c9984c4f6b8ea141bc50a3bdaf31941d8cd7dvboxsync#define SHFL_FN_LIST (8)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Query/set object information. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_INFORMATION (9)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Remove object */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_REMOVE (11)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Map folder (legacy) */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_MAP_FOLDER_OLD (12)
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync/** Unmap folder */
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync#define SHFL_FN_UNMAP_FOLDER (13)
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync/** Rename object (possibly moving it to another directory) */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_RENAME (14)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Flush file */
dc311b529996345ea65d51c87b60b6849642d894vboxsync#define SHFL_FN_FLUSH (15)
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** @todo macl, a description, please. */
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync#define SHFL_FN_SET_UTF8 (16)
e52c9984c4f6b8ea141bc50a3bdaf31941d8cd7dvboxsync/** Map folder */
dc311b529996345ea65d51c87b60b6849642d894vboxsync#define SHFL_FN_MAP_FOLDER (17)
dc311b529996345ea65d51c87b60b6849642d894vboxsync
0a3eb63419e41ef10cd135aeb66dcd6bd6f87cdcvboxsync/** @} */
dc311b529996345ea65d51c87b60b6849642d894vboxsync
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync/** Shared Folders service functions. (host)
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync * @{
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Add shared folder mapping. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_FN_ADD_MAPPING (1)
482a222498aae619afda0255a7edf4ebda97268cvboxsync/** Remove shared folder mapping. */
d19316699d7f91959d88c850fd7e0d64840f39a7vboxsync#define SHFL_FN_REMOVE_MAPPING (2)
482a222498aae619afda0255a7edf4ebda97268cvboxsync/** Set the led status light address */
d020036eb167a2f97f5010276fda5daa3f4773b3vboxsync#define SHFL_FN_SET_STATUS_LED (3)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** @} */
25c5ce7baf4b227ea80250c46d427d0e9fdab4c1vboxsync
25c5ce7baf4b227ea80250c46d427d0e9fdab4c1vboxsync/** Root handle for a mapping. Root handles are unique.
d91dc86210d602f51a4701762488a5e696c80a45vboxsync * @note
d91dc86210d602f51a4701762488a5e696c80a45vboxsync * Function parameters structures consider
59d96bafa78f7257869e30b88f2f98142ef5928evboxsync * the root handle as 32 bit value. If the typedef
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync * will be changed, then function parameters must be
a96ed55e8e1b248965a3d29d6e4c3116979e887bvboxsync * changed accordingly. All those parameters are marked
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * with SHFLROOT in comments.
c829b606c5535f37e00ffee381cca0815a57f319vboxsync */
c829b606c5535f37e00ffee381cca0815a57f319vboxsynctypedef uint32_t SHFLROOT;
c829b606c5535f37e00ffee381cca0815a57f319vboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** A shared folders handle for an opened object. */
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsynctypedef uint64_t SHFLHANDLE;
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync
7a2986a2fdd00cd130bcda05a53575fb58874754vboxsync#define SHFL_HANDLE_NIL ((SHFLHANDLE)~0LL)
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync#define SHFL_HANDLE_ROOT ((SHFLHANDLE)0LL)
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** Hardcoded maximum number of shared folder mapping available to the guest. */
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync#define SHFL_MAX_MAPPINGS (64)
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** Shared Folders strings. They can be either UTF8 or Unicode.
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync * @{
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync */
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsynctypedef struct _SHFLSTRING
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync{
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync /** Size of string String buffer in bytes. */
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync uint16_t u16Size;
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync /** Length of string without trailing nul in bytes. */
7a71f66d53a7dcdf19a7a357e99e560fda812dc3vboxsync uint16_t u16Length;
7a71f66d53a7dcdf19a7a357e99e560fda812dc3vboxsync
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync /** UTF8 or Unicode16 string. Nul terminated. */
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync union
7a71f66d53a7dcdf19a7a357e99e560fda812dc3vboxsync {
f2490dbf97c8247439446844458461b00e50beb0vboxsync uint8_t utf8[1];
d20e5d189feff7841cc3f40e5c9cca8c86b45eb5vboxsync uint16_t ucs2[1];
f2490dbf97c8247439446844458461b00e50beb0vboxsync } String;
f2490dbf97c8247439446844458461b00e50beb0vboxsync} SHFLSTRING;
f2490dbf97c8247439446844458461b00e50beb0vboxsync
f2490dbf97c8247439446844458461b00e50beb0vboxsynctypedef SHFLSTRING *PSHFLSTRING;
f2490dbf97c8247439446844458461b00e50beb0vboxsync
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Calculate size of the string. */
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsyncDECLINLINE(uint32_t) ShflStringSizeOfBuffer (PSHFLSTRING pString)
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync{
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync return pString? sizeof (SHFLSTRING) - sizeof (pString->String) + pString->u16Size: 0;
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync}
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncDECLINLINE(uint32_t) ShflStringLength (PSHFLSTRING pString)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync{
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync return pString? pString->u16Length: 0;
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync}
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsyncDECLINLINE(PSHFLSTRING) ShflStringInitBuffer(void *pvBuffer, uint32_t u32Size)
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync{
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync PSHFLSTRING pString = NULL;
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsync uint32_t u32HeaderSize = sizeof (SHFLSTRING) - sizeof (pString->String);
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* Check that the buffer size is big enough to hold a zero sized string
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * and is not too big to fit into 16 bit variables.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
eeb2d581c99b451fb1a26a5870af65981dc9cd5dvboxsync if (u32Size >= u32HeaderSize && u32Size - u32HeaderSize <= 0xFFFF)
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync {
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync pString = (PSHFLSTRING)pvBuffer;
0ce6ae9d6efed5d54222a13bbdabce9e688e4447vboxsync pString->u16Size = u32Size - u32HeaderSize;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync pString->u16Length = 0;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync }
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync return pString;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync}
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** @} */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Result of an open/create request.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Along with handle value the result code
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * identifies what has happened while
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * trying to open the object.
ea743ed8b8effc9f3647b76eb109c45788052fa0vboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsynctypedef enum _SHFLCREATERESULT
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync{
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync SHFL_NO_RESULT,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Specified path does not exist. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync SHFL_PATH_NOT_FOUND,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Path to file exists, but the last component does not. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync SHFL_FILE_NOT_FOUND,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** File already exists and either has been opened or not. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync SHFL_FILE_EXISTS,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** New file was created. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync SHFL_FILE_CREATED,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Existing file was replaced or overwritten. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync SHFL_FILE_REPLACED
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync} SHFLCREATERESULT;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
23ab2e25f17cdd6af9c0448ee70905a8c1c82896vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Open/create flags.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @{
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync */
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync/** No flags. Initialization value. */
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync#define SHFL_CF_NONE (0x00000000)
43e9355f77c0463e7ace350984bb5a09fb8c50a1vboxsync
611af5c9fc04865215e86b6e4906c9dfdfb6a381vboxsync/** Lookup only the object, do not return a handle. All other flags are ignored. */
d07e901177d22a8f66c66f155c423a524ac07776vboxsync#define SHFL_CF_LOOKUP (0x00000001)
d07e901177d22a8f66c66f155c423a524ac07776vboxsync
d07e901177d22a8f66c66f155c423a524ac07776vboxsync/** Open parent directory of specified object.
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * Useful for the corresponding Windows FSD flag
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * and for opening paths like \\dir\\*.* to search the 'dir'.
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * @todo possibly not needed???
d07e901177d22a8f66c66f155c423a524ac07776vboxsync */
f48fe310f85f13db0140bef980de1f56c2007957vboxsync#define SHFL_CF_OPEN_TARGET_DIRECTORY (0x00000002)
f48fe310f85f13db0140bef980de1f56c2007957vboxsync
f48fe310f85f13db0140bef980de1f56c2007957vboxsync/** Create/open a directory. */
f48fe310f85f13db0140bef980de1f56c2007957vboxsync#define SHFL_CF_DIRECTORY (0x00000004)
1b186b95b77faa977d3651bbfc13afb3f13e0225vboxsync
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync/** Open/create action to do if object exists
0b10203d41681eb80716c97a34ed6c3b6d5318ccvboxsync * and if the object does not exists.
611af5c9fc04865215e86b6e4906c9dfdfb6a381vboxsync * REPLACE file means atomically DELETE and CREATE.
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsync * OVERWRITE file means truncating the file to 0 and
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsync * setting new size.
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsync * When opening an existing directory REPLACE and OVERWRITE
d4f7483a46e1c44ae5fcc4195be291545ae720a4vboxsync * actions are considered invalid, and cause returning
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * FILE_EXISTS with NIL handle.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync#define SHFL_CF_ACT_MASK_IF_EXISTS (0x000000F0)
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync#define SHFL_CF_ACT_MASK_IF_NEW (0x00000F00)
d91dc86210d602f51a4701762488a5e696c80a45vboxsync
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync/** What to do if object exists. */
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsync#define SHFL_CF_ACT_OPEN_IF_EXISTS (0x00000000)
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync#define SHFL_CF_ACT_FAIL_IF_EXISTS (0x00000010)
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync#define SHFL_CF_ACT_REPLACE_IF_EXISTS (0x00000020)
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync#define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** What to do if object does not exist. */
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync#define SHFL_CF_ACT_CREATE_IF_NEW (0x00000000)
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync#define SHFL_CF_ACT_FAIL_IF_NEW (0x00000100)
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync/** Read/write requested access for the object. */
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync#define SHFL_CF_ACCESS_MASK_RW (0x00003000)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** No access requested. */
3221ae1f7bf53d9cccdd578099f55f782dba1447vboxsync#define SHFL_CF_ACCESS_NONE (0x00000000)
3221ae1f7bf53d9cccdd578099f55f782dba1447vboxsync/** Read access requested. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_CF_ACCESS_READ (0x00001000)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Write access requested. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define SHFL_CF_ACCESS_WRITE (0x00002000)
5e3a885d489b1c99d79d576813f8f321bae46927vboxsync/** Read/Write access requested. */
#define SHFL_CF_ACCESS_READWRITE (SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_WRITE)
/** Requested share access for the object. */
#define SHFL_CF_ACCESS_MASK_DENY (0x0000C000)
/** Allow any access. */
#define SHFL_CF_ACCESS_DENYNONE (0x00000000)
/** Do not allow read. */
#define SHFL_CF_ACCESS_DENYREAD (0x00004000)
/** Do not allow write. */
#define SHFL_CF_ACCESS_DENYWRITE (0x00008000)
/** Do not allow access. */
#define SHFL_CF_ACCESS_DENYALL (SHFL_CF_ACCESS_DENYREAD | SHFL_CF_ACCESS_DENYWRITE)
/** @} */
#pragma pack(1)
typedef struct _SHFLCREATEPARMS
{
/* Returned handle of opened object. */
SHFLHANDLE Handle;
/* Returned result of the operation */
SHFLCREATERESULT Result;
/* SHFL_CF_* */
uint32_t CreateFlags;
/* Attributes of object to create and
* returned actual attributes of opened/created object.
*/
RTFSOBJINFO Info;
} SHFLCREATEPARMS;
#pragma pack()
typedef SHFLCREATEPARMS *PSHFLCREATEPARMS;
/** Shared Folders mappings.
* @{
*/
/** The mapping has been added since last query. */
#define SHFL_MS_NEW (1)
/** The mapping has been deleted since last query. */
#define SHFL_MS_DELETED (2)
typedef struct _SHFLMAPPING
{
/** Mapping status. */
uint32_t u32Status;
/** Root handle. */
SHFLROOT root;
} SHFLMAPPING;
typedef SHFLMAPPING *PSHFLMAPPING;
/** @} */
/** Shared Folder directory information
* @{
*/
typedef struct _SHFLDIRINFO
{
/** Full information about the object. */
RTFSOBJINFO Info;
/** The length of the short field (number of RTUTF16 chars).
* It is 16-bit for reasons of alignment. */
uint16_t cucShortName;
/** The short name for 8.3 compatability.
* Empty string if not available.
*/
RTUTF16 uszShortName[14];
/** @todo malc, a description, please. */
SHFLSTRING name;
} SHFLDIRINFO, *PSHFLDIRINFO;
typedef struct _SHFLVOLINFO
{
RTFOFF ullTotalAllocationBytes;
RTFOFF ullAvailableAllocationBytes;
uint32_t ulBytesPerAllocationUnit;
uint32_t ulBytesPerSector;
uint32_t ulSerial;
RTFSPROPERTIES fsProperties;
} SHFLVOLINFO, *PSHFLVOLINFO;
/** @} */
/** Function parameter structures.
* @{
*/
/**
* SHFL_FN_QUERY_MAPPINGS
*/
#define SHFL_MF_UCS2 (0x00000000)
/** Guest uses UTF8 strings, if not set then the strings are unicode (UCS2). */
#define SHFL_MF_UTF8 (0x00000001)
/** Type of guest system. For future system dependent features. */
#define SHFL_MF_SYSTEM_MASK (0x0000FF00)
#define SHFL_MF_SYSTEM_NONE (0x00000000)
#define SHFL_MF_SYSTEM_WINDOWS (0x00000100)
#define SHFL_MF_SYSTEM_LINUX (0x00000200)
/** Parameters structure. */
typedef struct _VBoxSFQueryMappings
{
VBoxGuestHGCMCallInfo callInfo;
/** 32bit, in:
* Flags describing various client needs.
*/
HGCMFunctionParameter flags;
/** 32bit, in/out:
* Number of mappings the client expects.
* This is the number of elements in the
* mappings array.
*/
HGCMFunctionParameter numberOfMappings;
/** pointer, in/out:
* Points to array of SHFLMAPPING structures.
*/
HGCMFunctionParameter mappings;
} VBoxSFQueryMappings;
/** Number of parameters */
#define SHFL_CPARMS_QUERY_MAPPINGS (3)
/**
* SHFL_FN_QUERY_MAP_NAME
*/
/** Parameters structure. */
typedef struct _VBoxSFQueryMapName
{
VBoxGuestHGCMCallInfo callInfo;
/** 32bit, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** pointer, in/out:
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter name;
} VBoxSFQueryMapName;
/** Number of parameters */
#define SHFL_CPARMS_QUERY_MAP_NAME (2)
/**
* SHFL_FN_MAP_FOLDER_OLD
*/
/** Parameters structure. */
typedef struct _VBoxSFMapFolder_Old
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in:
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter path;
/** pointer, out: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** pointer, in: RTUTF16
* Path delimiter
*/
HGCMFunctionParameter delimiter;
} VBoxSFMapFolder_Old;
/** Number of parameters */
#define SHFL_CPARMS_MAP_FOLDER_OLD (3)
/**
* SHFL_FN_MAP_FOLDER
*/
/** Parameters structure. */
typedef struct _VBoxSFMapFolder
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in:
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter path;
/** pointer, out: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** pointer, in: RTUTF16
* Path delimiter
*/
HGCMFunctionParameter delimiter;
/** pointer, in: SHFLROOT
* Case senstive flag
*/
HGCMFunctionParameter fCaseSensitive;
} VBoxSFMapFolder;
/** Number of parameters */
#define SHFL_CPARMS_MAP_FOLDER (4)
/**
* SHFL_FN_UNMAP_FOLDER
*/
/** Parameters structure. */
typedef struct _VBoxSFUnmapFolder
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
} VBoxSFUnmapFolder;
/** Number of parameters */
#define SHFL_CPARMS_UNMAP_FOLDER (1)
/**
* SHFL_FN_CREATE
*/
/** Parameters structure. */
typedef struct _VBoxSFCreate
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** pointer, in:
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter path;
/** pointer, in/out:
* Points to SHFLCREATEPARMS buffer.
*/
HGCMFunctionParameter parms;
} VBoxSFCreate;
/** Number of parameters */
#define SHFL_CPARMS_CREATE (3)
/**
* SHFL_FN_CLOSE
*/
/** Parameters structure. */
typedef struct _VBoxSFClose
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** value64, in:
* SHFLHANDLE of object to close.
*/
HGCMFunctionParameter handle;
} VBoxSFClose;
/** Number of parameters */
#define SHFL_CPARMS_CLOSE (2)
/**
* SHFL_FN_READ
*/
/** Parameters structure. */
typedef struct _VBoxSFRead
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** value64, in:
* SHFLHANDLE of object to read from.
*/
HGCMFunctionParameter handle;
/** value64, in:
* Offset to read from.
*/
HGCMFunctionParameter offset;
/** value64, in/out:
* Bytes to read/How many were read.
*/
HGCMFunctionParameter cb;
/** pointer, out:
* Buffer to place data to.
*/
HGCMFunctionParameter buffer;
} VBoxSFRead;
/** Number of parameters */
#define SHFL_CPARMS_READ (5)
/**
* SHFL_FN_WRITE
*/
/** Parameters structure. */
typedef struct _VBoxSFWrite
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** value64, in:
* SHFLHANDLE of object to write to.
*/
HGCMFunctionParameter handle;
/** value64, in:
* Offset to write to.
*/
HGCMFunctionParameter offset;
/** value64, in/out:
* Bytes to write/How many were written.
*/
HGCMFunctionParameter cb;
/** pointer, in:
* Data to write.
*/
HGCMFunctionParameter buffer;
} VBoxSFWrite;
/** Number of parameters */
#define SHFL_CPARMS_WRITE (5)
/**
* SHFL_FN_LOCK
*/
/** Lock owner is the HGCM client. */
/** Lock mode bit mask. */
#define SHFL_LOCK_MODE_MASK (0x3)
/** Cancel lock on the given range. */
#define SHFL_LOCK_CANCEL (0x0)
/** Aquire read only lock. Prevent write to the range. */
#define SHFL_LOCK_SHARED (0x1)
/** Aquire write lock. Prevent both write and read to the range. */
#define SHFL_LOCK_EXCLUSIVE (0x2)
/** Do not wait for lock if it can not be acquired at the time. */
#define SHFL_LOCK_NOWAIT (0x0)
/** Wait and acquire lock. */
#define SHFL_LOCK_WAIT (0x4)
/** Lock the specified range. */
#define SHFL_LOCK_PARTIAL (0x0)
/** Lock entire object. */
#define SHFL_LOCK_ENTIRE (0x8)
/** Parameters structure. */
typedef struct _VBoxSFLock
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** value64, in:
* SHFLHANDLE of object to be locked.
*/
HGCMFunctionParameter handle;
/** value64, in:
* Starting offset of lock range.
*/
HGCMFunctionParameter offset;
/** value64, in:
* Length of range.
*/
HGCMFunctionParameter length;
/** value32, in:
* Lock flags SHFL_LOCK_*.
*/
HGCMFunctionParameter flags;
} VBoxSFLock;
/** Number of parameters */
#define SHFL_CPARMS_LOCK (5)
/**
* SHFL_FN_FLUSH
*/
/** Parameters structure. */
typedef struct _VBoxSFFlush
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** value64, in:
* SHFLHANDLE of object to be locked.
*/
HGCMFunctionParameter handle;
} VBoxSFFlush;
/** Number of parameters */
#define SHFL_CPARMS_FLUSH (2)
/**
* SHFL_FN_LIST
*/
/** Listing information includes variable length RTDIRENTRY[EX] structures. */
/** @todo might be necessary for future. */
#define SHFL_LIST_NONE 0
#define SHFL_LIST_RETURN_ONE 1
/** Parameters structure. */
typedef struct _VBoxSFList
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** value64, in:
* SHFLHANDLE of object to be listed.
*/
HGCMFunctionParameter handle;
/** value32, in:
* List flags SHFL_LIST_*.
*/
HGCMFunctionParameter flags;
/** value32, in/out:
* Bytes to be used for listing information/How many bytes were used.
*/
HGCMFunctionParameter cb;
/** pointer, in/optional
* Points to SHFLSTRING buffer that specifies a search path.
*/
HGCMFunctionParameter path;
/** pointer, out:
* Buffer to place listing information to. (SHFLDIRINFO)
*/
HGCMFunctionParameter buffer;
/** value32, in/out:
* Indicates a key where the listing must be resumed.
* in: 0 means start from begin of object.
* out: 0 means listing completed.
*/
HGCMFunctionParameter resumePoint;
/** pointer, out:
* Number of files returned
*/
HGCMFunctionParameter cFiles;
} VBoxSFList;
/** Number of parameters */
#define SHFL_CPARMS_LIST (8)
/**
* SHFL_FN_INFORMATION
*/
/** Mask of Set/Get bit. */
#define SHFL_INFO_MODE_MASK (0x1)
/** Get information */
#define SHFL_INFO_GET (0x0)
/** Set information */
#define SHFL_INFO_SET (0x1)
/** Get name of the object. */
#define SHFL_INFO_NAME (0x2)
/** Set size of object (extend/trucate); only applies to file objects */
#define SHFL_INFO_SIZE (0x4)
/** Get/Set file object info. */
#define SHFL_INFO_FILE (0x8)
/** Get volume information. */
#define SHFL_INFO_VOLUME (0x10)
/** @todo different file info structures */
/** Parameters structure. */
typedef struct _VBoxSFInformation
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** value64, in:
* SHFLHANDLE of object to be listed.
*/
HGCMFunctionParameter handle;
/** value32, in:
* SHFL_INFO_*
*/
HGCMFunctionParameter flags;
/** value32, in/out:
* Bytes to be used for information/How many bytes were used.
*/
HGCMFunctionParameter cb;
/** pointer, in/out:
* Information to be set/get (RTFSOBJINFO or SHFLSTRING).
* Do not forget to set the RTFSOBJINFO::Attr::enmAdditional for Get operation as well.
*/
HGCMFunctionParameter info;
} VBoxSFInformation;
/** Number of parameters */
#define SHFL_CPARMS_INFORMATION (5)
/**
* SHFL_FN_REMOVE
*/
#define SHFL_REMOVE_FILE (0x1)
#define SHFL_REMOVE_DIR (0x2)
/** Parameters structure. */
typedef struct _VBoxSFRemove
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** pointer, in:
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter path;
/** value32, in:
* remove flags (file/directory)
*/
HGCMFunctionParameter flags;
} VBoxSFRemove;
#define SHFL_CPARMS_REMOVE (3)
/**
* SHFL_FN_RENAME
*/
#define SHFL_RENAME_FILE (0x1)
#define SHFL_RENAME_DIR (0x2)
#define SHFL_RENAME_REPLACE_IF_EXISTS (0x4)
/** Parameters structure. */
typedef struct _VBoxSFRename
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: SHFLROOT
* Root handle of the mapping which name is queried.
*/
HGCMFunctionParameter root;
/** pointer, in:
* Points to SHFLSTRING src.
*/
HGCMFunctionParameter src;
/** pointer, in:
* Points to SHFLSTRING dest.
*/
HGCMFunctionParameter dest;
/** value32, in:
* rename flags (file/directory)
*/
HGCMFunctionParameter flags;
} VBoxSFRename;
#define SHFL_CPARMS_RENAME (4)
/**
* SHFL_FN_ADD_MAPPING
*/
/** Parameters structure. */
typedef struct _VBoxSFAddMapping
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: Folder name
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter folder;
/** pointer, in: Mapping name
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter mapping;
/** bool, in: Writable
* True (default) if the folder is writable.
*/
HGCMFunctionParameter writable;
} VBoxSFAddMapping;
#define SHFL_CPARMS_ADD_MAPPING (3)
/**
* SHFL_FN_REMOVE_MAPPING
*/
/** Parameters structure. */
typedef struct _VBoxSFRemoveMapping
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: Guest name
* Points to SHFLSTRING buffer.
*/
HGCMFunctionParameter path;
} VBoxSFRemoveMapping;
#define SHFL_CPARMS_REMOVE_MAPPING (1)
/**
* SHFL_FN_SET_STATUS_LED
*/
/** Parameters structure. */
typedef struct _VBoxSFSetStatusLed
{
VBoxGuestHGCMCallInfo callInfo;
/** pointer, in: LED address
* Points to PPDMLED buffer.
*/
HGCMFunctionParameter led;
} VBoxSFSetStatusLed;
#define SHFL_CPARMS_SET_STATUS_LED (1)
/** @} */
#endif