2
* VBoxGuestLib - Central calls header.
6
* Copyright (C) 2006-2007 Oracle Corporation
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.
16
* The contents of this file may alternatively be used under the terms
17
* of the Common Development and Distribution License Version 1.0
18
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19
* VirtualBox OSE distribution, in which case the provisions of the
20
* CDDL are applicable instead of those of the GPL.
22
* You may elect to license modified versions of this file under the
23
* terms and conditions of either the GPL or the CDDL or both.
26
#ifndef __VBOXCALLS__H
27
#define __VBOXCALLS__H
29
#include <VBox/VBoxGuestLib.h>
32
# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
33
# include <iprt/asm.h>
34
# define _InterlockedExchange _InterlockedExchange_StupidDDKvsCompilerCrap
35
# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKvsCompilerCrap
36
# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKvsCompilerCrap
37
# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKvsCompilerCrap
38
# pragma warning(disable : 4163)
42
# pragma warning(default : 4163)
43
# undef _InterlockedExchange
44
# undef _InterlockedExchangeAdd
45
# undef _InterlockedCompareExchange
46
# undef _InterlockedAddLargeStatistic
55
#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
56
/** @todo remove this legacy and use VBox/log.h and/or iprt/log.h. */
60
# include "VBoxGuestLog.h"
63
#include <iprt/assert.h>
64
#define ASSERTVBSF AssertRelease
66
#include <VBox/shflsvc.h>
68
typedef struct _VBSFCLIENT
71
VBGLHGCMHANDLE handle;
73
typedef VBSFCLIENT *PVBSFCLIENT;
75
typedef struct _VBSFMAP
81
#define VBSF_DRIVE_LETTER_FIRST L'A'
82
#define VBSF_DRIVE_LETTER_LAST L'Z'
84
#define VBSF_MAX_DRIVES (VBSF_DRIVE_LETTER_LAST - VBSF_DRIVE_LETTER_FIRST)
86
/* Poller thread flags. */
87
#define VBSF_TF_NONE (0x0000)
88
#define VBSF_TF_STARTED (0x0001)
89
#define VBSF_TF_TERMINATE (0x0002)
90
#define VBSF_TF_START_PROCESSING (0x0004)
92
#define DRIVE_FLAG_WORKING (0x1)
93
#define DRIVE_FLAG_LOCKED (0x2)
94
#define DRIVE_FLAG_WRITE_PROTECTED (0x4)
97
/** Device extension structure for each drive letter we created. */
98
typedef struct _VBSFDRIVE
100
/* A pointer to the Driver object we created for the drive. */
101
PDEVICE_OBJECT pDeviceObject;
103
/** Root handle to access the drive. */
106
/** Informational string - the resource name on host. */
107
WCHAR awcNameHost[256];
109
/** Guest drive letter. */
113
uint32_t u32DriveFlags;
115
/** Head of FCB list. */
118
/* Synchronise requests directed to the drive. */
119
ERESOURCE DriveResource;
121
typedef VBSFDRIVE *PVBSFDRIVE;
122
#endif /* RT_OS_WINDOWS */
125
struct _MRX_VBOX_DEVICE_EXTENSION;
126
typedef struct _MRX_VBOX_DEVICE_EXTENSION *PMRX_VBOX_DEVICE_EXTENSION;
128
DECLVBGL(int) vboxInit (void);
129
DECLVBGL(void) vboxUninit (void);
130
DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient);
131
DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient);
133
DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings);
135
DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size);
138
* Create a new file or folder or open an existing one in a shared folder. Proxies
139
* to vbsfCreate in the host shared folder service.
141
* @returns IPRT status code, but see note below
142
* @param pClient Host-guest communication connection
143
* @param pMap The mapping for the shared folder in which the file
144
* or folder is to be created
145
* @param pParsedPath The path of the file or folder relative to the shared
147
* @param pCreateParms Parameters for file/folder creation. See the
148
* structure description in shflsvc.h
149
* @retval pCreateParms See the structure description in shflsvc.h
151
* @note This function reports errors as follows. The return value is always
152
* VINF_SUCCESS unless an exceptional condition occurrs - out of
153
* memory, invalid arguments, etc. If the file or folder could not be
154
* opened or created, pCreateParms->Handle will be set to
155
* SHFL_HANDLE_NIL on return. In this case the value in
156
* pCreateParms->Result provides information as to why (e.g.
157
* SHFL_FILE_EXISTS). pCreateParms->Result is also set on success
158
* as additional information.
160
DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms);
162
DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle);
163
DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags);
164
DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags);
165
DECLVBGL(int) vboxCallFlush (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile);
167
DECLVBGL(int) vboxCallRead (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
168
DECLVBGL(int) vboxCallWrite (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked);
169
DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer);
171
DECLVBGL(int) vboxCallLock (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint64_t cbSize, uint32_t fLock);
173
DECLVBGL(int) vboxCallDirInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,PSHFLSTRING ParsedPath, uint32_t flags,
174
uint32_t index, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer, uint32_t *pcFiles);
175
DECLVBGL(int) vboxCallFSInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer);
177
DECLVBGL(int) vboxCallMapFolder (PVBSFCLIENT pClient, PSHFLSTRING szFolderName, PVBSFMAP pMap);
178
DECLVBGL(int) vboxCallUnmapFolder (PVBSFCLIENT pClient, PVBSFMAP pMap);
179
DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient);
181
#endif /* __VBOXCALLS__H */