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