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