Compare commits

..

43 Commits
v1.4B2 ... v1.4

Author SHA1 Message Date
0eb84d68e2 update changelog 2018-12-10 10:06:17 -08:00
750e424ac3 bump version to 2019.1 Gold 2018-12-10 10:05:58 -08:00
58162a8d78 update changelog 2018-12-10 10:03:00 -08:00
b323925d94 update changelog 2018-12-10 09:34:17 -08:00
3206e3dd15 change version to 2018.2 B4 2018-12-03 13:31:34 -08:00
0f185587c9 dll: np: implement custom Credential Provider logic 2018-11-29 21:05:57 -08:00
3119922708 np, launcher: allow RunAs=. registry setting 2018-11-26 13:29:34 -08:00
5d90c35e20 sys: FspFsvrtDeviceControl: STATUS_UNRECOGNIZED_VOLUME
This fixes GitHub issue #177. All credit for the investigation and
suggested workaround goes to @thinkport.
2018-11-21 15:32:25 -08:00
a910385cb1 dll: ensure FspFileSystemFinalize is called 2018-11-21 13:46:50 -08:00
17d687fe7e tools: run-tests: disable create_readonlydir_test on compat FUSE tests (no FileAttributes) 2018-11-05 14:14:21 -08:00
4deb7b96a9 tools: run-tests: disable create_readonlydir_test on FUSE3 (no FileAttributes) 2018-11-05 12:39:55 -08:00
36ba4ff402 dll: FspAccessCheckEx: fix #190: add test 2018-11-05 11:08:47 -08:00
55955b8514 dll: FspAccessCheckEx: fix #190: add test 2018-11-05 10:45:11 -08:00
1bebbcf634 dll: FspAccessCheckEx: fix #190 2018-10-19 21:53:44 -07:00
a292cd4d73 dll: FspAccessCheckEx: fix #190 2018-10-19 21:41:52 -07:00
0de00e872f dotnet: ModifySecurityDescriptorEx
Deprecate ModifySecurityDecriptor and introduce
ModifySecurityDescriptorEx. Works around the problem
of clobbering an existing security descriptor when the
native API FspSetSecurityDescriptor fails.
2018-10-08 15:08:07 -07:00
084f0b5b36 update changelog 2018-10-02 11:10:20 -07:00
901ef5e92f update changelog 2018-10-01 17:05:14 -07:00
f09597a519 bump version to 2018.2 Gold 2018-10-01 16:57:49 -07:00
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
139 changed files with 1835 additions and 617 deletions

View File

