Compare commits

...

24 Commits

Author SHA1 Message Date
a03b480eeb changelog: add note about drweb fix 2018-09-27 12:27:36 -07:00
c9f1c1c60d sys: FspPropagateTopFlags: only touch TopLevelIrp if it looks like a kernel mode address 2018-09-27 09:31:09 -07:00
f32c914ee8 sys: create: FspFsvolCreate
Only check reparse point ECP if running on OS prior to RS4
2018-09-06 18:03:53 -07:00
681eac9cd8 sys: create: FspFsvolCreate
Only check reparse point ECP if running on OS prior to RS4
2018-09-06 17:52:52 -07:00
52f0d1e1d8 Changelog, FAQ: add info about reparse point and case-sensitivity fix 2018-09-06 17:06:51 -07:00
dcf3d612bc sys: create: FspFsvolCreate
Fix file name case after crossing a reparse point as per
http://online.osr.com/ShowThread.cfm?link=287522
2018-09-06 16:40:27 -07:00
4551766f7a sys: create: FspFsvolCreate
Replace FspMainFileOpenCheck with inline code
2018-09-06 13:26:53 -07:00
a168b96b76 changelog: add SetDelete information 2018-09-05 14:28:26 -07:00
4b3d9951bc changelog: add SetDelete information 2018-09-05 14:26:54 -07:00
79fd87598f dotnet: Interop: fix silly mistake in SetDelete 2018-09-04 15:28:24 -07:00
9851f1b2c8 dotnet: properly handle SetDelete/CanDelete resolution 2018-08-29 20:54:49 -07:00
4725ff41d3 dotnet: FileSystemHost.DeviceControl flag 2018-08-29 17:21:24 -07:00
4756ee2d8a passthrough-dotnet: FlushAndPurgeOnCleanup 2018-08-29 16:45:14 -07:00
25f627f36f passthrough: FlushAndPurgeOnCleanup, SetDelete 2018-08-29 16:44:47 -07:00
24b96e7e1b inc, dll, dotnet: FSP_FILE_SYSTEM_INTERFACE::SetDelete 2018-08-29 15:45:02 -07:00
75ae8daf8f update commercial disclaimer 2018-08-21 18:09:33 -07:00
999847d8db Merge pull request #181 from JohnOberschelp/master
Added DeviceIoControl to Airfs
2018-08-01 19:35:03 -07:00
773bb12146 Update airfs.cpp 2018-08-01 17:34:24 -07:00
bef5ba7f3b dll: fuse: fix daemonization problem on Cygwin
The new FUSE loop use a Windows event (LoopEvent) to signal loop exit.
Prior to this commit the Windows event was created outside the FUSE
loop and potentially before daemonization (on Cygwin). This means that
the event was created in a different process and
WaitForMultipleObjects was failing with ERROR_ACCESS_DENIED.

This commit ensures that the LoopEvent is created inside the FUSE loop
and therefore in the daemonized process.
2018-07-31 21:02:46 -07:00
eecb7e00e2 fix tabs to spaces 2018-07-31 17:21:40 -07:00
9160f1c4ce cygfuse: fix CRLF to LF 2018-07-31 15:34:29 -07:00
796f97f078 cygfuse: remove exec bit from Makefile 2018-07-31 15:20:26 -07:00
5f1c3b7728 build: bump version 2018-07-31 15:12:50 -07:00
f672ae817a Added DeviceIoControl to Airfs
Added DeviceIoControl code à la Memfs, simplified file allocation code, and cleaned up some white space.
2018-07-31 15:04:08 -07:00
138 changed files with 1333 additions and 543 deletions

View File

