- Timestamp:
- Apr 26, 2019 12:39:27 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/SharedFolders/driver
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/file.cpp
r78304 r78321 16 16 */ 17 17 18 /********************************************************************************************************************************* 19 * Header Files * 20 *********************************************************************************************************************************/ 18 21 #include "vbsf.h" 19 22 #include <iprt/fs.h> … … 21 24 22 25 26 /********************************************************************************************************************************* 27 * Defined Constants And Macros * 28 *********************************************************************************************************************************/ 23 29 /* How much data to transfer in one HGCM request. */ 24 30 #define VBSF_MAX_READ_WRITE_PAGES 256 -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.cpp
r78304 r78321 16 16 */ 17 17 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 18 22 #include "vbsf.h" 19 23 #include <iprt/err.h> 20 24 21 25 26 /********************************************************************************************************************************* 27 * Defined Constants And Macros * 28 *********************************************************************************************************************************/ 22 29 /** Macro for copying a SHFLSTRING file name into a FILE_DIRECTORY_INFORMATION structure. */ 23 30 #define INIT_FILE_NAME(obj, str) \ … … 27 34 RtlCopyMemory((obj)->FileName, &(str).String.ucs2[0], cbLength + 2); \ 28 35 } while (0) 36 29 37 30 38 NTSTATUS VBoxMRxQueryDirectory(IN OUT PRX_CONTEXT RxContext) -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/net.cpp
r78304 r78321 16 16 */ 17 17 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 18 22 #include "vbsf.h" 23 19 24 20 25 NTSTATUS VBoxMRxUpdateNetRootState(IN OUT PMRX_NET_ROOT pNetRoot) -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/path.cpp
r78304 r78321 16 16 */ 17 17 18 /********************************************************************************************************************************* 19 * Header Files * 20 *********************************************************************************************************************************/ 18 21 #include "vbsf.h" 19 22 #include <iprt/err.h> 20 23 21 24 25 /********************************************************************************************************************************* 26 * Defined Constants And Macros * 27 *********************************************************************************************************************************/ 22 28 static UNICODE_STRING g_UnicodeBackslash = { 2, 4, L"\\" }; 29 23 30 24 31 static NTSTATUS vbsfProcessCreate(PRX_CONTEXT RxContext, -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.cpp
r78305 r78321 16 16 */ 17 17 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 18 22 #include "vbsf.h" 19 23 20 24 25 /********************************************************************************************************************************* 26 * Structures and Typedefs * 27 *********************************************************************************************************************************/ 21 28 /** 22 29 * The current state of the driver. -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h
r78304 r78321 22 22 #endif 23 23 24 24 25 /* 25 26 * This must be defined before including RX headers. 26 27 */ 27 #define MINIRDR__NAME VBoxMRx28 #define ___MINIRDR_IMPORTS_NAME (VBoxMRxDeviceObject->RdbssExports)28 #define MINIRDR__NAME VBoxMRx 29 #define ___MINIRDR_IMPORTS_NAME (VBoxMRxDeviceObject->RdbssExports) 29 30 30 31 /* … … 41 42 * VBox shared folders. 42 43 */ 43 #include "vbsfhlp.h"44 44 #include "vbsfshared.h" 45 #ifdef __cplusplus /* mixes code and variables */ 46 # include <VBox/VBoxGuestLibSharedFoldersInline.h> 47 #endif 45 #include <VBox/log.h> 46 #include <VBox/VBoxGuestLibSharedFolders.h> 47 #include <VBox/VBoxGuestLibSharedFoldersInline.h> 48 48 49 49 50 RT_C_DECLS_BEGIN 50 51 52 /* 53 * Global data. 54 */ 51 55 extern PRDBSS_DEVICE_OBJECT VBoxMRxDeviceObject; 52 56 53 /* 57 /** 54 58 * Maximum drive letters (A - Z). 55 59 */ 56 60 #define _MRX_MAX_DRIVE_LETTERS 26 57 61 58 /* 62 /** 59 63 * The shared folders device extension. 60 64 */ 61 65 typedef struct _MRX_VBOX_DEVICE_EXTENSION 62 66 { 63 /* The shared folders device object pointer. */67 /** The shared folders device object pointer. */ 64 68 PRDBSS_DEVICE_OBJECT pDeviceObject; 65 69 66 /* 70 /** 67 71 * Keep a list of local connections used. 68 72 * The size (_MRX_MAX_DRIVE_LETTERS = 26) of the array presents the available drive letters C: - Z: of Windows. … … 79 83 } MRX_VBOX_DEVICE_EXTENSION, *PMRX_VBOX_DEVICE_EXTENSION; 80 84 81 /* 85 /** 82 86 * The shared folders NET_ROOT extension. 83 87 */ 84 88 typedef struct _MRX_VBOX_NETROOT_EXTENSION 85 89 { 86 /* The shared folder map handle of this netroot. */90 /** The shared folder map handle of this netroot. */ 87 91 VBGLSFMAP map; 88 92 /** Simple initialized (mapped folder) indicator that works better with the … … 137 141 #define VBOX_MJ_CREATE_SLASH_HACK UINT16_C(0x0400) 138 142 139 /* 140 * Prototypes for the dispatch table routines.143 /** @name Prototypes for the dispatch table routines. 144 * @{ 141 145 */ 142 146 NTSTATUS VBoxMRxStart(IN OUT struct _RX_CONTEXT * RxContext, … … 190 194 IN PBOOLEAN ForceDisconnect); 191 195 NTSTATUS VBoxMRxUpdateNetRootState(IN PMRX_NET_ROOT pNetRoot); 192 VOID VBoxMRxExtractNetRootName(IN PUNICODE_STRING FilePathName,193 IN PMRX_SRV_CALL SrvCall,194 OUT PUNICODE_STRING NetRootName,195 OUT PUNICODE_STRING RestOfName OPTIONAL);196 VOID VBoxMRxExtractNetRootName(IN PUNICODE_STRING FilePathName, 197 IN PMRX_SRV_CALL SrvCall, 198 OUT PUNICODE_STRING NetRootName, 199 OUT PUNICODE_STRING RestOfName OPTIONAL); 196 200 197 201 NTSTATUS VBoxMRxCreateSrvCall(PMRX_SRV_CALL pSrvCall, … … 204 208 205 209 NTSTATUS VBoxMRxDevFcbXXXControlFile(IN OUT PRX_CONTEXT RxContext); 206 207 /* 208 * Support functions. 210 /** @} */ 211 212 /** @name Support functions and helpers 213 * @{ 209 214 */ 210 215 NTSTATUS vbsfDeleteConnection(IN PRX_CONTEXT RxContext, … … 225 230 226 231 232 233 NTSTATUS vbsfHlpCreateDriveLetter(WCHAR Letter, UNICODE_STRING *pDeviceName); 234 NTSTATUS vbsfHlpDeleteDriveLetter(WCHAR Letter); 235 NTSTATUS VBoxErrorToNTStatus(int vrc); 236 237 PVOID vbsfAllocNonPagedMem(ULONG ulSize); 238 void vbsfFreeNonPagedMem(PVOID lpMem); 239 240 #if defined(DEBUG) || defined(LOG_ENABLED) 241 PCHAR MajorFunctionString(UCHAR MajorFunction, LONG MinorFunction); 242 #endif 243 244 NTSTATUS vbsfShflStringFromUnicodeAlloc(PSHFLSTRING *ppShflString, const WCHAR *pwc, uint16_t cb); 245 246 /** 247 * Converts VBox (IPRT) file mode to NT file attributes. 248 * 249 * @returns NT file attributes 250 * @param fIprtMode IPRT file mode. 251 * 252 */ 253 DECLINLINE(uint32_t) VBoxToNTFileAttributes(uint32_t fIprtMode) 254 { 255 AssertCompile((RTFS_DOS_READONLY >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_READONLY); 256 AssertCompile((RTFS_DOS_HIDDEN >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_HIDDEN); 257 AssertCompile((RTFS_DOS_SYSTEM >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_SYSTEM); 258 AssertCompile((RTFS_DOS_DIRECTORY >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_DIRECTORY); 259 AssertCompile((RTFS_DOS_ARCHIVED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_ARCHIVE); 260 AssertCompile((RTFS_DOS_NT_DEVICE >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_DEVICE); 261 AssertCompile((RTFS_DOS_NT_NORMAL >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_NORMAL); 262 AssertCompile((RTFS_DOS_NT_TEMPORARY >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_TEMPORARY); 263 AssertCompile((RTFS_DOS_NT_SPARSE_FILE >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_SPARSE_FILE); 264 AssertCompile((RTFS_DOS_NT_REPARSE_POINT >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_REPARSE_POINT); 265 AssertCompile((RTFS_DOS_NT_COMPRESSED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_COMPRESSED); 266 AssertCompile((RTFS_DOS_NT_OFFLINE >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_OFFLINE); 267 AssertCompile((RTFS_DOS_NT_NOT_CONTENT_INDEXED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); 268 AssertCompile((RTFS_DOS_NT_ENCRYPTED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_ENCRYPTED); 269 270 uint32_t fNtAttribs = (fIprtMode & (RTFS_DOS_MASK_NT & ~(RTFS_DOS_NT_OFFLINE | RTFS_DOS_NT_DEVICE | RTFS_DOS_NT_REPARSE_POINT))) 271 >> RTFS_DOS_SHIFT; 272 return fNtAttribs ? fNtAttribs : FILE_ATTRIBUTE_NORMAL; 273 } 274 275 /** 276 * Converts NT file attributes to VBox (IPRT) ones. 277 * 278 * @returns IPRT file mode 279 * @param fNtAttribs NT file attributes 280 */ 281 DECLINLINE(uint32_t) NTToVBoxFileAttributes(uint32_t fNtAttribs) 282 { 283 uint32_t fIprtMode = (fNtAttribs << RTFS_DOS_SHIFT) & RTFS_DOS_MASK_NT; 284 fIprtMode &= ~(RTFS_DOS_NT_OFFLINE | RTFS_DOS_NT_DEVICE | RTFS_DOS_NT_REPARSE_POINT); 285 return fIprtMode ? fIprtMode : RTFS_DOS_NT_NORMAL; 286 } 287 288 /** @} */ 289 227 290 RT_C_DECLS_END 228 291 -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsfhlp.cpp
r78304 r78321 16 16 */ 17 17 18 #include <iprt/nt/nt.h> /* includes ntifs.h and wdm.h */ 19 #include <iprt/win/ntdddisk.h> 20 21 #include "vbsfhlp.h" 18 19 /********************************************************************************************************************************* 20 * Header Files * 21 *********************************************************************************************************************************/ 22 #include "vbsf.h" 22 23 #include <iprt/err.h> 23 24 25 26 /********************************************************************************************************************************* 27 * Global Variables * 28 *********************************************************************************************************************************/ 24 29 #ifdef DEBUG 25 30 static int s_iAllocRefCount = 0; 26 31 #endif 27 32 28 void vbsfHlpSleep(ULONG ulMillies)29 {30 KEVENT event;31 LARGE_INTEGER dueTime;32 33 KeInitializeEvent(&event, NotificationEvent, FALSE);34 35 dueTime.QuadPart = -10000 * (int)ulMillies;36 37 KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, &dueTime);38 }39 40 /**41 * Converts VBox (IPRT) file mode to NT file attributes.42 *43 * @returns NT file attributes44 * @param fIprtMode IPRT file mode.45 *46 */47 uint32_t VBoxToNTFileAttributes(uint32_t fIprtMode)48 {49 AssertCompile((RTFS_DOS_READONLY >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_READONLY);50 AssertCompile((RTFS_DOS_HIDDEN >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_HIDDEN);51 AssertCompile((RTFS_DOS_SYSTEM >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_SYSTEM);52 AssertCompile((RTFS_DOS_DIRECTORY >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_DIRECTORY);53 AssertCompile((RTFS_DOS_ARCHIVED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_ARCHIVE);54 /* skipping: RTFS_DOS_NT_DEVICE */55 AssertCompile((RTFS_DOS_NT_NORMAL >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_NORMAL);56 AssertCompile((RTFS_DOS_NT_TEMPORARY >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_TEMPORARY);57 AssertCompile((RTFS_DOS_NT_SPARSE_FILE >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_SPARSE_FILE);58 AssertCompile((RTFS_DOS_NT_REPARSE_POINT >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_REPARSE_POINT);59 AssertCompile((RTFS_DOS_NT_COMPRESSED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_COMPRESSED);60 /* skipping: RTFS_DOS_NT_OFFLINE */61 AssertCompile((RTFS_DOS_NT_NOT_CONTENT_INDEXED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);62 AssertCompile((RTFS_DOS_NT_ENCRYPTED >> RTFS_DOS_SHIFT) == FILE_ATTRIBUTE_ENCRYPTED);63 64 uint32_t fNtAttribs = (fIprtMode & (RTFS_DOS_MASK_NT & ~(RTFS_DOS_NT_OFFLINE | RTFS_DOS_NT_DEVICE | RTFS_DOS_NT_REPARSE_POINT)))65 >> RTFS_DOS_SHIFT;66 return fNtAttribs ? fNtAttribs : FILE_ATTRIBUTE_NORMAL;67 }68 69 /**70 * Converts NT file attributes to VBox (IPRT) ones.71 *72 * @returns IPRT file mode73 * @param fNtAttribs NT file attributes74 */75 uint32_t NTToVBoxFileAttributes(uint32_t fNtAttribs)76 {77 uint32_t fIprtMode = (fNtAttribs << RTFS_DOS_SHIFT) & RTFS_DOS_MASK_NT;78 fIprtMode &= ~(RTFS_DOS_NT_OFFLINE | RTFS_DOS_NT_DEVICE | RTFS_DOS_NT_REPARSE_POINT);79 return fIprtMode ? fIprtMode : RTFS_DOS_NT_NORMAL;80 }81 33 82 34 NTSTATUS vbsfHlpCreateDriveLetter(WCHAR Letter, UNICODE_STRING *pDeviceName) -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsfshared.h
r76563 r78321 1 1 /* $Id$ */ 2 2 /** @file 3 * 4 * VirtualBox Windows Guest Shared Folders 5 * 6 * File System Driver header file shared with the network provider dll 3 * VirtualBox Windows Guest Shared Folders FSD - Definitions shared with the network provider dll. 7 4 */ 8 5 … … 25 22 #endif 26 23 27 /* The network provider name for shared folders. */28 #define MRX_VBOX_PROVIDER_NAME_U L"VirtualBox Shared Folders"24 /** The network provider name for shared folders. */ 25 #define MRX_VBOX_PROVIDER_NAME_U L"VirtualBox Shared Folders" 29 26 30 /* The filesystem name for shared folders. */31 #define MRX_VBOX_FILESYS_NAME_U L"VBoxSharedFolderFS"27 /** The filesystem name for shared folders. */ 28 #define MRX_VBOX_FILESYS_NAME_U L"VBoxSharedFolderFS" 32 29 33 /* The redirector device name. */34 #define DD_MRX_VBOX_FS_DEVICE_NAME_U L"\\Device\\VBoxMiniRdr"30 /** The redirector device name. */ 31 #define DD_MRX_VBOX_FS_DEVICE_NAME_U L"\\Device\\VBoxMiniRdr" 35 32 36 #define VBOX_VOLNAME_PREFIX L"VBOX_" 37 #define VBOX_VOLNAME_PREFIX_SIZE (sizeof(VBOX_VOLNAME_PREFIX) - sizeof(VBOX_VOLNAME_PREFIX[0])) 33 /** Volume label prefix. */ 34 #define VBOX_VOLNAME_PREFIX L"VBOX_" 35 /** Size of volume label prefix. */ 36 #define VBOX_VOLNAME_PREFIX_SIZE (sizeof(VBOX_VOLNAME_PREFIX) - sizeof(VBOX_VOLNAME_PREFIX[0])) 38 37 39 /* Name of symbolic link, which is used by the user mode dll to open the driver. */ 40 #define DD_MRX_VBOX_USERMODE_SHADOW_DEV_NAME_U L"\\??\\VBoxMiniRdrDN" 41 #define DD_MRX_VBOX_USERMODE_DEV_NAME_U L"\\\\.\\VBoxMiniRdrDN" 38 /** NT path of the symbolic link, which is used by the user mode dll to 39 * open the FSD. */ 40 #define DD_MRX_VBOX_USERMODE_SHADOW_DEV_NAME_U L"\\??\\VBoxMiniRdrDN" 41 /** Win32 path of the symbolic link, which is used by the user mode dll 42 * to open the FSD. */ 43 #define DD_MRX_VBOX_USERMODE_DEV_NAME_U L"\\\\.\\VBoxMiniRdrDN" 42 44 43 #define IOCTL_MRX_VBOX_BASE FILE_DEVICE_NETWORK_FILE_SYSTEM 44 45 #define _MRX_VBOX_CONTROL_CODE(request, method, access) \ 46 CTL_CODE(IOCTL_MRX_VBOX_BASE, request, method, access) 47 48 /* VBoxSF IOCTL codes. */ 49 #define IOCTL_MRX_VBOX_ADDCONN _MRX_VBOX_CONTROL_CODE(100, METHOD_BUFFERED, FILE_ANY_ACCESS) 50 #define IOCTL_MRX_VBOX_GETCONN _MRX_VBOX_CONTROL_CODE(101, METHOD_BUFFERED, FILE_ANY_ACCESS) 51 #define IOCTL_MRX_VBOX_DELCONN _MRX_VBOX_CONTROL_CODE(102, METHOD_BUFFERED, FILE_ANY_ACCESS) 52 #define IOCTL_MRX_VBOX_GETLIST _MRX_VBOX_CONTROL_CODE(103, METHOD_BUFFERED, FILE_ANY_ACCESS) 53 #define IOCTL_MRX_VBOX_GETGLOBALLIST _MRX_VBOX_CONTROL_CODE(104, METHOD_BUFFERED, FILE_ANY_ACCESS) 54 #define IOCTL_MRX_VBOX_GETGLOBALCONN _MRX_VBOX_CONTROL_CODE(105, METHOD_BUFFERED, FILE_ANY_ACCESS) 55 #define IOCTL_MRX_VBOX_START _MRX_VBOX_CONTROL_CODE(106, METHOD_BUFFERED, FILE_ANY_ACCESS) 56 #define IOCTL_MRX_VBOX_STOP _MRX_VBOX_CONTROL_CODE(107, METHOD_BUFFERED, FILE_ANY_ACCESS) 45 /** @name IOCTL_MRX_VBOX_XXX - VBoxSF IOCTL codes. 46 * @{ */ 47 #define IOCTL_MRX_VBOX_ADDCONN CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 100, METHOD_BUFFERED, FILE_ANY_ACCESS) 48 #define IOCTL_MRX_VBOX_GETCONN CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 101, METHOD_BUFFERED, FILE_ANY_ACCESS) 49 #define IOCTL_MRX_VBOX_DELCONN CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 102, METHOD_BUFFERED, FILE_ANY_ACCESS) 50 #define IOCTL_MRX_VBOX_GETLIST CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 103, METHOD_BUFFERED, FILE_ANY_ACCESS) 51 #define IOCTL_MRX_VBOX_GETGLOBALLIST CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 104, METHOD_BUFFERED, FILE_ANY_ACCESS) 52 #define IOCTL_MRX_VBOX_GETGLOBALCONN CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 105, METHOD_BUFFERED, FILE_ANY_ACCESS) 53 #define IOCTL_MRX_VBOX_START CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 106, METHOD_BUFFERED, FILE_ANY_ACCESS) 54 #define IOCTL_MRX_VBOX_STOP CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 107, METHOD_BUFFERED, FILE_ANY_ACCESS) 55 /** @} */ 57 56 58 57 #endif /* !GA_INCLUDED_SRC_WINNT_SharedFolders_driver_vbsfshared_h */
Note:
See TracChangeset
for help on using the changeset viewer.