@ -1,6 +1,57 @@
= Changelog = Changelog
v1.4 (2019.1)::
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.)
* The Launcher now supports running file systems under the user account that started them. Use `RunAs="."` in the file system registry entry.
* 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 a fix for a Windows problem: that case-sensitive file systems do not work properly when mounted as directories. See FAQ entry #3.
* The FSD includes a fix for a rare but serious problem. (GitHub issue #177. Thanks @thinkport.)
* The FSD includes a fix for an incompatibility with DrWeb Antivirus. (GitHub issue #192)
* The DLL includes a fix for an errorenous `STATUS_ACCESS_DENIED` on read-only directories. (GitHub issue #190. Thanks @alfaunits.)
v1.4B4 (2018.2 B4)::
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.)
* The Launcher now supports running file systems under the user account that started them. Use `RunAs="."` in the file system registry entry.
* 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 a fix for a Windows problem: that case-sensitive file systems do not work properly when mounted as directories. See FAQ entry #3.
* The FSD includes a fix for a rare but serious problem. (GitHub issue #177. Thanks @thinkport.)
* The FSD includes a fix for an incompatibility with DrWeb Antivirus. (GitHub issue #192)
* The DLL includes a fix for an errorenous `STATUS_ACCESS_DENIED` on read-only directories. (GitHub issue #190. Thanks @alfaunits.)
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,8 +18,8 @@
<MyCanonicalVersion>1.4</MyCanonicalVersion> <MyCanonicalVersion>1.4</MyCanonicalVersion>
<MyProductVersion>2018.2 B2</MyProductVersion> <MyProductVersion>2019.1</MyProductVersion>
<MyProductStage>Beta</MyProductStage> <MyProductStage>Gold</MyProductStage>
<MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion> <MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion>
<MyVersionWithCommas>$(MyVersion.Replace('.',',')),0</MyVersionWithCommas> <MyVersionWithCommas>$(MyVersion.Replace('.',',')),0</MyVersionWithCommas>

View File

@ -222,7 +222,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName> <MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile> <ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile>
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;version.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;secur32.lib;version.lib</AdditionalDependencies>
<StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols> <StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -250,7 +250,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName> <MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile> <ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile>
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;version.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;secur32.lib;version.lib</AdditionalDependencies>
<StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols> <StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -281,7 +281,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName> <MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile> <ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile>
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;version.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;secur32.lib;version.lib</AdditionalDependencies>
<StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols> <StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -312,7 +312,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName> <MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile> <ModuleDefinitionFile>..\..\src\dll\library.def</ModuleDefinitionFile>
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;version.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;credui.lib;secur32.lib;version.lib</AdditionalDependencies>
<StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols> <StripPrivateSymbols>$(OutDir)$(TargetFileName).public.pdb</StripPrivateSymbols>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>

View File

@ -6,8 +6,8 @@
I am running Windows 7 and I am finding that the installed driver is not signed.:: I am running Windows 7 and I am finding that the installed driver is not signed.::
Your Windows 7 OS is missing SHA-2 Code Signing Support. You need to install the following security advisory that will rectify the problem: Your Windows 7 OS is missing SHA-2 Code Signing Support. You need to install the following security advisory that will rectify the problem:
https://technet.microsoft.com/en-us/library/security/3033929.aspx https://technet.microsoft.com/en-us/library/security/3033929.aspx
Disconnecting (unmapping) a network drive does not work.:: Disconnecting (unmapping) a network drive does not work.::
@ -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

@ -1,2 +1,2 @@
Taken from secfs.core/src/tlib codebase: Taken from secfs.core/src/tlib codebase:
commit 16296d2ac64a7d532b1c486dd3c44af5865d4851 commit 16296d2ac64a7d532b1c486dd3c44af5865d4851

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_
@ -41,16 +45,16 @@ extern "C" {
struct fuse_opt struct fuse_opt
{ {
const char *templ; const char *templ;
unsigned int offset; unsigned int offset;
int value; int value;
}; };
struct fuse_args struct fuse_args
{ {
int argc; int argc;
char **argv; char **argv;
int allocated; int allocated;
}; };
typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key, typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,

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
@ -107,7 +111,43 @@ enum
*/ */
FSP_API NTSTATUS FspLaunchCallLauncherPipe( FSP_API NTSTATUS FspLaunchCallLauncherPipe(
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl, WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
PWSTR Buffer, PULONG PSize, PULONG PLauncherError); PWSTR Buffer, PULONG PSize,
PULONG PLauncherError);
/**
* Call launcher pipe.
*
* This function is used to send a command to the launcher and receive a response.
*
* @param Command
* Launcher command to send. For example, the 'L' launcher command instructs
* the launcher to list all running service instances.
* @param Argc
* Command argument count. May be 0.
* @param Argv
* Command argument array. May be NULL.
* @param Argl
* Command argument length array. May be NULL. If this is NULL all command arguments
* are assumed to be NULL-terminated strings. It is also possible for specific arguments
* to be NULL-terminated; in this case pass -1 in the corresponding Argl position.
* @param Buffer
* Buffer that receives the command response. May be NULL.
* @param PSize
* Pointer to a ULONG. On input it contains the size of the Buffer. On output it
* contains the number of bytes transferred. May be NULL.
* @param AllowImpersonation
* Allow caller to be impersonated by launcher.
* @param PLauncherError
* Receives the launcher error if any. This is always a Win32 error code. May not be NULL.
* @return
* STATUS_SUCCESS if the command is sent successfully to the launcher, even if the launcher
* returns an error. Other status codes indicate a communication error. Launcher errors are
* reported through PLauncherError.
*/
FSP_API NTSTATUS FspLaunchCallLauncherPipeEx(
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
PWSTR Buffer, PULONG PSize,
BOOLEAN AllowImpersonation,
PULONG PLauncherError);
/** /**
* Start a service instance. * Start a service instance.
* *
@ -134,6 +174,35 @@ FSP_API NTSTATUS FspLaunchStart(
PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv, PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv,
BOOLEAN HasSecret, BOOLEAN HasSecret,
PULONG PLauncherError); PULONG PLauncherError);
/**
* Start a service instance.
*
* @param ClassName
* Class name of the service instance to start.
* @param InstanceName
* Instance name of the service instance to start.
* @param Argc
* Service instance argument count. May be 0.
* @param Argv
* Service instance argument array. May be NULL.
* @param HasSecret
* Whether the last argument in Argv is assumed to be a secret (e.g. password) or not.
* Secrets are passed to service instances through standard input rather than the command
* line.
* @param AllowImpersonation
* Allow caller to be impersonated by launcher.
* @param PLauncherError
* Receives the launcher error if any. This is always a Win32 error code. May not be NULL.
* @return
* STATUS_SUCCESS if the command is sent successfully to the launcher, even if the launcher
* returns an error. Other status codes indicate a communication error. Launcher errors are
* reported through PLauncherError.
*/
FSP_API NTSTATUS FspLaunchStartEx(
PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv,
BOOLEAN HasSecret,
BOOLEAN AllowImpersonation,
PULONG PLauncherError);
/** /**
* Stop a service instance. * Stop a service instance.
* *
@ -217,10 +286,12 @@ typedef struct _FSP_LAUNCH_REG_RECORD
PWSTR WorkDirectory; PWSTR WorkDirectory;
PWSTR RunAs; PWSTR RunAs;
PWSTR Security; PWSTR Security;
PVOID Reserved0[6]; PWSTR AuthPackage;
PVOID Reserved0[5];
ULONG JobControl; ULONG JobControl;
ULONG Credentials; ULONG Credentials;
ULONG Reserved1[6]; ULONG AuthPackageId;
ULONG Reserved1[5];
UINT8 Buffer[]; UINT8 Buffer[];
} FSP_LAUNCH_REG_RECORD; } FSP_LAUNCH_REG_RECORD;
#pragma warning(pop) #pragma warning(pop)

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.");
@ -1752,6 +1795,10 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize, PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize,
PULONG PBytesTransferred, ULONG Timeout, PULONG PBytesTransferred, ULONG Timeout,
PSID Sid); PSID Sid);
FSP_API NTSTATUS FspCallNamedPipeSecurelyEx(PWSTR PipeName,
PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize,
PULONG PBytesTransferred, ULONG Timeout, BOOLEAN AllowImpersonation,
PSID Sid);
FSP_API NTSTATUS FspVersion(PUINT32 PVersion); FSP_API NTSTATUS FspVersion(PUINT32 PVersion);
/* /*

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,7 +489,8 @@ 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)
{ {
SetEvent(f->LoopEvent); if (0 != 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 */
WaitObjects[0] = fsp_fuse_svcthread; Result = STATUS_SUCCESS;
WaitObjects[1] = f->LoopEvent; if (!f->exited)
WaitResult = WaitForMultipleObjects(2, WaitObjects, FALSE, INFINITE); {
if (WAIT_OBJECT_0 != WaitResult && WAIT_OBJECT_0 + 1 != WaitResult) WaitObjects[0] = fsp_fuse_svcthread;
Result = FspNtStatusFromWin32(GetLastError()); WaitObjects[1] = f->LoopEvent;
WaitResult = WaitForMultipleObjects(2, WaitObjects, FALSE, INFINITE);
if (WAIT_OBJECT_0 != WaitResult && WAIT_OBJECT_0 + 1 != WaitResult)
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,16 +10,31 @@
* 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>
FSP_API NTSTATUS FspLaunchCallLauncherPipe( FSP_API NTSTATUS FspLaunchCallLauncherPipe(
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl, WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
PWSTR Buffer, PULONG PSize, PULONG PLauncherError) PWSTR Buffer, PULONG PSize,
PULONG PLauncherError)
{
return FspLaunchCallLauncherPipeEx(
Command, Argc, Argv, Argl, Buffer, PSize, FALSE, PLauncherError);
}
FSP_API NTSTATUS FspLaunchCallLauncherPipeEx(
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
PWSTR Buffer, PULONG PSize,
BOOLEAN AllowImpersonation,
PULONG PLauncherError)
{ {
PWSTR PipeBuf = 0, P; PWSTR PipeBuf = 0, P;
ULONG Length, BytesTransferred; ULONG Length, BytesTransferred;
@ -49,9 +64,9 @@ FSP_API NTSTATUS FspLaunchCallLauncherPipe(
memcpy(P, Argv[I], Length * sizeof(WCHAR)); P += Length; *P++ = L'\0'; memcpy(P, Argv[I], Length * sizeof(WCHAR)); P += Length; *P++ = L'\0';
} }
Result = FspCallNamedPipeSecurely(L"" FSP_LAUNCH_PIPE_NAME, Result = FspCallNamedPipeSecurelyEx(L"" FSP_LAUNCH_PIPE_NAME,
PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), PipeBuf, FSP_LAUNCH_PIPE_BUFFER_SIZE, PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), PipeBuf, FSP_LAUNCH_PIPE_BUFFER_SIZE,
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, FSP_LAUNCH_PIPE_OWNER); &BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, AllowImpersonation, FSP_LAUNCH_PIPE_OWNER);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
goto exit; goto exit;
@ -98,8 +113,17 @@ exit:
} }
FSP_API NTSTATUS FspLaunchStart( FSP_API NTSTATUS FspLaunchStart(
PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv,
BOOLEAN HasSecret,
PULONG PLauncherError)
{
return FspLaunchStartEx(ClassName, InstanceName, Argc, Argv, HasSecret, FALSE, PLauncherError);
}
FSP_API NTSTATUS FspLaunchStartEx(
PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv0, PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv0,
BOOLEAN HasSecret, BOOLEAN HasSecret,
BOOLEAN AllowImpersonation,
PULONG PLauncherError) PULONG PLauncherError)
{ {
PWSTR Argv[9 + 2]; PWSTR Argv[9 + 2];
@ -111,9 +135,9 @@ FSP_API NTSTATUS FspLaunchStart(
Argv[1] = InstanceName; Argv[1] = InstanceName;
memcpy(Argv + 2, Argv0, Argc * sizeof(PWSTR)); memcpy(Argv + 2, Argv0, Argc * sizeof(PWSTR));
return FspLaunchCallLauncherPipe( return FspLaunchCallLauncherPipeEx(
HasSecret ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart, HasSecret ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart,
Argc + 2, Argv, 0, 0, 0, PLauncherError); Argc + 2, Argv, 0, 0, 0, AllowImpersonation, PLauncherError);
} }
FSP_API NTSTATUS FspLaunchStop( FSP_API NTSTATUS FspLaunchStop(
@ -246,8 +270,10 @@ FSP_API NTSTATUS FspLaunchRegSetRecord(
SETFIELD(WorkDirectory); SETFIELD(WorkDirectory);
SETFIELD(RunAs); SETFIELD(RunAs);
SETFIELD(Security); SETFIELD(Security);
SETFIELD(AuthPackage);
SETFIELDI(JobControl, ~0); /* JobControl default is 1; but we treat as without default */ SETFIELDI(JobControl, ~0); /* JobControl default is 1; but we treat as without default */
SETFIELDI(Credentials, 0); SETFIELDI(Credentials, 0);
SETFIELDI(AuthPackageId, 0);
} }
else else
{ {
@ -396,8 +422,10 @@ FSP_API NTSTATUS FspLaunchRegGetRecord(
GETFIELD(WorkDirectory); GETFIELD(WorkDirectory);
GETFIELD(RunAs); GETFIELD(RunAs);
GETFIELD(Security); GETFIELD(Security);
GETFIELD(AuthPackage);
GETFIELDI(JobControl); GETFIELDI(JobControl);
GETFIELDI(Credentials); GETFIELDI(Credentials);
GETFIELDI(AuthPackageId);
if (0 == Record->Executable) if (0 == Record->Executable)
{ {
@ -426,8 +454,11 @@ FSP_API NTSTATUS FspLaunchRegGetRecord(
(PVOID)(Record->Buffer + ((PUINT8)RecordBuf.RunAs - RegBuf)) : 0; (PVOID)(Record->Buffer + ((PUINT8)RecordBuf.RunAs - RegBuf)) : 0;
Record->Security = 0 != RecordBuf.Security ? Record->Security = 0 != RecordBuf.Security ?
(PVOID)(Record->Buffer + ((PUINT8)RecordBuf.Security - RegBuf)) : 0; (PVOID)(Record->Buffer + ((PUINT8)RecordBuf.Security - RegBuf)) : 0;
Record->AuthPackage = 0 != RecordBuf.AuthPackage ?
(PVOID)(Record->Buffer + ((PUINT8)RecordBuf.AuthPackage - RegBuf)) : 0;
Record->JobControl = RecordBuf.JobControl; Record->JobControl = RecordBuf.JobControl;
Record->Credentials = RecordBuf.Credentials; Record->Credentials = RecordBuf.Credentials;
Record->AuthPackageId = RecordBuf.AuthPackageId;
*PRecord = Record; *PRecord = Record;
Result = STATUS_SUCCESS; Result = STATUS_SUCCESS;

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>
@ -42,6 +46,7 @@ BOOL WINAPI DllMain(HINSTANCE Instance, DWORD Reason, PVOID Reserved)
Dynamic = 0 == Reserved; Dynamic = 0 == Reserved;
fsp_fuse_finalize(Dynamic); fsp_fuse_finalize(Dynamic);
FspServiceFinalize(Dynamic); FspServiceFinalize(Dynamic);
FspFileSystemFinalize(Dynamic);
FspEventLogFinalize(Dynamic); FspEventLogFinalize(Dynamic);
FspPosixFinalize(Dynamic); FspPosixFinalize(Dynamic);
FspWksidFinalize(Dynamic); FspWksidFinalize(Dynamic);

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
@ -43,6 +47,7 @@
VOID FspWksidFinalize(BOOLEAN Dynamic); VOID FspWksidFinalize(BOOLEAN Dynamic);
VOID FspPosixFinalize(BOOLEAN Dynamic); VOID FspPosixFinalize(BOOLEAN Dynamic);
VOID FspEventLogFinalize(BOOLEAN Dynamic); VOID FspEventLogFinalize(BOOLEAN Dynamic);
VOID FspFileSystemFinalize(BOOLEAN Dynamic);
VOID FspServiceFinalize(BOOLEAN Dynamic); VOID FspServiceFinalize(BOOLEAN Dynamic);
VOID fsp_fuse_finalize(BOOLEAN Dynamic); VOID fsp_fuse_finalize(BOOLEAN Dynamic);
VOID fsp_fuse_finalize_thread(VOID); VOID fsp_fuse_finalize_thread(VOID);

View File

@ -10,15 +10,22 @@
* 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>
#include <npapi.h> #include <npapi.h>
#include <wincred.h> #include <wincred.h>
#define _NTDEF_
#include <ntsecapi.h>
#define FSP_NP_NAME LIBRARY_NAME ".Np" #define FSP_NP_NAME LIBRARY_NAME ".Np"
#define FSP_NP_TYPE ' spF' /* pick a value hopefully not in use */ #define FSP_NP_TYPE ' spF' /* pick a value hopefully not in use */
#define FSP_NP_ADDCONNECTION_TIMEOUT 15000 #define FSP_NP_ADDCONNECTION_TIMEOUT 15000
@ -175,12 +182,14 @@ static inline BOOLEAN FspNpParseRemoteUserName(PWSTR RemoteName,
static inline DWORD FspNpCallLauncherPipe( static inline DWORD FspNpCallLauncherPipe(
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl, WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
PWSTR Buffer, PULONG PSize) PWSTR Buffer, PULONG PSize,
BOOLEAN AllowImpersonation)
{ {
NTSTATUS Result; NTSTATUS Result;
ULONG ErrorCode; ULONG ErrorCode;
Result = FspLaunchCallLauncherPipe(Command, Argc, Argv, Argl, Buffer, PSize, &ErrorCode); Result = FspLaunchCallLauncherPipeEx(Command, Argc, Argv, Argl, Buffer, PSize, AllowImpersonation,
&ErrorCode);
return !NT_SUCCESS(Result) ? return !NT_SUCCESS(Result) ?
WN_NO_NETWORK : WN_NO_NETWORK :
(ERROR_BROKEN_PIPE == ErrorCode ? WN_NO_NETWORK : ErrorCode); (ERROR_BROKEN_PIPE == ErrorCode ? WN_NO_NETWORK : ErrorCode);
@ -247,7 +256,50 @@ static WCHAR FspNpGetDriveLetter(PDWORD PLogicalDrives, PWSTR VolumeName)
return 0; return 0;
} }
static DWORD FspNpGetRemoteInfo(PWSTR RemoteName, PDWORD PCredentialsKind) static NTSTATUS FspNpGetAuthPackage(PWSTR AuthPackageName, PULONG PAuthPackage)
{
HANDLE LsaHandle;
BOOLEAN LsaHandleValid = FALSE;
CHAR LsaAuthPackageNameBuf[127]; /* "The package name must not exceed 127 bytes in length." */
LSA_STRING LsaAuthPackageName;
ULONG AuthPackage;
NTSTATUS Result;
*PAuthPackage = 0;
Result = LsaConnectUntrusted(&LsaHandle);
if (!NT_SUCCESS(Result))
goto exit;
LsaHandleValid = TRUE;
LsaAuthPackageName.MaximumLength = sizeof LsaAuthPackageNameBuf;
LsaAuthPackageName.Buffer = LsaAuthPackageNameBuf;
LsaAuthPackageName.Length = WideCharToMultiByte(CP_UTF8, 0,
AuthPackageName, lstrlenW(AuthPackageName),
LsaAuthPackageNameBuf, sizeof LsaAuthPackageNameBuf,
0, 0);
if (0 == LsaAuthPackageName.Length)
{
Result = FspNtStatusFromWin32(GetLastError());
goto exit;
}
Result = LsaLookupAuthenticationPackage(LsaHandle, &LsaAuthPackageName, &AuthPackage);
if (!NT_SUCCESS(Result))
goto exit;
*PAuthPackage = AuthPackage;
Result = STATUS_SUCCESS;
exit:
if (LsaHandleValid)
LsaDeregisterLogonProcess(LsaHandle);
return Result;
}
static DWORD FspNpGetRemoteInfo(PWSTR RemoteName,
PDWORD PAuthPackage, PDWORD PCredentialsKind, PBOOLEAN PAllowImpersonation)
{ {
PWSTR ClassName, InstanceName; PWSTR ClassName, InstanceName;
ULONG ClassNameLen, InstanceNameLen; ULONG ClassNameLen, InstanceNameLen;
@ -255,7 +307,14 @@ static DWORD FspNpGetRemoteInfo(PWSTR RemoteName, PDWORD PCredentialsKind)
FSP_LAUNCH_REG_RECORD *Record; FSP_LAUNCH_REG_RECORD *Record;
NTSTATUS Result; NTSTATUS Result;
*PCredentialsKind = FSP_NP_CREDENTIALS_NONE; if (0 != PAuthPackage)
*PAuthPackage = 0;
if (0 != PCredentialsKind)
*PCredentialsKind = FSP_NP_CREDENTIALS_NONE;
if (0 != PAllowImpersonation)
*PAllowImpersonation = FALSE;
if (!FspNpParseRemoteName(RemoteName, if (!FspNpParseRemoteName(RemoteName,
&ClassName, &ClassNameLen, &InstanceName, &InstanceNameLen)) &ClassName, &ClassNameLen, &InstanceName, &InstanceNameLen))
@ -270,15 +329,36 @@ static DWORD FspNpGetRemoteInfo(PWSTR RemoteName, PDWORD PCredentialsKind)
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
return WN_NO_NETWORK; return WN_NO_NETWORK;
switch (Record->Credentials) if (0 != PAuthPackage)
{ {
case FSP_NP_CREDENTIALS_NONE: if (0 != Record->AuthPackage)
case FSP_NP_CREDENTIALS_PASSWORD: {
case FSP_NP_CREDENTIALS_USERPASS: ULONG AuthPackage = 0;
*PCredentialsKind = Record->Credentials;
break; Result = FspNpGetAuthPackage(Record->AuthPackage, &AuthPackage);
if (!NT_SUCCESS(Result))
return WN_NO_NETWORK;
*PAuthPackage = AuthPackage + 1; /* ensure non-0 (Negotiate AuthPackage == 0) */
}
else if (0 != Record->AuthPackageId)
*PAuthPackage = Record->AuthPackageId + 1; /* ensure non-0 (Negotiate AuthPackage == 0) */
} }
if (0 != PCredentialsKind)
switch (Record->Credentials)
{
case FSP_NP_CREDENTIALS_NONE:
case FSP_NP_CREDENTIALS_PASSWORD:
case FSP_NP_CREDENTIALS_USERPASS:
*PCredentialsKind = Record->Credentials;
break;
}
if (0 != PAllowImpersonation)
*PAllowImpersonation = 0 != Record->RunAs &&
L'.' == Record->RunAs[0] && L'\0' == Record->RunAs[1];
FspLaunchRegFreeRecord(Record); FspLaunchRegFreeRecord(Record);
return WN_SUCCESS; return WN_SUCCESS;
@ -286,7 +366,7 @@ static DWORD FspNpGetRemoteInfo(PWSTR RemoteName, PDWORD PCredentialsKind)
static DWORD FspNpGetCredentials( static DWORD FspNpGetCredentials(
HWND hwndOwner, PWSTR Caption, DWORD PrevNpResult, HWND hwndOwner, PWSTR Caption, DWORD PrevNpResult,
DWORD CredentialsKind, DWORD AuthPackage0, DWORD CredentialsKind,
PBOOL PSave, PBOOL PSave,
PWSTR UserName, ULONG UserNameSize/* in chars */, PWSTR UserName, ULONG UserNameSize/* in chars */,
PWSTR Password, ULONG PasswordSize/* in chars */) PWSTR Password, ULONG PasswordSize/* in chars */)
@ -313,7 +393,7 @@ static DWORD FspNpGetCredentials(
(FSP_NP_CREDENTIALS_PASSWORD == CredentialsKind ? 0/*CREDUI_FLAGS_KEEP_USERNAME*/ : 0)); (FSP_NP_CREDENTIALS_PASSWORD == CredentialsKind ? 0/*CREDUI_FLAGS_KEEP_USERNAME*/ : 0));
#else #else
WCHAR Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1]; WCHAR Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1];
ULONG AuthPackage = 0; ULONG AuthPackage = 0 != AuthPackage0 ? AuthPackage0 - 1 : 0;
PVOID InAuthBuf = 0, OutAuthBuf = 0; PVOID InAuthBuf = 0, OutAuthBuf = 0;
ULONG InAuthSize, OutAuthSize, DomainSize; ULONG InAuthSize, OutAuthSize, DomainSize;
@ -342,7 +422,8 @@ static DWORD FspNpGetCredentials(
NpResult = CredUIPromptForWindowsCredentialsW(&UiInfo, PrevNpResult, NpResult = CredUIPromptForWindowsCredentialsW(&UiInfo, PrevNpResult,
&AuthPackage, InAuthBuf, InAuthSize, &OutAuthBuf, &OutAuthSize, PSave, &AuthPackage, InAuthBuf, InAuthSize, &OutAuthBuf, &OutAuthSize, PSave,
CREDUIWIN_GENERIC | (0 != PSave ? CREDUIWIN_CHECKBOX : 0)); (0 != AuthPackage0 ? CREDUIWIN_AUTHPACKAGE_ONLY : CREDUIWIN_GENERIC) |
(0 != PSave ? CREDUIWIN_CHECKBOX : 0));
if (ERROR_SUCCESS != NpResult) if (ERROR_SUCCESS != NpResult)
goto exit; goto exit;
@ -460,6 +541,7 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
PWSTR ClassName, InstanceName, RemoteName, P; PWSTR ClassName, InstanceName, RemoteName, P;
ULONG ClassNameLen, InstanceNameLen; ULONG ClassNameLen, InstanceNameLen;
DWORD CredentialsKind; DWORD CredentialsKind;
BOOLEAN AllowImpersonation;
ULONG Argc; ULONG Argc;
PWSTR Argv[6]; PWSTR Argv[6];
ULONG Argl[6]; ULONG Argl[6];
@ -489,7 +571,7 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
return WN_ALREADY_CONNECTED; return WN_ALREADY_CONNECTED;
} }
NpResult = FspNpGetRemoteInfo(lpRemoteName, &CredentialsKind); NpResult = FspNpGetRemoteInfo(lpRemoteName, 0, &CredentialsKind, &AllowImpersonation);
if (WN_SUCCESS != NpResult) if (WN_SUCCESS != NpResult)
return NpResult; return NpResult;
@ -546,7 +628,8 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
NpResult = FspNpCallLauncherPipe( NpResult = FspNpCallLauncherPipe(
FSP_NP_CREDENTIALS_NONE != CredentialsKind ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart, FSP_NP_CREDENTIALS_NONE != CredentialsKind ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart,
Argc, Argv, Argl, 0, 0); Argc, Argv, Argl, 0, 0,
AllowImpersonation);
switch (NpResult) switch (NpResult)
{ {
case WN_SUCCESS: case WN_SUCCESS:
@ -598,7 +681,8 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
if (WN_SUCCESS != FspNpCallLauncherPipe( if (WN_SUCCESS != FspNpCallLauncherPipe(
FspLaunchCmdGetInfo, FspLaunchCmdGetInfo,
Argc, Argv, Argl, 0, 0)) Argc, Argv, Argl, 0, 0,
FALSE))
{ {
/* looks like the file system is gone! */ /* looks like the file system is gone! */
NpResult = WN_NO_NETWORK; NpResult = WN_NO_NETWORK;
@ -655,7 +739,7 @@ DWORD APIENTRY NPAddConnection3(HWND hwndOwner,
{ {
DWORD NpResult; DWORD NpResult;
PWSTR RemoteName = lpNetResource->lpRemoteName; PWSTR RemoteName = lpNetResource->lpRemoteName;
DWORD CredentialsKind; DWORD AuthPackage, CredentialsKind;
WCHAR UserName[CREDUI_MAX_USERNAME_LENGTH + 1], Password[CREDUI_MAX_PASSWORD_LENGTH + 1]; WCHAR UserName[CREDUI_MAX_USERNAME_LENGTH + 1], Password[CREDUI_MAX_PASSWORD_LENGTH + 1];
#if defined(FSP_NP_CREDENTIAL_MANAGER) #if defined(FSP_NP_CREDENTIAL_MANAGER)
BOOL Save = TRUE; BOOL Save = TRUE;
@ -675,7 +759,7 @@ DWORD APIENTRY NPAddConnection3(HWND hwndOwner,
return NpResult; return NpResult;
} }
NpResult = FspNpGetRemoteInfo(RemoteName, &CredentialsKind); NpResult = FspNpGetRemoteInfo(RemoteName, &AuthPackage, &CredentialsKind, 0);
if (WN_SUCCESS != NpResult) if (WN_SUCCESS != NpResult)
return NpResult; return NpResult;
if (FSP_NP_CREDENTIALS_NONE == CredentialsKind) if (FSP_NP_CREDENTIALS_NONE == CredentialsKind)
@ -691,7 +775,7 @@ DWORD APIENTRY NPAddConnection3(HWND hwndOwner,
{ {
NpResult = FspNpGetCredentials( NpResult = FspNpGetCredentials(
hwndOwner, RemoteName, NpResult, hwndOwner, RemoteName, NpResult,
CredentialsKind, AuthPackage, CredentialsKind,
#if defined(FSP_NP_CREDENTIAL_MANAGER) #if defined(FSP_NP_CREDENTIAL_MANAGER)
&Save, &Save,
#else #else
@ -762,7 +846,8 @@ DWORD APIENTRY NPCancelConnection(LPWSTR lpName, BOOL fForce)
NpResult = FspNpCallLauncherPipe( NpResult = FspNpCallLauncherPipe(
FspLaunchCmdStop, FspLaunchCmdStop,
Argc, Argv, Argl, 0, 0); Argc, Argv, Argl, 0, 0,
FALSE);
switch (NpResult) switch (NpResult)
{ {
case WN_SUCCESS: case WN_SUCCESS:

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>
@ -337,26 +341,25 @@ FSP_API NTSTATUS FspAccessCheckEx(FSP_FILE_SYSTEM *FileSystem,
if (Request->Req.Create.UserMode) if (Request->Req.Create.UserMode)
{ {
if (0 != (FileAttributes & FILE_ATTRIBUTE_READONLY)) if (FILE_ATTRIBUTE_READONLY == (FileAttributes & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_DIRECTORY)) &&
(DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_ADD_SUBDIRECTORY | FILE_DELETE_CHILD)))
{ {
if (DesiredAccess & Result = STATUS_ACCESS_DENIED;
(FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_ADD_SUBDIRECTORY | FILE_DELETE_CHILD)) goto exit;
{ }
Result = STATUS_ACCESS_DENIED;
goto exit; if (FILE_ATTRIBUTE_READONLY == (FileAttributes & FILE_ATTRIBUTE_READONLY) &&
} (Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE))
if (Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE) {
{ Result = STATUS_CANNOT_DELETE;
Result = STATUS_CANNOT_DELETE; goto exit;
goto exit;
}
} }
if (0 == SecurityDescriptorSize) if (0 == SecurityDescriptorSize)
*PGrantedAccess = (MAXIMUM_ALLOWED & DesiredAccess) ? *PGrantedAccess = (MAXIMUM_ALLOWED & DesiredAccess) ?
FspFileGenericMapping.GenericAll : DesiredAccess; FspFileGenericMapping.GenericAll : DesiredAccess;
if (0 != (FileAttributes & FILE_ATTRIBUTE_READONLY) && if (FILE_ATTRIBUTE_READONLY == (FileAttributes & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_DIRECTORY)) &&
0 != (MAXIMUM_ALLOWED & DesiredAccess)) 0 != (MAXIMUM_ALLOWED & DesiredAccess))
*PGrantedAccess &= ~(FILE_WRITE_DATA | FILE_APPEND_DATA | *PGrantedAccess &= ~(FILE_WRITE_DATA | FILE_APPEND_DATA |
FILE_ADD_SUBDIRECTORY | FILE_DELETE_CHILD); FILE_ADD_SUBDIRECTORY | FILE_DELETE_CHILD);

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>
@ -63,6 +67,16 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize, PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize,
PULONG PBytesTransferred, ULONG Timeout, PULONG PBytesTransferred, ULONG Timeout,
PSID Sid) PSID Sid)
{
return FspCallNamedPipeSecurelyEx(PipeName,
InBuffer, InBufferSize, OutBuffer, OutBufferSize, PBytesTransferred, Timeout,
FALSE, Sid);
}
FSP_API NTSTATUS FspCallNamedPipeSecurelyEx(PWSTR PipeName,
PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize,
PULONG PBytesTransferred, ULONG Timeout, BOOLEAN AllowImpersonation,
PSID Sid)
{ {
NTSTATUS Result; NTSTATUS Result;
HANDLE Pipe = INVALID_HANDLE_VALUE; HANDLE Pipe = INVALID_HANDLE_VALUE;
@ -71,7 +85,8 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
Pipe = CreateFileW(PipeName, Pipe = CreateFileW(PipeName,
GENERIC_READ | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES, GENERIC_READ | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING,
SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION, 0); SECURITY_SQOS_PRESENT | (AllowImpersonation ? SECURITY_IMPERSONATION : SECURITY_IDENTIFICATION),
0);
if (INVALID_HANDLE_VALUE == Pipe) if (INVALID_HANDLE_VALUE == Pipe)
{ {
if (ERROR_PIPE_BUSY != GetLastError()) if (ERROR_PIPE_BUSY != GetLastError())
@ -85,7 +100,8 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
Pipe = CreateFileW(PipeName, Pipe = CreateFileW(PipeName,
GENERIC_READ | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES, GENERIC_READ | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING,
SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION, 0); SECURITY_SQOS_PRESENT | (AllowImpersonation ? SECURITY_IMPERSONATION : SECURITY_IDENTIFICATION),
0);
if (INVALID_HANDLE_VALUE == Pipe) if (INVALID_HANDLE_VALUE == Pipe)
{ {
Result = FspNtStatusFromWin32(GetLastError()); Result = FspNtStatusFromWin32(GetLastError());

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,
@ -685,7 +707,7 @@ namespace Fsp
/// Describes the modifications to apply to the file or directory security descriptor. /// Describes the modifications to apply to the file or directory security descriptor.
/// </param> /// </param>
/// <returns>STATUS_SUCCESS or error code.</returns> /// <returns>STATUS_SUCCESS or error code.</returns>
/// <seealso cref="ModifySecurityDescriptor"/> /// <seealso cref="ModifySecurityDescriptorEx"/>
public virtual Int32 SetSecurity( public virtual Int32 SetSecurity(
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>
@ -1036,7 +1105,7 @@ namespace Fsp
return (int)Api.FspFileSystemOperationProcessId(); return (int)Api.FspFileSystemOperationProcessId();
} }
/// <summary> /// <summary>
/// Modifies a security descriptor. /// Modifies a security descriptor. [OBSOLETE]
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This is a helper for implementing the SetSecurity operation. /// This is a helper for implementing the SetSecurity operation.
@ -1052,6 +1121,7 @@ namespace Fsp
/// </param> /// </param>
/// <returns>The modified security descriptor.</returns> /// <returns>The modified security descriptor.</returns>
/// <seealso cref="SetSecurity"/> /// <seealso cref="SetSecurity"/>
[Obsolete("use ModifySecurityDescriptorEx")]
public static byte[] ModifySecurityDescriptor( public static byte[] ModifySecurityDescriptor(
Byte[] SecurityDescriptor, Byte[] SecurityDescriptor,
AccessControlSections Sections, AccessControlSections Sections,
@ -1071,6 +1141,47 @@ namespace Fsp
SecurityInformation, SecurityInformation,
ModificationDescriptor); ModificationDescriptor);
} }
/// <summary>
/// Modifies a security descriptor.
/// </summary>
/// <remarks>
/// This is a helper for implementing the SetSecurity operation.
/// </remarks>
/// <param name="SecurityDescriptor">
/// The original security descriptor.
/// </param>
/// <param name="Sections">
/// Describes what parts of the file or directory security descriptor should be modified.
/// </param>
/// <param name="ModificationDescriptor">
/// Describes the modifications to apply to the file or directory security descriptor.
/// </param>
/// <param name="ModifiedDescriptor">
/// The modified security descriptor. This parameter is modified only on success.
/// </param>
/// <returns>STATUS_SUCCESS or error code.</returns>
/// <seealso cref="SetSecurity"/>
public static Int32 ModifySecurityDescriptorEx(
Byte[] SecurityDescriptor,
AccessControlSections Sections,
Byte[] ModificationDescriptor,
ref Byte[] ModifiedDescriptor)
{
UInt32 SecurityInformation = 0;
if (0 != (Sections & AccessControlSections.Owner))
SecurityInformation |= 1/*OWNER_SECURITY_INFORMATION*/;
if (0 != (Sections & AccessControlSections.Group))
SecurityInformation |= 2/*GROUP_SECURITY_INFORMATION*/;
if (0 != (Sections & AccessControlSections.Access))
SecurityInformation |= 4/*DACL_SECURITY_INFORMATION*/;
if (0 != (Sections & AccessControlSections.Audit))
SecurityInformation |= 8/*SACL_SECURITY_INFORMATION*/;
return Api.ModifySecurityDescriptorEx(
SecurityDescriptor,
SecurityInformation,
ModificationDescriptor,
ref ModifiedDescriptor);
}
public Int32 SeekableReadDirectory( public Int32 SeekableReadDirectory(
Object FileNode, Object FileNode,
Object FileDesc, Object FileDesc,

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]
@ -916,6 +928,26 @@ namespace Fsp.Interop
return SecurityDescriptorBytes; return SecurityDescriptorBytes;
} }
} }
internal unsafe static Int32 ModifySecurityDescriptorEx(
Byte[] SecurityDescriptorBytes,
UInt32 SecurityInformation,
Byte[] ModificationDescriptorBytes,
ref Byte[] ModifiedDescriptorBytes)
{
fixed (Byte *S = SecurityDescriptorBytes)
fixed (Byte *M = ModificationDescriptorBytes)
{
IntPtr SecurityDescriptor;
Int32 Result = FspSetSecurityDescriptor(
(IntPtr)S, SecurityInformation, (IntPtr)M, out SecurityDescriptor);
if (0 > Result)
return Result;
SecurityDescriptorBytes = MakeSecurityDescriptor(SecurityDescriptor);
FspDeleteSecurityDescriptor(SecurityDescriptor, _FspSetSecurityDescriptorPtr);
ModifiedDescriptorBytes = SecurityDescriptorBytes;
return 0/*STATUS_SUCCESS*/;
}
}
internal unsafe static Int32 CopyReparsePoint( internal unsafe static Int32 CopyReparsePoint(
Byte[] ReparseData, Byte[] ReparseData,

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>
@ -68,8 +72,8 @@ static int call_pipe_and_report(PWSTR PipeBuf, ULONG SendSize, ULONG RecvSize)
NTSTATUS Result; NTSTATUS Result;
DWORD LastError, BytesTransferred; DWORD LastError, BytesTransferred;
Result = FspCallNamedPipeSecurely(L"" FSP_LAUNCH_PIPE_NAME, PipeBuf, SendSize, PipeBuf, RecvSize, Result = FspCallNamedPipeSecurelyEx(L"" FSP_LAUNCH_PIPE_NAME, PipeBuf, SendSize, PipeBuf, RecvSize,
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, FSP_LAUNCH_PIPE_OWNER); &BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, TRUE, FSP_LAUNCH_PIPE_OWNER);
LastError = FspWin32FromNtStatus(Result); LastError = FspWin32FromNtStatus(Result);
if (0 != LastError) if (0 != LastError)

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>
@ -251,6 +255,7 @@ exit:
static BOOL LogonCreateProcess( static BOOL LogonCreateProcess(
PWSTR UserName, PWSTR UserName,
HANDLE Token,
LPCWSTR ApplicationName, LPCWSTR ApplicationName,
LPWSTR CommandLine, LPWSTR CommandLine,
LPSECURITY_ATTRIBUTES ProcessAttributes, LPSECURITY_ATTRIBUTES ProcessAttributes,
@ -267,11 +272,20 @@ static BOOL LogonCreateProcess(
if (0 != UserName) if (0 != UserName)
{ {
if (0 == invariant_wcsicmp(UserName, L"LocalSystem")) if (0 == invariant_wcsicmp(UserName, L"LocalSystem"))
{
UserName = 0; UserName = 0;
Token = 0;
}
else else
if (0 == invariant_wcsicmp(UserName, L"LocalService") || if (0 == invariant_wcsicmp(UserName, L"LocalService") ||
0 == invariant_wcsicmp(UserName, L"NetworkService")) 0 == invariant_wcsicmp(UserName, L"NetworkService"))
{
DomainName = L"NT AUTHORITY"; DomainName = L"NT AUTHORITY";
Token = 0;
}
else
if (0 == invariant_wcsicmp(UserName, L"."))
;
else else
{ {
SetLastError(ERROR_ACCESS_DENIED); SetLastError(ERROR_ACCESS_DENIED);
@ -295,18 +309,40 @@ static BOOL LogonCreateProcess(
HANDLE LogonToken = 0; HANDLE LogonToken = 0;
PVOID EnvironmentBlock = 0; PVOID EnvironmentBlock = 0;
DWORD SessionId;
DWORD LastError; DWORD LastError;
BOOL Success; BOOL Success;
Success = LogonUserW( if (0 == Token)
UserName, {
DomainName, Success = LogonUserW(
0, UserName,
LOGON32_LOGON_SERVICE, DomainName,
LOGON32_PROVIDER_DEFAULT, 0,
&LogonToken); LOGON32_LOGON_SERVICE,
if (!Success) LOGON32_PROVIDER_DEFAULT,
goto exit; &LogonToken);
if (!Success)
goto exit;
}
else
{
/* convert the impersonation token to a primary token */
Success = DuplicateTokenEx(Token,
TOKEN_ALL_ACCESS,
0,
SecurityAnonymous,
TokenPrimary,
&LogonToken);
if (!Success)
goto exit;
if (!ProcessIdToSessionId(GetCurrentProcessId(), &SessionId))
SessionId = 0;
/* place the duplicated token in the service session (session 0) */
Success = SetTokenInformation(LogonToken, TokenSessionId, &SessionId, sizeof SessionId);
if (!Success)
goto exit;
}
if (0 == Environment) if (0 == Environment)
{ {
@ -659,7 +695,7 @@ static NTSTATUS SvcInstanceAccessCheck(HANDLE ClientToken, ULONG DesiredAccess,
return Result; return Result;
} }
static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName, static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName, HANDLE ClientToken,
PWSTR Executable, PWSTR CommandLine, PWSTR WorkDirectory, PWSTR Executable, PWSTR CommandLine, PWSTR WorkDirectory,
HANDLE StdioHandles[2], HANDLE StdioHandles[2],
PPROCESS_INFORMATION ProcessInfo) PPROCESS_INFORMATION ProcessInfo)
@ -754,7 +790,7 @@ static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
StartupInfoEx.StartupInfo.hStdOutput = ChildHandles[1]; StartupInfoEx.StartupInfo.hStdOutput = ChildHandles[1];
StartupInfoEx.StartupInfo.hStdError = ChildHandles[2]; StartupInfoEx.StartupInfo.hStdError = ChildHandles[2];
if (!LogonCreateProcess(UserName, if (!LogonCreateProcess(UserName, ClientToken,
Executable, CommandLine, 0, 0, TRUE, Executable, CommandLine, 0, 0, TRUE,
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP | EXTENDED_STARTUPINFO_PRESENT, CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP | EXTENDED_STARTUPINFO_PRESENT,
0, WorkDirectory, 0, WorkDirectory,
@ -775,7 +811,7 @@ static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
* Not ideal, but... * Not ideal, but...
*/ */
StartupInfoEx.StartupInfo.cb = sizeof StartupInfoEx.StartupInfo; StartupInfoEx.StartupInfo.cb = sizeof StartupInfoEx.StartupInfo;
if (!LogonCreateProcess(UserName, if (!LogonCreateProcess(UserName, ClientToken,
Executable, CommandLine, 0, 0, TRUE, Executable, CommandLine, 0, 0, TRUE,
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP, CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP,
0, WorkDirectory, 0, WorkDirectory,
@ -788,7 +824,7 @@ static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
} }
else else
{ {
if (!LogonCreateProcess(UserName, if (!LogonCreateProcess(UserName, ClientToken,
Executable, CommandLine, 0, 0, FALSE, Executable, CommandLine, 0, 0, FALSE,
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP, CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP,
0, WorkDirectory, 0, WorkDirectory,
@ -1005,7 +1041,7 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
goto exit; goto exit;
Result = SvcInstanceCreateProcess(L'\0' != RunAsBuf[0] ? RunAsBuf : 0, Result = SvcInstanceCreateProcess(L'\0' != RunAsBuf[0] ? RunAsBuf : 0, ClientToken,
Executable, SvcInstance->CommandLine, L'\0' != WorkDirectory[0] ? WorkDirectory : 0, Executable, SvcInstance->CommandLine, L'\0' != WorkDirectory[0] ? WorkDirectory : 0,
RedirectStdio ? SvcInstance->StdioHandles : 0, &ProcessInfo); RedirectStdio ? SvcInstance->StdioHandles : 0, &ProcessInfo);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
@ -1625,7 +1661,10 @@ static DWORD WINAPI SvcPipeServer(PVOID Context)
ClientToken = 0; ClientToken = 0;
if (!ImpersonateNamedPipeClient(SvcPipe) || if (!ImpersonateNamedPipeClient(SvcPipe) ||
!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &ClientToken) || (
!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY | TOKEN_DUPLICATE, FALSE, &ClientToken) &&
!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &ClientToken)
) ||
!RevertToSelf()) !RevertToSelf())
{ {
LastError = GetLastError(); LastError = GetLastError();

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,13 +10,19 @@
* 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>
static NTSTATUS FspFsvrtDeviceControl(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp);
static NTSTATUS FspFsvolDeviceControl( static NTSTATUS FspFsvolDeviceControl(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp); PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp);
FSP_IOCMPL_DISPATCH FspFsvolDeviceControlComplete; FSP_IOCMPL_DISPATCH FspFsvolDeviceControlComplete;
@ -24,6 +30,7 @@ static FSP_IOP_REQUEST_FINI FspFsvolDeviceControlRequestFini;
FSP_DRIVER_DISPATCH FspDeviceControl; FSP_DRIVER_DISPATCH FspDeviceControl;
#ifdef ALLOC_PRAGMA #ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, FspFsvrtDeviceControl)
#pragma alloc_text(PAGE, FspFsvolDeviceControl) #pragma alloc_text(PAGE, FspFsvolDeviceControl)
#pragma alloc_text(PAGE, FspFsvolDeviceControlComplete) #pragma alloc_text(PAGE, FspFsvolDeviceControlComplete)
#pragma alloc_text(PAGE, FspFsvolDeviceControlRequestFini) #pragma alloc_text(PAGE, FspFsvolDeviceControlRequestFini)
@ -35,6 +42,28 @@ enum
RequestFileNode = 0, RequestFileNode = 0,
}; };
static NTSTATUS FspFsvrtDeviceControl(
PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
{
PAGED_CODE();
/*
* Fix GitHub issue #177. All credit for the investigation of this issue
* and the suggested steps to reproduce and work around the problem goes
* to GitHub user @thinkport.
*
* When Windows attempts to mount a new volume it iterates over all disk file
* systems registered with IoRegisterFileSystem. Foreign (i.e. non-WinFsp) file
* systems would in some cases attempt to mount our Fsvrt volume device by
* sending it unknown IOCTL codes, which would then be failed with
* STATUS_INVALID_DEVICE_REQUEST. Unfortunately the file systems would then
* report this error code to the I/O Manager, which would cause it to abort the
* mounting process completely and thus WinFsp would never get a chance to
* mount its own volume device!
*/
return STATUS_UNRECOGNIZED_VOLUME;
}
static NTSTATUS FspFsvolDeviceControl( static NTSTATUS FspFsvolDeviceControl(
PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp) PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
{ {
@ -151,6 +180,8 @@ NTSTATUS FspDeviceControl(
{ {
case FspFsvolDeviceExtensionKind: case FspFsvolDeviceExtensionKind:
FSP_RETURN(Result = FspFsvolDeviceControl(DeviceObject, Irp, IrpSp)); FSP_RETURN(Result = FspFsvolDeviceControl(DeviceObject, Irp, IrpSp));
case FspFsvrtDeviceExtensionKind:
FSP_RETURN(Result = FspFsvrtDeviceControl(DeviceObject, Irp, IrpSp));
default: default:
FSP_RETURN(Result = STATUS_INVALID_DEVICE_REQUEST); FSP_RETURN(Result = STATUS_INVALID_DEVICE_REQUEST);
} }

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>
@ -165,6 +169,21 @@ NTSTATUS DriverEntry(
&FspFsmupDeviceObject); &FspFsmupDeviceObject);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
goto exit; goto exit;
#if DBG
/*
* Fix GitHub issue #177. All credit for the investigation of this issue
* and the suggested steps to reproduce and work around the problem goes
* to GitHub user @thinkport.
*
* On debug builds set DO_LOW_PRIORITY_FILESYSTEM to place the file system
* at the end of the file system list during IoRegisterFileSystem below.
* This allows us to test the behavior of our Fsvrt devices when foreign
* file systems attempt to use them for mounting.
*/
SetFlag(FspFsctlDiskDeviceObject->Flags, DO_LOW_PRIORITY_FILESYSTEM);
#endif
Result = FspDeviceInitialize(FspFsctlDiskDeviceObject); Result = FspDeviceInitialize(FspFsctlDiskDeviceObject);
ASSERT(STATUS_SUCCESS == Result); ASSERT(STATUS_SUCCESS == Result);
Result = FspDeviceInitialize(FspFsctlNetDeviceObject); Result = FspDeviceInitialize(FspFsctlNetDeviceObject);
@ -229,6 +248,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 +288,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
@ -713,13 +725,13 @@ exit /b 0
:sample-passthrough-fuse3-x64 :sample-passthrough-fuse3-x64
call :__run_sample_fuse_test passthrough-fuse3 x64 passthrough-fuse3-x64 winfsp-tests-x64 ^ call :__run_sample_fuse_test passthrough-fuse3 x64 passthrough-fuse3-x64 winfsp-tests-x64 ^
"-create_fileattr_test -setfileinfo_test" "-create_fileattr_test -create_readonlydir_test -setfileinfo_test"
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
exit /b 0 exit /b 0
:sample-passthrough-fuse3-x86 :sample-passthrough-fuse3-x86
call :__run_sample_fuse_test passthrough-fuse3 x86 passthrough-fuse3-x86 winfsp-tests-x86 ^ call :__run_sample_fuse_test passthrough-fuse3 x86 passthrough-fuse3-x86 winfsp-tests-x86 ^
"-create_fileattr_test -setfileinfo_test" "-create_fileattr_test -create_readonlydir_test -setfileinfo_test"
if !ERRORLEVEL! neq 0 goto fail if !ERRORLEVEL! neq 0 goto fail
exit /b 0 exit /b 0
@ -911,7 +923,7 @@ cd L: >nul 2>nul || (echo Unable to find drive L: >&2 & goto fail)
L: L:
"%ProjRoot%\build\VStudio\build\%Configuration%\%3.exe" ^ "%ProjRoot%\build\VStudio\build\%Configuration%\%3.exe" ^
--external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^ --external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^
-create_fileattr_test -create_allocation_test -create_notraverse_test -create_backup_test -create_restore_test -create_namelen_test ^ -create_fileattr_test -create_readonlydir_test -create_allocation_test -create_notraverse_test -create_backup_test -create_restore_test -create_namelen_test ^
-getfileinfo_name_test -setfileinfo_test -delete_access_test -delete_mmap_test -rename_flipflop_test -rename_mmap_test -setsecurity_test -querydir_namelen_test -exec_rename_dir_test ^ -getfileinfo_name_test -setfileinfo_test -delete_access_test -delete_mmap_test -rename_flipflop_test -rename_mmap_test -setsecurity_test -querydir_namelen_test -exec_rename_dir_test ^
-reparse* -stream* -reparse* -stream*
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1 if !ERRORLEVEL! neq 0 set RunSampleTestExit=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.
*/ */
/* /*
* 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
{ {
@ -289,7 +297,7 @@ void DeleteAllNodes(AIRFS_ Airfs)
else else
{ {
#if defined(AIRFS_NAMED_STREAMS) #if defined(AIRFS_NAMED_STREAMS)
if (Node->Streams) if (Node->Streams)
{ {
for (auto Iter = Node->Streams->begin(); Iter != Node->Streams->end(); ) for (auto Iter = Node->Streams->begin(); Iter != Node->Streams->end(); )
{ {
@ -334,7 +342,7 @@ NTSTATUS FindNode(AIRFS_ Airfs, PWSTR Name, PWSTR *BaseName,
{ {
// Isolate the next base name. // Isolate the next base name.
for (fm = to+1; *fm == L'\\'; fm++) {} for (fm = to+1; *fm == L'\\'; fm++) {}
for (to = fm; *to != L'\0' && *to != L'\\'; to++) for (to = fm; *to != L'\0' && *to != L'\\'; to++)
if (*to == ':'){Colon = to; break;} if (*to == ':'){Colon = to; break;}
if (*to == 0) break; if (*to == 0) break;
*to = 0; *to = 0;
@ -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))
@ -1419,9 +1421,9 @@ NTSTATUS ApiReadDirectory(FSP_FILE_SYSTEM *FileSystem, PVOID Node0,
{ {
NODE_ Node = *Iter; NODE_ Node = *Iter;
if (!AddDirInfo(Node, Node->Name, Buffer, Length, PBytesTransferred)) if (!AddDirInfo(Node, Node->Name, Buffer, Length, PBytesTransferred))
{ {
goto bufferReady; goto bufferReady;
} }
} }
FspFileSystemAddDirInfo(0, Buffer, Length, PBytesTransferred); FspFileSystemAddDirInfo(0, Buffer, Length, PBytesTransferred);
@ -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),
@ -1998,7 +2034,7 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
" -R RarefyDelay [adjust the rarity of pending slow IO]\n" " -R RarefyDelay [adjust the rarity of pending slow IO]\n"
" -F FileSystemName\n" " -F FileSystemName\n"
" -S RootSddl [file rights: FA, etc; NO generic rights: GA, etc.]\n" " -S RootSddl [file rights: FA, etc; NO generic rights: GA, etc.]\n"
" -u \\Server\\Share [UNC prefix (single backslash)]\n" " -u \\Server\\Share [UNC prefix (single backslash)]\n"
" -m MountPoint [X:|* (required if no UNC prefix)]\n"; " -m MountPoint [X:|* (required if no UNC prefix)]\n";
fail(usage, L"" PROGNAME); fail(usage, L"" PROGNAME);
@ -2010,7 +2046,7 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
NTSTATUS SvcStop(FSP_SERVICE *Service) NTSTATUS SvcStop(FSP_SERVICE *Service)
{ {
AIRFS_ Airfs = (AIRFS_) Service->UserContext; AIRFS_ Airfs = (AIRFS_) Service->UserContext;
AirfsStop(Airfs); AirfsStop(Airfs);
AirfsDelete(Airfs); AirfsDelete(Airfs);

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;
@ -779,10 +783,8 @@ namespace memfs
if (null != FileNode.MainFileNode) if (null != FileNode.MainFileNode)
FileNode = FileNode.MainFileNode; FileNode = FileNode.MainFileNode;
FileNode.FileSecurity = ModifySecurityDescriptor( return ModifySecurityDescriptorEx(FileNode.FileSecurity, Sections, SecurityDescriptor,
FileNode.FileSecurity, Sections, SecurityDescriptor); ref FileNode.FileSecurity);
return STATUS_SUCCESS;
} }
public override Boolean ReadDirectoryEntry( public override Boolean ReadDirectoryEntry(

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

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