From 03db443406d5172aec560b64fef2f3673a078910 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Wed, 20 Jul 2016 23:41:55 -0700 Subject: [PATCH 01/11] Update README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 0469df05..c3345dd7 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,13 @@ I am looking for help in the following areas: In all cases I can provide ideas and/or support. +## Where to Discuss + +If you wish to discuss WinFsp there are now two options: + +- [WinFsp Google Group](https://groups.google.com/forum/#!forum/winfsp) +- [Author's Twitter](https://twitter.com/BZissimopoulos) + ## License WinFsp is available under the [AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html) license. If you find the constraints of the AGPLv3 too onerous, a commercial license is also available. Please contact Bill Zissimopoulos for more details. From e7cba96c74339f1ea56b055c6bfa1d6d33f5367d Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 21 Jul 2016 14:08:00 -0700 Subject: [PATCH 02/11] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3345dd7..562d638d 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ I am looking for help in the following areas: * If you have a file system that runs on FUSE please consider porting it to WinFsp. WinFsp has a native API, but it also has a FUSE (high-level) API. * If you are working with a language other than C/C++ (e.g. Delphi, C#, etc.) and you are interested in porting/wrapping WinFsp I would love to hear from you. -* There are a number of outstanding issues listed in the [BitBucket repository](https://bitbucket.org/billziss/winfsp/issues?status=new&status=open). Many of these require knowledge of Windows kernel-mode and an understanding of the internals of WinFsp so they are not for the faint of heart. If you decide to tackle any of those please coordinate with me as I am actively working on that issue list. +* There are a number of outstanding issues listed in the [GitHub repository](https://github.com/billziss-gh/winfsp/issues) ~~[BitBucket repository](https://bitbucket.org/billziss/winfsp/issues?status=new&status=open)~~. Many of these require knowledge of Windows kernel-mode and an understanding of the internals of WinFsp so they are not for the faint of heart. If you decide to tackle any of those please coordinate with me as I am actively working on that issue list. In all cases I can provide ideas and/or support. From 0e2f46dc900b2cdbcccf64974284d2682b5925f9 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Wed, 27 Jul 2016 16:14:59 -0700 Subject: [PATCH 03/11] Define NTDDI_VERSION,_WIN32_WINNT; remove GetOverlappedResultEx - Ensures that only Vista+ DDI/API's are used - Project should now run on Win 7 --- build/VStudio/version.properties | 5 ++ src/launcher/launcher.c | 22 +++-- src/sys/driver.h | 10 +++ src/sys/ioctl.i | 150 +++++++++++++++---------------- 4 files changed, 106 insertions(+), 81 deletions(-) diff --git a/build/VStudio/version.properties b/build/VStudio/version.properties index 603b2238..3cd4408d 100644 --- a/build/VStudio/version.properties +++ b/build/VStudio/version.properties @@ -10,4 +10,9 @@ 0.15.$(MyBuildNumber) $(MyVersion.Replace('.',',')),0 + + + NTDDI_VERSION=0x06000000;_WIN32_WINNT=0x0600 + + \ No newline at end of file diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 3828f11f..f97399be 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -686,6 +686,7 @@ NTSTATUS SvcInstanceStart(HANDLE ClientToken, UINT8 RspBuf[2]; DWORD BytesTransferred; OVERLAPPED Overlapped; + DWORD WaitResult; if (0 == (BytesTransferred = WideCharToMultiByte(CP_UTF8, 0, Secret, lstrlenW(Secret), ReqBuf, sizeof ReqBuf, 0, 0))) @@ -711,13 +712,22 @@ NTSTATUS SvcInstanceStart(HANDLE ClientToken, goto exit; } - if (!GetOverlappedResultEx(SvcInstance->StdioHandles[1], &Overlapped, &BytesTransferred, - LAUNCHER_START_WITH_SECRET_TIMEOUT, FALSE)) + /* + * We need to perform a GetOverlappedResult with a timeout. GetOverlappedResultEx would + * be perfect except that it is a Windows 8 and above API. We will therefore replace with + * WaitForSingleObject followed by GetOverlappedResult on success. + */ + WaitResult = WaitForSingleObject(SvcInstance->StdioHandles[1], + LAUNCHER_START_WITH_SECRET_TIMEOUT); + if (WAIT_OBJECT_0 == WaitResult) + Result = GetOverlappedResult(SvcInstance->StdioHandles[1], &Overlapped, &BytesTransferred, TRUE) ? + STATUS_SUCCESS : FspNtStatusFromWin32(GetLastError()); + else if (WAIT_TIMEOUT == WaitResult) + Result = STATUS_TIMEOUT; + else + Result = FspNtStatusFromWin32(GetLastError()); + if (!NT_SUCCESS(Result)) { - if (WAIT_TIMEOUT == GetLastError()) - Result = STATUS_TIMEOUT; - else - Result = FspNtStatusFromWin32(GetLastError()); CancelIoEx(SvcInstance->StdioHandles[1], &Overlapped); goto exit; } diff --git a/src/sys/driver.h b/src/sys/driver.h index 684a56de..7b10a5db 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -1034,4 +1034,14 @@ extern WCHAR FspFileDescDirectoryPatternMatchAll[]; extern FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache; extern ULONG FspMvMdlMappingNoWrite; +/* add missing API prototype */ +#if (NTDDI_VERSION < NTDDI_WIN7) +NTKERNELAPI +NTSTATUS +ObCloseHandle( + _In_ HANDLE Handle, + _In_ KPROCESSOR_MODE PreviousMode + ); +#endif + #endif diff --git a/src/sys/ioctl.i b/src/sys/ioctl.i index 8b7acfc2..f56887ab 100644 --- a/src/sys/ioctl.i +++ b/src/sys/ioctl.i @@ -89,82 +89,82 @@ SYM(FSCTL_DFSR_SET_GHOST_HANDLE_STATE) SYM(FSCTL_TXFS_LIST_TRANSACTIONS) SYM(FSCTL_QUERY_PAGEFILE_ENCRYPTION) SYM(FSCTL_RESET_VOLUME_ALLOCATION_HINTS) -SYM(FSCTL_QUERY_DEPENDENT_VOLUME) -SYM(FSCTL_SD_GLOBAL_CHANGE) +//SYM(FSCTL_QUERY_DEPENDENT_VOLUME) +//SYM(FSCTL_SD_GLOBAL_CHANGE) SYM(FSCTL_TXFS_READ_BACKUP_INFORMATION2) -SYM(FSCTL_LOOKUP_STREAM_FROM_CLUSTER) -SYM(FSCTL_TXFS_WRITE_BACKUP_INFORMATION2) -SYM(FSCTL_FILE_TYPE_NOTIFICATION) -SYM(FSCTL_FILE_LEVEL_TRIM) -SYM(FSCTL_GET_BOOT_AREA_INFO) -SYM(FSCTL_GET_RETRIEVAL_POINTER_BASE) -SYM(FSCTL_SET_PERSISTENT_VOLUME_STATE) -SYM(FSCTL_QUERY_PERSISTENT_VOLUME_STATE) -SYM(FSCTL_REQUEST_OPLOCK) -SYM(FSCTL_CSV_TUNNEL_REQUEST) -SYM(FSCTL_IS_CSV_FILE) -SYM(FSCTL_QUERY_FILE_SYSTEM_RECOGNITION) -SYM(FSCTL_CSV_GET_VOLUME_PATH_NAME) -SYM(FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT) -SYM(FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME) -SYM(FSCTL_IS_FILE_ON_CSV_VOLUME) -SYM(FSCTL_CORRUPTION_HANDLING) -SYM(FSCTL_OFFLOAD_READ) -SYM(FSCTL_OFFLOAD_WRITE) -SYM(FSCTL_CSV_INTERNAL) -SYM(FSCTL_SET_PURGE_FAILURE_MODE) -SYM(FSCTL_QUERY_FILE_LAYOUT) -SYM(FSCTL_IS_VOLUME_OWNED_BYCSVFS) -SYM(FSCTL_GET_INTEGRITY_INFORMATION) -SYM(FSCTL_SET_INTEGRITY_INFORMATION) -SYM(FSCTL_QUERY_FILE_REGIONS) -SYM(FSCTL_DEDUP_FILE) -SYM(FSCTL_DEDUP_QUERY_FILE_HASHES) -SYM(FSCTL_DEDUP_QUERY_RANGE_STATE) -SYM(FSCTL_DEDUP_QUERY_REPARSE_INFO) -SYM(FSCTL_RKF_INTERNAL) -SYM(FSCTL_SCRUB_DATA) -SYM(FSCTL_REPAIR_COPIES) -SYM(FSCTL_DISABLE_LOCAL_BUFFERING) -SYM(FSCTL_CSV_MGMT_LOCK) -SYM(FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS) -SYM(FSCTL_ADVANCE_FILE_ID) -SYM(FSCTL_CSV_SYNC_TUNNEL_REQUEST) -SYM(FSCTL_CSV_QUERY_VETO_FILE_DIRECT_IO) -SYM(FSCTL_WRITE_USN_REASON) -SYM(FSCTL_CSV_CONTROL) -SYM(FSCTL_GET_REFS_VOLUME_DATA) -SYM(FSCTL_CSV_H_BREAKING_SYNC_TUNNEL_REQUEST) -SYM(FSCTL_QUERY_STORAGE_CLASSES) -SYM(FSCTL_QUERY_REGION_INFO) -SYM(FSCTL_USN_TRACK_MODIFIED_RANGES) -SYM(FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT) -SYM(FSCTL_SVHDX_SYNC_TUNNEL_REQUEST) -SYM(FSCTL_SVHDX_SET_INITIATOR_INFORMATION) -SYM(FSCTL_SET_EXTERNAL_BACKING) -SYM(FSCTL_GET_EXTERNAL_BACKING) -SYM(FSCTL_DELETE_EXTERNAL_BACKING) -SYM(FSCTL_ENUM_EXTERNAL_BACKING) -SYM(FSCTL_ENUM_OVERLAY) -SYM(FSCTL_ADD_OVERLAY) -SYM(FSCTL_REMOVE_OVERLAY) -SYM(FSCTL_UPDATE_OVERLAY) -SYM(FSCTL_DUPLICATE_EXTENTS_TO_FILE) -SYM(FSCTL_SPARSE_OVERALLOCATE) -SYM(FSCTL_STORAGE_QOS_CONTROL) -SYM(FSCTL_INITIATE_FILE_METADATA_OPTIMIZATION) -SYM(FSCTL_QUERY_FILE_METADATA_OPTIMIZATION) -SYM(FSCTL_SVHDX_ASYNC_TUNNEL_REQUEST) -SYM(FSCTL_GET_WOF_VERSION) -SYM(FSCTL_HCS_SYNC_TUNNEL_REQUEST) -SYM(FSCTL_HCS_ASYNC_TUNNEL_REQUEST) -SYM(FSCTL_QUERY_EXTENT_READ_CACHE_INFO) -SYM(FSCTL_QUERY_REFS_VOLUME_COUNTER_INFO) -SYM(FSCTL_CLEAN_VOLUME_METADATA) -SYM(FSCTL_SET_INTEGRITY_INFORMATION_EX) -SYM(FSCTL_SUSPEND_OVERLAY) -SYM(FSCTL_VIRTUAL_STORAGE_QUERY_PROPERTY) -SYM(FSCTL_FILESYSTEM_GET_STATISTICS_EX) +//SYM(FSCTL_LOOKUP_STREAM_FROM_CLUSTER) +//SYM(FSCTL_TXFS_WRITE_BACKUP_INFORMATION2) +//SYM(FSCTL_FILE_TYPE_NOTIFICATION) +//SYM(FSCTL_FILE_LEVEL_TRIM) +//SYM(FSCTL_GET_BOOT_AREA_INFO) +//SYM(FSCTL_GET_RETRIEVAL_POINTER_BASE) +//SYM(FSCTL_SET_PERSISTENT_VOLUME_STATE) +//SYM(FSCTL_QUERY_PERSISTENT_VOLUME_STATE) +//SYM(FSCTL_REQUEST_OPLOCK) +//SYM(FSCTL_CSV_TUNNEL_REQUEST) +//SYM(FSCTL_IS_CSV_FILE) +//SYM(FSCTL_QUERY_FILE_SYSTEM_RECOGNITION) +//SYM(FSCTL_CSV_GET_VOLUME_PATH_NAME) +//SYM(FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT) +//SYM(FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME) +//SYM(FSCTL_IS_FILE_ON_CSV_VOLUME) +//SYM(FSCTL_CORRUPTION_HANDLING) +//SYM(FSCTL_OFFLOAD_READ) +//SYM(FSCTL_OFFLOAD_WRITE) +//SYM(FSCTL_CSV_INTERNAL) +//SYM(FSCTL_SET_PURGE_FAILURE_MODE) +//SYM(FSCTL_QUERY_FILE_LAYOUT) +//SYM(FSCTL_IS_VOLUME_OWNED_BYCSVFS) +//SYM(FSCTL_GET_INTEGRITY_INFORMATION) +//SYM(FSCTL_SET_INTEGRITY_INFORMATION) +//SYM(FSCTL_QUERY_FILE_REGIONS) +//SYM(FSCTL_DEDUP_FILE) +//SYM(FSCTL_DEDUP_QUERY_FILE_HASHES) +//SYM(FSCTL_DEDUP_QUERY_RANGE_STATE) +//SYM(FSCTL_DEDUP_QUERY_REPARSE_INFO) +//SYM(FSCTL_RKF_INTERNAL) +//SYM(FSCTL_SCRUB_DATA) +//SYM(FSCTL_REPAIR_COPIES) +//SYM(FSCTL_DISABLE_LOCAL_BUFFERING) +//SYM(FSCTL_CSV_MGMT_LOCK) +//SYM(FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS) +//SYM(FSCTL_ADVANCE_FILE_ID) +//SYM(FSCTL_CSV_SYNC_TUNNEL_REQUEST) +//SYM(FSCTL_CSV_QUERY_VETO_FILE_DIRECT_IO) +//SYM(FSCTL_WRITE_USN_REASON) +//SYM(FSCTL_CSV_CONTROL) +//SYM(FSCTL_GET_REFS_VOLUME_DATA) +//SYM(FSCTL_CSV_H_BREAKING_SYNC_TUNNEL_REQUEST) +//SYM(FSCTL_QUERY_STORAGE_CLASSES) +//SYM(FSCTL_QUERY_REGION_INFO) +//SYM(FSCTL_USN_TRACK_MODIFIED_RANGES) +//SYM(FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT) +//SYM(FSCTL_SVHDX_SYNC_TUNNEL_REQUEST) +//SYM(FSCTL_SVHDX_SET_INITIATOR_INFORMATION) +//SYM(FSCTL_SET_EXTERNAL_BACKING) +//SYM(FSCTL_GET_EXTERNAL_BACKING) +//SYM(FSCTL_DELETE_EXTERNAL_BACKING) +//SYM(FSCTL_ENUM_EXTERNAL_BACKING) +//SYM(FSCTL_ENUM_OVERLAY) +//SYM(FSCTL_ADD_OVERLAY) +//SYM(FSCTL_REMOVE_OVERLAY) +//SYM(FSCTL_UPDATE_OVERLAY) +//SYM(FSCTL_DUPLICATE_EXTENTS_TO_FILE) +//SYM(FSCTL_SPARSE_OVERALLOCATE) +//SYM(FSCTL_STORAGE_QOS_CONTROL) +//SYM(FSCTL_INITIATE_FILE_METADATA_OPTIMIZATION) +//SYM(FSCTL_QUERY_FILE_METADATA_OPTIMIZATION) +//SYM(FSCTL_SVHDX_ASYNC_TUNNEL_REQUEST) +//SYM(FSCTL_GET_WOF_VERSION) +//SYM(FSCTL_HCS_SYNC_TUNNEL_REQUEST) +//SYM(FSCTL_HCS_ASYNC_TUNNEL_REQUEST) +//SYM(FSCTL_QUERY_EXTENT_READ_CACHE_INFO) +//SYM(FSCTL_QUERY_REFS_VOLUME_COUNTER_INFO) +//SYM(FSCTL_CLEAN_VOLUME_METADATA) +//SYM(FSCTL_SET_INTEGRITY_INFORMATION_EX) +//SYM(FSCTL_SUSPEND_OVERLAY) +//SYM(FSCTL_VIRTUAL_STORAGE_QUERY_PROPERTY) +//SYM(FSCTL_FILESYSTEM_GET_STATISTICS_EX) SYM(FSCTL_LMR_GET_LINK_TRACKING_INFORMATION) SYM(FSCTL_LMR_SET_LINK_TRACKING_INFORMATION) SYM(IOCTL_LMR_ARE_FILE_OBJECTS_ON_SAME_SERVER) From 913f7ac9cd32004d5450ab41f738811f12cd459d Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Wed, 27 Jul 2016 16:25:41 -0700 Subject: [PATCH 04/11] dll: suppress compiler warning on x86 builds --- src/dll/np.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dll/np.c b/src/dll/np.c index 9b4d55c3..a410ba02 100644 --- a/src/dll/np.c +++ b/src/dll/np.c @@ -161,7 +161,7 @@ static inline BOOLEAN FspNpParseUserName(PWSTR RemoteName, &ClassName, &ClassNameLen, &InstanceName, &InstanceNameLen)) { for (P = InstanceName; *P; P++) - if ('@' == *P && P - InstanceName < UserNameSize) + if ('@' == *P && (ULONG)(P - InstanceName) < UserNameSize) { memcpy(UserName, InstanceName, (P - InstanceName) * sizeof(WCHAR)); UserName[P - InstanceName] = L'\0'; From 5827b1fa9cd6e7d6543f63fab0b7031bf5bf4e5f Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 28 Jul 2016 00:03:53 -0700 Subject: [PATCH 05/11] sys: fixes for Win7 x86 --- build/VStudio/winfsp_sys.vcxproj | 4 ++++ src/sys/driver.h | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/build/VStudio/winfsp_sys.vcxproj b/build/VStudio/winfsp_sys.vcxproj index 71926b47..a1c10f76 100644 --- a/build/VStudio/winfsp_sys.vcxproj +++ b/build/VStudio/winfsp_sys.vcxproj @@ -34,6 +34,7 @@ Windows10 true + $(DDK_LIB_PATH)\BufferOverflowK.lib WindowsKernelModeDriver10.0 Driver WDM @@ -41,6 +42,7 @@ Windows10 false + $(DDK_LIB_PATH)\BufferOverflowK.lib WindowsKernelModeDriver10.0 Driver WDM @@ -48,6 +50,7 @@ Windows10 true + $(DDK_LIB_PATH)\BufferOverflowK.lib WindowsKernelModeDriver10.0 Driver WDM @@ -55,6 +58,7 @@ Windows10 false + $(DDK_LIB_PATH)\BufferOverflowK.lib WindowsKernelModeDriver10.0 Driver WDM diff --git a/src/sys/driver.h b/src/sys/driver.h index 7b10a5db..7c2b11f2 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -1034,7 +1034,11 @@ extern WCHAR FspFileDescDirectoryPatternMatchAll[]; extern FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache; extern ULONG FspMvMdlMappingNoWrite; -/* add missing API prototype */ +/* + * Fixes + */ + + /* ObCloseHandle: add missing prototype */ #if (NTDDI_VERSION < NTDDI_WIN7) NTKERNELAPI NTSTATUS @@ -1044,4 +1048,12 @@ ObCloseHandle( ); #endif +/* RtlEqualMemory: this is defined as memcmp, which does not exist on Win7 x86! */ +#undef RtlEqualMemory +static inline +LOGICAL RtlEqualMemory(const VOID *Source1, const VOID *Source2, SIZE_T Length) +{ + return Length == RtlCompareMemory(Source1, Source2, Length); +} + #endif From 9b4318c65523199f1f03df115727343146e56439 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 28 Jul 2016 09:57:31 -0700 Subject: [PATCH 06/11] sys: fix request header alignment on 32-bit builds --- src/sys/driver.h | 3 ++- src/sys/iop.c | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/sys/driver.h b/src/sys/driver.h index 7c2b11f2..c5941ffc 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -655,13 +655,14 @@ enum #define FspIopPostWorkRequestBestEffort(D, R)\ FspIopPostWorkRequestFunnel(D, R, TRUE) #define FspIopCompleteIrp(I, R) FspIopCompleteIrpEx(I, R, TRUE) +#define REQ_ALIGN_SIZE 16 typedef VOID FSP_IOP_REQUEST_FINI(FSP_FSCTL_TRANSACT_REQ *Request, PVOID Context[4]); typedef struct { FSP_IOP_REQUEST_FINI *RequestFini; PVOID Context[4]; FSP_FSCTL_TRANSACT_RSP *Response; - __declspec(align(MEMORY_ALLOCATION_ALIGNMENT)) UINT8 RequestBuf[]; + __declspec(align(REQ_ALIGN_SIZE)) UINT8 RequestBuf[]; } FSP_FSCTL_TRANSACT_REQ_HEADER; static inline PVOID *FspIopRequestContextAddress(FSP_FSCTL_TRANSACT_REQ *Request, ULONG I) diff --git a/src/sys/iop.c b/src/sys/iop.c index 4060ebac..cdc1f68f 100644 --- a/src/sys/iop.c +++ b/src/sys/iop.c @@ -48,10 +48,12 @@ NTSTATUS FspIopDispatchComplete(PIRP Irp, const FSP_FSCTL_TRANSACT_RSP *Response #endif /* Requests (and RequestHeaders) must be 16-byte aligned, because we use the low 4 bits for flags */ -#if 16 != MEMORY_ALLOCATION_ALIGNMENT -#define REQ_HEADER_ALIGNMASK 15 +#if REQ_ALIGN_SIZE <= MEMORY_ALLOCATION_ALIGNMENT +#define REQ_HEADER_ALIGN_MASK 0 +#define REQ_HEADER_ALIGN_OVERHEAD 0 #else -#define REQ_HEADER_ALIGNMASK 0 +#define REQ_HEADER_ALIGN_MASK (REQ_ALIGN_SIZE - 1) +#define REQ_HEADER_ALIGN_OVERHEAD (sizeof(PVOID) + REQ_HEADER_ALIGN_MASK) #endif NTSTATUS FspIopCreateRequestFunnel( @@ -74,20 +76,23 @@ NTSTATUS FspIopCreateRequestFunnel( if (FlagOn(Flags, FspIopRequestMustSucceed)) RequestHeader = FspAllocatePoolMustSucceed( FlagOn(Flags, FspIopRequestNonPaged) ? NonPagedPool : PagedPool, - sizeof *RequestHeader + sizeof *Request + ExtraSize + REQ_HEADER_ALIGNMASK, + sizeof *RequestHeader + sizeof *Request + ExtraSize + REQ_HEADER_ALIGN_OVERHEAD, FSP_ALLOC_INTERNAL_TAG); else { RequestHeader = ExAllocatePoolWithTag( FlagOn(Flags, FspIopRequestNonPaged) ? NonPagedPool : PagedPool, - sizeof *RequestHeader + sizeof *Request + ExtraSize + REQ_HEADER_ALIGNMASK, + sizeof *RequestHeader + sizeof *Request + ExtraSize + REQ_HEADER_ALIGN_OVERHEAD, FSP_ALLOC_INTERNAL_TAG); if (0 == RequestHeader) return STATUS_INSUFFICIENT_RESOURCES; } -#if 0 != REQ_HEADER_ALIGNMASK - RequestHeader = (PVOID)(((UINT_PTR)RequestHeader + REQ_HEADER_ALIGNMASK) & REQ_HEADER_ALIGNMASK); +#if 0 != REQ_HEADER_ALIGN_MASK + PVOID Allocation = RequestHeader; + RequestHeader = (PVOID)(((UINT_PTR)RequestHeader + REQ_HEADER_ALIGN_OVERHEAD) & + ~REQ_HEADER_ALIGN_MASK); + ((PVOID *)RequestHeader)[-1] = Allocation; #endif RtlZeroMemory(RequestHeader, sizeof *RequestHeader + sizeof *Request + ExtraSize); @@ -127,6 +132,10 @@ VOID FspIopDeleteRequest(FSP_FSCTL_TRANSACT_REQ *Request) if (0 != RequestHeader->Response) FspFree(RequestHeader->Response); +#if 0 != REQ_HEADER_ALIGN_MASK + RequestHeader = ((PVOID *)RequestHeader)[-1]; +#endif + FspFree(RequestHeader); } From a4e2ad9dd6cf9f36889f7e65cd2c4db6078834b4 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 28 Jul 2016 14:56:06 -0700 Subject: [PATCH 07/11] dll: FspFsctlStop: fix problem in call to DeviceIoControl - The DeviceIoControl was invoked in an incorrect fashion that nevertheless worked in Win64, but not Win32. --- src/dll/fsctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dll/fsctl.c b/src/dll/fsctl.c index 490122c2..2fa10c17 100644 --- a/src/dll/fsctl.c +++ b/src/dll/fsctl.c @@ -132,7 +132,9 @@ exit: FSP_API NTSTATUS FspFsctlStop(HANDLE VolumeHandle) { - if (!DeviceIoControl(VolumeHandle, FSP_FSCTL_STOP, 0, 0, 0, 0, 0, 0)) + DWORD Bytes; + + if (!DeviceIoControl(VolumeHandle, FSP_FSCTL_STOP, 0, 0, 0, 0, &Bytes, 0)) return FspNtStatusFromWin32(GetLastError()); return STATUS_SUCCESS; From 35b9cb15a3d3e18e5461146e4bc6815a64be00c2 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 28 Jul 2016 16:37:49 -0700 Subject: [PATCH 08/11] tst: do not test for read-only buffer during Write when not on Win8+ --- tst/memfs/memfs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tst/memfs/memfs.cpp b/tst/memfs/memfs.cpp index 486f5c4d..3ba4a2fe 100644 --- a/tst/memfs/memfs.cpp +++ b/tst/memfs/memfs.cpp @@ -20,6 +20,7 @@ #include #include #include +#include /* * Define the DEBUG_BUFFER_CHECK macro on Windows 8 or above. This includes @@ -539,7 +540,8 @@ static NTSTATUS Write(FSP_FILE_SYSTEM *FileSystem, __try { *P = *P | 0; - assert(0); + assert(!IsWindows8OrGreater()); + /* only on Windows 8 we can make the buffer read-only! */ } __except (EXCEPTION_EXECUTE_HANDLER) { From 13cee6e019f54e9a0fccadcc0b4e1d922da20f33 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 28 Jul 2016 16:54:07 -0700 Subject: [PATCH 09/11] Update Changelog --- doc/Changelog.adoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/Changelog.adoc b/doc/Changelog.adoc index c8292c4b..7a76d2ef 100644 --- a/doc/Changelog.adoc +++ b/doc/Changelog.adoc @@ -1,6 +1,14 @@ = Changelog +v0.15:: + +This is a minor release that brings support for Windows 7 and 32-bit OS'es. + +- Fixes a number of issues for Windows 7. Windows 7 is now officially supported. +- Fixes a number of issues with the 32-bit FSD and user mode components. 32-bit versions of Windows are now officially supported. + + v0.14:: This release includes support for file systems protected by credentials. From e4b808806cf8805c7daaeeebea03e8737c32c1c2 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 28 Jul 2016 17:03:47 -0700 Subject: [PATCH 10/11] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 562d638d..bc9fd6ff 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ If you build the driver yourself it will not be signed and Windows will refuse t WinFsp is designed to run on Vista and above. It has been tested on the following platforms so far: +* Windows 7 Enterprise * Windows 8 Pro * Windows 10 Pro * Windows Server 2012 From 436686665390cf3fbd6e22fb1b949b04f98189e5 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Thu, 28 Jul 2016 23:50:49 -0700 Subject: [PATCH 11/11] launcher: SvcInstanceStart: STATUS_TIMEOUT is not error; handle it correctly --- src/launcher/launcher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index f97399be..4612bed9 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -726,7 +726,7 @@ NTSTATUS SvcInstanceStart(HANDLE ClientToken, Result = STATUS_TIMEOUT; else Result = FspNtStatusFromWin32(GetLastError()); - if (!NT_SUCCESS(Result)) + if (!NT_SUCCESS(Result) || STATUS_TIMEOUT == Result) { CancelIoEx(SvcInstance->StdioHandles[1], &Overlapped); goto exit;