shflsvc.h revision 35552ddafb570c069e1960bc17e19ccff2d99083
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Shared Folders:
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Common header for host service and guest clients.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Copyright (C) 2006-2007 innotek GmbH
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 * 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 * 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.
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync/** Some bit flag manipulation macros. to be moved to VBox/cdefs.h? */
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#define BIT_FLAG(__Field,__Flag) ((__Field) & (__Flag))
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#define BIT_FLAG_SET(__Field,__Flag) ((__Field) |= (__Flag))
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync#define BIT_FLAG_CLEAR(__Field,__Flag) ((__Field) &= ~(__Flag))
eeb2d581c99b451fb1a26a5870af65981dc9cd5dvboxsync * Structures shared between guest and the service
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync * can be relocated and use offsets to point to variable
f32de6c198a491c28ace2b4c53f8d04a79fd6d69vboxsync * length parts.
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/** Shared Folders service functions. (guest)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Query mappings changes. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Query mappings changes. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Open/create object. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Close object handle. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Read object content. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Write new object content. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Lock/unlock a range in the object. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** List object content. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Query/set object information. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Remove object */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Map folder (legacy) */
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync/** Unmap folder */
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync/** Rename object (possibly moving it to another directory) */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Flush file */
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** @todo macl, a description, please. */
e52c9984c4f6b8ea141bc50a3bdaf31941d8cd7dvboxsync/** Map folder */
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync/** Shared Folders service functions. (host)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Add shared folder mapping. */
482a222498aae619afda0255a7edf4ebda97268cvboxsync/** Remove shared folder mapping. */
482a222498aae619afda0255a7edf4ebda97268cvboxsync/** Set the led status light address */
25c5ce7baf4b227ea80250c46d427d0e9fdab4c1vboxsync/** Root handle for a mapping. Root handles are unique.
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.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** A shared folders handle for an opened object. */
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** Hardcoded maximum number of shared folder mapping available to the guest. */
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync/** Shared Folders strings. They can be either UTF8 or Unicode.
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsynctypedef struct _SHFLSTRING
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync /** Size of string String buffer in bytes. */
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync /** Length of string without trailing nul in bytes. */
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync /** UTF8 or Unicode16 string. Nul terminated. */
f2490dbf97c8247439446844458461b00e50beb0vboxsync/** Calculate size of the string. */
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsyncDECLINLINE(uint32_t) ShflStringSizeOfBuffer (PSHFLSTRING pString)
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync return pString? sizeof (SHFLSTRING) - sizeof (pString->String) + pString->u16Size: 0;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncDECLINLINE(uint32_t) ShflStringLength (PSHFLSTRING pString)
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsyncDECLINLINE(PSHFLSTRING) ShflStringInitBuffer(void *pvBuffer, uint32_t u32Size)
50453af238fcec34bf98f91cc4c32bf57f738bd3vboxsync uint32_t u32HeaderSize = sizeof (SHFLSTRING) - sizeof (pString->String);
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.
eeb2d581c99b451fb1a26a5870af65981dc9cd5dvboxsync if (u32Size >= u32HeaderSize && u32Size - u32HeaderSize <= 0xFFFF)
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.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Specified path does not exist. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Path to file exists, but the last component does not. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** File already exists and either has been opened or not. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** New file was created. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Existing file was replaced or overwritten. */
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync/** No flags. Initialization value. */
611af5c9fc04865215e86b6e4906c9dfdfb6a381vboxsync/** Lookup only the object, do not return a handle. All other flags are ignored. */
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???
f48fe310f85f13db0140bef980de1f56c2007957vboxsync/** Create/open a directory. */
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.
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync/** What to do if object exists. */
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync#define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** What to do if object does not exist. */
db85b6b8ce514217c1fb35d04b0854a65dc299f3vboxsync/** Read/write requested access for the object. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** No access requested. */
3221ae1f7bf53d9cccdd578099f55f782dba1447vboxsync/** Read access requested. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** Write access requested. */
5e3a885d489b1c99d79d576813f8f321bae46927vboxsync/** Read/Write access requested. */
typedef struct _SHFLCREATEPARMS
#pragma pack()
typedef struct _SHFLMAPPING
} SHFLMAPPING;
typedef struct _SHFLDIRINFO
typedef struct _SHFLVOLINFO
typedef struct _VBoxSFQueryMappings
typedef struct _VBoxSFQueryMapName
typedef struct _VBoxSFMapFolder_Old
typedef struct _VBoxSFMapFolder
typedef struct _VBoxSFUnmapFolder
typedef struct _VBoxSFCreate
} VBoxSFCreate;
typedef struct _VBoxSFClose
} VBoxSFClose;
typedef struct _VBoxSFRead
} VBoxSFRead;
typedef struct _VBoxSFWrite
} VBoxSFWrite;
typedef struct _VBoxSFLock
} VBoxSFLock;
typedef struct _VBoxSFFlush
} VBoxSFFlush;
#define SHFL_LIST_NONE 0
typedef struct _VBoxSFList
* Bytes to be used for listing information/How many bytes were used.
} VBoxSFList;
typedef struct _VBoxSFInformation
* Bytes to be used for information/How many bytes were used.
typedef struct _VBoxSFRemove
} VBoxSFRemove;
typedef struct _VBoxSFRename
} VBoxSFRename;
typedef struct _VBoxSFAddMapping
typedef struct _VBoxSFRemoveMapping
typedef struct _VBoxSFSetStatusLed