1 | /* $Id: vbsf.h 55401 2015-04-23 10:03:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VirtualBox Windows Guest Shared Folders
|
---|
5 | *
|
---|
6 | * File System Driver header file
|
---|
7 | */
|
---|
8 |
|
---|
9 | /*
|
---|
10 | * Copyright (C) 2012 Oracle Corporation
|
---|
11 | *
|
---|
12 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | * available from http://www.virtualbox.org. This file is free software;
|
---|
14 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | * General Public License (GPL) as published by the Free Software
|
---|
16 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef VBSF_H
|
---|
22 | #define VBSF_H
|
---|
23 |
|
---|
24 | /*
|
---|
25 | * This must be defined before including RX headers.
|
---|
26 | */
|
---|
27 | #define MINIRDR__NAME VBoxMRx
|
---|
28 | #define ___MINIRDR_IMPORTS_NAME (VBoxMRxDeviceObject->RdbssExports)
|
---|
29 |
|
---|
30 | /*
|
---|
31 | * System and RX headers.
|
---|
32 | */
|
---|
33 | #include <ntifs.h>
|
---|
34 | #include <windef.h>
|
---|
35 |
|
---|
36 | #include "rx.h"
|
---|
37 |
|
---|
38 | /*
|
---|
39 | * VBox shared folders.
|
---|
40 | */
|
---|
41 | #include "vbsfhlp.h"
|
---|
42 | #include "vbsfshared.h"
|
---|
43 |
|
---|
44 | extern PRDBSS_DEVICE_OBJECT VBoxMRxDeviceObject;
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * Maximum drive letters (A - Z).
|
---|
48 | */
|
---|
49 | #define _MRX_MAX_DRIVE_LETTERS 26
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * The shared folders device extension.
|
---|
53 | */
|
---|
54 | typedef struct _MRX_VBOX_DEVICE_EXTENSION
|
---|
55 | {
|
---|
56 | /* The shared folders device object pointer. */
|
---|
57 | PRDBSS_DEVICE_OBJECT pDeviceObject;
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * Keep a list of local connections used.
|
---|
61 | * The size (_MRX_MAX_DRIVE_LETTERS = 26) of the array presents the available drive letters C: - Z: of Windows.
|
---|
62 | */
|
---|
63 | CHAR cLocalConnections[_MRX_MAX_DRIVE_LETTERS];
|
---|
64 | PUNICODE_STRING wszLocalConnectionName[_MRX_MAX_DRIVE_LETTERS];
|
---|
65 | FAST_MUTEX mtxLocalCon;
|
---|
66 |
|
---|
67 | /* The HGCM client information. */
|
---|
68 | VBSFCLIENT hgcmClient;
|
---|
69 |
|
---|
70 | /* Saved pointer to the original IRP_MJ_DEVICE_CONTROL handler. */
|
---|
71 | NTSTATUS (* pfnRDBSSDeviceControl) (PDEVICE_OBJECT pDevObj, PIRP pIrp);
|
---|
72 |
|
---|
73 | } MRX_VBOX_DEVICE_EXTENSION, *PMRX_VBOX_DEVICE_EXTENSION;
|
---|
74 |
|
---|
75 | /*
|
---|
76 | * The shared folders NET_ROOT extension.
|
---|
77 | */
|
---|
78 | typedef struct _MRX_VBOX_NETROOT_EXTENSION
|
---|
79 | {
|
---|
80 | /* The pointert to HGCM client information in device extension. */
|
---|
81 | VBSFCLIENT *phgcmClient;
|
---|
82 |
|
---|
83 | /* The shared folder map handle of this netroot. */
|
---|
84 | VBSFMAP map;
|
---|
85 | } MRX_VBOX_NETROOT_EXTENSION, *PMRX_VBOX_NETROOT_EXTENSION;
|
---|
86 |
|
---|
87 | #define VBOX_FOBX_F_INFO_CREATION_TIME 0x01
|
---|
88 | #define VBOX_FOBX_F_INFO_LASTACCESS_TIME 0x02
|
---|
89 | #define VBOX_FOBX_F_INFO_LASTWRITE_TIME 0x04
|
---|
90 | #define VBOX_FOBX_F_INFO_CHANGE_TIME 0x08
|
---|
91 | #define VBOX_FOBX_F_INFO_ATTRIBUTES 0x10
|
---|
92 |
|
---|
93 | /*
|
---|
94 | * The shared folders file extension.
|
---|
95 | */
|
---|
96 | typedef struct _MRX_VBOX_FOBX_
|
---|
97 | {
|
---|
98 | SHFLHANDLE hFile;
|
---|
99 | PMRX_SRV_CALL pSrvCall;
|
---|
100 | FILE_BASIC_INFORMATION FileBasicInfo;
|
---|
101 | FILE_STANDARD_INFORMATION FileStandardInfo;
|
---|
102 | BOOLEAN fKeepCreationTime;
|
---|
103 | BOOLEAN fKeepLastAccessTime;
|
---|
104 | BOOLEAN fKeepLastWriteTime;
|
---|
105 | BOOLEAN fKeepChangeTime;
|
---|
106 | BYTE SetFileInfoOnCloseFlags;
|
---|
107 | } MRX_VBOX_FOBX, *PMRX_VBOX_FOBX;
|
---|
108 |
|
---|
109 | #define VBoxMRxGetDeviceExtension(RxContext) \
|
---|
110 | (PMRX_VBOX_DEVICE_EXTENSION)((PBYTE)(RxContext->RxDeviceObject) + sizeof(RDBSS_DEVICE_OBJECT))
|
---|
111 |
|
---|
112 | #define VBoxMRxGetNetRootExtension(pNetRoot) \
|
---|
113 | (((pNetRoot) == NULL) ? NULL : (PMRX_VBOX_NETROOT_EXTENSION)((pNetRoot)->Context))
|
---|
114 |
|
---|
115 | #define VBoxMRxGetSrvOpenExtension(pSrvOpen) \
|
---|
116 | (((pSrvOpen) == NULL) ? NULL : (PMRX_VBOX_SRV_OPEN)((pSrvOpen)->Context))
|
---|
117 |
|
---|
118 | #define VBoxMRxGetFileObjectExtension(pFobx) \
|
---|
119 | (((pFobx) == NULL) ? NULL : (PMRX_VBOX_FOBX)((pFobx)->Context))
|
---|
120 |
|
---|
121 | /*
|
---|
122 | * Prototypes for the dispatch table routines.
|
---|
123 | */
|
---|
124 | NTSTATUS VBoxMRxStart(IN OUT struct _RX_CONTEXT * RxContext,
|
---|
125 | IN OUT PRDBSS_DEVICE_OBJECT RxDeviceObject);
|
---|
126 | NTSTATUS VBoxMRxStop(IN OUT struct _RX_CONTEXT * RxContext,
|
---|
127 | IN OUT PRDBSS_DEVICE_OBJECT RxDeviceObject);
|
---|
128 |
|
---|
129 | NTSTATUS VBoxMRxCreate(IN OUT PRX_CONTEXT RxContext);
|
---|
130 | NTSTATUS VBoxMRxCollapseOpen(IN OUT PRX_CONTEXT RxContext);
|
---|
131 | NTSTATUS VBoxMRxShouldTryToCollapseThisOpen(IN OUT PRX_CONTEXT RxContext);
|
---|
132 | NTSTATUS VBoxMRxFlush(IN OUT PRX_CONTEXT RxContext);
|
---|
133 | NTSTATUS VBoxMRxTruncate(IN OUT PRX_CONTEXT RxContext);
|
---|
134 | NTSTATUS VBoxMRxCleanupFobx(IN OUT PRX_CONTEXT RxContext);
|
---|
135 | NTSTATUS VBoxMRxCloseSrvOpen(IN OUT PRX_CONTEXT RxContext);
|
---|
136 | NTSTATUS VBoxMRxDeallocateForFcb(IN OUT PMRX_FCB pFcb);
|
---|
137 | NTSTATUS VBoxMRxDeallocateForFobx(IN OUT PMRX_FOBX pFobx);
|
---|
138 | NTSTATUS VBoxMRxForceClosed(IN OUT PMRX_SRV_OPEN SrvOpen);
|
---|
139 |
|
---|
140 | NTSTATUS VBoxMRxQueryDirectory(IN OUT PRX_CONTEXT RxContext);
|
---|
141 | NTSTATUS VBoxMRxQueryFileInfo(IN OUT PRX_CONTEXT RxContext);
|
---|
142 | NTSTATUS VBoxMRxSetFileInfo(IN OUT PRX_CONTEXT RxContext);
|
---|
143 | NTSTATUS VBoxMRxSetFileInfoAtCleanup(IN OUT PRX_CONTEXT RxContext);
|
---|
144 | NTSTATUS VBoxMRxQueryEaInfo(IN OUT PRX_CONTEXT RxContext);
|
---|
145 | NTSTATUS VBoxMRxSetEaInfo(IN OUT struct _RX_CONTEXT * RxContext);
|
---|
146 | NTSTATUS VBoxMRxQuerySdInfo(IN OUT PRX_CONTEXT RxContext);
|
---|
147 | NTSTATUS VBoxMRxSetSdInfo(IN OUT struct _RX_CONTEXT * RxContext);
|
---|
148 | NTSTATUS VBoxMRxQueryVolumeInfo(IN OUT PRX_CONTEXT RxContext);
|
---|
149 |
|
---|
150 | NTSTATUS VBoxMRxComputeNewBufferingState(IN OUT PMRX_SRV_OPEN pSrvOpen,
|
---|
151 | IN PVOID pMRxContext,
|
---|
152 | OUT ULONG *pNewBufferingState);
|
---|
153 |
|
---|
154 | NTSTATUS VBoxMRxRead(IN OUT PRX_CONTEXT RxContext);
|
---|
155 | NTSTATUS VBoxMRxWrite(IN OUT PRX_CONTEXT RxContext);
|
---|
156 | NTSTATUS VBoxMRxLocks(IN OUT PRX_CONTEXT RxContext);
|
---|
157 | NTSTATUS VBoxMRxFsCtl(IN OUT PRX_CONTEXT RxContext);
|
---|
158 | NTSTATUS VBoxMRxIoCtl(IN OUT PRX_CONTEXT RxContext);
|
---|
159 | NTSTATUS VBoxMRxNotifyChangeDirectory(IN OUT PRX_CONTEXT RxContext);
|
---|
160 |
|
---|
161 | NTSTATUS VBoxMRxExtendStub(IN OUT struct _RX_CONTEXT * RxContext,
|
---|
162 | IN OUT PLARGE_INTEGER pNewFileSize,
|
---|
163 | OUT PLARGE_INTEGER pNewAllocationSize);
|
---|
164 | NTSTATUS VBoxMRxCompleteBufferingStateChangeRequest(IN OUT PRX_CONTEXT RxContext,
|
---|
165 | IN OUT PMRX_SRV_OPEN SrvOpen,
|
---|
166 | IN PVOID pContext);
|
---|
167 |
|
---|
168 | NTSTATUS VBoxMRxCreateVNetRoot(IN OUT PMRX_CREATENETROOT_CONTEXT pContext);
|
---|
169 | NTSTATUS VBoxMRxFinalizeVNetRoot(IN OUT PMRX_V_NET_ROOT pVirtualNetRoot,
|
---|
170 | IN PBOOLEAN ForceDisconnect);
|
---|
171 | NTSTATUS VBoxMRxFinalizeNetRoot(IN OUT PMRX_NET_ROOT pNetRoot,
|
---|
172 | IN PBOOLEAN ForceDisconnect);
|
---|
173 | NTSTATUS VBoxMRxUpdateNetRootState(IN PMRX_NET_ROOT pNetRoot);
|
---|
174 | VOID VBoxMRxExtractNetRootName(IN PUNICODE_STRING FilePathName,
|
---|
175 | IN PMRX_SRV_CALL SrvCall,
|
---|
176 | OUT PUNICODE_STRING NetRootName,
|
---|
177 | OUT PUNICODE_STRING RestOfName OPTIONAL);
|
---|
178 |
|
---|
179 | NTSTATUS VBoxMRxCreateSrvCall(PMRX_SRV_CALL pSrvCall,
|
---|
180 | PMRX_SRVCALL_CALLBACK_CONTEXT pCallbackContext);
|
---|
181 | NTSTATUS VBoxMRxSrvCallWinnerNotify(IN OUT PMRX_SRV_CALL pSrvCall,
|
---|
182 | IN BOOLEAN ThisMinirdrIsTheWinner,
|
---|
183 | IN OUT PVOID pSrvCallContext);
|
---|
184 | NTSTATUS VBoxMRxFinalizeSrvCall(PMRX_SRV_CALL pSrvCall,
|
---|
185 | BOOLEAN Force);
|
---|
186 |
|
---|
187 | NTSTATUS VBoxMRxDevFcbXXXControlFile(IN OUT PRX_CONTEXT RxContext);
|
---|
188 |
|
---|
189 | /*
|
---|
190 | * Support functions.
|
---|
191 | */
|
---|
192 | NTSTATUS vbsfDeleteConnection(IN PRX_CONTEXT RxContext,
|
---|
193 | OUT PBOOLEAN PostToFsp);
|
---|
194 | NTSTATUS vbsfCreateConnection(IN PRX_CONTEXT RxContext,
|
---|
195 | OUT PBOOLEAN PostToFsp);
|
---|
196 |
|
---|
197 | NTSTATUS vbsfSetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext,
|
---|
198 | IN OUT PLARGE_INTEGER pNewFileSize,
|
---|
199 | OUT PLARGE_INTEGER pNewAllocationSize);
|
---|
200 | NTSTATUS vbsfRename(IN PRX_CONTEXT RxContext,
|
---|
201 | IN FILE_INFORMATION_CLASS FileInformationClass,
|
---|
202 | IN PVOID pBuffer,
|
---|
203 | IN ULONG BufferLength);
|
---|
204 | NTSTATUS vbsfRemove(IN PRX_CONTEXT RxContext);
|
---|
205 | NTSTATUS vbsfCloseFileHandle(PMRX_VBOX_DEVICE_EXTENSION pDeviceExtension,
|
---|
206 | PMRX_VBOX_NETROOT_EXTENSION pNetRootExtension,
|
---|
207 | PMRX_VBOX_FOBX pVBoxFobx);
|
---|
208 |
|
---|
209 | #endif /* VBSF_H */
|
---|