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