@ -1,6 +1,21 @@
= Changelog = Changelog
v1.4B3 (2018.2 B3)::
Changes since v1.3:
* FUSE3 API (version 3.2) is now available. The FUSE2 API (version 2.8) also remains supported.
* New `Control` file system operation allows sending custom control codes to the file system using the Windows `DeviceIoControl` API. FUSE `ioctl` is also supported.
* New `SetDelete` file system operation can optionally be used instead of `CanDelete`. `SetDelete` or `CanDelete` are used to handle the file "disposition" flag, which determines if a file is marked for deletion. See the relevant documentation for more details.
* `FlushAndPurgeOnCleanup` has now been added to the .NET API. (GitHub PR #176; thanks @FrKaram.)
* New sample file system "airfs" contributed by @JohnOberschelp. Airfs is an in-memory file system like Memfs on which it is based on; it has received substantial improvements in how the file name space is maintained and has been modified to use modern C++ techniques by John.
* New sample file system "passthrough-fuse3" passes all operations to an underlying file system. This file system is built using the FUSE3 API. It builds and runs on both Windows and Cygwin.
* The FUSE layer now supports multiple file systems within a single process. This is a long standing problem that has been fixed. (GitHub issue #135.)
* The FSD includes an experimental fix for a Windows problem: that case-sensitive file systems do not work properly when mounted as directories. See the relevant FAQ entry.
* The FSD includes a fix for an incompatibility with DrWeb Antivirus. (GitHub issue #192)
v1.4B2 (2018.2 B2):: v1.4B2 (2018.2 B2)::
Changes since v1.3: Changes since v1.3:

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN

View File

@ -18,7 +18,7 @@
<MyCanonicalVersion>1.4</MyCanonicalVersion> <MyCanonicalVersion>1.4</MyCanonicalVersion>
<MyProductVersion>2018.2 B2</MyProductVersion> <MyProductVersion>2018.2 B3</MyProductVersion>
<MyProductStage>Beta</MyProductStage> <MyProductStage>Beta</MyProductStage>
<MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion> <MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion>

View File

@ -17,7 +17,9 @@ Disconnecting (unmapping) a network drive does not work.::
Case-sensitive file systems do not work properly when mounted as a directory.:: Case-sensitive file systems do not work properly when mounted as a directory.::
Windows and WinFsp support case-sensitive file systems. These file systems work properly when mounted as a drive. Unfortunately when a file system is mounted as a directory over NTFS, Windows expects it to be case-insensitive and will UPPERCASE many of the file names sent to the file system. This is fixed as of WinFsp 2018.2 B3.
+
Windows and WinFsp support case-sensitive file systems. These file systems work properly when mounted as a drive. Unfortunately when a file system is mounted as a directory over NTFS, Windows expects it to be case-insensitive and will UPPERCASE many of the file names sent to the file system.
+ +
This is an unfortunate but well understood Windows limitation. Case-sensitive file systems should only be mounted as drives. This is an unfortunate but well understood Windows limitation. Case-sensitive file systems should only be mounted as drives.
@ -67,4 +69,4 @@ WinFsp-FUSE does not have the ability to support multiple file systems from with
This is supported as of WinFsp 2018.2 B2. This is supported as of WinFsp 2018.2 B2.
+ +
The core WinFsp layer always supported multiple file systems in the same process either simultaneously or one after another. However this was not the case with WinFsp-FUSE (i.e. the FUSE layer of WinFsp) prior to version 2018.2 B2. This limitation has been rectified as of WinFsp 2018 B2. The core WinFsp layer always supported multiple file systems in the same process either simultaneously or one after another. However this was not the case with WinFsp-FUSE (i.e. the FUSE layer of WinFsp) prior to version 2018.2 B2. This limitation has been rectified as of WinFsp 2018.2 B2.

View File

@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FUSE_H_ #ifndef FUSE_H_

View File

@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FUSE_COMMON_H_ #ifndef FUSE_COMMON_H_

View File

@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FUSE_OPT_H_ #ifndef FUSE_OPT_H_

View File

@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FUSE_WINFSP_FUSE_H_INCLUDED #ifndef FUSE_WINFSP_FUSE_H_INCLUDED

View File

@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FUSE_H_ #ifndef FUSE_H_

View File

@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FUSE_COMMON_H_ #ifndef FUSE_COMMON_H_

View File

@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include "../fuse/fuse_opt.h" #include "../fuse/fuse_opt.h"

View File

@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FUSE3_WINFSP_FUSE_H_INCLUDED #ifndef FUSE3_WINFSP_FUSE_H_INCLUDED

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_FSCTL_H_INCLUDED #ifndef WINFSP_FSCTL_H_INCLUDED

View File

@ -14,9 +14,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_LAUNCH_H_INCLUDED #ifndef WINFSP_LAUNCH_H_INCLUDED

View File

@ -14,9 +14,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_WINFSP_H_INCLUDED #ifndef WINFSP_WINFSP_H_INCLUDED
@ -380,6 +384,7 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
* @see * @see
* Close * Close
* CanDelete * CanDelete
* SetDelete
*/ */
VOID (*Cleanup)(FSP_FILE_SYSTEM *FileSystem, VOID (*Cleanup)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, PWSTR FileName, ULONG Flags); PVOID FileContext, PWSTR FileName, ULONG Flags);
@ -563,6 +568,9 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
* This function gets called when Win32 API's such as DeleteFile or RemoveDirectory are used. * This function gets called when Win32 API's such as DeleteFile or RemoveDirectory are used.
* It does not get called when a file or directory is opened with FILE_DELETE_ON_CLOSE. * It does not get called when a file or directory is opened with FILE_DELETE_ON_CLOSE.
* *
* NOTE: If both CanDelete and SetDelete are defined, SetDelete takes precedence. However
* most file systems need only implement the CanDelete operation.
*
* @param FileSystem * @param FileSystem
* The file system on which this request is posted. * The file system on which this request is posted.
* @param FileContext * @param FileContext
@ -573,6 +581,7 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
* STATUS_SUCCESS or error code. * STATUS_SUCCESS or error code.
* @see * @see
* Cleanup * Cleanup
* SetDelete
*/ */
NTSTATUS (*CanDelete)(FSP_FILE_SYSTEM *FileSystem, NTSTATUS (*CanDelete)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, PWSTR FileName); PVOID FileContext, PWSTR FileName);
@ -851,12 +860,46 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
PVOID FileContext, UINT32 ControlCode, PVOID FileContext, UINT32 ControlCode,
PVOID InputBuffer, ULONG InputBufferLength, PVOID InputBuffer, ULONG InputBufferLength,
PVOID OutputBuffer, ULONG OutputBufferLength, PULONG PBytesTransferred); PVOID OutputBuffer, ULONG OutputBufferLength, PULONG PBytesTransferred);
/**
* Set the file delete flag.
*
* This function sets a flag to indicates whether the FSD file should delete a file
* when it is closed. This function does not need to perform access checks, but may
* performs tasks such as check for empty directories, etc.
*
* This function should <b>NEVER</b> delete the file or directory in question. Deletion should
* happen during Cleanup with the FspCleanupDelete flag set.
*
* This function gets called when Win32 API's such as DeleteFile or RemoveDirectory are used.
* It does not get called when a file or directory is opened with FILE_DELETE_ON_CLOSE.
*
* NOTE: If both CanDelete and SetDelete are defined, SetDelete takes precedence. However
* most file systems need only implement the CanDelete operation.
*
* @param FileSystem
* The file system on which this request is posted.
* @param FileContext
* The file context of the file or directory to set the delete flag for.
* @param FileName
* The name of the file or directory to set the delete flag for.
* @param DeleteFile
* If set to TRUE the FSD indicates that the file will be deleted on Cleanup; otherwise
* it will not be deleted. It is legal to receive multiple SetDelete calls for the same
* file with different DeleteFile parameters.
* @return
* STATUS_SUCCESS or error code.
* @see
* Cleanup
* CanDelete
*/
NTSTATUS (*SetDelete)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, PWSTR FileName, BOOLEAN DeleteFile);
/* /*
* This ensures that this interface will always contain 64 function pointers. * This ensures that this interface will always contain 64 function pointers.
* Please update when changing the interface as it is important for future compatibility. * Please update when changing the interface as it is important for future compatibility.
*/ */
NTSTATUS (*Reserved[38])(); NTSTATUS (*Reserved[37])();
} FSP_FILE_SYSTEM_INTERFACE; } FSP_FILE_SYSTEM_INTERFACE;
FSP_FSCTL_STATIC_ASSERT(sizeof(FSP_FILE_SYSTEM_INTERFACE) == 64 * sizeof(NTSTATUS (*)()), FSP_FSCTL_STATIC_ASSERT(sizeof(FSP_FILE_SYSTEM_INTERFACE) == 64 * sizeof(NTSTATUS (*)()),
"FSP_FILE_SYSTEM_INTERFACE must have 64 entries."); "FSP_FILE_SYSTEM_INTERFACE must have 64 entries.");

View File

@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_WINFSP_HPP_INCLUDED #ifndef WINFSP_WINFSP_HPP_INCLUDED

