1 | /** @file
|
---|
2 | *
|
---|
3 | * VBoxGuestLib - A support library for VirtualBox guest additions:
|
---|
4 | * Central calls header
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung 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 as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBOXCALLS__H
|
---|
24 | #define __VBOXCALLS__H
|
---|
25 |
|
---|
26 | #include <VBox/VBoxGuestLib.h>
|
---|
27 | #ifndef _NTIFS_
|
---|
28 | # ifdef __WIN__
|
---|
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 | __BEGIN_DECLS
|
---|
36 | # include <ntddk.h>
|
---|
37 | __END_DECLS
|
---|
38 | # undef _InterlockedExchange
|
---|
39 | # undef _InterlockedExchangeAdd
|
---|
40 | # undef _InterlockedCompareExchange
|
---|
41 | # undef _InterlockedAddLargeStatistic
|
---|
42 | # else
|
---|
43 | __BEGIN_DECLS
|
---|
44 | # include <ntddk.h>
|
---|
45 | __END_DECLS
|
---|
46 | # endif
|
---|
47 | # endif
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | #ifdef DEBUG
|
---|
51 | # define LOG_ENABLED
|
---|
52 | #endif
|
---|
53 | #include "VBoxGuestLog.h"
|
---|
54 |
|
---|
55 | #include <iprt/assert.h>
|
---|
56 | #define ASSERTVBSF AssertRelease
|
---|
57 |
|
---|
58 | #include <VBox/shflsvc.h>
|
---|
59 |
|
---|
60 | typedef struct _VBSFCLIENT
|
---|
61 | {
|
---|
62 | uint32_t ulClientID;
|
---|
63 | VBGLHGCMHANDLE handle;
|
---|
64 | } VBSFCLIENT;
|
---|
65 | typedef VBSFCLIENT *PVBSFCLIENT;
|
---|
66 |
|
---|
67 | typedef struct _VBSFMAP
|
---|
68 | {
|
---|
69 | SHFLROOT root;
|
---|
70 | } VBSFMAP, *PVBSFMAP;
|
---|
71 |
|
---|
72 |
|
---|
73 | #define VBSF_DRIVE_LETTER_FIRST L'A'
|
---|
74 | #define VBSF_DRIVE_LETTER_LAST L'Z'
|
---|
75 |
|
---|
76 | #define VBSF_MAX_DRIVES (VBSF_DRIVE_LETTER_LAST - VBSF_DRIVE_LETTER_FIRST)
|
---|
77 |
|
---|
78 | /* Poller thread flags. */
|
---|
79 | #define VBSF_TF_NONE (0x0000)
|
---|
80 | #define VBSF_TF_STARTED (0x0001)
|
---|
81 | #define VBSF_TF_TERMINATE (0x0002)
|
---|
82 | #define VBSF_TF_START_PROCESSING (0x0004)
|
---|
83 |
|
---|
84 | #define DRIVE_FLAG_WORKING (0x1)
|
---|
85 | #define DRIVE_FLAG_LOCKED (0x2)
|
---|
86 | #define DRIVE_FLAG_WRITE_PROTECTED (0x4)
|
---|
87 |
|
---|
88 | #ifndef __linux__
|
---|
89 | /** Device extension structure for each drive letter we created. */
|
---|
90 | typedef struct _VBSFDRIVE
|
---|
91 | {
|
---|
92 | /* A pointer to the Driver object we created for the drive. */
|
---|
93 | PDEVICE_OBJECT pDeviceObject;
|
---|
94 |
|
---|
95 | /** Root handle to access the drive. */
|
---|
96 | SHFLROOT root;
|
---|
97 |
|
---|
98 | /** Informational string - the resource name on host. */
|
---|
99 | WCHAR awcNameHost[256];
|
---|
100 |
|
---|
101 | /** Guest drive letter. */
|
---|
102 | WCHAR wcDriveLetter;
|
---|
103 |
|
---|
104 | /** DRIVE_FLAG_* */
|
---|
105 | uint32_t u32DriveFlags;
|
---|
106 |
|
---|
107 | /** Head of FCB list. */
|
---|
108 | LIST_ENTRY FCBHead;
|
---|
109 |
|
---|
110 | /* Synchronise requests directed to the drive. */
|
---|
111 | ERESOURCE DriveResource;
|
---|
112 | } VBSFDRIVE;
|
---|
113 | typedef VBSFDRIVE *PVBSFDRIVE;
|
---|
114 | #endif
|
---|
115 |
|
---|
116 | /* forward decl */
|
---|
117 | struct _MRX_VBOX_DEVICE_EXTENSION;
|
---|
118 | typedef struct _MRX_VBOX_DEVICE_EXTENSION *PMRX_VBOX_DEVICE_EXTENSION;
|
---|
119 |
|
---|
120 | DECLVBGL(int) vboxInit (void);
|
---|
121 | DECLVBGL(void) vboxUninit (void);
|
---|
122 | DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient);
|
---|
123 | DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient);
|
---|
124 |
|
---|
125 | DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[], uint32_t *pcMappings);
|
---|
126 |
|
---|
127 | DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, int type, SHFLSTRING *pString, uint32_t size);
|
---|
128 |
|
---|
129 | DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms);
|
---|
130 |
|
---|
131 | DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle);
|
---|
132 | DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pParsedPath, uint32_t flags);
|
---|
133 | DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap, PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags);
|
---|
134 | DECLVBGL(int) vboxCallFlush (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile);
|
---|
135 |
|
---|
136 | DECLVBGL(int) vboxCallRead (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer);
|
---|
137 | DECLVBGL(int) vboxCallWrite (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer);
|
---|
138 |
|
---|
139 | DECLVBGL(int) vboxCallLock (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint64_t cbSize, uint32_t fLock);
|
---|
140 |
|
---|
141 | DECLVBGL(int) vboxCallDirInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,PSHFLSTRING ParsedPath, uint32_t flags,
|
---|
142 | uint32_t index, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer, uint32_t *pcFiles);
|
---|
143 | DECLVBGL(int) vboxCallFSInfo (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer);
|
---|
144 |
|
---|
145 | DECLVBGL(int) vboxCallMapFolder (PVBSFCLIENT pClient, PSHFLSTRING szFolderName, PVBSFMAP pMap);
|
---|
146 | DECLVBGL(int) vboxCallUnmapFolder (PVBSFCLIENT pClient, PVBSFMAP pMap);
|
---|
147 | DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient);
|
---|
148 |
|
---|
149 | #endif /* __VBOXCALLS__H */
|
---|