1 | /* $Id: VBoxGuestR0LibSharedFolders.h 55401 2015-04-23 10:03:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxGuestLib - Central calls header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___VBoxGuestLib_VBoxGuestR0LibSharedFolders_h
|
---|
28 | #define ___VBoxGuestLib_VBoxGuestR0LibSharedFolders_h
|
---|
29 |
|
---|
30 | #include <VBox/VBoxGuestLib.h>
|
---|
31 | #ifndef _NTIFS_
|
---|
32 | # ifdef RT_OS_WINDOWS
|
---|
33 | # undef PAGE_SIZE
|
---|
34 | # undef PAGE_SHIFT
|
---|
35 | # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
36 | # include <iprt/asm.h>
|
---|
37 | # define _InterlockedExchange _InterlockedExchange_StupidDDKvsCompilerCrap
|
---|
38 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKvsCompilerCrap
|
---|
39 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKvsCompilerCrap
|
---|
40 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKvsCompilerCrap
|
---|
41 | # pragma warning(disable : 4163)
|
---|
42 | RT_C_DECLS_BEGIN
|
---|
43 | # include <ntddk.h>
|
---|
44 | RT_C_DECLS_END
|
---|
45 | # pragma warning(default : 4163)
|
---|
46 | # undef _InterlockedExchange
|
---|
47 | # undef _InterlockedExchangeAdd
|
---|
48 | # undef _InterlockedCompareExchange
|
---|
49 | # undef _InterlockedAddLargeStatistic
|
---|
50 | # else
|
---|
51 | RT_C_DECLS_BEGIN
|
---|
52 | # include <ntddk.h>
|
---|
53 | RT_C_DECLS_END
|
---|
54 | # endif
|
---|
55 | # endif
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | #if defined(RT_OS_WINDOWS) && 0
|
---|
59 | /** @todo remove this legacy and use VBox/log.h and/or iprt/log.h. */
|
---|
60 | /* => Done. The next person who needs logging in Windows guests will have the
|
---|
61 | * honour of making it work. */
|
---|
62 | # ifdef DEBUG
|
---|
63 | # define LOG_ENABLED
|
---|
64 | # endif
|
---|
65 | # include "VBoxGuestLog.h"
|
---|
66 | #endif
|
---|
67 | #if defined(RT_OS_WINDOWS)
|
---|
68 | # include <VBox/log.h>
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | #include <iprt/assert.h>
|
---|
72 | #define ASSERTVBSF AssertRelease
|
---|
73 |
|
---|
74 | #include <VBox/shflsvc.h>
|
---|
75 |
|
---|
76 | typedef struct _VBSFCLIENT
|
---|
77 | {
|
---|
78 | uint32_t ulClientID;
|
---|
79 | VBGLHGCMHANDLE handle;
|
---|
80 | } VBSFCLIENT;
|
---|
81 | typedef VBSFCLIENT *PVBSFCLIENT;
|
---|
82 |
|
---|
83 | typedef struct _VBSFMAP
|
---|
84 | {
|
---|
85 | SHFLROOT root;
|
---|
86 | } VBSFMAP, *PVBSFMAP;
|
---|
87 |
|
---|
88 |
|
---|
89 | #define VBSF_DRIVE_LETTER_FIRST L'A'
|
---|
90 | #define VBSF_DRIVE_LETTER_LAST L'Z'
|
---|
91 |
|
---|
92 | #define VBSF_MAX_DRIVES (VBSF_DRIVE_LETTER_LAST - VBSF_DRIVE_LETTER_FIRST)
|
---|
93 |
|
---|
94 | /* Poller thread flags. */
|
---|
95 | #define VBSF_TF_NONE (0x0000)
|
---|
96 | #define VBSF_TF_STARTED (0x0001)
|
---|
97 | #define VBSF_TF_TERMINATE (0x0002)
|
---|
98 | #define VBSF_TF_START_PROCESSING (0x0004)
|
---|
99 |
|
---|
100 | #define DRIVE_FLAG_WORKING (0x1)
|
---|
101 | #define DRIVE_FLAG_LOCKED (0x2)
|
---|
102 | #define DRIVE_FLAG_WRITE_PROTECTED (0x4)
|
---|
103 |
|
---|
104 | #ifdef RT_OS_WINDOWS
|
---|
105 | /** Device extension structure for each drive letter we created. */
|
---|
106 | typedef struct _VBSFDRIVE
|
---|
107 | {
|
---|
108 | /* A pointer to the Driver object we created for the drive. */
|
---|
109 | PDEVICE_OBJECT pDeviceObject;
|
---|
110 |
|
---|
111 | /** Root handle to access the drive. */
|
---|
112 | SHFLROOT root;
|
---|
113 |
|
---|
114 | /** Informational string - the resource name on host. */
|
---|
115 | WCHAR awcNameHost[256];
|
---|
116 |
|
---|
117 | /** Guest drive letter. */
|
---|
118 | WCHAR wcDriveLetter;
|
---|
119 |
|
---|
120 | /** DRIVE_FLAG_* */
|
---|
121 | uint32_t u32DriveFlags;
|
---|
122 |
|
---|
123 | /** Head of FCB list. */
|
---|
124 | LIST_ENTRY FCBHead;
|
---|
125 |
|
---|
126 | /* Synchronise requests directed to the drive. */
|
---|
127 | ERESOURCE DriveResource;
|
---|
128 | } VBSFDRIVE;
|
---|
129 | typedef VBSFDRIVE *PVBSFDRIVE;
|
---|
130 | #endif /* RT_OS_WINDOWS */
|
---|
131 |
|
---|
132 | /* forward decl */
|
---|
133 | struct _MRX_VBOX_DEVICE_EXTENSION;
|
---|
134 | typedef struct _MRX_VBOX_DEVICE_EXTENSION *PMRX_VBOX_DEVICE_EXTENSION;
|
---|
135 |
|
---|
136 | DECLVBGL(int) vboxInit (void);
|
---|
137 | DECLVBGL(void) vboxUninit (void);
|
---|
138 | DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient);
|
---|
139 | DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient);
|
---|
140 |
|
---|
141 | DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings);
|
---|
142 |
|
---|
143 | DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size);
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * Create a new file or folder or open an existing one in a shared folder. Proxies
|
---|
147 | * to vbsfCreate in the host shared folder service.
|
---|
148 | *
|
---|
149 | * @returns IPRT status code, but see note below
|
---|
150 | * @param pClient Host-guest communication connection
|
---|
151 | * @param pMap The mapping for the shared folder in which the file
|
---|
152 | * or folder is to be created
|
---|
153 | * @param pParsedPath The path of the file or folder relative to the shared
|
---|
154 | * folder
|
---|
155 | * @param pCreateParms Parameters for file/folder creation. See the
|
---|
156 | * structure description in shflsvc.h
|
---|
157 | * @retval pCreateParms See the structure description in shflsvc.h
|
---|
158 | *
|
---|
159 | * @note This function reports errors as follows. The return value is always
|
---|
160 | * VINF_SUCCESS unless an exceptional condition occurs - out of
|
---|
161 | * memory, invalid arguments, etc. If the file or folder could not be
|
---|
162 | * opened or created, pCreateParms->Handle will be set to
|
---|
163 | * SHFL_HANDLE_NIL on return. In this case the value in
|
---|
164 | * pCreateParms->Result provides information as to why (e.g.
|
---|
165 | * SHFL_FILE_EXISTS). pCreateParms->Result is also set on success
|
---|
166 | * as additional information.
|
---|
167 | */
|
---|
168 | DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms);
|
---|
169 |
|
---|
170 | DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle);
|
---|
171 | DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags);
|
---|
172 | DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags);
|
---|
173 | DECLVBGL(int) vboxCallFlush (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile);
|
---|
174 |
|
---|
175 | DECLVBGL(int) vboxCallRead (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
|
---|
176 | DECLVBGL(int) VbglR0SharedFolderReadPageList(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
|
---|
177 | uint64_t offset, uint32_t *pcbBuffer,
|
---|
178 | uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages);
|
---|
179 | DECLVBGL(int) vboxCallWrite (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
|
---|
180 | DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer);
|
---|
181 | DECLVBGL(int) VbglR0SharedFolderWritePageList(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
|
---|
182 | uint64_t offset, uint32_t *pcbBuffer,
|
---|
183 | uint16_t offFirstPage, uint16_t cPages, RTGCPHYS64 *paPages);
|
---|
184 |
|
---|
185 | DECLVBGL(int) vboxCallLock (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint64_t cbSize, uint32_t fLock);
|
---|
186 |
|
---|
187 | DECLVBGL(int) vboxCallDirInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,PSHFLSTRING ParsedPath, uint32_t flags,
|
---|
188 | uint32_t index, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer, uint32_t *pcFiles);
|
---|
189 | DECLVBGL(int) vboxCallFSInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer);
|
---|
190 |
|
---|
191 | DECLVBGL(int) vboxCallMapFolder (PVBSFCLIENT pClient, PSHFLSTRING szFolderName, PVBSFMAP pMap);
|
---|
192 | DECLVBGL(int) vboxCallUnmapFolder (PVBSFCLIENT pClient, PVBSFMAP pMap);
|
---|
193 | DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient);
|
---|
194 |
|
---|
195 | DECLVBGL(int) vboxReadLink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING ParsedPath, uint32_t pcbBuffer, uint8_t *pBuffer);
|
---|
196 | DECLVBGL(int) vboxCallSymlink (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pNewPath, PSHFLSTRING pOldPath, PSHFLFSOBJINFO pBuffer);
|
---|
197 | DECLVBGL(int) vboxCallSetSymlinks (PVBSFCLIENT pClient);
|
---|
198 |
|
---|
199 | #endif /* !___VBoxGuestLib_VBoxGuestR0LibSharedFolders_h */
|
---|
200 |
|
---|