1 | /** @file
|
---|
2 | * VBoxGuestLib - Central calls header.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
17 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
18 | * additional information or have any questions.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef __VBOXCALLS__H
|
---|
22 | #define __VBOXCALLS__H
|
---|
23 |
|
---|
24 | #include <VBox/VBoxGuestLib.h>
|
---|
25 | #ifndef _NTIFS_
|
---|
26 | # ifdef RT_OS_WINDOWS
|
---|
27 | # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
28 | # include <iprt/asm.h>
|
---|
29 | # define _InterlockedExchange _InterlockedExchange_StupidDDKvsCompilerCrap
|
---|
30 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKvsCompilerCrap
|
---|
31 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKvsCompilerCrap
|
---|
32 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKvsCompilerCrap
|
---|
33 | # pragma warning(disable : 4163)
|
---|
34 | RT_C_DECLS_BEGIN
|
---|
35 | # include <ntddk.h>
|
---|
36 | RT_C_DECLS_END
|
---|
37 | # pragma warning(default : 4163)
|
---|
38 | # undef _InterlockedExchange
|
---|
39 | # undef _InterlockedExchangeAdd
|
---|
40 | # undef _InterlockedCompareExchange
|
---|
41 | # undef _InterlockedAddLargeStatistic
|
---|
42 | # else
|
---|
43 | RT_C_DECLS_BEGIN
|
---|
44 | # include <ntddk.h>
|
---|
45 | RT_C_DECLS_END
|
---|
46 | # endif
|
---|
47 | # endif
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
51 | /** @todo remove this legacy and use VBox/log.h and/or iprt/log.h. */
|
---|
52 | # ifdef DEBUG
|
---|
53 | # define LOG_ENABLED
|
---|
54 | # endif
|
---|
55 | # include "VBoxGuestLog.h"
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | #include <iprt/assert.h>
|
---|
59 | #define ASSERTVBSF AssertRelease
|
---|
60 |
|
---|
61 | #include <VBox/shflsvc.h>
|
---|
62 |
|
---|
63 | typedef struct _VBSFCLIENT
|
---|
64 | {
|
---|
65 | uint32_t ulClientID;
|
---|
66 | VBGLHGCMHANDLE handle;
|
---|
67 | } VBSFCLIENT;
|
---|
68 | typedef VBSFCLIENT *PVBSFCLIENT;
|
---|
69 |
|
---|
70 | typedef struct _VBSFMAP
|
---|
71 | {
|
---|
72 | SHFLROOT root;
|
---|
73 | } VBSFMAP, *PVBSFMAP;
|
---|
74 |
|
---|
75 |
|
---|
76 | #define VBSF_DRIVE_LETTER_FIRST L'A'
|
---|
77 | #define VBSF_DRIVE_LETTER_LAST L'Z'
|
---|
78 |
|
---|
79 | #define VBSF_MAX_DRIVES (VBSF_DRIVE_LETTER_LAST - VBSF_DRIVE_LETTER_FIRST)
|
---|
80 |
|
---|
81 | /* Poller thread flags. */
|
---|
82 | #define VBSF_TF_NONE (0x0000)
|
---|
83 | #define VBSF_TF_STARTED (0x0001)
|
---|
84 | #define VBSF_TF_TERMINATE (0x0002)
|
---|
85 | #define VBSF_TF_START_PROCESSING (0x0004)
|
---|
86 |
|
---|
87 | #define DRIVE_FLAG_WORKING (0x1)
|
---|
88 | #define DRIVE_FLAG_LOCKED (0x2)
|
---|
89 | #define DRIVE_FLAG_WRITE_PROTECTED (0x4)
|
---|
90 |
|
---|
91 | #ifdef RT_OS_WINDOWS
|
---|
92 | /** Device extension structure for each drive letter we created. */
|
---|
93 | typedef struct _VBSFDRIVE
|
---|
94 | {
|
---|
95 | /* A pointer to the Driver object we created for the drive. */
|
---|
96 | PDEVICE_OBJECT pDeviceObject;
|
---|
97 |
|
---|
98 | /** Root handle to access the drive. */
|
---|
99 | SHFLROOT root;
|
---|
100 |
|
---|
101 | /** Informational string - the resource name on host. */
|
---|
102 | WCHAR awcNameHost[256];
|
---|
103 |
|
---|
104 | /** Guest drive letter. */
|
---|
105 | WCHAR wcDriveLetter;
|
---|
106 |
|
---|
107 | /** DRIVE_FLAG_* */
|
---|
108 | uint32_t u32DriveFlags;
|
---|
109 |
|
---|
110 | /** Head of FCB list. */
|
---|
111 | LIST_ENTRY FCBHead;
|
---|
112 |
|
---|
113 | /* Synchronise requests directed to the drive. */
|
---|
114 | ERESOURCE DriveResource;
|
---|
115 | } VBSFDRIVE;
|
---|
116 | typedef VBSFDRIVE *PVBSFDRIVE;
|
---|
117 | #endif /* RT_OS_WINDOWS */
|
---|
118 |
|
---|
119 | /* forward decl */
|
---|
120 | struct _MRX_VBOX_DEVICE_EXTENSION;
|
---|
121 | typedef struct _MRX_VBOX_DEVICE_EXTENSION *PMRX_VBOX_DEVICE_EXTENSION;
|
---|
122 |
|
---|
123 | DECLVBGL(int) vboxInit (void);
|
---|
124 | DECLVBGL(void) vboxUninit (void);
|
---|
125 | DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient);
|
---|
126 | DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient);
|
---|
127 |
|
---|
128 | DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings);
|
---|
129 |
|
---|
130 | DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size);
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * Create a new file or folder or open an existing one in a shared folder. Proxies
|
---|
134 | * to vbsfCreate in the host shared folder service.
|
---|
135 | *
|
---|
136 | * @returns IPRT status code, but see note below
|
---|
137 | * @param pClient Host-guest communication connection
|
---|
138 | * @param pMap The mapping for the shared folder in which the file
|
---|
139 | * or folder is to be created
|
---|
140 | * @param pParsedPath The path of the file or folder relative to the shared
|
---|
141 | * folder
|
---|
142 | * @param pCreateParms Parameters for file/folder creation. See the
|
---|
143 | * structure description in shflsvc.h
|
---|
144 | * @retval pCreateParms See the structure description in shflsvc.h
|
---|
145 | *
|
---|
146 | * @note This function reports errors as follows. The return value is always
|
---|
147 | * VINF_SUCCESS unless an exceptional condition occurrs - out of
|
---|
148 | * memory, invalid arguments, etc. If the file or folder could not be
|
---|
149 | * opened or created, pCreateParms->Handle will be set to
|
---|
150 | * SHFL_HANDLE_NIL on return. In this case the value in
|
---|
151 | * pCreateParms->Result provides information as to why (e.g.
|
---|
152 | * SHFL_FILE_EXISTS). pCreateParms->Result is also set on success
|
---|
153 | * as additional information.
|
---|
154 | */
|
---|
155 | DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms);
|
---|
156 |
|
---|
157 | DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle);
|
---|
158 | DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags);
|
---|
159 | DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags);
|
---|
160 | DECLVBGL(int) vboxCallFlush (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile);
|
---|
161 |
|
---|
162 | DECLVBGL(int) vboxCallRead (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
|
---|
163 | DECLVBGL(int) vboxCallWrite (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
|
---|
164 | DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer);
|
---|
165 |
|
---|
166 | DECLVBGL(int) vboxCallLock (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint64_t cbSize, uint32_t fLock);
|
---|
167 |
|
---|
168 | DECLVBGL(int) vboxCallDirInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,PSHFLSTRING ParsedPath, uint32_t flags,
|
---|
169 | uint32_t index, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer, uint32_t *pcFiles);
|
---|
170 | DECLVBGL(int) vboxCallFSInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer);
|
---|
171 |
|
---|
172 | DECLVBGL(int) vboxCallMapFolder (PVBSFCLIENT pClient, PSHFLSTRING szFolderName, PVBSFMAP pMap);
|
---|
173 | DECLVBGL(int) vboxCallUnmapFolder (PVBSFCLIENT pClient, PVBSFMAP pMap);
|
---|
174 | DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient);
|
---|
175 |
|
---|
176 | #endif /* __VBOXCALLS__H */
|
---|