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