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