0
opt/cygfuse/Makefile Executable file → Normal file
View File

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dlfcn.h> #include <dlfcn.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dlfcn.h> #include <dlfcn.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>
@ -1043,13 +1047,22 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
break; break;
} }
} }
if (0 != FileSystem->Interface->CanDelete) if (0 != FileSystem->Interface->SetDelete)
{
Result = FileSystem->Interface->SetDelete(FileSystem,
(PVOID)ValOfFileContext(Request->Req.SetInformation),
(PWSTR)Request->Buffer,
Request->Req.SetInformation.Info.Disposition.Delete);
}
else if (0 != FileSystem->Interface->CanDelete)
{
if (Request->Req.SetInformation.Info.Disposition.Delete) if (Request->Req.SetInformation.Info.Disposition.Delete)
Result = FileSystem->Interface->CanDelete(FileSystem, Result = FileSystem->Interface->CanDelete(FileSystem,
(PVOID)ValOfFileContext(Request->Req.SetInformation), (PVOID)ValOfFileContext(Request->Req.SetInformation),
(PWSTR)Request->Buffer); (PWSTR)Request->Buffer);
else else
Result = STATUS_SUCCESS; Result = STATUS_SUCCESS;
}
break; break;
case 10/*FileRenameInformation*/: case 10/*FileRenameInformation*/:
if (0 != FileSystem->Interface->Rename) if (0 != FileSystem->Interface->Rename)

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/fuse/library.h> #include <dll/fuse/library.h>
@ -430,10 +434,6 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
goto fail; goto fail;
memcpy(f->MountPoint, ch->MountPoint, Size); memcpy(f->MountPoint, ch->MountPoint, Size);
f->LoopEvent = CreateEventW(0, TRUE, FALSE, 0);
if (0 == f->LoopEvent)
goto fail;
Result = FspFileSystemPreflight( Result = FspFileSystemPreflight(
f->VolumeParams.Prefix[0] ? L"" FSP_FSCTL_NET_DEVICE_NAME : L"" FSP_FSCTL_DISK_DEVICE_NAME, f->VolumeParams.Prefix[0] ? L"" FSP_FSCTL_NET_DEVICE_NAME : L"" FSP_FSCTL_DISK_DEVICE_NAME,
'*' != f->MountPoint[0] || '\0' != f->MountPoint[1] ? f->MountPoint : 0); '*' != f->MountPoint[0] || '\0' != f->MountPoint[1] ? f->MountPoint : 0);
@ -481,9 +481,6 @@ fail:
FSP_FUSE_API void fsp_fuse_destroy(struct fsp_fuse_env *env, FSP_FUSE_API void fsp_fuse_destroy(struct fsp_fuse_env *env,
struct fuse *f) struct fuse *f)
{ {
if (0 != f->LoopEvent)
CloseHandle(f->LoopEvent);
fsp_fuse_obj_free(f->MountPoint); fsp_fuse_obj_free(f->MountPoint);
fsp_fuse_obj_free(f); fsp_fuse_obj_free(f);
@ -492,6 +489,7 @@ FSP_FUSE_API void fsp_fuse_destroy(struct fsp_fuse_env *env,
FSP_FUSE_API void fsp_fuse_exit(struct fsp_fuse_env *env, FSP_FUSE_API void fsp_fuse_exit(struct fsp_fuse_env *env,
struct fuse *f) struct fuse *f)
{ {
if (0 != f->LoopEvent)
SetEvent(f->LoopEvent); SetEvent(f->LoopEvent);
f->exited = 1; f->exited = 1;
} }

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/fuse/library.h> #include <dll/fuse/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/fuse/library.h> #include <dll/fuse/library.h>
@ -53,6 +57,10 @@ static NTSTATUS fsp_fuse_loop_start(struct fuse *f)
struct fuse_conn_info conn; struct fuse_conn_info conn;
NTSTATUS Result; NTSTATUS Result;
f->LoopEvent = CreateEventW(0, TRUE, FALSE, 0);
if (0 == f->LoopEvent)
goto fail;
context = fsp_fuse_get_context(f->env); context = fsp_fuse_get_context(f->env);
if (0 == context) if (0 == context)
{ {
@ -239,6 +247,12 @@ static void fsp_fuse_loop_cleanup(struct fuse *f)
f->ops.destroy(f->data); f->ops.destroy(f->data);
f->fsinit = FALSE; f->fsinit = FALSE;
} }
if (0 != f->LoopEvent)
{
CloseHandle(f->LoopEvent);
f->LoopEvent = 0;
}
} }
static NTSTATUS fsp_fuse_loop_internal(struct fuse *f) static NTSTATUS fsp_fuse_loop_internal(struct fuse *f)
@ -264,11 +278,15 @@ static NTSTATUS fsp_fuse_loop_internal(struct fuse *f)
} }
/* if either the service thread dies or our event gets signaled, stop the loop */ /* if either the service thread dies or our event gets signaled, stop the loop */
Result = STATUS_SUCCESS;
if (!f->exited)
{
WaitObjects[0] = fsp_fuse_svcthread; WaitObjects[0] = fsp_fuse_svcthread;
WaitObjects[1] = f->LoopEvent; WaitObjects[1] = f->LoopEvent;
WaitResult = WaitForMultipleObjects(2, WaitObjects, FALSE, INFINITE); WaitResult = WaitForMultipleObjects(2, WaitObjects, FALSE, INFINITE);
if (WAIT_OBJECT_0 != WaitResult && WAIT_OBJECT_0 + 1 != WaitResult) if (WAIT_OBJECT_0 != WaitResult && WAIT_OBJECT_0 + 1 != WaitResult)
Result = FspNtStatusFromWin32(GetLastError()); Result = FspNtStatusFromWin32(GetLastError());
}
fsp_fuse_loop_stop(f); fsp_fuse_loop_stop(f);

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/fuse/library.h> #include <dll/fuse/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/fuse/library.h> #include <dll/fuse/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_DLL_FUSE_LIBRARY_H_INCLUDED #ifndef WINFSP_DLL_FUSE_LIBRARY_H_INCLUDED

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/fuse3/library.h> #include <dll/fuse3/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/fuse3/library.h> #include <dll/fuse3/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED #ifndef WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_DLL_LIBRARY_H_INCLUDED #ifndef WINFSP_DLL_LIBRARY_H_INCLUDED

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -23,9 +23,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <dll/library.h> #include <dll/library.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
using System; using System;

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
using System; using System;
@ -337,6 +341,7 @@ namespace Fsp
/// These flags determine whether the file was modified and whether to delete the file. /// These flags determine whether the file was modified and whether to delete the file.
/// </param> /// </param>
/// <seealso cref="CanDelete"/> /// <seealso cref="CanDelete"/>
/// <seealso cref="SetDelete"/>
/// <seealso cref="Close"/> /// <seealso cref="Close"/>
public virtual void Cleanup( public virtual void Cleanup(
Object FileNode, Object FileNode,
@ -591,6 +596,22 @@ namespace Fsp
/// <summary> /// <summary>
/// Determines whether a file or directory can be deleted. /// Determines whether a file or directory can be deleted.
/// </summary> /// </summary>
/// <remarks>
/// <para>
/// This function tests whether a file or directory can be safely deleted. This function does
/// not need to perform access checks, but may performs tasks such as check for empty
/// directories, etc.
/// </para><para>
/// This function should <b>NEVER</b> delete the file or directory in question. Deletion should
/// happen during Cleanup with the FspCleanupDelete flag set.
/// </para><para>
/// This function gets called when Win32 API's such as DeleteFile or RemoveDirectory are used.
/// It does not get called when a file or directory is opened with FILE_DELETE_ON_CLOSE.
/// </para><para>
/// NOTE: If both CanDelete and SetDelete are defined, SetDelete takes precedence. However
/// most file systems need only implement the CanDelete operation.
/// </para>
/// </remarks>
/// <param name="FileNode"> /// <param name="FileNode">
/// The file node of the file or directory to test for deletion. /// The file node of the file or directory to test for deletion.
/// </param> /// </param>
@ -602,6 +623,7 @@ namespace Fsp
/// </param> /// </param>
/// <returns>STATUS_SUCCESS or error code.</returns> /// <returns>STATUS_SUCCESS or error code.</returns>
/// <seealso cref="Cleanup"/> /// <seealso cref="Cleanup"/>
/// <seealso cref="SetDelete"/>
public virtual Int32 CanDelete( public virtual Int32 CanDelete(
Object FileNode, Object FileNode,
Object FileDesc, Object FileDesc,
@ -1009,6 +1031,53 @@ namespace Fsp
BytesTransferred = default(UInt32); BytesTransferred = default(UInt32);
return STATUS_INVALID_DEVICE_REQUEST; return STATUS_INVALID_DEVICE_REQUEST;
} }
/// <summary>
/// Sets the file delete flag.
/// </summary>
/// <remarks>
/// <para>
/// This function sets a flag to indicates whether the FSD file should delete a file
/// when it is closed. This function does not need to perform access checks, but may
/// performs tasks such as check for empty directories, etc.
/// </para><para>
/// This function should <b>NEVER</b> delete the file or directory in question. Deletion should
/// happen during Cleanup with the FspCleanupDelete flag set.
/// </para><para>
/// This function gets called when Win32 API's such as DeleteFile or RemoveDirectory are used.
/// It does not get called when a file or directory is opened with FILE_DELETE_ON_CLOSE.
/// </para><para>
/// NOTE: If both CanDelete and SetDelete are defined, SetDelete takes precedence. However
/// most file systems need only implement the CanDelete operation.
/// </para>
/// </remarks>
/// <param name="FileNode">
/// The file node of the file or directory to set the delete flag for.
/// </param>
/// <param name="FileDesc">
/// The file descriptor of the file or directory to set the delete flag for.
/// </param>
/// <param name="FileName">
/// The name of the file or directory to set the delete flag for.
/// </param>
/// <param name="DeleteFile">
/// If set to TRUE the FSD indicates that the file will be deleted on Cleanup; otherwise
/// it will not be deleted. It is legal to receive multiple SetDelete calls for the same
/// file with different DeleteFile parameters.
/// </param>
/// <returns>STATUS_SUCCESS or error code.</returns>
/// <seealso cref="Cleanup"/>
/// <seealso cref="CanDelete"/>
public virtual Int32 SetDelete(
Object FileNode,
Object FileDesc,
String FileName,
Boolean DeleteFile)
{
if (DeleteFile)
return CanDelete(FileNode, FileDesc, FileName);
else
return STATUS_SUCCESS;
}
/* helpers */ /* helpers */
/// <summary> /// <summary>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
using System; using System;
@ -199,6 +203,11 @@ namespace Fsp
get { return 0 != (_VolumeParams.Flags & VolumeParams.FlushAndPurgeOnCleanup); } get { return 0 != (_VolumeParams.Flags & VolumeParams.FlushAndPurgeOnCleanup); }
set { _VolumeParams.Flags |= (value ? VolumeParams.FlushAndPurgeOnCleanup : 0); } set { _VolumeParams.Flags |= (value ? VolumeParams.FlushAndPurgeOnCleanup : 0); }
} }
public Boolean DeviceControl
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.DeviceControl); }
set { _VolumeParams.Flags |= (value ? VolumeParams.DeviceControl : 0); }
}
/// <summary> /// <summary>
/// Gets or sets the prefix for a network file system. /// Gets or sets the prefix for a network file system.
/// </summary> /// </summary>
@ -745,26 +754,6 @@ namespace Fsp
return ExceptionHandler(FileSystem, ex); return ExceptionHandler(FileSystem, ex);
} }
} }
private static Int32 CanDelete(
IntPtr FileSystemPtr,
ref FullContext FullContext,
String FileName)
{
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
try
{
Object FileNode, FileDesc;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
return FileSystem.CanDelete(
FileNode,
FileDesc,
FileName);
}
catch (Exception ex)
{
return ExceptionHandler(FileSystem, ex);
}
}
private static Int32 Rename( private static Int32 Rename(
IntPtr FileSystemPtr, IntPtr FileSystemPtr,
ref FullContext FullContext, ref FullContext FullContext,
@ -1061,6 +1050,28 @@ namespace Fsp
return ExceptionHandler(FileSystem, ex); return ExceptionHandler(FileSystem, ex);
} }
} }
private static Int32 SetDelete(
IntPtr FileSystemPtr,
ref FullContext FullContext,
String FileName,
Boolean DeleteFile)
{
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
try
{
Object FileNode, FileDesc;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
return FileSystem.SetDelete(
FileNode,
FileDesc,
FileName,
DeleteFile);
}
catch (Exception ex)
{
return ExceptionHandler(FileSystem, ex);
}
}
static FileSystemHost() static FileSystemHost()
{ {
@ -1078,7 +1089,6 @@ namespace Fsp
_FileSystemInterface.GetFileInfo = GetFileInfo; _FileSystemInterface.GetFileInfo = GetFileInfo;
_FileSystemInterface.SetBasicInfo = SetBasicInfo; _FileSystemInterface.SetBasicInfo = SetBasicInfo;
_FileSystemInterface.SetFileSize = SetFileSize; _FileSystemInterface.SetFileSize = SetFileSize;
_FileSystemInterface.CanDelete = CanDelete;
_FileSystemInterface.Rename = Rename; _FileSystemInterface.Rename = Rename;
_FileSystemInterface.GetSecurity = GetSecurity; _FileSystemInterface.GetSecurity = GetSecurity;
_FileSystemInterface.SetSecurity = SetSecurity; _FileSystemInterface.SetSecurity = SetSecurity;
@ -1090,6 +1100,7 @@ namespace Fsp
_FileSystemInterface.GetStreamInfo = GetStreamInfo; _FileSystemInterface.GetStreamInfo = GetStreamInfo;
_FileSystemInterface.GetDirInfoByName = GetDirInfoByName; _FileSystemInterface.GetDirInfoByName = GetDirInfoByName;
_FileSystemInterface.Control = Control; _FileSystemInterface.Control = Control;
_FileSystemInterface.SetDelete = SetDelete;
_FileSystemInterfacePtr = Marshal.AllocHGlobal(FileSystemInterface.Size); _FileSystemInterfacePtr = Marshal.AllocHGlobal(FileSystemInterface.Size);
Marshal.StructureToPtr(_FileSystemInterface, _FileSystemInterfacePtr, false); Marshal.StructureToPtr(_FileSystemInterface, _FileSystemInterfacePtr, false);

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
using System; using System;
@ -44,6 +48,7 @@ namespace Fsp.Interop
internal const UInt32 AlwaysUseDoubleBuffering = 0x00001000; internal const UInt32 AlwaysUseDoubleBuffering = 0x00001000;
internal const UInt32 PassQueryDirectoryFileName = 0x00002000; internal const UInt32 PassQueryDirectoryFileName = 0x00002000;
internal const UInt32 FlushAndPurgeOnCleanup = 0x00004000; internal const UInt32 FlushAndPurgeOnCleanup = 0x00004000;
internal const UInt32 DeviceControl = 0x00008000;
internal const UInt32 UmFileContextIsUserContext2 = 0x00010000; internal const UInt32 UmFileContextIsUserContext2 = 0x00010000;
internal const UInt32 UmFileContextIsFullContext = 0x00020000; internal const UInt32 UmFileContextIsFullContext = 0x00020000;
internal const int PrefixSize = 192; internal const int PrefixSize = 192;
@ -466,6 +471,12 @@ namespace Fsp.Interop
IntPtr InputBuffer, UInt32 InputBufferLength, IntPtr InputBuffer, UInt32 InputBufferLength,
IntPtr OutputBuffer, UInt32 OutputBufferLength, IntPtr OutputBuffer, UInt32 OutputBufferLength,
out UInt32 PBytesTransferred); out UInt32 PBytesTransferred);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate Int32 SetDelete(
IntPtr FileSystem,
ref FullContext FullContext,
[MarshalAs(UnmanagedType.LPWStr)] String FileName,
[MarshalAs(UnmanagedType.U1)] Boolean DeleteFile);
} }
internal static int Size = IntPtr.Size * 64; internal static int Size = IntPtr.Size * 64;
@ -496,7 +507,8 @@ namespace Fsp.Interop
internal Proto.GetStreamInfo GetStreamInfo; internal Proto.GetStreamInfo GetStreamInfo;
internal Proto.GetDirInfoByName GetDirInfoByName; internal Proto.GetDirInfoByName GetDirInfoByName;
internal Proto.Control Control; internal Proto.Control Control;
/* NTSTATUS (*Reserved[38])(); */ internal Proto.SetDelete SetDelete;
/* NTSTATUS (*Reserved[37])(); */
} }
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
using System; using System;

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <winfsp/winfsp.h> #include <winfsp/winfsp.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <winfsp/launch.h> #include <winfsp/launch.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <winfsp/launch.h> #include <winfsp/launch.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_SHARED_MINIMAL_H_INCLUDED #ifndef WINFSP_SHARED_MINIMAL_H_INCLUDED

View File

@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>
@ -294,7 +298,7 @@ VOID FspPropagateTopFlags(PIRP Irp, PIRP TopLevelIrp)
FspIrpSetTopFlags(Irp, FspFileNodeAcquireFull); FspIrpSetTopFlags(Irp, FspFileNodeAcquireFull);
} }
else if (IO_TYPE_IRP == TopLevelIrp->Type) else if ((PIRP)MM_SYSTEM_RANGE_START <= TopLevelIrp && IO_TYPE_IRP == TopLevelIrp->Type)
{ {
PFILE_OBJECT FileObject = IoGetCurrentIrpStackLocation(Irp)->FileObject; PFILE_OBJECT FileObject = IoGetCurrentIrpStackLocation(Irp)->FileObject;
PFILE_OBJECT TopLevelFileObject = IoGetCurrentIrpStackLocation(TopLevelIrp)->FileObject; PFILE_OBJECT TopLevelFileObject = IoGetCurrentIrpStackLocation(TopLevelIrp)->FileObject;

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>
@ -65,6 +69,16 @@ FSP_DRIVER_DISPATCH FspCreate;
#pragma alloc_text(PAGE, FspCreate) #pragma alloc_text(PAGE, FspCreate)
#endif #endif
/*
* FSP_CREATE_REPARSE_POINT_ECP
*
* Define this macro to include code to fix file name case after crossing
* a reparse point as per http://online.osr.com/ShowThread.cfm?link=287522.
* Fixing this problem requires undocumented information; for this reason
* this fix is EXPERIMENTAL.
*/
#define FSP_CREATE_REPARSE_POINT_ECP
#define PREFIXW L"" FSP_FSCTL_VOLUME_PARAMS_PREFIX #define PREFIXW L"" FSP_FSCTL_VOLUME_PARAMS_PREFIX
#define PREFIXW_SIZE (sizeof PREFIXW - sizeof(WCHAR)) #define PREFIXW_SIZE (sizeof PREFIXW - sizeof(WCHAR))
@ -122,8 +136,86 @@ static NTSTATUS FspFsvolCreate(
{ {
PAGED_CODE(); PAGED_CODE();
NTSTATUS Result = STATUS_SUCCESS; NTSTATUS Result;
BOOLEAN MainFileOpen = FspMainFileOpenCheck(Irp); PECP_LIST ExtraCreateParameters;
PVOID ExtraCreateParameter;
BOOLEAN MainFileOpen = FALSE;
/*
* Check if the IRP has ECP's.
*
* We do this check for the following reason:
*
* - To determine whether this is a "main file open", i.e. the opening
* of the main file for a stream. In this case this is a reentrant open
* and we should be careful not to try to acquire the rename resource,
* which is already acquired (otherwise DEADLOCK).
*
* - To determine whether this is an open after crossing a reparse point
* (e.g. when the file system is mounted as a directory). Unfortunately
* Windows does not preserve file name case in this case and sends us
* UPPERCASE file names, which results in all kinds of problems, esp.
* for case-sensitive file systems.
*/
ExtraCreateParameters = 0;
Result = FsRtlGetEcpListFromIrp(Irp, &ExtraCreateParameters);
if (NT_SUCCESS(Result) && 0 != ExtraCreateParameters)
{
ExtraCreateParameter = 0;
MainFileOpen =
NT_SUCCESS(FsRtlFindExtraCreateParameter(ExtraCreateParameters,
&FspMainFileOpenEcpGuid, &ExtraCreateParameter, 0)) &&
0 != ExtraCreateParameter &&
!FsRtlIsEcpFromUserMode(ExtraCreateParameter);
#if defined(FSP_CREATE_REPARSE_POINT_ECP)
if (!FspHasReparsePointCaseSensitivityFix)
{
// {73d5118a-88ba-439f-92f4-46d38952d250}
static const GUID FspReparsePointEcpGuid =
{ 0x73d5118a, 0x88ba, 0x439f, { 0x92, 0xf4, 0x46, 0xd3, 0x89, 0x52, 0xd2, 0x50 } };
typedef struct _REPARSE_POINT_ECP
{
USHORT UnparsedNameLength;
USHORT Flags;
USHORT DeviceNameLength;
PVOID Reserved;
UNICODE_STRING Name;
} REPARSE_POINT_ECP;
REPARSE_POINT_ECP *ReparsePointEcp;
ExtraCreateParameter = 0;
ReparsePointEcp =
NT_SUCCESS(FsRtlFindExtraCreateParameter(ExtraCreateParameters,
&FspReparsePointEcpGuid, &ExtraCreateParameter, 0)) &&
0 != ExtraCreateParameter &&
!FsRtlIsEcpFromUserMode(ExtraCreateParameter) ?
ExtraCreateParameter : 0;
if (0 != ReparsePointEcp)
{
//DEBUGLOG("%hu %wZ", ReparsePointEcp->UnparsedNameLength, ReparsePointEcp->Name);
UNICODE_STRING FileName = IrpSp->FileObject->FileName;
if (0 != ReparsePointEcp->UnparsedNameLength &&
FileName.Length == ReparsePointEcp->UnparsedNameLength &&
ReparsePointEcp->Name.Length > ReparsePointEcp->UnparsedNameLength)
{
/*
* If the ReparsePointEcp name and our file name differ only in case,
* go ahead and overwrite our file name.
*/
UNICODE_STRING UnparsedName;
UnparsedName.Length = UnparsedName.MaximumLength = ReparsePointEcp->UnparsedNameLength;
UnparsedName.Buffer = (PWCH)((UINT8 *)ReparsePointEcp->Name.Buffer +
(ReparsePointEcp->Name.Length - UnparsedName.Length));
if (0 == FspFileNameCompare(&UnparsedName, &FileName, TRUE, 0))
RtlMoveMemory(FileName.Buffer, UnparsedName.Buffer, UnparsedName.Length);
}
}
}
#endif
}
if (!MainFileOpen) if (!MainFileOpen)
{ {

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>
@ -229,6 +233,9 @@ static VOID FspDriverMultiVersionInitialize(VOID)
if (RtlIsNtDdiVersionAvailable(NTDDI_WIN8)) if (RtlIsNtDdiVersionAvailable(NTDDI_WIN8))
FspMvMdlMappingNoWrite = MdlMappingNoWrite; FspMvMdlMappingNoWrite = MdlMappingNoWrite;
if (RtlIsNtDdiVersionAvailable(0x0A000005/*NTDDI_WIN10_RS4*/))
FspHasReparsePointCaseSensitivityFix = TRUE;
} }
#if defined(FSP_UNLOAD) #if defined(FSP_UNLOAD)
@ -266,3 +273,4 @@ CACHE_MANAGER_CALLBACKS FspCacheManagerCallbacks;
ULONG FspProcessorCount; ULONG FspProcessorCount;
FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache; FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
ULONG FspMvMdlMappingNoWrite = 0; ULONG FspMvMdlMappingNoWrite = 0;
BOOLEAN FspHasReparsePointCaseSensitivityFix = FALSE;

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef WINFSP_SYS_DRIVER_H_INCLUDED #ifndef WINFSP_SYS_DRIVER_H_INCLUDED
@ -1448,28 +1452,6 @@ NTSTATUS FspMainFileOpen(
NTSTATUS FspMainFileClose( NTSTATUS FspMainFileClose(
HANDLE MainFileHandle, HANDLE MainFileHandle,
PFILE_OBJECT MainFileObject); PFILE_OBJECT MainFileObject);
static __forceinline
BOOLEAN FspMainFileOpenCheck(PIRP Irp)
{
extern const GUID FspMainFileOpenEcpGuid;
NTSTATUS Result;
PECP_LIST ExtraCreateParameters = 0;
PVOID ExtraCreateParameter = 0;
Result = FsRtlGetEcpListFromIrp(Irp, &ExtraCreateParameters);
if (!NT_SUCCESS(Result) || 0 == ExtraCreateParameters)
return FALSE;
Result = FsRtlFindExtraCreateParameter(ExtraCreateParameters,
&FspMainFileOpenEcpGuid, &ExtraCreateParameter, 0);
if (!NT_SUCCESS(Result) || 0 == ExtraCreateParameter)
return FALSE;
if (FsRtlIsEcpFromUserMode(ExtraCreateParameter))
return FALSE;
return TRUE;
}
#define FspFileNodeAcquireShared(N,F) FspFileNodeAcquireSharedF(N, FspFileNodeAcquire ## F) #define FspFileNodeAcquireShared(N,F) FspFileNodeAcquireSharedF(N, FspFileNodeAcquire ## F)
#define FspFileNodeTryAcquireShared(N,F) FspFileNodeTryAcquireSharedF(N, FspFileNodeAcquire ## F, FALSE) #define FspFileNodeTryAcquireShared(N,F) FspFileNodeTryAcquireSharedF(N, FspFileNodeAcquire ## F, FALSE)
#define FspFileNodeAcquireExclusive(N,F) FspFileNodeAcquireExclusiveF(N, FspFileNodeAcquire ## F) #define FspFileNodeAcquireExclusive(N,F) FspFileNodeAcquireExclusiveF(N, FspFileNodeAcquire ## F)
@ -1595,6 +1577,7 @@ extern const GUID FspMainFileOpenEcpGuid;
extern ULONG FspProcessorCount; extern ULONG FspProcessorCount;
extern FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache; extern FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
extern ULONG FspMvMdlMappingNoWrite; extern ULONG FspMvMdlMappingNoWrite;
extern BOOLEAN FspHasReparsePointCaseSensitivityFix;
/* /*
* Fixes * Fixes

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <sys/driver.h> #include <sys/driver.h>

View File

@ -34,6 +34,7 @@ set dfl_tests=^
winfsp-tests-x64-flushpurge ^ winfsp-tests-x64-flushpurge ^
winfsp-tests-x64-mountpoint-drive ^ winfsp-tests-x64-mountpoint-drive ^
winfsp-tests-x64-mountpoint-dir ^ winfsp-tests-x64-mountpoint-dir ^
winfsp-tests-x64-mountpoint-dir-case-sensitive ^
winfsp-tests-x64-no-traverse ^ winfsp-tests-x64-no-traverse ^
winfsp-tests-x64-oplock ^ winfsp-tests-x64-oplock ^
winfsp-tests-x64-external ^ winfsp-tests-x64-external ^
@ -52,6 +53,7 @@ set dfl_tests=^
winfsp-tests-x86-flushpurge ^ winfsp-tests-x86-flushpurge ^
winfsp-tests-x86-mountpoint-drive ^ winfsp-tests-x86-mountpoint-drive ^
winfsp-tests-x86-mountpoint-dir ^ winfsp-tests-x86-mountpoint-dir ^
winfsp-tests-x86-mountpoint-dir-case-sensitive ^
winfsp-tests-x86-no-traverse ^ winfsp-tests-x86-no-traverse ^
winfsp-tests-x86-oplock ^ winfsp-tests-x86-oplock ^
winfsp-tests-x86-external ^ winfsp-tests-x86-external ^
@ -192,6 +194,11 @@ winfsp-tests-x64 --mountpoint=mymnt --case-insensitive
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
exit /b 0 exit /b 0
:winfsp-tests-x64-mountpoint-dir-case-sensitive
winfsp-tests-x64 --mountpoint=mymnt
if !ERRORLEVEL! neq 0 goto fail
exit /b 0
:winfsp-tests-x64-no-traverse :winfsp-tests-x64-no-traverse
winfsp-tests-x64 --no-traverse winfsp-tests-x64 --no-traverse
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
@ -227,6 +234,11 @@ winfsp-tests-x86 --mountpoint=mymnt --case-insensitive
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
exit /b 0 exit /b 0
:winfsp-tests-x86-mountpoint-dir-case-sensitive
winfsp-tests-x86 --mountpoint=mymnt
if !ERRORLEVEL! neq 0 goto fail
exit /b 0
:winfsp-tests-x86-no-traverse :winfsp-tests-x86-no-traverse
winfsp-tests-x86 --no-traverse winfsp-tests-x86 --no-traverse
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
/* /*
* Airfs is based on Memfs with changes contributed by John Oberschelp. * Airfs is based on Memfs with changes contributed by John Oberschelp.
@ -38,9 +42,13 @@ FSP_FSCTL_STATIC_ASSERT(AIRFS_MAX_PATH > MAX_PATH,
#define AIRFS_NAMED_STREAMS // Include alternate data streams support. #define AIRFS_NAMED_STREAMS // Include alternate data streams support.
#define AIRFS_DIRINFO_BY_NAME // Include GetDirInfoByName. #define AIRFS_DIRINFO_BY_NAME // Include GetDirInfoByName.
#define AIRFS_SLOWIO // Include delayed I/O response support. #define AIRFS_SLOWIO // Include delayed I/O response support.
#define AIRFS_CONTROL // Include DeviceIoControl support.
#define AIRFS_SECTOR_SIZE 512
#define AIRFS_SECTORS_PER_ALLOCATION_UNIT 1 #define SECTOR_SIZE 512
#define SECTORS_PER_ALLOCATION_UNIT 1
#define ALLOCATION_UNIT ( SECTOR_SIZE * SECTORS_PER_ALLOCATION_UNIT )
#define IN_ALLOCATION_UNITS(bytes) (((bytes) + ALLOCATION_UNIT - 1) / ALLOCATION_UNIT * ALLOCATION_UNIT)
enum enum
{ {
@ -660,10 +668,11 @@ NTSTATUS SetAllocSize(FSP_FILE_SYSTEM *FileSystem, NODE_ Node,
{ {
AIRFS_ Airfs = (AIRFS_) FileSystem->UserContext; AIRFS_ Airfs = (AIRFS_) FileSystem->UserContext;
RequestedAllocSize = IN_ALLOCATION_UNITS(RequestedAllocSize);
if (Node->FileInfo.AllocationSize != RequestedAllocSize) if (Node->FileInfo.AllocationSize != RequestedAllocSize)
{ {
if (RequestedAllocSize > Airfs->MaxFileSize) if (RequestedAllocSize > Airfs->MaxFileSize) return STATUS_DISK_FULL;
return STATUS_DISK_FULL;
// Reallocate only if the file is made smaller, or if it will not fit in the actual memory footprint. // Reallocate only if the file is made smaller, or if it will not fit in the actual memory footprint.
size_t ActualSize = AirfsHeapSize(Node->FileData); size_t ActualSize = AirfsHeapSize(Node->FileData);
@ -671,7 +680,7 @@ NTSTATUS SetAllocSize(FSP_FILE_SYSTEM *FileSystem, NODE_ Node,
{ {
// If the file grow request was modest, guess that it might happen again, and grow the file by 50%. // If the file grow request was modest, guess that it might happen again, and grow the file by 50%.
if (RequestedAllocSize > Node->FileInfo.AllocationSize && RequestedAllocSize <= ActualSize + ActualSize / 8) if (RequestedAllocSize > Node->FileInfo.AllocationSize && RequestedAllocSize <= ActualSize + ActualSize / 8)
RequestedAllocSize = (ActualSize + ActualSize / 2 + 7) ^ 7; RequestedAllocSize = IN_ALLOCATION_UNITS(ActualSize + ActualSize / 2);
PVOID FileData = AirfsHeapRealloc(Node->FileData, (size_t)RequestedAllocSize); PVOID FileData = AirfsHeapRealloc(Node->FileData, (size_t)RequestedAllocSize);
if (!FileData && RequestedAllocSize > 0) if (!FileData && RequestedAllocSize > 0)
@ -697,10 +706,7 @@ NTSTATUS SetFileSize(FSP_FILE_SYSTEM *FileSystem, NODE_ Node,
{ {
if (Node->FileInfo.AllocationSize < RequestedFileSize) if (Node->FileInfo.AllocationSize < RequestedFileSize)
{ {
UINT64 AllocationUnit = AIRFS_SECTOR_SIZE * AIRFS_SECTORS_PER_ALLOCATION_UNIT; NTSTATUS Result = SetAllocSize(FileSystem, Node, RequestedFileSize);
UINT64 AllocationSize = (RequestedFileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
NTSTATUS Result = SetAllocSize(FileSystem, Node, AllocationSize);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
return Result; return Result;
} }
@ -1054,11 +1060,7 @@ void ApiCleanup(FSP_FILE_SYSTEM *FileSystem, PVOID Node0, PWSTR Name, ULONG Flag
if (Flags & FspCleanupSetAllocationSize) if (Flags & FspCleanupSetAllocationSize)
{ {
UINT64 AllocationUnit = AIRFS_SECTOR_SIZE * AIRFS_SECTORS_PER_ALLOCATION_UNIT; SetAllocSize(FileSystem, Node, Node->FileInfo.FileSize);
UINT64 AllocationSize = (Node->FileInfo.FileSize + AllocationUnit - 1) /
AllocationUnit * AllocationUnit;
SetAllocSize(FileSystem, Node, AllocationSize);
} }
if ((Flags & FspCleanupDelete) && !NodeHasChildren(Node)) if ((Flags & FspCleanupDelete) && !NodeHasChildren(Node))
@ -1609,6 +1611,34 @@ NTSTATUS ApiGetStreamInfo(FSP_FILE_SYSTEM *FileSystem, PVOID Node0,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
#endif
//////////////////////////////////////////////////////////////////////
#if defined(AIRFS_CONTROL)
NTSTATUS ApiControl(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, UINT32 ControlCode,
PVOID InputBuffer, ULONG InputBufferLength,
PVOID OutputBuffer, ULONG OutputBufferLength, PULONG PBytesTransferred)
{
// Trivial example: Perform a ROT13 translation on alphas.
if (CTL_CODE(0x8000 + 'M', 'R', METHOD_BUFFERED, FILE_ANY_ACCESS) == ControlCode)
{
if (OutputBufferLength != InputBufferLength) return STATUS_INVALID_PARAMETER;
for (ULONG i = 0; i < InputBufferLength; i++)
{
char c = ((char*)InputBuffer)[i];
if (('A' <= c && c <= 'M') || ('a' <= c && c <= 'm')) c += 13;
else
if (('N' <= c && c <= 'Z') || ('n' <= c && c <= 'z')) c -= 13;
((char*)OutputBuffer)[i] = c;
}
*PBytesTransferred = InputBufferLength;
return STATUS_SUCCESS;
}
return STATUS_INVALID_DEVICE_REQUEST;
}
#endif #endif
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -1654,6 +1684,11 @@ FSP_FILE_SYSTEM_INTERFACE AirfsInterface =
#else #else
0, 0,
#endif #endif
#if defined(AIRFS_CONTROL)
ApiControl,
#else
0,
#endif
}; };
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -1711,7 +1746,6 @@ NTSTATUS AirfsCreate(
BOOLEAN FlushAndPurgeOnCleanup = !!(Flags & AirfsFlushAndPurgeOnCleanup); BOOLEAN FlushAndPurgeOnCleanup = !!(Flags & AirfsFlushAndPurgeOnCleanup);
PWSTR DevicePath = AirfsNet == (Flags & AirfsDeviceMask) ? PWSTR DevicePath = AirfsNet == (Flags & AirfsDeviceMask) ?
L"" FSP_FSCTL_NET_DEVICE_NAME : L"" FSP_FSCTL_DISK_DEVICE_NAME; L"" FSP_FSCTL_NET_DEVICE_NAME : L"" FSP_FSCTL_DISK_DEVICE_NAME;
UINT64 AllocationUnit;
AIRFS_ Airfs; AIRFS_ Airfs;
NODE_ RootNode; NODE_ RootNode;
PSECURITY_DESCRIPTOR RootSecurity; PSECURITY_DESCRIPTOR RootSecurity;
@ -1737,8 +1771,7 @@ NTSTATUS AirfsCreate(
memset(Airfs, 0, sizeof *Airfs); memset(Airfs, 0, sizeof *Airfs);
Airfs->MaxNodes = MaxNodes; Airfs->MaxNodes = MaxNodes;
AllocationUnit = AIRFS_SECTOR_SIZE * AIRFS_SECTORS_PER_ALLOCATION_UNIT; Airfs->MaxFileSize = IN_ALLOCATION_UNITS(MaxFileSize);
Airfs->MaxFileSize = (ULONG)((MaxFileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit);
#ifdef AIRFS_SLOWIO #ifdef AIRFS_SLOWIO
Airfs->SlowioMaxDelay = SlowioMaxDelay; Airfs->SlowioMaxDelay = SlowioMaxDelay;
@ -1750,8 +1783,8 @@ NTSTATUS AirfsCreate(
memset(&VolumeParams, 0, sizeof VolumeParams); memset(&VolumeParams, 0, sizeof VolumeParams);
VolumeParams.Version = sizeof FSP_FSCTL_VOLUME_PARAMS; VolumeParams.Version = sizeof FSP_FSCTL_VOLUME_PARAMS;
VolumeParams.SectorSize = AIRFS_SECTOR_SIZE; VolumeParams.SectorSize = SECTOR_SIZE;
VolumeParams.SectorsPerAllocationUnit = AIRFS_SECTORS_PER_ALLOCATION_UNIT; VolumeParams.SectorsPerAllocationUnit = SECTORS_PER_ALLOCATION_UNIT;
VolumeParams.VolumeCreationTime = GetSystemTime(); VolumeParams.VolumeCreationTime = GetSystemTime();
VolumeParams.VolumeSerialNumber = (UINT32)(GetSystemTime() / (10000 * 1000)); VolumeParams.VolumeSerialNumber = (UINT32)(GetSystemTime() / (10000 * 1000));
VolumeParams.FileInfoTimeout = FileInfoTimeout; VolumeParams.FileInfoTimeout = FileInfoTimeout;
@ -1769,6 +1802,9 @@ NTSTATUS AirfsCreate(
VolumeParams.PassQueryDirectoryFileName = 1; VolumeParams.PassQueryDirectoryFileName = 1;
#endif #endif
VolumeParams.FlushAndPurgeOnCleanup = FlushAndPurgeOnCleanup; VolumeParams.FlushAndPurgeOnCleanup = FlushAndPurgeOnCleanup;
#if defined(AIRFS_CONTROL)
VolumeParams.DeviceControl = 1;
#endif
if (VolumePrefix) if (VolumePrefix)
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix); wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR), wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR),

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <windows.h> #include <windows.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <winfsp/winfsp.h> #include <winfsp/winfsp.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include "fscrash.h" #include "fscrash.h"

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef FSCRASH_H_INCLUDED #ifndef FSCRASH_H_INCLUDED

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
using System; using System;

View File

@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <winfsp/winfsp.h> #include <winfsp/winfsp.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <winfsp/winfsp.h> #include <winfsp/winfsp.h>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#undef _DEBUG #undef _DEBUG

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#ifndef MEMFS_H_INCLUDED #ifndef MEMFS_H_INCLUDED

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
#include <winfsp/winfsp.hpp> #include <winfsp/winfsp.hpp>

View File

@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software * General Public License version 3 as published by the Free Software
* Foundation. * Foundation.
* *
* Licensees holding a valid commercial license may use this file in * Licensees holding a valid commercial license may use this software
* accordance with the commercial license agreement provided with the * in accordance with the commercial license agreement provided in
* software. * conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/ */
using System; using System;
@ -307,6 +311,7 @@ namespace passthrough
Host.PersistentAcls = true; Host.PersistentAcls = true;
Host.PostCleanupWhenModifiedOnly = true; Host.PostCleanupWhenModifiedOnly = true;
Host.PassQueryDirectoryPattern = true; Host.PassQueryDirectoryPattern = true;
Host.FlushAndPurgeOnCleanup = true;
Host.VolumeCreationTime = (UInt64)File.GetCreationTimeUtc(_Path).ToFileTimeUtc(); Host.VolumeCreationTime = (UInt64)File.GetCreationTimeUtc(_Path).ToFileTimeUtc();
Host.VolumeSerialNumber = 0; Host.VolumeSerialNumber = 0;
return STATUS_SUCCESS; return STATUS_SUCCESS;

Some files were not shown because too many files have changed in this diff Show More