Compare commits

..

143 Commits

Author SHA1 Message Date
ee1ae0370e build: version.properties: fix product version 2019-03-29 16:38:14 -07:00
1ebceb8214 installer: fix refs to cygfuse 2019-03-29 13:38:19 -07:00
e6bb463444 cygfuse: update packages 2019-03-29 13:03:51 -07:00
86231de113 update changelog 2019-03-29 12:46:13 -07:00
a2cc564400 dll: posix: update upper limit on UID 2019-03-29 12:06:36 -07:00
5239c63274 Contributors: sort names 2019-03-29 11:50:34 -07:00
2d46387faa Merge pull request #223 from sganis/master
Fixed invalid Sid bug
2019-03-29 11:47:51 -07:00
d2381f3425 tst: passthrough-fuse3: xattr 2019-03-26 17:36:02 -07:00
4e7d2fd204 tst: passthrough-fuse: xattr 2019-03-26 17:25:46 -07:00
San
e6fb014c79 Updated contributors list 2019-03-23 02:57:25 +03:00
574efe3f72 sys: dirctl: add magic constant 4 to EaSize 2019-03-21 21:50:28 -07:00
88896c2fd8 dotnet: interop: FileInfo.EaSize is now a property 2019-03-21 21:42:27 -07:00
46210b0c48 tst: passthrough-dotnet: fix compilation problem 2019-03-21 19:48:06 -07:00
3d646bdf88 tools: run-tests: enable ifstest EA tests 2019-03-21 18:19:01 -07:00
732e6cc38c grand EaSize patch; passes winfsp-tests and ifstest 2019-03-21 18:14:15 -07:00
b619dbfe97 tst: memfs, memfs-dotnet: EaSize support 2019-03-21 15:05:39 -07:00
948254f083 dotnet: EA support 2019-03-21 15:05:14 -07:00
62b0e889b2 sys: FileEaInformation and EaSize support 2019-03-21 14:05:17 -07:00
8c0957f702 tools: run-tests: EA testing 2019-03-20 19:42:45 -07:00
0dbc3f9f25 tools: run-tests 2019-03-20 19:13:54 -07:00
2d0c8e14be sys: FspEaBufferFromOriginatingProcessValidate, FspEaBufferFromFileSystemValidate 2019-03-20 19:06:24 -07:00
8c6d037332 dll: fuse: extended attributes support 2019-03-20 14:32:00 -07:00
c23aabe533 sys: ea: return STATUS_INVALID_DEVICE_REQUEST if no ExtendedAttributes 2019-03-20 13:08:20 -07:00
San
6e2b509697 Fixed invalid Sid bug 2019-03-20 09:54:01 +03:00
d2b6c4691e sys: create: minor fix 2019-03-19 18:36:52 -07:00
ff6421866d Merge branch 'pvt-xattr' 2019-03-19 18:23:47 -07:00
0664b492c8 inc: fsctl: fix FSP_FSCTL_VOLUME_PARAMS sizes 2019-03-19 16:29:08 -07:00
58fa2a0620 appveyor: troubleshoot 2019-03-19 16:09:57 -07:00
e6d1de1cad appveyor: troubleshoot 2019-03-19 15:35:53 -07:00
37bcfc888a tst: memfs-dotnet: testing EA support 2019-03-19 15:27:43 -07:00
ff94a63c37 tst: winfsp-tests: Overwrite: EA support 2019-03-19 14:21:25 -07:00
a830de9d04 sys: create: overwrite EA support 2019-03-19 13:22:35 -07:00
02a650f8d0 sys: ea: return STATUS_EA_CORRUPT_ERROR when appropriate 2019-03-19 11:15:14 -07:00
5c42377c1b tst: memfs-dotnet: ea support 2019-03-18 18:43:18 -07:00
ad612c535d tst: memfs-dotnet: ea support 2019-03-18 13:51:58 -07:00
4d4bf92c32 tst: memfs: cosmetic change 2019-03-17 17:17:30 -07:00
7ee289fb13 tst: winfsp-tests: ea 2019-03-17 13:25:29 -07:00
c6e1b15b37 tst: winfsp-tests: ea 2019-03-17 13:13:12 -07:00
1dfbb0d9bf tst: winfsp-tests: ea 2019-03-17 13:08:12 -07:00
92dfb0be96 tst: winfsp-tests: ea 2019-03-17 12:39:00 -07:00
41c3465f2a tst: winfsp-tests: ea 2019-03-17 12:21:32 -07:00
9e5d75fadc sys: util: FspEaBufferAndNamesValid 2019-03-16 13:58:09 -07:00
91568edc45 sys: ea: testing 2019-03-16 00:04:00 -07:00
67bd49d5d4 tst: winfsp-tests: ea_getset_test 2019-03-15 16:43:54 -07:00
cdb1ca22fc tst: winfsp-tests: ea_getset_test 2019-03-15 15:29:37 -07:00
ef6df51b5e tst: winfsp-tests: ea_create_test 2019-03-15 14:21:17 -07:00
1aa2353ca6 tst: winfsp-tests: ea_create_test 2019-03-15 14:04:03 -07:00
351285f5c6 tst: winfsp-tests: ea_create_test 2019-03-15 13:44:45 -07:00
c4ef64e31f tst: winfsp-tests: ea_create_test 2019-03-15 12:47:36 -07:00
5aa06358fc tst: winfsp-tests: ea_create_test 2019-03-15 12:43:14 -07:00
9fd491fa3d sys, dll: ea testing 2019-03-15 11:21:11 -07:00
d3efdd9219 dll, sys: FSP_NEXT_EA 2019-03-14 22:04:31 -07:00
d59976bd5d tst: winfsp-tests: ea_create_test 2019-03-14 21:36:29 -07:00
3553aec992 dotnet: extended attributes support 2019-03-14 15:05:17 -07:00
795caec679 tst: memfs: VolumeParams.ExtendedAttributes 2019-03-13 21:59:27 -07:00
3dd8ae24a8 sys: FspFsvolSetEa: check EaName validity 2019-03-13 21:45:09 -07:00
d8686a7726 tst: memfs: extended attributes support 2019-03-13 21:44:10 -07:00
58c6708123 tools: cloc.bat wraps cloc 2019-03-13 15:15:07 -07:00
b2912460e0 tools: cloc.bat wraps cloc 2019-03-13 15:04:39 -07:00
a811cd2cf8 sys, dll: extended attributes: checkpoint 2019-03-13 14:29:49 -07:00
7ec47f8125 Update README 2019-03-11 17:12:44 -07:00
778f5f70dc build: remove anycpu configuration 2019-03-11 14:06:29 -07:00
09d9928195 README: add link to WinSpd 2019-03-11 13:08:50 -07:00
e2349fef10 Merge branch 'pvt-fix217' 2019-03-11 13:03:49 -07:00
ad866631b6 Merge pull request #219 from dworkin/read-4g-corruption
Fix read corruption issue.
2019-03-11 13:01:44 -07:00
4cdc8b4d9c Update contributor's agreement. 2019-03-07 09:57:49 +01:00
b350dffe6c Fix 32 bit overflow issue in FspFsvolReadCached.
FspFsvolReadCached takes care not to read beyond the end of the file.
However, the offset check uses a 32 bit comparison, which fails for
files >= 4G.  As a result, reads on a large file will skip blocks at
offset (filesize % 4G), and those blocks will zero-filled.
2019-03-07 09:45:42 +01:00
70dd54e114 sys: write: FspFsvolWriteCached
- double-check that WriteEndOffset is within file bounds
2019-02-28 11:00:47 -08:00
d2de5e996c update source copyright for 2019 2019-02-28 10:39:31 -08:00
85cdb37f10 bump version to v1.5 2019-02-28 10:30:52 -08:00
c2553e3451 Merge pull request #216 from VidaID/cpp-flushpurge
Make FlushAndPurgeOnCleanup accessible in C++
2019-02-25 14:07:48 -08:00
9cd2f6972b Set FlushAndPurgeOnCleanup in the C++ passthrough 2019-02-25 14:25:56 -05:00
791a2162a3 fix: Make FlushAndPurgeOnCleanup accessible in C++
Adds the appropriate setters and getters to the C++ API.
2019-02-22 11:14:48 -05:00
5d8686b64e Merge branch 'release/1.4' 2019-02-19 12:17:01 -08:00
41f80d9c24 update changelog 2019-02-19 12:02:11 -08:00
b69ed7e2f0 Fix #213 and a typo in macro FSP_FUSE_CTLCODE_FROM_IOCTL 2019-02-18 12:25:34 -08:00
f214561832 update changelog 2019-02-18 12:23:56 -08:00
35c06fe0ba bump version to 2019.2 Gold 2019-02-18 12:20:40 -08:00
d1c15b43ca Merge pull request #214 from felfert/fix-fuse-ioctl
Fix #213 and a typo in macro FSP_FUSE_CTLCODE_FROM_IOCTL
2019-02-12 10:29:55 -08:00
f97b8fcc3a Fix #213 and a typo in macro FSP_FUSE_CTLCODE_FROM_IOCTL 2019-02-12 11:51:07 +01:00
1d701a3560 Merge branch 'release/1.4' 2018-12-10 10:06:36 -08:00
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
d2f6ceaf28 Merge branch 'release/1.4' 2018-12-10 09:36:03 -08:00
b323925d94 update changelog 2018-12-10 09:34:17 -08:00
ab6e07853c Merge branch 'release/1.4' 2018-12-08 13:56:50 -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
e0a6312387 Merge branch 'release/1.4' 2018-11-27 16:27:15 -08:00
5d2705f3f9 Merge branch 'release/1.4' 2018-11-26 14:59:38 -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
618a59fc0e dll: ensure FspFileSystemFinalize is called 2018-11-13 10:11:39 -08:00
fcd3aff811 Merge branch 'release/1.4': fix #190 2018-11-06 10:12:45 -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
74df26a28d Merge branch 'release/1.4' 2018-10-09 14:32:42 -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
60aee6867c tools: run-tests: disable getfileattr_test for compat-fuse tests 2018-10-04 14:58:34 -07:00
33eb5d1703 fsbench: file_attr_test 2018-10-04 14:55:58 -07:00
4d49039abe sys: FspFastIoQueryOpen: access control
Extend the WinFsp kernel-user mode protocol to allow passing
security descriptors that can then be used for access control
during FastIoQueryOpen.
2018-10-04 13:21:29 -07:00
fd9eccbe8b memfs: AllowOpenInKernelMode==1
The getfileattr_test is expected to fail.
2018-10-03 09:32:14 -07:00
4255d4eec7 tools: run-tests: disable getfileattr_test on file systems that cannot pass it 2018-10-03 09:31:21 -07:00
d813116f77 winfsp-tests: getfileattr_test 2018-10-02 22:35:44 -07:00
a201919291 winfsp-tests: getfileattr_test 2018-10-02 21:44:23 -07:00
1aab4662e5 inc, sys, dotnet: FSP_FSCTL_VOLUME_PARAMS::AllowOpenInKernelMode 2018-10-02 11:47:51 -07:00
02a4d3641e sys: implement FastIo operations
FspFastIoQueryOpen: return FALSE when RelatedFileObject is not NULL
2018-10-02 11:12:26 -07:00
3dfbdc313b sys: implement FastIo operations
DEBUGTEST
2018-10-02 11:12:25 -07:00
3a286324ff sys: implement FastIo operations
FspFastIoQueryOpen
2018-10-02 11:12:25 -07:00
0d849ffcc8 sys: implement FastIo operations
FastIoQueryBasicInfo, FastIoQueryStandardInfo, FastIoQueryNetworkOpenInfo
2018-10-02 11:12:24 -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
169 changed files with 6430 additions and 962 deletions

View File

@ -1,6 +1,86 @@
= Changelog
v1.5B1 (2019.3 B1)::
Changes since v1.4:
* Extended attribute support has been added for all WinFsp API's: native, .NET, FUSE2 and FUSE3.
* Initial FastIO support has been added. FastIO operations are enabled on cache-enabled file systems with the notable exception of `FastIoQueryOpen`, which allows opening files in kernel mode; this operation requires the file system to specify the `FSP_FSCTL_VOLUME_PARAMS::AllowOpenInKernelMode` flag.
* Fixes for very large (> 4GiB) files. (Thanks @dworkin.)
* A fix for an invalid UID to SID mapping on domains with a lot of users. (Thanks @sganis.)
* A fix on the C++ layer. (Thanks @colatkinson.)
v1.4.19049 (2019.2)::
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.)
* The FUSE layer includes a fix for the `ioctl` operation. (GitHub PR #214. Thanks @felfert.)
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)::
Changes since v1.3:

View File

@ -56,9 +56,12 @@ CONTRIBUTOR LIST
|===
|Ben Rubson |ben.rubson at gmail.com
|Bill Zissimopoulos |billziss at navimatics.com
|Colin Atkinson (Atakama, https://atakama.com) |colin at atakama.com
|Felix Croes |felix at dworkin.nl
|Francois Karam (KS2, http://www.ks2.fr) |francois.karam at ks2.fr
|Fritz Elfert |fritz-github at fritz-elfert.de
|John Oberschelp |john at oberschelp.net
|Sam Kelly (DuroSoft Technologies LLC, https://durosoft.com) |sam at durosoft.com
|Santiago Ganis |sganis at gmail.com
|Tobias Urlaub |saibotu at outlook.de
|===

View File

@ -29,6 +29,9 @@
</a>
<br/>
<br/>
<b>Check out my new kernel driver project <a href="https://github.com/billziss-gh/winspd">WinSpd</a>.</b>
<br/>
<br/>
</p>
<p align="center">

View File

@ -11,6 +11,9 @@ environment:
#- CONFIGURATION: Release
# TESTING: Perf
init:
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
install:
- git submodule update --init --recursive
- appveyor AddMessage "Change boot configuration and reboot" -Category Information
@ -42,3 +45,4 @@ test_script:
on_finish:
- if exist %SystemRoot%\memory.dmp (7z a memory.dmp.zip %SystemRoot%\memory.dmp && appveyor PushArtifact memory.dmp.zip)
- verifier /query
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@ -1,7 +1,7 @@
/**
* @file CustomActions.cpp
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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

View File

@ -348,18 +348,18 @@
<Directory Id="OPTDIR.cygfuse" Name="cygfuse" FileSource="..\..\..\opt\cygfuse\dist">
<Directory Id="OPTDIR.cygfuse.x64" Name="x64">
<Component Id="C.fuse.tar.xz.x64">
<File Id="FILE.fuse.tar.xz.x64" Name="fuse-2.8-9.tar.xz" KeyPath="yes" />
<File Id="FILE.fuse.tar.xz.x64" Name="fuse-2.8-10.tar.xz" KeyPath="yes" />
</Component>
<Component Id="C.fuse3.tar.xz.x64">
<File Id="FILE.fuse3.tar.xz.x64" Name="fuse3-3.2-1.tar.xz" KeyPath="yes" />
<File Id="FILE.fuse3.tar.xz.x64" Name="fuse3-3.2-2.tar.xz" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="OPTDIR.cygfuse.x86" Name="x86">
<Component Id="C.fuse.tar.xz.x86">
<File Id="FILE.fuse.tar.xz.x86" Name="fuse-2.8-9.tar.xz" KeyPath="yes" />
<File Id="FILE.fuse.tar.xz.x86" Name="fuse-2.8-10.tar.xz" KeyPath="yes" />
</Component>
<Component Id="C.fuse3.tar.xz.x86">
<File Id="FILE.fuse3.tar.xz.x86" Name="fuse3-3.2-1.tar.xz" KeyPath="yes" />
<File Id="FILE.fuse3.tar.xz.x86" Name="fuse3-3.2-2.tar.xz" KeyPath="yes" />
</Component>
</Directory>
<Component Id="C.fuse.install.sh">

View File

@ -185,6 +185,7 @@
<ClCompile Include="..\..\..\tst\winfsp-tests\devctl-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\dirbuf-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\dirctl-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\ea-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\eventlog-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\exec-test.c" />
<ClCompile Include="..\..\..\tst\winfsp-tests\flush-test.c" />

View File

@ -94,6 +94,9 @@
<ClCompile Include="..\..\..\tst\winfsp-tests\fuse-test.c">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\tst\winfsp-tests\ea-test.c">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\ext\tlib\testsuite.h">

View File

@ -16,9 +16,9 @@
<MyCompanyName>Navimatics Corporation</MyCompanyName>
<MyCopyright>2015-$([System.DateTime]::Now.ToString(`yyyy`)) Bill Zissimopoulos</MyCopyright>
<MyCanonicalVersion>1.4</MyCanonicalVersion>
<MyCanonicalVersion>1.5</MyCanonicalVersion>
<MyProductVersion>2018.2 B2</MyProductVersion>
<MyProductVersion>2019.3 B1</MyProductVersion>
<MyProductStage>Beta</MyProductStage>
<MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion>

View File

@ -60,232 +60,168 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsptool", "tools\fsptool.vc
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Installer.Debug|Any CPU = Installer.Debug|Any CPU
Installer.Debug|x64 = Installer.Debug|x64
Installer.Debug|x86 = Installer.Debug|x86
Installer.Release|Any CPU = Installer.Release|Any CPU
Installer.Release|x64 = Installer.Release|x64
Installer.Release|x86 = Installer.Release|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Debug|Any CPU.ActiveCfg = Debug|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Debug|x64.ActiveCfg = Debug|x64
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Debug|x64.Build.0 = Debug|x64
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Debug|x86.ActiveCfg = Debug|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Debug|x86.Build.0 = Debug|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Installer.Debug|Any CPU.ActiveCfg = Release|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Installer.Debug|x64.ActiveCfg = Debug|x64
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Installer.Release|Any CPU.ActiveCfg = Release|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Installer.Release|x64.ActiveCfg = Release|x64
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Installer.Release|x86.ActiveCfg = Release|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Release|Any CPU.ActiveCfg = Release|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Release|x64.ActiveCfg = Release|x64
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Release|x64.Build.0 = Release|x64
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Release|x86.ActiveCfg = Release|Win32
{4A7C0B21-9E10-4C81-92DE-1493EFCF24EB}.Release|x86.Build.0 = Release|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Debug|x64.ActiveCfg = Debug|x64
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Debug|x64.Build.0 = Debug|x64
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Debug|x86.ActiveCfg = Debug|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Debug|x86.Build.0 = Debug|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Installer.Debug|Any CPU.ActiveCfg = Release|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Installer.Debug|x64.ActiveCfg = Debug|x64
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Installer.Release|Any CPU.ActiveCfg = Release|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Installer.Release|x64.ActiveCfg = Release|x64
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Installer.Release|x86.ActiveCfg = Release|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Release|Any CPU.ActiveCfg = Release|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Release|x64.ActiveCfg = Release|x64
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Release|x64.Build.0 = Release|x64
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Release|x86.ActiveCfg = Release|Win32
{C85C26BA-8C22-4D30-83DA-46C3548E6332}.Release|x86.Build.0 = Release|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Debug|Any CPU.ActiveCfg = Debug|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Debug|x64.ActiveCfg = Debug|x64
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Debug|x64.Build.0 = Debug|x64
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Debug|x86.ActiveCfg = Debug|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Debug|x86.Build.0 = Debug|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Installer.Debug|Any CPU.ActiveCfg = Release|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Installer.Debug|x64.ActiveCfg = Debug|x64
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Installer.Release|Any CPU.ActiveCfg = Release|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Installer.Release|x64.ActiveCfg = Release|x64
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Installer.Release|x86.ActiveCfg = Release|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Release|Any CPU.ActiveCfg = Release|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Release|x64.ActiveCfg = Release|x64
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Release|x64.Build.0 = Release|x64
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Release|x86.ActiveCfg = Release|Win32
{262DF8CC-E7A8-4460-A22C-683CBA322C32}.Release|x86.Build.0 = Release|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Debug|Any CPU.ActiveCfg = Debug|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Debug|x64.ActiveCfg = Debug|x64
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Debug|x64.Build.0 = Debug|x64
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Debug|x86.ActiveCfg = Debug|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Debug|x86.Build.0 = Debug|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Installer.Debug|Any CPU.ActiveCfg = Release|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Installer.Debug|x64.ActiveCfg = Debug|x64
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Installer.Release|Any CPU.ActiveCfg = Release|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Installer.Release|x64.ActiveCfg = Release|x64
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Installer.Release|x86.ActiveCfg = Release|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Release|Any CPU.ActiveCfg = Release|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Release|x64.ActiveCfg = Release|x64
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Release|x64.Build.0 = Release|x64
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Release|x86.ActiveCfg = Release|Win32
{AA7190E8-877F-4827-8CDD-E0D85F83C8C1}.Release|x86.Build.0 = Release|Win32
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Debug|Any CPU.ActiveCfg = Debug|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Debug|x64.ActiveCfg = Debug|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Debug|x86.ActiveCfg = Debug|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Debug|Any CPU.ActiveCfg = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Debug|Any CPU.Build.0 = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Debug|x64.ActiveCfg = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Debug|x64.Build.0 = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Debug|x86.ActiveCfg = Debug|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Debug|x86.Build.0 = Debug|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Release|Any CPU.ActiveCfg = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Release|Any CPU.Build.0 = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Release|x64.ActiveCfg = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Release|x64.Build.0 = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Release|x86.ActiveCfg = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Installer.Release|x86.Build.0 = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Release|Any CPU.ActiveCfg = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Release|x64.ActiveCfg = Release|x86
{D53AAC39-4C57-4CA5-A4F3-C2B24888C594}.Release|x86.ActiveCfg = Release|x86
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Debug|Any CPU.ActiveCfg = Debug|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Debug|x64.ActiveCfg = Debug|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Debug|x86.ActiveCfg = Debug|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Debug|Any CPU.ActiveCfg = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Debug|Any CPU.Build.0 = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Debug|x64.ActiveCfg = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Debug|x64.Build.0 = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Debug|x86.Build.0 = Debug|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Release|Any CPU.ActiveCfg = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Release|Any CPU.Build.0 = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Release|x64.ActiveCfg = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Release|x64.Build.0 = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Release|x86.ActiveCfg = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Installer.Release|x86.Build.0 = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Release|Any CPU.ActiveCfg = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Release|x64.ActiveCfg = Release|Win32
{95C223E6-B5F1-4FD0-9376-41CDBC824445}.Release|x86.ActiveCfg = Release|Win32
{10757011-749D-4954-873B-AE38D8145472}.Debug|Any CPU.ActiveCfg = Debug|Win32
{10757011-749D-4954-873B-AE38D8145472}.Debug|x64.ActiveCfg = Debug|x64
{10757011-749D-4954-873B-AE38D8145472}.Debug|x64.Build.0 = Debug|x64
{10757011-749D-4954-873B-AE38D8145472}.Debug|x86.ActiveCfg = Debug|Win32
{10757011-749D-4954-873B-AE38D8145472}.Debug|x86.Build.0 = Debug|Win32
{10757011-749D-4954-873B-AE38D8145472}.Installer.Debug|Any CPU.ActiveCfg = Release|Win32
{10757011-749D-4954-873B-AE38D8145472}.Installer.Debug|x64.ActiveCfg = Debug|x64
{10757011-749D-4954-873B-AE38D8145472}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{10757011-749D-4954-873B-AE38D8145472}.Installer.Release|Any CPU.ActiveCfg = Release|Win32
{10757011-749D-4954-873B-AE38D8145472}.Installer.Release|x64.ActiveCfg = Release|x64
{10757011-749D-4954-873B-AE38D8145472}.Installer.Release|x86.ActiveCfg = Release|Win32
{10757011-749D-4954-873B-AE38D8145472}.Release|Any CPU.ActiveCfg = Release|Win32
{10757011-749D-4954-873B-AE38D8145472}.Release|x64.ActiveCfg = Release|x64
{10757011-749D-4954-873B-AE38D8145472}.Release|x64.Build.0 = Release|x64
{10757011-749D-4954-873B-AE38D8145472}.Release|x86.ActiveCfg = Release|Win32
{10757011-749D-4954-873B-AE38D8145472}.Release|x86.Build.0 = Release|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Debug|x64.ActiveCfg = Debug|x64
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Debug|x64.Build.0 = Debug|x64
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Debug|x86.ActiveCfg = Debug|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Debug|x86.Build.0 = Debug|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Installer.Debug|Any CPU.ActiveCfg = Release|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Installer.Debug|x64.ActiveCfg = Debug|x64
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Installer.Release|Any CPU.ActiveCfg = Release|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Installer.Release|x64.ActiveCfg = Release|x64
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Installer.Release|x86.ActiveCfg = Release|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Release|Any CPU.ActiveCfg = Release|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Release|x64.ActiveCfg = Release|x64
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Release|x64.Build.0 = Release|x64
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Release|x86.ActiveCfg = Release|Win32
{C4E1E9E5-0959-488E-8C6A-C327CC81BEFB}.Release|x86.Build.0 = Release|Win32
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Debug|x64.ActiveCfg = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Debug|x64.Build.0 = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Debug|x86.ActiveCfg = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Debug|x86.Build.0 = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Installer.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Installer.Debug|x64.ActiveCfg = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Installer.Debug|x86.ActiveCfg = Debug|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Installer.Release|Any CPU.ActiveCfg = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Installer.Release|x64.ActiveCfg = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Installer.Release|x86.ActiveCfg = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Release|Any CPU.Build.0 = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Release|x64.ActiveCfg = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Release|x64.Build.0 = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Release|x86.ActiveCfg = Release|Any CPU
{94580219-CC8D-4FE5-A3BE-437B0B3481E1}.Release|x86.Build.0 = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|x64.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|x64.Build.0 = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|x86.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|x86.Build.0 = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Debug|x64.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Debug|x86.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Release|Any CPU.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Release|x64.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Release|x86.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Release|Any CPU.Build.0 = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Release|x64.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Release|x64.Build.0 = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Release|x86.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Release|x86.Build.0 = Release|Any CPU
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Debug|x64.ActiveCfg = Debug|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Debug|x64.Build.0 = Debug|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Debug|x86.ActiveCfg = Debug|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Debug|x86.Build.0 = Debug|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Debug|Any CPU.ActiveCfg = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Debug|x64.ActiveCfg = Debug|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Release|Any CPU.ActiveCfg = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Release|x64.ActiveCfg = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Release|x86.ActiveCfg = Release|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Release|Any CPU.ActiveCfg = Release|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Release|x64.ActiveCfg = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Release|x64.Build.0 = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Release|x86.ActiveCfg = Release|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Release|x86.Build.0 = Release|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Debug|Any CPU.ActiveCfg = Debug|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Debug|x64.ActiveCfg = Debug|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Debug|x64.Build.0 = Debug|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Debug|x86.ActiveCfg = Debug|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Debug|x86.Build.0 = Debug|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Debug|Any CPU.ActiveCfg = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Debug|x64.ActiveCfg = Debug|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Release|Any CPU.ActiveCfg = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Release|x64.ActiveCfg = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Release|x86.ActiveCfg = Release|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|Any CPU.ActiveCfg = Release|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|x64.ActiveCfg = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|x64.Build.0 = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|x86.ActiveCfg = Release|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|x86.Build.0 = Release|Win32
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|Any CPU.ActiveCfg = Debug|Win32
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x64.ActiveCfg = Debug|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x64.Build.0 = Debug|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x86.ActiveCfg = Debug|Win32
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x86.Build.0 = Debug|Win32
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Debug|Any CPU.ActiveCfg = Release|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Debug|x64.ActiveCfg = Debug|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Release|Any CPU.ActiveCfg = Release|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Release|x64.ActiveCfg = Release|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Release|x86.ActiveCfg = Release|Win32
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|Any CPU.ActiveCfg = Release|Win32
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|x64.ActiveCfg = Release|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|x64.Build.0 = Release|x64
{1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|x86.ActiveCfg = Release|Win32

View File

@ -222,7 +222,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<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>
</Link>
</ItemDefinitionGroup>
@ -250,7 +250,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<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>
</Link>
</ItemDefinitionGroup>
@ -281,7 +281,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<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>
</Link>
</ItemDefinitionGroup>
@ -312,7 +312,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf
<MapFileName>$(OutDir)$(TargetFileName).map</MapFileName>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<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>
</Link>
</ItemDefinitionGroup>

View File

@ -6,8 +6,8 @@
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:
https://technet.microsoft.com/en-us/library/security/3033929.aspx
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
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.::
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.
@ -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.
+
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:
commit 16296d2ac64a7d532b1c486dd3c44af5865d4851
commit 16296d2ac64a7d532b1c486dd3c44af5865d4851

View File

@ -1,7 +1,7 @@
/**
* @file tlib/callstack.c
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#include <tlib/callstack.h>

View File

@ -1,7 +1,7 @@
/**
* @file tlib/callstack.h
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#ifndef TLIB_CALLSTACK_H_INCLUDED

View File

@ -1,7 +1,7 @@
/**
* @file tlib/injected/allfunc.h
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#ifndef TLIB_INJECTED_ALLFUNC_H_INCLUDED

View File

@ -1,7 +1,7 @@
/**
* @file tlib/injected/curlfunc.c
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#include <tlib/injected/curlfunc.h>

View File

@ -1,7 +1,7 @@
/**
* @file tlib/injected/curlfunc.h
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#ifndef TLIB_INJECTED_CURLFUNC_H_INCLUDED

View File

@ -1,7 +1,7 @@
/**
* @file tlib/injected/stdfunc.c
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#include <tlib/injected/stdfunc.h>

View File

@ -1,7 +1,7 @@
/**
* @file tlib/injected/stdfunc.h
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#ifndef TLIB_INJECTED_STDFUNC_H_INCLUDED

View File

@ -1,7 +1,7 @@
/**
* @file tlib/injection.c
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#include <tlib/injection.h>

View File

@ -1,7 +1,7 @@
/**
* @file tlib/injection.h
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
/* NOTE: This header may usefully be included multiple times.

View File

@ -1,7 +1,7 @@
/**
* @file tlib/testsuite.c
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#include <tlib/testsuite.h>

View File

@ -1,7 +1,7 @@
/**
* @file tlib/testsuite.h
*
* @copyright 2014-2018 Bill Zissimopoulos
* @copyright 2014-2019 Bill Zissimopoulos
*/
#ifndef TLIB_TESTSUITE_H_INCLUDED

View File

@ -6,7 +6,7 @@
* FUSE: Filesystem in Userspace
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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_
@ -63,11 +67,11 @@ struct fuse_operations
/* S */ int (*flush)(const char *path, struct fuse_file_info *fi);
/* S */ int (*release)(const char *path, struct fuse_file_info *fi);
/* S */ int (*fsync)(const char *path, int datasync, struct fuse_file_info *fi);
/* _ */ int (*setxattr)(const char *path, const char *name, const char *value, size_t size,
/* S */ int (*setxattr)(const char *path, const char *name, const char *value, size_t size,
int flags);
/* _ */ int (*getxattr)(const char *path, const char *name, char *value, size_t size);
/* _ */ int (*listxattr)(const char *path, char *namebuf, size_t size);
/* _ */ int (*removexattr)(const char *path, const char *name);
/* S */ int (*getxattr)(const char *path, const char *name, char *value, size_t size);
/* S */ int (*listxattr)(const char *path, char *namebuf, size_t size);
/* S */ int (*removexattr)(const char *path, const char *name);
/* S */ int (*opendir)(const char *path, struct fuse_file_info *fi);
/* S */ int (*readdir)(const char *path, void *buf, fuse_fill_dir_t filler, fuse_off_t off,
struct fuse_file_info *fi);

View File

@ -6,7 +6,7 @@
* FUSE: Filesystem in Userspace
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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_

View File

@ -6,7 +6,7 @@
* FUSE: Filesystem in Userspace
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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_
@ -41,16 +45,16 @@ extern "C" {
struct fuse_opt
{
const char *templ;
unsigned int offset;
int value;
const char *templ;
unsigned int offset;
int value;
};
struct fuse_args
{
int argc;
char **argv;
int allocated;
int argc;
char **argv;
int allocated;
};
typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,

View File

@ -2,7 +2,7 @@
* @file fuse/winfsp_fuse.h
* WinFsp FUSE compatible API.
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -55,7 +59,7 @@ extern "C" {
#define FSP_FUSE_DEVICE_TYPE (0x8000 | 'W' | 'F' * 0x100) /* DeviceIoControl -> ioctl */
#define FSP_FUSE_CTLCODE_FROM_IOCTL(cmd)\
(FSP_FUSE_DEVICE_TYPE << 16) | (((c) & 0x0fff) << 2)
(FSP_FUSE_DEVICE_TYPE << 16) | (((cmd) & 0x0fff) << 2)
#define FSP_FUSE_IOCTL(cmd, isiz, osiz) \
( \
(((osiz) != 0) << 31) | \

View File

@ -6,7 +6,7 @@
* FUSE: Filesystem in Userspace
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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_
@ -102,11 +106,11 @@ struct fuse3_operations
/* S */ int (*flush)(const char *path, struct fuse3_file_info *fi);
/* S */ int (*release)(const char *path, struct fuse3_file_info *fi);
/* S */ int (*fsync)(const char *path, int datasync, struct fuse3_file_info *fi);
/* _ */ int (*setxattr)(const char *path, const char *name, const char *value, size_t size,
/* S */ int (*setxattr)(const char *path, const char *name, const char *value, size_t size,
int flags);
/* _ */ int (*getxattr)(const char *path, const char *name, char *value, size_t size);
/* _ */ int (*listxattr)(const char *path, char *namebuf, size_t size);
/* _ */ int (*removexattr)(const char *path, const char *name);
/* S */ int (*getxattr)(const char *path, const char *name, char *value, size_t size);
/* S */ int (*listxattr)(const char *path, char *namebuf, size_t size);
/* S */ int (*removexattr)(const char *path, const char *name);
/* S */ int (*opendir)(const char *path, struct fuse3_file_info *fi);
/* S */ int (*readdir)(const char *path, void *buf, fuse3_fill_dir_t filler, fuse_off_t off,
struct fuse3_file_info *fi, enum fuse3_readdir_flags);

View File

@ -6,7 +6,7 @@
* FUSE: Filesystem in Userspace
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -15,9 +15,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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_

View File

@ -2,7 +2,7 @@
* @file fuse3/fuse_opt.h
* WinFsp FUSE3 compatible API.
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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"

View File

@ -2,7 +2,7 @@
* @file fuse3/winfsp_fuse.h
* WinFsp FUSE3 compatible API.
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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

View File

@ -1,7 +1,7 @@
/**
* @file winfsp/fsctl.h
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -148,7 +152,7 @@ enum
UINT32 ReparsePointsAccessCheck:1; /* file system performs reparse point access checks */\
UINT32 NamedStreams:1; /* file system supports named streams */\
UINT32 HardLinks:1; /* unimplemented; set to 0 */\
UINT32 ExtendedAttributes:1; /* unimplemented; set to 0 */\
UINT32 ExtendedAttributes:1; /* file system supports extended attributes */\
UINT32 ReadOnlyVolume:1;\
/* kernel-mode flags */\
UINT32 PostCleanupWhenModifiedOnly:1; /* post Cleanup when a file was modified/deleted */\
@ -162,7 +166,9 @@ enum
UINT32 UmFileContextIsFullContext:1; /* user mode: FileContext parameter is FullContext */\
UINT32 UmReservedFlags:6;\
/* additional kernel-mode flags */\
UINT32 KmReservedFlags:8;\
UINT32 AllowOpenInKernelMode:1; /* allow kernel mode to open files when possible */\
UINT32 CasePreservedExtendedAttributes:1; /* preserve case of EA (default is UPPERCASE) */\
UINT32 KmReservedFlags:6;\
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */\
WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];
#define FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN\
@ -171,22 +177,28 @@ enum
UINT32 DirInfoTimeoutValid:1; /* DirInfoTimeout field is valid */\
UINT32 SecurityTimeoutValid:1; /* SecurityTimeout field is valid*/\
UINT32 StreamInfoTimeoutValid:1; /* StreamInfoTimeout field is valid */\
UINT32 KmAdditionalReservedFlags:28;\
UINT32 EaTimeoutValid:1; /* EaTimeout field is valid */\
UINT32 KmAdditionalReservedFlags:27;\
UINT32 VolumeInfoTimeout; /* volume info timeout (millis); overrides FileInfoTimeout */\
UINT32 DirInfoTimeout; /* dir info timeout (millis); overrides FileInfoTimeout */\
UINT32 SecurityTimeout; /* security info timeout (millis); overrides FileInfoTimeout */\
UINT32 StreamInfoTimeout; /* stream info timeout (millis); overrides FileInfoTimeout */\
UINT32 Reserved32[3];\
UINT32 EaTimeout; /* EA timeout (millis); overrides FileInfoTimeout */\
UINT32 Reserved32[2];\
UINT64 Reserved64[2];
typedef struct
{
FSP_FSCTL_VOLUME_PARAMS_V0_FIELD_DEFN
} FSP_FSCTL_VOLUME_PARAMS_V0;
FSP_FSCTL_STATIC_ASSERT(456 == sizeof(FSP_FSCTL_VOLUME_PARAMS_V0),
"sizeof(FSP_FSCTL_VOLUME_PARAMS_V0) must be exactly 456.");
typedef struct
{
FSP_FSCTL_VOLUME_PARAMS_V0_FIELD_DEFN
FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN
} FSP_FSCTL_VOLUME_PARAMS;
FSP_FSCTL_STATIC_ASSERT(504 == sizeof(FSP_FSCTL_VOLUME_PARAMS),
"sizeof(FSP_FSCTL_VOLUME_PARAMS) is currently 504. Update this assertion check if it changes.");
typedef struct
{
UINT64 TotalSize;
@ -194,6 +206,8 @@ typedef struct
UINT16 VolumeLabelLength;
WCHAR VolumeLabel[32];
} FSP_FSCTL_VOLUME_INFO;
FSP_FSCTL_STATIC_ASSERT(88 == sizeof(FSP_FSCTL_VOLUME_INFO),
"sizeof(FSP_FSCTL_VOLUME_INFO) must be exactly 88.");
typedef struct
{
UINT32 FileAttributes;
@ -206,7 +220,10 @@ typedef struct
UINT64 ChangeTime;
UINT64 IndexNumber;
UINT32 HardLinks; /* unimplemented: set to 0 */
UINT32 EaSize;
} FSP_FSCTL_FILE_INFO;
FSP_FSCTL_STATIC_ASSERT(72 == sizeof(FSP_FSCTL_FILE_INFO),
"sizeof(FSP_FSCTL_FILE_INFO) must be exactly 72.");
typedef struct
{
FSP_FSCTL_FILE_INFO FileInfo;
@ -221,6 +238,8 @@ typedef struct
/* make struct as big as FILE_ID_BOTH_DIR_INFORMATION; allows for in-place copying */
WCHAR FileNameBuf[];
} FSP_FSCTL_DIR_INFO;
FSP_FSCTL_STATIC_ASSERT(104 == sizeof(FSP_FSCTL_DIR_INFO),
"sizeof(FSP_FSCTL_DIR_INFO) must be exactly 104.");
typedef struct
{
UINT16 Size;
@ -228,6 +247,8 @@ typedef struct
UINT64 StreamAllocationSize;
WCHAR StreamNameBuf[];
} FSP_FSCTL_STREAM_INFO;
FSP_FSCTL_STATIC_ASSERT(24 == sizeof(FSP_FSCTL_STREAM_INFO),
"sizeof(FSP_FSCTL_STREAM_INFO) must be exactly 24.");
typedef struct
{
UINT64 UserContext;
@ -256,7 +277,7 @@ typedef struct
UINT32 DesiredAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
UINT32 GrantedAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
UINT32 ShareAccess; /* FILE_SHARE_{READ,WRITE,DELETE} */
FSP_FSCTL_TRANSACT_BUF Ea; /* reserved; not currently implemented */
FSP_FSCTL_TRANSACT_BUF Ea; /* extended attributes buffer */
UINT32 UserMode:1; /* request originated in user mode */
UINT32 HasTraversePrivilege:1; /* requestor has TOKEN_HAS_TRAVERSE_PRIVILEGE */
UINT32 HasBackupPrivilege:1; /* requestor has TOKEN_HAS_BACKUP_PRIVILEGE */
@ -264,7 +285,8 @@ typedef struct
UINT32 OpenTargetDirectory:1; /* open target dir and report FILE_{EXISTS,DOES_NOT_EXIST} */
UINT32 CaseSensitive:1; /* FileName comparisons should be case-sensitive */
UINT32 HasTrailingBackslash:1; /* FileName had trailing backslash */
UINT32 ReservedFlags:25;
UINT32 AcceptsSecurityDescriptor:1;
UINT32 ReservedFlags:24;
UINT16 NamedStream; /* request targets named stream; colon offset in FileName */
} Create;
struct
@ -274,6 +296,7 @@ typedef struct
UINT32 FileAttributes; /* file attributes for overwritten/superseded files */
UINT64 AllocationSize; /* allocation size for overwritten/superseded files */
UINT32 Supersede:1; /* 0: FILE_OVERWRITE operation, 1: FILE_SUPERSEDE operation */
FSP_FSCTL_TRANSACT_BUF Ea; /* extended attributes buffer */
} Overwrite;
struct
{
@ -350,6 +373,17 @@ typedef struct
} Info;
} SetInformation;
struct
{
UINT64 UserContext;
UINT64 UserContext2;
} QueryEa;
struct
{
UINT64 UserContext;
UINT64 UserContext2;
FSP_FSCTL_TRANSACT_BUF Ea;
} SetEa;
struct
{
UINT64 UserContext;
UINT64 UserContext2;
@ -435,9 +469,11 @@ typedef struct
UINT64 UserContext; /* user context associated with file node */
UINT64 UserContext2; /* user context associated with file descriptor (handle) */
UINT32 GrantedAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor;
FSP_FSCTL_FILE_INFO FileInfo;
FSP_FSCTL_TRANSACT_BUF FileName;
UINT32 DisableCache:1;
UINT32 HasSecurityDescriptor:1;
} Opened;
/* IoStatus.Status == STATUS_REPARSE */
struct
@ -462,6 +498,15 @@ typedef struct
FSP_FSCTL_FILE_INFO FileInfo; /* valid: File{Allocation,Basic,EndOfFile}Information */
} SetInformation;
struct
{
FSP_FSCTL_TRANSACT_BUF Ea;
} QueryEa;
struct
{
FSP_FSCTL_FILE_INFO FileInfo;
FSP_FSCTL_TRANSACT_BUF Ea; /* Size==0 means no extended atttributed returned */
} SetEa;
struct
{
FSP_FSCTL_FILE_INFO FileInfo; /* valid when flushing file (not volume) */
} FlushBuffers;

View File

@ -5,7 +5,7 @@
* In order to use the WinFsp Launch API a program must include &lt;winfsp/launch.h&gt;
* and link with the winfsp_x64.dll (or winfsp_x86.dll) library.
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -14,9 +14,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -107,7 +111,43 @@ enum
*/
FSP_API NTSTATUS FspLaunchCallLauncherPipe(
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.
*
@ -134,6 +174,35 @@ FSP_API NTSTATUS FspLaunchStart(
PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv,
BOOLEAN HasSecret,
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.
*
@ -217,10 +286,12 @@ typedef struct _FSP_LAUNCH_REG_RECORD
PWSTR WorkDirectory;
PWSTR RunAs;
PWSTR Security;
PVOID Reserved0[6];
PWSTR AuthPackage;
PVOID Reserved0[5];
ULONG JobControl;
ULONG Credentials;
ULONG Reserved1[6];
ULONG AuthPackageId;
ULONG Reserved1[5];
UINT8 Buffer[];
} FSP_LAUNCH_REG_RECORD;
#pragma warning(pop)

View File

@ -5,7 +5,7 @@
* In order to use the WinFsp API the user mode file system must include &lt;winfsp/winfsp.h&gt;
* and link with the winfsp_x64.dll (or winfsp_x86.dll) library.
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -14,9 +14,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -81,6 +85,21 @@ typedef struct _REPARSE_DATA_BUFFER
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
#endif
/*
* The FILE_FULL_EA_INFORMATION definitions are missing from the user mode headers.
*/
#if !defined(FILE_NEED_EA)
#define FILE_NEED_EA 0x00000080
#endif
typedef struct _FILE_FULL_EA_INFORMATION
{
ULONG NextEntryOffset;
UCHAR Flags;
UCHAR EaNameLength;
USHORT EaValueLength;
CHAR EaName[1];
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
/**
* @group File System
*
@ -380,6 +399,7 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
* @see
* Close
* CanDelete
* SetDelete
*/
VOID (*Cleanup)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, PWSTR FileName, ULONG Flags);
@ -563,6 +583,9 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
* 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
@ -573,6 +596,7 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
* STATUS_SUCCESS or error code.
* @see
* Cleanup
* SetDelete
*/
NTSTATUS (*CanDelete)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, PWSTR FileName);
@ -851,12 +875,172 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
PVOID FileContext, UINT32 ControlCode,
PVOID InputBuffer, ULONG InputBufferLength,
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);
/**
* Create new file or directory.
*
* This function works like Create, except that it also accepts EA (extended attributes).
*
* NOTE: If both Create and CreateEx are defined, CreateEx takes precedence.
*
* @param FileSystem
* The file system on which this request is posted.
* @param FileName
* The name of the file or directory to be created.
* @param CreateOptions
* Create options for this request. This parameter has the same meaning as the
* CreateOptions parameter of the NtCreateFile API. User mode file systems should typically
* only be concerned with the flag FILE_DIRECTORY_FILE, which is an instruction to create a
* directory rather than a file. Some file systems may also want to pay attention to the
* FILE_NO_INTERMEDIATE_BUFFERING and FILE_WRITE_THROUGH flags, although these are
* typically handled by the FSD component.
* @param GrantedAccess
* Determines the specific access rights that have been granted for this request. Upon
* receiving this call all access checks have been performed and the user mode file system
* need not perform any additional checks. However this parameter may be useful to a user
* mode file system; for example the WinFsp-FUSE layer uses this parameter to determine
* which flags to use in its POSIX open() call.
* @param FileAttributes
* File attributes to apply to the newly created file or directory.
* @param SecurityDescriptor
* Security descriptor to apply to the newly created file or directory. This security
* descriptor will always be in self-relative format. Its length can be retrieved using the
* Windows GetSecurityDescriptorLength API. Will be NULL for named streams.
* @param AllocationSize
* Allocation size for the newly created file.
* @param Ea
* Extended attributes buffer.
* @param EaLength
* Extended attributes buffer length.
* @param PFileContext [out]
* Pointer that will receive the file context on successful return from this call.
* @param FileInfo [out]
* Pointer to a structure that will receive the file information on successful return
* from this call. This information includes file attributes, file times, etc.
* @return
* STATUS_SUCCESS or error code.
*/
NTSTATUS (*CreateEx)(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
PVOID *PFileContext, FSP_FSCTL_FILE_INFO *FileInfo);
/**
* Overwrite a file.
*
* This function works like Overwrite, except that it also accepts EA (extended attributes).
*
* NOTE: If both Overwrite and OverwriteEx are defined, OverwriteEx takes precedence.
*
* @param FileSystem
* The file system on which this request is posted.
* @param FileContext
* The file context of the file to overwrite.
* @param FileAttributes
* File attributes to apply to the overwritten file.
* @param ReplaceFileAttributes
* When TRUE the existing file attributes should be replaced with the new ones.
* When FALSE the existing file attributes should be merged (or'ed) with the new ones.
* @param AllocationSize
* Allocation size for the overwritten file.
* @param Ea
* Extended attributes buffer.
* @param EaLength
* Extended attributes buffer length.
* @param FileInfo [out]
* Pointer to a structure that will receive the file information on successful return
* from this call. This information includes file attributes, file times, etc.
* @return
* STATUS_SUCCESS or error code.
*/
NTSTATUS (*OverwriteEx)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext, UINT32 FileAttributes, BOOLEAN ReplaceFileAttributes, UINT64 AllocationSize,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
FSP_FSCTL_FILE_INFO *FileInfo);
/**
* Get extended attributes.
*
* @param FileSystem
* The file system on which this request is posted.
* @param FileContext
* The file context of the file to get extended attributes for.
* @param Ea
* Extended attributes buffer.
* @param EaLength
* Extended attributes buffer length.
* @param PBytesTransferred [out]
* Pointer to a memory location that will receive the actual number of bytes transferred.
* @return
* STATUS_SUCCESS or error code.
* @see
* SetEa
* FspFileSystemAddEa
*/
NTSTATUS (*GetEa)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength, PULONG PBytesTransferred);
/**
* Set extended attributes.
*
* @param FileSystem
* The file system on which this request is posted.
* @param FileContext
* The file context of the file to set extended attributes for.
* @param Ea
* Extended attributes buffer.
* @param EaLength
* Extended attributes buffer length.
* @param FileInfo [out]
* Pointer to a structure that will receive the file information on successful return
* from this call. This information includes file attributes, file times, etc.
* @return
* STATUS_SUCCESS or error code.
* @see
* GetEa
*/
NTSTATUS (*SetEa)(FSP_FILE_SYSTEM *FileSystem,
PVOID FileContext,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
FSP_FSCTL_FILE_INFO *FileInfo);
/*
* This ensures that this interface will always contain 64 function pointers.
* Please update when changing the interface as it is important for future compatibility.
*/
NTSTATUS (*Reserved[38])();
NTSTATUS (*Reserved[33])();
} FSP_FILE_SYSTEM_INTERFACE;
FSP_FSCTL_STATIC_ASSERT(sizeof(FSP_FILE_SYSTEM_INTERFACE) == 64 * sizeof(NTSTATUS (*)()),
"FSP_FILE_SYSTEM_INTERFACE must have 64 entries.");
@ -1160,6 +1344,10 @@ FSP_API NTSTATUS FspFileSystemOpQueryInformation(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
FSP_API NTSTATUS FspFileSystemOpQueryEa(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
FSP_API NTSTATUS FspFileSystemOpSetEa(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
FSP_API NTSTATUS FspFileSystemOpFlushBuffers(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
FSP_API NTSTATUS FspFileSystemOpQueryVolumeInformation(FSP_FILE_SYSTEM *FileSystem,
@ -1390,6 +1578,70 @@ FSP_API NTSTATUS FspFileSystemCanReplaceReparsePoint(
*/
FSP_API BOOLEAN FspFileSystemAddStreamInfo(FSP_FSCTL_STREAM_INFO *StreamInfo,
PVOID Buffer, ULONG Length, PULONG PBytesTransferred);
/**
* Enumerate extended attributes in a buffer.
*
* This is a helper for implementing the CreateEx and SetEa operations in file systems
* that support extended attributes.
*
* @param FileSystem
* The file system object.
* @param EnumerateEa
* Pointer to function that receives a single extended attribute. The function
* should return STATUS_SUCCESS or an error code if unsuccessful.
* @param Context
* User context to supply to EnumEa.
* @param Ea
* Extended attributes buffer.
* @param EaLength
* Extended attributes buffer length.
* @return
* STATUS_SUCCESS or error code from EnumerateEa.
*/
FSP_API NTSTATUS FspFileSystemEnumerateEa(FSP_FILE_SYSTEM *FileSystem,
NTSTATUS (*EnumerateEa)(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PFILE_FULL_EA_INFORMATION SingleEa),
PVOID Context,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength);
/**
* Add extended attribute to a buffer.
*
* This is a helper for implementing the GetEa operation.
*
* @param SingleEa
* The extended attribute to add. A value of NULL acts as an EOF marker for a GetEa
* operation.
* @param Ea
* Pointer to a buffer that will receive the extended attribute. This should contain
* the same value passed to the GetEa Ea parameter.
* @param EaLength
* Length of buffer. This should contain the same value passed to the GetEa
* EaLength parameter.
* @param PBytesTransferred [out]
* Pointer to a memory location that will receive the actual number of bytes stored. This should
* contain the same value passed to the GetEa PBytesTransferred parameter.
* @return
* TRUE if the extended attribute was added, FALSE if there was not enough space to add it.
* @see
* GetEa
*/
FSP_API BOOLEAN FspFileSystemAddEa(PFILE_FULL_EA_INFORMATION SingleEa,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength, PULONG PBytesTransferred);
/**
* Get extended attribute "packed" size. This computation matches what NTFS reports.
*
* @param SingleEa
* The extended attribute to get the size for.
* @return
* The packed size of the extended attribute.
*/
static inline
UINT32 FspFileSystemGetEaPackedSize(PFILE_FULL_EA_INFORMATION SingleEa)
{
/* magic computations are courtesy of NTFS */
return 5 + SingleEa->EaNameLength + SingleEa->EaValueLength;
}
/*
* Directory buffering
@ -1752,6 +2004,10 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize,
PULONG PBytesTransferred, ULONG Timeout,
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);
/*

View File

@ -2,7 +2,7 @@
* @file winfsp/winfsp.hpp
* WinFsp C++ Layer.
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -608,6 +612,14 @@ public:
{
_VolumeParams.PassQueryDirectoryPattern = !!PassQueryDirectoryPattern;
}
BOOLEAN FlushAndPurgeOnCleanup()
{
return _VolumeParams.FlushAndPurgeOnCleanup;
}
VOID SetFlushAndPurgeOnCleanup(BOOLEAN FlushAndPurgeOnCleanup)
{
_VolumeParams.FlushAndPurgeOnCleanup = !!FlushAndPurgeOnCleanup;
}
PWSTR Prefix()
{
return _VolumeParams.Prefix;

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

BIN
opt/cygfuse/dist/x64/fuse-2.8-10.tar.xz vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
opt/cygfuse/dist/x64/fuse3-3.2-2.tar.xz vendored Normal file

Binary file not shown.

BIN
opt/cygfuse/dist/x86/fuse-2.8-10.tar.xz vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
opt/cygfuse/dist/x86/fuse3-3.2-2.tar.xz vendored Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
#include <fuse.h>
int main()
{
return !(FUSE_VERSION == fuse_version());
}
#include <fuse.h>
int main()
{
return !(FUSE_VERSION == fuse_version());
}

View File

@ -1,7 +1,7 @@
/**
* @file fuse/cygfuse.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,6 +1,6 @@
NAME="fuse"
VERSION=2.8
RELEASE=9
RELEASE=10
CATEGORY="Utils"
SUMMARY="WinFsp FUSE compatibility layer"
DESCRIPTION="Enables FUSE file systems to be run on Cygwin."

View File

@ -1,6 +1,6 @@
#include <fuse.h>
int main()
{
return !(FUSE_VERSION == fuse_version());
}
#include <fuse.h>
int main()
{
return !(FUSE_VERSION == fuse_version());
}

View File

@ -1,7 +1,7 @@
/**
* @file fuse3/cygfuse.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,6 +1,6 @@
NAME="fuse3"
VERSION=3.2
RELEASE=1
RELEASE=2
CATEGORY="Utils"
SUMMARY="WinFsp FUSE3 compatibility layer"
DESCRIPTION="Enables FUSE3 file systems to be run on Cygwin."

View File

@ -1,7 +1,7 @@
/**
* @file dll/debug.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/dirbuf.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/eventlog.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fs.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -157,6 +161,8 @@ FSP_API NTSTATUS FspFileSystemCreate(PWSTR DevicePath,
FileSystem->Operations[FspFsctlTransactWriteKind] = FspFileSystemOpWrite;
FileSystem->Operations[FspFsctlTransactQueryInformationKind] = FspFileSystemOpQueryInformation;
FileSystem->Operations[FspFsctlTransactSetInformationKind] = FspFileSystemOpSetInformation;
FileSystem->Operations[FspFsctlTransactQueryEaKind] = FspFileSystemOpQueryEa;
FileSystem->Operations[FspFsctlTransactSetEaKind] = FspFileSystemOpSetEa;
FileSystem->Operations[FspFsctlTransactFlushBuffersKind] = FspFileSystemOpFlushBuffers;
FileSystem->Operations[FspFsctlTransactQueryVolumeInformationKind] = FspFileSystemOpQueryVolumeInformation;
FileSystem->Operations[FspFsctlTransactSetVolumeInformationKind] = FspFileSystemOpSetVolumeInformation;

View File

@ -1,7 +1,7 @@
/**
* @file dll/fsctl.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fsop.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -238,7 +242,8 @@ NTSTATUS FspFileSystemCreateCheck(FSP_FILE_SYSTEM *FileSystem,
static inline
NTSTATUS FspFileSystemOpenCheck(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response,
BOOLEAN AllowTraverseCheck, PUINT32 PGrantedAccess)
BOOLEAN AllowTraverseCheck, PUINT32 PGrantedAccess,
PSECURITY_DESCRIPTOR *PSecurityDescriptor)
{
NTSTATUS Result;
UINT32 GrantedAccess;
@ -253,10 +258,11 @@ NTSTATUS FspFileSystemOpenCheck(FSP_FILE_SYSTEM *FileSystem,
* requested in DesiredAccess.
*/
Result = FspAccessCheck(FileSystem, Request, FALSE, AllowTraverseCheck,
Result = FspAccessCheckEx(FileSystem, Request, FALSE, AllowTraverseCheck,
Request->Req.Create.DesiredAccess |
((Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE) ? DELETE : 0),
&GrantedAccess);
&GrantedAccess,
Request->Req.Create.AcceptsSecurityDescriptor ? PSecurityDescriptor : 0);
if (STATUS_REPARSE == Result)
Result = FspFileSystemCallResolveReparsePoints(FileSystem, Request, Response, GrantedAccess);
else if (NT_SUCCESS(Result))
@ -387,21 +393,40 @@ NTSTATUS FspFileSystemRenameCheck(FSP_FILE_SYSTEM *FileSystem,
return Result;
}
static inline
VOID FspFileSystemOpCreate_SetOpenDescriptor(FSP_FSCTL_TRANSACT_RSP *Response,
PSECURITY_DESCRIPTOR OpenDescriptor)
{
FSP_FSCTL_TRANSACT_BUF Buf;
Buf.Offset = FSP_FSCTL_DEFAULT_ALIGN_UP(Response->Rsp.Create.Opened.FileName.Size);
Buf.Size = (UINT16)GetSecurityDescriptorLength(OpenDescriptor);
if (FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX >= Buf.Offset + Buf.Size)
{
Response->Size += Buf.Offset + Buf.Size;
Response->Rsp.Create.Opened.SecurityDescriptor.Offset = Buf.Offset;
Response->Rsp.Create.Opened.SecurityDescriptor.Size = Buf.Size;
Response->Rsp.Create.Opened.HasSecurityDescriptor = 1;
memcpy(Response->Buffer + Buf.Offset, OpenDescriptor, Buf.Size);
}
}
static NTSTATUS FspFileSystemOpCreate_FileCreate(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
NTSTATUS Result;
UINT32 GrantedAccess;
PSECURITY_DESCRIPTOR ParentDescriptor, ObjectDescriptor;
PSECURITY_DESCRIPTOR ParentDescriptor;
FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext;
FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo;
PSECURITY_DESCRIPTOR OpenDescriptor = 0;
Result = FspFileSystemCreateCheck(FileSystem, Request, Response, TRUE,
&GrantedAccess, &ParentDescriptor);
if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result)
return Result;
Result = FspCreateSecurityDescriptor(FileSystem, Request, ParentDescriptor, &ObjectDescriptor);
Result = FspCreateSecurityDescriptor(FileSystem, Request, ParentDescriptor, &OpenDescriptor);
FspDeleteSecurityDescriptor(ParentDescriptor, FspAccessCheckEx);
if (!NT_SUCCESS(Result))
return Result;
@ -411,13 +436,24 @@ static NTSTATUS FspFileSystemOpCreate_FileCreate(FSP_FILE_SYSTEM *FileSystem,
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
Result = FileSystem->Interface->Create(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor);
if (0 != FileSystem->Interface->CreateEx)
Result = FileSystem->Interface->CreateEx(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, OpenDescriptor, Request->Req.Create.AllocationSize,
0 != Request->Req.Create.Ea.Size ?
(PVOID)(Request->Buffer + Request->Req.Create.Ea.Offset) : 0,
Request->Req.Create.Ea.Size,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
else
Result = FileSystem->Interface->Create(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, OpenDescriptor, Request->Req.Create.AllocationSize,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
if (!NT_SUCCESS(Result))
{
FspDeleteSecurityDescriptor(OpenDescriptor, FspCreateSecurityDescriptor);
return Result;
}
if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize)
{
@ -426,6 +462,12 @@ static NTSTATUS FspFileSystemOpCreate_FileCreate(FSP_FILE_SYSTEM *FileSystem,
Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize;
}
if (0 != OpenDescriptor)
{
FspFileSystemOpCreate_SetOpenDescriptor(Response, OpenDescriptor);
FspDeleteSecurityDescriptor(OpenDescriptor, FspCreateSecurityDescriptor);
}
Response->IoStatus.Information = FILE_CREATED;
SetFileContext(Response->Rsp.Create.Opened, FullContext);
Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess;
@ -441,8 +483,10 @@ static NTSTATUS FspFileSystemOpCreate_FileOpen(FSP_FILE_SYSTEM *FileSystem,
UINT32 GrantedAccess;
FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext;
FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo;
PSECURITY_DESCRIPTOR OpenDescriptor = 0;
Result = FspFileSystemOpenCheck(FileSystem, Request, Response, TRUE, &GrantedAccess);
Result = FspFileSystemOpenCheck(FileSystem, Request, Response, TRUE, &GrantedAccess,
&OpenDescriptor);
if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result)
return Result;
@ -455,7 +499,10 @@ static NTSTATUS FspFileSystemOpCreate_FileOpen(FSP_FILE_SYSTEM *FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
if (!NT_SUCCESS(Result))
{
FspDeleteSecurityDescriptor(OpenDescriptor, FspAccessCheckEx);
return Result;
}
if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize)
{
@ -464,6 +511,12 @@ static NTSTATUS FspFileSystemOpCreate_FileOpen(FSP_FILE_SYSTEM *FileSystem,
Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize;
}
if (0 != OpenDescriptor)
{
FspFileSystemOpCreate_SetOpenDescriptor(Response, OpenDescriptor);
FspDeleteSecurityDescriptor(OpenDescriptor, FspAccessCheckEx);
}
Response->IoStatus.Information = FILE_OPENED;
SetFileContext(Response->Rsp.Create.Opened, FullContext);
Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess;
@ -477,12 +530,14 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem,
{
NTSTATUS Result;
UINT32 GrantedAccess;
PSECURITY_DESCRIPTOR ParentDescriptor, ObjectDescriptor;
PSECURITY_DESCRIPTOR ParentDescriptor;
FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext;
FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo;
PSECURITY_DESCRIPTOR OpenDescriptor = 0;
BOOLEAN Create = FALSE;
Result = FspFileSystemOpenCheck(FileSystem, Request, Response, TRUE, &GrantedAccess);
Result = FspFileSystemOpenCheck(FileSystem, Request, Response, TRUE, &GrantedAccess,
&OpenDescriptor);
if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result)
{
if (STATUS_OBJECT_NAME_NOT_FOUND != Result)
@ -502,6 +557,9 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
if (!NT_SUCCESS(Result))
{
FspDeleteSecurityDescriptor(OpenDescriptor, FspAccessCheckEx);
OpenDescriptor = 0;
if (STATUS_OBJECT_NAME_NOT_FOUND != Result)
return Result;
Create = TRUE;
@ -515,7 +573,7 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem,
if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result)
return Result;
Result = FspCreateSecurityDescriptor(FileSystem, Request, ParentDescriptor, &ObjectDescriptor);
Result = FspCreateSecurityDescriptor(FileSystem, Request, ParentDescriptor, &OpenDescriptor);
FspDeleteSecurityDescriptor(ParentDescriptor, FspAccessCheckEx);
if (!NT_SUCCESS(Result))
return Result;
@ -525,13 +583,24 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem,
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
Result = FileSystem->Interface->Create(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor);
if (0 != FileSystem->Interface->CreateEx)
Result = FileSystem->Interface->CreateEx(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, OpenDescriptor, Request->Req.Create.AllocationSize,
0 != Request->Req.Create.Ea.Size ?
(PVOID)(Request->Buffer + Request->Req.Create.Ea.Offset) : 0,
Request->Req.Create.Ea.Size,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
else
Result = FileSystem->Interface->Create(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, OpenDescriptor, Request->Req.Create.AllocationSize,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
if (!NT_SUCCESS(Result))
{
FspDeleteSecurityDescriptor(OpenDescriptor, FspCreateSecurityDescriptor);
return Result;
}
}
if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize)
@ -541,6 +610,13 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem,
Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize;
}
if (0 != OpenDescriptor)
{
FspFileSystemOpCreate_SetOpenDescriptor(Response, OpenDescriptor);
FspDeleteSecurityDescriptor(OpenDescriptor, Create ?
(NTSTATUS (*)())FspCreateSecurityDescriptor : (NTSTATUS (*)())FspAccessCheckEx);
}
Response->IoStatus.Information = Create ? FILE_CREATED : FILE_OPENED;
SetFileContext(Response->Rsp.Create.Opened, FullContext);
Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess;
@ -641,10 +717,19 @@ static NTSTATUS FspFileSystemOpCreate_FileOverwriteIf(FSP_FILE_SYSTEM *FileSyste
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
Result = FileSystem->Interface->Create(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
if (0 != FileSystem->Interface->CreateEx)
Result = FileSystem->Interface->CreateEx(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
0 != Request->Req.Create.Ea.Size ?
(PVOID)(Request->Buffer + Request->Req.Create.Ea.Offset) : 0,
Request->Req.Create.Ea.Size,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
else
Result = FileSystem->Interface->Create(FileSystem,
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo);
FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor);
if (!NT_SUCCESS(Result))
return Result;
@ -807,9 +892,9 @@ FSP_API NTSTATUS FspFileSystemOpCreate(FSP_FILE_SYSTEM *FileSystem,
{
NTSTATUS Result;
if (0 == FileSystem->Interface->Create ||
if ((0 == FileSystem->Interface->Create && 0 == FileSystem->Interface->CreateEx) ||
0 == FileSystem->Interface->Open ||
0 == FileSystem->Interface->Overwrite)
(0 == FileSystem->Interface->Overwrite && 0 == FileSystem->Interface->OverwriteEx))
return STATUS_INVALID_DEVICE_REQUEST;
if (Request->Req.Create.OpenTargetDirectory)
@ -852,16 +937,27 @@ FSP_API NTSTATUS FspFileSystemOpOverwrite(FSP_FILE_SYSTEM *FileSystem,
NTSTATUS Result;
FSP_FSCTL_FILE_INFO FileInfo;
if (0 == FileSystem->Interface->Overwrite)
if (0 == FileSystem->Interface->Overwrite && 0 == FileSystem->Interface->OverwriteEx)
return STATUS_INVALID_DEVICE_REQUEST;
memset(&FileInfo, 0, sizeof FileInfo);
Result = FileSystem->Interface->Overwrite(FileSystem,
(PVOID)ValOfFileContext(Request->Req.Overwrite),
Request->Req.Overwrite.FileAttributes,
Request->Req.Overwrite.Supersede,
Request->Req.Overwrite.AllocationSize,
&FileInfo);
if (0 != FileSystem->Interface->OverwriteEx)
Result = FileSystem->Interface->OverwriteEx(FileSystem,
(PVOID)ValOfFileContext(Request->Req.Overwrite),
Request->Req.Overwrite.FileAttributes,
Request->Req.Overwrite.Supersede,
Request->Req.Overwrite.AllocationSize,
0 != Request->Req.Overwrite.Ea.Size ?
(PVOID)(Request->Buffer + Request->Req.Overwrite.Ea.Offset) : 0,
Request->Req.Overwrite.Ea.Size,
&FileInfo);
else
Result = FileSystem->Interface->Overwrite(FileSystem,
(PVOID)ValOfFileContext(Request->Req.Overwrite),
Request->Req.Overwrite.FileAttributes,
Request->Req.Overwrite.Supersede,
Request->Req.Overwrite.AllocationSize,
&FileInfo);
if (!NT_SUCCESS(Result))
{
if (0 != FileSystem->Interface->Close)
@ -1043,13 +1139,22 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
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)
Result = FileSystem->Interface->CanDelete(FileSystem,
(PVOID)ValOfFileContext(Request->Req.SetInformation),
(PWSTR)Request->Buffer);
else
Result = STATUS_SUCCESS;
}
break;
case 10/*FileRenameInformation*/:
if (0 != FileSystem->Interface->Rename)
@ -1078,6 +1183,49 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
return STATUS_SUCCESS;
}
FSP_API NTSTATUS FspFileSystemOpQueryEa(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
NTSTATUS Result;
ULONG BytesTransferred;
if (0 == FileSystem->Interface->GetEa)
return STATUS_INVALID_DEVICE_REQUEST;
BytesTransferred = 0;
Result = FileSystem->Interface->GetEa(FileSystem,
(PVOID)ValOfFileContext(Request->Req.QueryEa),
(PVOID)Response->Buffer, FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX, &BytesTransferred);
if (!NT_SUCCESS(Result))
return STATUS_BUFFER_OVERFLOW != Result ? Result : STATUS_EA_LIST_INCONSISTENT;
Response->Size = (UINT16)(sizeof *Response + BytesTransferred);
Response->Rsp.QueryEa.Ea.Offset = 0;
Response->Rsp.QueryEa.Ea.Size = (UINT16)BytesTransferred;
return STATUS_SUCCESS;
}
FSP_API NTSTATUS FspFileSystemOpSetEa(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
NTSTATUS Result;
FSP_FSCTL_FILE_INFO FileInfo;
if (0 == FileSystem->Interface->SetEa)
return STATUS_INVALID_DEVICE_REQUEST;
memset(&FileInfo, 0, sizeof FileInfo);
Result = FileSystem->Interface->SetEa(FileSystem,
(PVOID)ValOfFileContext(Request->Req.SetEa),
(PVOID)Request->Buffer, Request->Req.SetEa.Ea.Size,
&FileInfo);
if (!NT_SUCCESS(Result))
return Result;
memcpy(&Response->Rsp.SetEa.FileInfo, &FileInfo, sizeof FileInfo);
return STATUS_SUCCESS;
}
FSP_API NTSTATUS FspFileSystemOpQueryVolumeInformation(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
@ -1659,3 +1807,51 @@ FSP_API BOOLEAN FspFileSystemAddStreamInfo(FSP_FSCTL_STREAM_INFO *StreamInfo,
{
return FspFileSystemAddXxxInfo(StreamInfo, Buffer, Length, PBytesTransferred);
}
FSP_API NTSTATUS FspFileSystemEnumerateEa(FSP_FILE_SYSTEM *FileSystem,
NTSTATUS (*EnumerateEa)(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PFILE_FULL_EA_INFORMATION SingleEa),
PVOID Context,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength)
{
NTSTATUS Result = STATUS_SUCCESS;
for (PFILE_FULL_EA_INFORMATION EaEnd = (PVOID)((PUINT8)Ea + EaLength);
EaEnd > Ea; Ea = FSP_NEXT_EA(Ea, EaEnd))
{
Result = EnumerateEa(FileSystem, Context, Ea);
if (!NT_SUCCESS(Result))
break;
}
return Result;
}
FSP_API BOOLEAN FspFileSystemAddEa(PFILE_FULL_EA_INFORMATION SingleEa,
PFILE_FULL_EA_INFORMATION Ea, ULONG Length, PULONG PBytesTransferred)
{
if (0 != SingleEa)
{
PUINT8 EaPtr = (PUINT8)Ea + FSP_FSCTL_ALIGN_UP(*PBytesTransferred, sizeof(ULONG));
PUINT8 EaEnd = (PUINT8)Ea + Length;
ULONG EaLen = FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) +
SingleEa->EaNameLength + 1 + SingleEa->EaValueLength;
if (EaEnd < EaPtr + EaLen)
return FALSE;
memcpy(EaPtr, SingleEa, EaLen);
((PFILE_FULL_EA_INFORMATION)EaPtr)->NextEntryOffset = FSP_FSCTL_ALIGN_UP(EaLen, sizeof(ULONG));
*PBytesTransferred = (ULONG)(EaPtr + EaLen - (PUINT8)Ea);
}
else if ((ULONG)FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) <= *PBytesTransferred)
{
PUINT8 EaEnd = (PUINT8)Ea + *PBytesTransferred;
while (EaEnd > (PUINT8)Ea + Ea->NextEntryOffset)
Ea = (PVOID)((PUINT8)Ea + Ea->NextEntryOffset);
Ea->NextEntryOffset = 0;
}
return TRUE;
}

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/fuse.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -79,6 +83,8 @@ static struct fuse_opt fsp_fuse_core_opts[] =
FSP_FUSE_CORE_OPT("FileInfoTimeout=%d", VolumeParams.FileInfoTimeout, 0),
FSP_FUSE_CORE_OPT("DirInfoTimeout=", set_DirInfoTimeout, 1),
FSP_FUSE_CORE_OPT("DirInfoTimeout=%d", VolumeParams.DirInfoTimeout, 0),
FSP_FUSE_CORE_OPT("EaTimeout=", set_EaTimeout, 1),
FSP_FUSE_CORE_OPT("EaTimeout=%d", VolumeParams.EaTimeout, 0),
FSP_FUSE_CORE_OPT("VolumeInfoTimeout=", set_VolumeInfoTimeout, 1),
FSP_FUSE_CORE_OPT("VolumeInfoTimeout=%d", VolumeParams.VolumeInfoTimeout, 0),
FSP_FUSE_CORE_OPT("KeepFileCache=", set_KeepFileCache, 1),
@ -248,6 +254,7 @@ static int fsp_fuse_core_opt_proc(void *opt_data0, const char *arg, int key,
FSP_FUSE_LIBRARY_NAME " advanced options:\n"
" -o FileInfoTimeout=N metadata timeout (millis, -1 for data caching)\n"
" -o DirInfoTimeout=N directory info timeout (millis)\n"
" -o EaTimeout=N extended attribute timeout (millis)\n"
" -o VolumeInfoTimeout=N volume info timeout (millis)\n"
" -o KeepFileCache do not discard cache when files are closed\n"
" -o ThreadCount number of file system dispatcher threads\n"
@ -388,6 +395,8 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
opt_data.VolumeParams.FileInfoTimeout = opt_data.attr_timeout * 1000;
if (opt_data.set_DirInfoTimeout)
opt_data.VolumeParams.DirInfoTimeoutValid = 1;
if (opt_data.set_EaTimeout)
opt_data.VolumeParams.EaTimeoutValid = 1;
if (opt_data.set_VolumeInfoTimeout)
opt_data.VolumeParams.VolumeInfoTimeoutValid = 1;
if (opt_data.set_KeepFileCache)
@ -430,10 +439,6 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
goto fail;
memcpy(f->MountPoint, ch->MountPoint, Size);
f->LoopEvent = CreateEventW(0, TRUE, FALSE, 0);
if (0 == f->LoopEvent)
goto fail;
Result = FspFileSystemPreflight(
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);
@ -481,9 +486,6 @@ fail:
FSP_FUSE_API void fsp_fuse_destroy(struct fsp_fuse_env *env,
struct fuse *f)
{
if (0 != f->LoopEvent)
CloseHandle(f->LoopEvent);
fsp_fuse_obj_free(f->MountPoint);
fsp_fuse_obj_free(f);
@ -492,7 +494,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,
struct fuse *f)
{
SetEvent(f->LoopEvent);
if (0 != f->LoopEvent)
SetEvent(f->LoopEvent);
f->exited = 1;
}

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/fuse_compat.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/fuse_intf.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -434,6 +438,9 @@ static NTSTATUS fsp_fuse_intf_GetFileInfoFunnel(FSP_FILE_SYSTEM *FileSystem,
FspPosixUnixTimeToFileTime((void *)&stbuf.st_ctim, &FileInfo->ChangeTime);
FileInfo->IndexNumber = stbuf.st_ino;
FileInfo->HardLinks = 0;
FileInfo->EaSize = 0;
return STATUS_SUCCESS;
}
@ -662,6 +669,9 @@ static NTSTATUS fsp_fuse_intf_GetReparsePointEx(FSP_FILE_SYSTEM *FileSystem,
static NTSTATUS fsp_fuse_intf_GetReparsePointByName(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize);
static NTSTATUS fsp_fuse_intf_SetEaEntry(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PFILE_FULL_EA_INFORMATION SingleEa);
static NTSTATUS fsp_fuse_intf_GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_VOLUME_INFO *VolumeInfo)
@ -733,6 +743,7 @@ exit:
static NTSTATUS fsp_fuse_intf_Create(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
PVOID *PFileDesc, FSP_FSCTL_FILE_INFO *FileInfo)
{
struct fuse *f = FileSystem->UserContext;
@ -746,6 +757,16 @@ static NTSTATUS fsp_fuse_intf_Create(FSP_FILE_SYSTEM *FileSystem,
int err;
NTSTATUS Result;
if (0 != Ea)
{
if (0 == f->ops.listxattr || 0 == f->ops.getxattr ||
0 == f->ops.setxattr || 0 == f->ops.removexattr)
{
Result = STATUS_EAS_NOT_SUPPORTED;
goto exit;
}
}
filedesc = MemAlloc(sizeof *filedesc);
if (0 == filedesc)
{
@ -845,6 +866,13 @@ static NTSTATUS fsp_fuse_intf_Create(FSP_FILE_SYSTEM *FileSystem,
goto exit;
}
if (0 != Ea)
{
Result = FspFileSystemEnumerateEa(FileSystem,
fsp_fuse_intf_SetEaEntry, contexthdr->PosixPath, Ea, EaLength);
if (!NT_SUCCESS(Result))
goto exit;
}
/*
* Ignore fuse_file_info::direct_io, fuse_file_info::keep_cache.
* NOTE: Originally WinFsp dit not support disabling the cache manager
@ -997,6 +1025,7 @@ exit:
static NTSTATUS fsp_fuse_intf_Overwrite(FSP_FILE_SYSTEM *FileSystem,
PVOID FileDesc, UINT32 FileAttributes, BOOLEAN ReplaceFileAttributes, UINT64 AllocationSize,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
FSP_FSCTL_FILE_INFO *FileInfo)
{
struct fuse *f = FileSystem->UserContext;
@ -1009,6 +1038,29 @@ static NTSTATUS fsp_fuse_intf_Overwrite(FSP_FILE_SYSTEM *FileSystem,
if (filedesc->IsDirectory || filedesc->IsReparsePoint)
return STATUS_ACCESS_DENIED;
if (0 != Ea)
{
char names[3 * 1024];
int namesize;
if (0 == f->ops.listxattr || 0 == f->ops.getxattr ||
0 == f->ops.setxattr || 0 == f->ops.removexattr)
return STATUS_EAS_NOT_SUPPORTED;
namesize = f->ops.listxattr(filedesc->PosixPath, names, sizeof names);
if (0 < namesize)
for (char *p = names, *endp = p + namesize; endp > p; p += namesize)
{
namesize = lstrlenA(p) + 1;
f->ops.removexattr(filedesc->PosixPath, p);
}
Result = FspFileSystemEnumerateEa(FileSystem,
fsp_fuse_intf_SetEaEntry, filedesc->PosixPath, Ea, EaLength);
if (!NT_SUCCESS(Result))
return Result;
}
if (0 != f->ops.ftruncate)
{
memset(&fi, 0, sizeof fi);
@ -2164,18 +2216,118 @@ static NTSTATUS fsp_fuse_intf_Control(FSP_FILE_SYSTEM *FileSystem,
memcpy(OutputBuffer, InputBuffer, InputBufferLength);
err = f->ops.ioctl(filedesc->PosixPath, cmd, 0, &fi, 0, OutputBuffer);
}
*PBytesTransferred = OutputBufferLength;
return fsp_fuse_ntstatus_from_errno(f->env, err);
}
static NTSTATUS fsp_fuse_intf_GetEa(FSP_FILE_SYSTEM *FileSystem,
PVOID FileDesc,
PFILE_FULL_EA_INFORMATION Ea0, ULONG EaLength, PULONG PBytesTransferred)
{
struct fuse *f = FileSystem->UserContext;
struct fsp_fuse_file_desc *filedesc = FileDesc;
char names[3 * 1024];
int namesize, valuesize;
PFILE_FULL_EA_INFORMATION Ea = Ea0, PrevEa = 0;
PUINT8 EaEnd = (PUINT8)Ea + EaLength, EaValue;
if (0 == f->ops.listxattr || 0 == f->ops.getxattr)
return STATUS_INVALID_DEVICE_REQUEST;
namesize = f->ops.listxattr(filedesc->PosixPath, names, sizeof names);
if (0 >= namesize)
{
*PBytesTransferred = 0;
return fsp_fuse_ntstatus_from_errno(f->env, namesize);
}
for (char *p = names, *endp = p + namesize; endp > p; p += namesize)
{
namesize = lstrlenA(p) + 1;
EaValue = (PUINT8)Ea + FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + namesize;
if (EaValue >= EaEnd)
/* if there is no space (at least 1 byte) for a value bail out */
break;
valuesize = f->ops.getxattr(filedesc->PosixPath, p, EaValue, EaEnd - EaValue);
if (0 >= valuesize)
continue;
Ea->NextEntryOffset = 0;
Ea->Flags = 0;
Ea->EaNameLength = namesize - 1;
Ea->EaValueLength = valuesize;
memcpy(Ea->EaName, p, namesize);
if (0 != PrevEa)
PrevEa->NextEntryOffset = (ULONG)((PUINT8)Ea - (PUINT8)PrevEa);
PrevEa = Ea;
*PBytesTransferred = (ULONG)((PUINT8)EaValue - (PUINT8)Ea0 + valuesize);
Ea = (PVOID)((PUINT8)Ea +
FSP_FSCTL_ALIGN_UP(
FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + namesize + valuesize,
sizeof(ULONG)));
}
return STATUS_SUCCESS;
}
static NTSTATUS fsp_fuse_intf_SetEaEntry(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PFILE_FULL_EA_INFORMATION SingleEa)
{
struct fuse *f = FileSystem->UserContext;
const char *PosixPath = Context;
int err;
if (0 != SingleEa->EaValueLength)
err = f->ops.setxattr(PosixPath,
SingleEa->EaName, SingleEa->EaName + SingleEa->EaNameLength + 1, SingleEa->EaValueLength, 0);
else
err = f->ops.removexattr(PosixPath,
SingleEa->EaName);
return fsp_fuse_ntstatus_from_errno(f->env, err);
}
static NTSTATUS fsp_fuse_intf_SetEa(FSP_FILE_SYSTEM *FileSystem,
PVOID FileDesc,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
FSP_FSCTL_FILE_INFO *FileInfo)
{
struct fuse *f = FileSystem->UserContext;
struct fsp_fuse_file_desc *filedesc = FileDesc;
UINT32 Uid, Gid, Mode;
struct fuse_file_info fi;
NTSTATUS Result;
if (0 == f->ops.setxattr || 0 == f->ops.removexattr)
return STATUS_INVALID_DEVICE_REQUEST;
Result = FspFileSystemEnumerateEa(FileSystem,
fsp_fuse_intf_SetEaEntry, filedesc->PosixPath, Ea, EaLength);
if (!NT_SUCCESS(Result))
return Result;
memset(&fi, 0, sizeof fi);
fi.flags = filedesc->OpenFlags;
fi.fh = filedesc->FileHandle;
return fsp_fuse_intf_GetFileInfoEx(FileSystem, filedesc->PosixPath, &fi,
&Uid, &Gid, &Mode, FileInfo);
}
FSP_FILE_SYSTEM_INTERFACE fsp_fuse_intf =
{
fsp_fuse_intf_GetVolumeInfo,
fsp_fuse_intf_SetVolumeLabel,
fsp_fuse_intf_GetSecurityByName,
fsp_fuse_intf_Create,
0,
fsp_fuse_intf_Open,
fsp_fuse_intf_Overwrite,
0,
fsp_fuse_intf_Cleanup,
fsp_fuse_intf_Close,
fsp_fuse_intf_Read,
@ -2196,6 +2348,11 @@ FSP_FILE_SYSTEM_INTERFACE fsp_fuse_intf =
0,
fsp_fuse_intf_GetDirInfoByName,
fsp_fuse_intf_Control,
0,
fsp_fuse_intf_Create,
fsp_fuse_intf_Overwrite,
fsp_fuse_intf_GetEa,
fsp_fuse_intf_SetEa,
};
/*

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/fuse_loop.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -53,6 +57,10 @@ static NTSTATUS fsp_fuse_loop_start(struct fuse *f)
struct fuse_conn_info conn;
NTSTATUS Result;
f->LoopEvent = CreateEventW(0, TRUE, FALSE, 0);
if (0 == f->LoopEvent)
goto fail;
context = fsp_fuse_get_context(f->env);
if (0 == context)
{
@ -152,6 +160,9 @@ static NTSTATUS fsp_fuse_loop_start(struct fuse *f)
err = f->ops.readlink("/", buf, sizeof buf);
f->has_symlinks = -ENOSYS_(f->env) != err;
}
if (0 != f->ops.listxattr && 0 != f->ops.getxattr &&
0 != f->ops.setxattr && 0 != f->ops.removexattr)
f->VolumeParams.ExtendedAttributes = 1;
/* the FSD does not currently limit these VolumeParams fields; do so here! */
if (f->VolumeParams.SectorSize < FSP_FUSE_SECTORSIZE_MIN ||
@ -239,6 +250,12 @@ static void fsp_fuse_loop_cleanup(struct fuse *f)
f->ops.destroy(f->data);
f->fsinit = FALSE;
}
if (0 != f->LoopEvent)
{
CloseHandle(f->LoopEvent);
f->LoopEvent = 0;
}
}
static NTSTATUS fsp_fuse_loop_internal(struct fuse *f)
@ -264,11 +281,15 @@ static NTSTATUS fsp_fuse_loop_internal(struct fuse *f)
}
/* if either the service thread dies or our event gets signaled, stop the loop */
WaitObjects[0] = fsp_fuse_svcthread;
WaitObjects[1] = f->LoopEvent;
WaitResult = WaitForMultipleObjects(2, WaitObjects, FALSE, INFINITE);
if (WAIT_OBJECT_0 != WaitResult && WAIT_OBJECT_0 + 1 != WaitResult)
Result = FspNtStatusFromWin32(GetLastError());
Result = STATUS_SUCCESS;
if (!f->exited)
{
WaitObjects[0] = fsp_fuse_svcthread;
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);

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/fuse_main.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/fuse_opt.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/library.h
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -139,6 +143,7 @@ struct fsp_fuse_core_opt_data
rellinks;
int set_FileInfoTimeout,
set_DirInfoTimeout,
set_EaTimeout,
set_VolumeInfoTimeout,
set_KeepFileCache;
unsigned ThreadCount;

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse3/fuse2to3.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse3/fuse3.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse/fuse3_compat.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/fuse3/library.h
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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

View File

@ -1,7 +1,7 @@
/**
* @file dll/launch.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,16 +10,31 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
FSP_API NTSTATUS FspLaunchCallLauncherPipe(
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;
ULONG Length, BytesTransferred;
@ -49,9 +64,9 @@ FSP_API NTSTATUS FspLaunchCallLauncherPipe(
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,
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, FSP_LAUNCH_PIPE_OWNER);
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, AllowImpersonation, FSP_LAUNCH_PIPE_OWNER);
if (!NT_SUCCESS(Result))
goto exit;
@ -98,8 +113,17 @@ exit:
}
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,
BOOLEAN HasSecret,
BOOLEAN AllowImpersonation,
PULONG PLauncherError)
{
PWSTR Argv[9 + 2];
@ -111,9 +135,9 @@ FSP_API NTSTATUS FspLaunchStart(
Argv[1] = InstanceName;
memcpy(Argv + 2, Argv0, Argc * sizeof(PWSTR));
return FspLaunchCallLauncherPipe(
return FspLaunchCallLauncherPipeEx(
HasSecret ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart,
Argc + 2, Argv, 0, 0, 0, PLauncherError);
Argc + 2, Argv, 0, 0, 0, AllowImpersonation, PLauncherError);
}
FSP_API NTSTATUS FspLaunchStop(
@ -246,8 +270,10 @@ FSP_API NTSTATUS FspLaunchRegSetRecord(
SETFIELD(WorkDirectory);
SETFIELD(RunAs);
SETFIELD(Security);
SETFIELD(AuthPackage);
SETFIELDI(JobControl, ~0); /* JobControl default is 1; but we treat as without default */
SETFIELDI(Credentials, 0);
SETFIELDI(AuthPackageId, 0);
}
else
{
@ -396,8 +422,10 @@ FSP_API NTSTATUS FspLaunchRegGetRecord(
GETFIELD(WorkDirectory);
GETFIELD(RunAs);
GETFIELD(Security);
GETFIELD(AuthPackage);
GETFIELDI(JobControl);
GETFIELDI(Credentials);
GETFIELDI(AuthPackageId);
if (0 == Record->Executable)
{
@ -426,8 +454,11 @@ FSP_API NTSTATUS FspLaunchRegGetRecord(
(PVOID)(Record->Buffer + ((PUINT8)RecordBuf.RunAs - RegBuf)) : 0;
Record->Security = 0 != RecordBuf.Security ?
(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->Credentials = RecordBuf.Credentials;
Record->AuthPackageId = RecordBuf.AuthPackageId;
*PRecord = Record;
Result = STATUS_SUCCESS;

View File

@ -1,7 +1,7 @@
/**
* @file dll/library.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -42,6 +46,7 @@ BOOL WINAPI DllMain(HINSTANCE Instance, DWORD Reason, PVOID Reserved)
Dynamic = 0 == Reserved;
fsp_fuse_finalize(Dynamic);
FspServiceFinalize(Dynamic);
FspFileSystemFinalize(Dynamic);
FspEventLogFinalize(Dynamic);
FspPosixFinalize(Dynamic);
FspWksidFinalize(Dynamic);

View File

@ -1,7 +1,7 @@
/**
* @file dll/library.h
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -43,6 +47,7 @@
VOID FspWksidFinalize(BOOLEAN Dynamic);
VOID FspPosixFinalize(BOOLEAN Dynamic);
VOID FspEventLogFinalize(BOOLEAN Dynamic);
VOID FspFileSystemFinalize(BOOLEAN Dynamic);
VOID FspServiceFinalize(BOOLEAN Dynamic);
VOID fsp_fuse_finalize(BOOLEAN Dynamic);
VOID fsp_fuse_finalize_thread(VOID);
@ -87,4 +92,7 @@ static inline BOOLEAN FspPathIsDrive(PWSTR FileName)
L':' == FileName[1] && L'\0' == FileName[2];
}
#define FSP_NEXT_EA(Ea, EaEnd) \
(0 != (Ea)->NextEntryOffset ? (PVOID)((PUINT8)(Ea) + (Ea)->NextEntryOffset) : (EaEnd))
#endif

View File

@ -1,7 +1,7 @@
/**
* @file dll/np.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,15 +10,22 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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 <npapi.h>
#include <wincred.h>
#define _NTDEF_
#include <ntsecapi.h>
#define FSP_NP_NAME LIBRARY_NAME ".Np"
#define FSP_NP_TYPE ' spF' /* pick a value hopefully not in use */
#define FSP_NP_ADDCONNECTION_TIMEOUT 15000
@ -175,12 +182,14 @@ static inline BOOLEAN FspNpParseRemoteUserName(PWSTR RemoteName,
static inline DWORD FspNpCallLauncherPipe(
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
PWSTR Buffer, PULONG PSize)
PWSTR Buffer, PULONG PSize,
BOOLEAN AllowImpersonation)
{
NTSTATUS Result;
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) ?
WN_NO_NETWORK :
(ERROR_BROKEN_PIPE == ErrorCode ? WN_NO_NETWORK : ErrorCode);
@ -247,7 +256,50 @@ static WCHAR FspNpGetDriveLetter(PDWORD PLogicalDrives, PWSTR VolumeName)
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;
ULONG ClassNameLen, InstanceNameLen;
@ -255,7 +307,14 @@ static DWORD FspNpGetRemoteInfo(PWSTR RemoteName, PDWORD PCredentialsKind)
FSP_LAUNCH_REG_RECORD *Record;
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,
&ClassName, &ClassNameLen, &InstanceName, &InstanceNameLen))
@ -270,15 +329,36 @@ static DWORD FspNpGetRemoteInfo(PWSTR RemoteName, PDWORD PCredentialsKind)
if (!NT_SUCCESS(Result))
return WN_NO_NETWORK;
switch (Record->Credentials)
if (0 != PAuthPackage)
{
case FSP_NP_CREDENTIALS_NONE:
case FSP_NP_CREDENTIALS_PASSWORD:
case FSP_NP_CREDENTIALS_USERPASS:
*PCredentialsKind = Record->Credentials;
break;
if (0 != Record->AuthPackage)
{
ULONG AuthPackage = 0;
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);
return WN_SUCCESS;
@ -286,7 +366,7 @@ static DWORD FspNpGetRemoteInfo(PWSTR RemoteName, PDWORD PCredentialsKind)
static DWORD FspNpGetCredentials(
HWND hwndOwner, PWSTR Caption, DWORD PrevNpResult,
DWORD CredentialsKind,
DWORD AuthPackage0, DWORD CredentialsKind,
PBOOL PSave,
PWSTR UserName, ULONG UserNameSize/* 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));
#else
WCHAR Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1];
ULONG AuthPackage = 0;
ULONG AuthPackage = 0 != AuthPackage0 ? AuthPackage0 - 1 : 0;
PVOID InAuthBuf = 0, OutAuthBuf = 0;
ULONG InAuthSize, OutAuthSize, DomainSize;
@ -342,7 +422,8 @@ static DWORD FspNpGetCredentials(
NpResult = CredUIPromptForWindowsCredentialsW(&UiInfo, PrevNpResult,
&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)
goto exit;
@ -460,6 +541,7 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
PWSTR ClassName, InstanceName, RemoteName, P;
ULONG ClassNameLen, InstanceNameLen;
DWORD CredentialsKind;
BOOLEAN AllowImpersonation;
ULONG Argc;
PWSTR Argv[6];
ULONG Argl[6];
@ -489,7 +571,7 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
return WN_ALREADY_CONNECTED;
}
NpResult = FspNpGetRemoteInfo(lpRemoteName, &CredentialsKind);
NpResult = FspNpGetRemoteInfo(lpRemoteName, 0, &CredentialsKind, &AllowImpersonation);
if (WN_SUCCESS != NpResult)
return NpResult;
@ -546,7 +628,8 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
NpResult = FspNpCallLauncherPipe(
FSP_NP_CREDENTIALS_NONE != CredentialsKind ? FspLaunchCmdStartWithSecret : FspLaunchCmdStart,
Argc, Argv, Argl, 0, 0);
Argc, Argv, Argl, 0, 0,
AllowImpersonation);
switch (NpResult)
{
case WN_SUCCESS:
@ -598,7 +681,8 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
if (WN_SUCCESS != FspNpCallLauncherPipe(
FspLaunchCmdGetInfo,
Argc, Argv, Argl, 0, 0))
Argc, Argv, Argl, 0, 0,
FALSE))
{
/* looks like the file system is gone! */
NpResult = WN_NO_NETWORK;
@ -655,7 +739,7 @@ DWORD APIENTRY NPAddConnection3(HWND hwndOwner,
{
DWORD NpResult;
PWSTR RemoteName = lpNetResource->lpRemoteName;
DWORD CredentialsKind;
DWORD AuthPackage, CredentialsKind;
WCHAR UserName[CREDUI_MAX_USERNAME_LENGTH + 1], Password[CREDUI_MAX_PASSWORD_LENGTH + 1];
#if defined(FSP_NP_CREDENTIAL_MANAGER)
BOOL Save = TRUE;
@ -675,7 +759,7 @@ DWORD APIENTRY NPAddConnection3(HWND hwndOwner,
return NpResult;
}
NpResult = FspNpGetRemoteInfo(RemoteName, &CredentialsKind);
NpResult = FspNpGetRemoteInfo(RemoteName, &AuthPackage, &CredentialsKind, 0);
if (WN_SUCCESS != NpResult)
return NpResult;
if (FSP_NP_CREDENTIALS_NONE == CredentialsKind)
@ -691,7 +775,7 @@ DWORD APIENTRY NPAddConnection3(HWND hwndOwner,
{
NpResult = FspNpGetCredentials(
hwndOwner, RemoteName, NpResult,
CredentialsKind,
AuthPackage, CredentialsKind,
#if defined(FSP_NP_CREDENTIAL_MANAGER)
&Save,
#else
@ -762,7 +846,8 @@ DWORD APIENTRY NPCancelConnection(LPWSTR lpName, BOOL fForce)
NpResult = FspNpCallLauncherPipe(
FspLaunchCmdStop,
Argc, Argv, Argl, 0, 0);
Argc, Argv, Argl, 0, 0,
FALSE);
switch (NpResult)
{
case WN_SUCCESS:

View File

@ -1,7 +1,7 @@
/**
* @file dll/ntstatus.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/path.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -14,7 +14,7 @@
* [SNAME]
* https://www.cygwin.com/cygwin-ug-net/using-specialnames.html
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -23,9 +23,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -186,7 +190,7 @@ FSP_API NTSTATUS FspPosixMapUidToSid(UINT32 Uid, PSID *PSid)
Uid - 0x30000);
}
}
else if (0x100000 <= Uid && Uid < 0x200000)
else if (0x100000 <= Uid && Uid < 0xff000000)
{
if (0 != FspPrimaryDomainSid &&
5 == FspPrimaryDomainSid->IdentifierAuthority.Value[5] &&

View File

@ -1,7 +1,7 @@
/**
* @file dll/security.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -337,26 +341,25 @@ FSP_API NTSTATUS FspAccessCheckEx(FSP_FILE_SYSTEM *FileSystem,
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 &
(FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_ADD_SUBDIRECTORY | FILE_DELETE_CHILD))
{
Result = STATUS_ACCESS_DENIED;
goto exit;
}
if (Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE)
{
Result = STATUS_CANNOT_DELETE;
goto exit;
}
Result = STATUS_ACCESS_DENIED;
goto exit;
}
if (FILE_ATTRIBUTE_READONLY == (FileAttributes & FILE_ATTRIBUTE_READONLY) &&
(Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE))
{
Result = STATUS_CANNOT_DELETE;
goto exit;
}
if (0 == SecurityDescriptorSize)
*PGrantedAccess = (MAXIMUM_ALLOWED & 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))
*PGrantedAccess &= ~(FILE_WRITE_DATA | FILE_APPEND_DATA |
FILE_ADD_SUBDIRECTORY | FILE_DELETE_CHILD);

View File

@ -1,7 +1,7 @@
/**
* @file dll/service.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file dll/util.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -63,6 +67,16 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize,
PULONG PBytesTransferred, ULONG Timeout,
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;
HANDLE Pipe = INVALID_HANDLE_VALUE;
@ -71,7 +85,8 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
Pipe = CreateFileW(PipeName,
GENERIC_READ | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES,
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 (ERROR_PIPE_BUSY != GetLastError())
@ -85,7 +100,8 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
Pipe = CreateFileW(PipeName,
GENERIC_READ | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES,
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)
{
Result = FspNtStatusFromWin32(GetLastError());

View File

@ -1,7 +1,7 @@
/**
* @file dll/wksid.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/*
* dotnet/FileSystemBase+Const.cs
*
* Copyright 2015-2018 Bill Zissimopoulos
* Copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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;

View File

@ -1,7 +1,7 @@
/*
* dotnet/FileSystemBase.cs
*
* Copyright 2015-2018 Bill Zissimopoulos
* Copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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;
@ -337,6 +341,7 @@ namespace Fsp
/// These flags determine whether the file was modified and whether to delete the file.
/// </param>
/// <seealso cref="CanDelete"/>
/// <seealso cref="SetDelete"/>
/// <seealso cref="Close"/>
public virtual void Cleanup(
Object FileNode,
@ -591,6 +596,22 @@ namespace Fsp
/// <summary>
/// Determines whether a file or directory can be deleted.
/// </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">
/// The file node of the file or directory to test for deletion.
/// </param>
@ -602,6 +623,7 @@ namespace Fsp
/// </param>
/// <returns>STATUS_SUCCESS or error code.</returns>
/// <seealso cref="Cleanup"/>
/// <seealso cref="SetDelete"/>
public virtual Int32 CanDelete(
Object FileNode,
Object FileDesc,
@ -685,7 +707,7 @@ namespace Fsp
/// Describes the modifications to apply to the file or directory security descriptor.
/// </param>
/// <returns>STATUS_SUCCESS or error code.</returns>
/// <seealso cref="ModifySecurityDescriptor"/>
/// <seealso cref="ModifySecurityDescriptorEx"/>
public virtual Int32 SetSecurity(
Object FileNode,
Object FileDesc,
@ -1009,6 +1031,162 @@ namespace Fsp
BytesTransferred = default(UInt32);
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;
}
public virtual Int32 CreateEx(
String FileName,
UInt32 CreateOptions,
UInt32 GrantedAccess,
UInt32 FileAttributes,
Byte[] SecurityDescriptor,
UInt64 AllocationSize,
IntPtr Ea,
UInt32 EaLength,
out Object FileNode,
out Object FileDesc,
out FileInfo FileInfo,
out String NormalizedName)
{
return Create(
FileName,
CreateOptions,
GrantedAccess,
FileAttributes,
SecurityDescriptor,
AllocationSize,
out FileNode,
out FileDesc,
out FileInfo,
out NormalizedName);
}
public virtual Int32 OverwriteEx(
Object FileNode,
Object FileDesc,
UInt32 FileAttributes,
Boolean ReplaceFileAttributes,
UInt64 AllocationSize,
IntPtr Ea,
UInt32 EaLength,
out FileInfo FileInfo)
{
return Overwrite(
FileNode,
FileDesc,
FileAttributes,
ReplaceFileAttributes,
AllocationSize,
out FileInfo);
}
public virtual Int32 GetEa(
Object FileNode,
Object FileDesc,
IntPtr Ea,
UInt32 EaLength,
out UInt32 BytesTransferred)
{
Object Context = null;
String EaName;
Byte[] EaValue;
Boolean NeedEa;
FullEaInformation EaInfo = new FullEaInformation();
BytesTransferred = default(UInt32);
while (GetEaEntry(FileNode, FileDesc, ref Context, out EaName, out EaValue, out NeedEa))
{
EaInfo.Set(EaName, EaValue, NeedEa);
if (!Api.FspFileSystemAddEa(ref EaInfo, Ea, EaLength, out BytesTransferred))
return STATUS_SUCCESS;
}
Api.FspFileSystemEndEa(Ea, EaLength, out BytesTransferred);
return STATUS_SUCCESS;
}
public virtual Boolean GetEaEntry(
Object FileNode,
Object FileDesc,
ref Object Context,
out String EaName,
out Byte[] EaValue,
out Boolean NeedEa)
{
EaName = default(String);
EaValue = default(Byte[]);
NeedEa = default(Boolean);
return false;
}
public virtual Int32 SetEa(
Object FileNode,
Object FileDesc,
IntPtr Ea,
UInt32 EaLength,
out FileInfo FileInfo)
{
Int32 Result;
Result = SetEaEntries(
FileNode,
FileDesc,
Ea,
EaLength);
if (0 > Result)
{
FileInfo = default(FileInfo);
return Result;
}
return GetFileInfo(FileNode, FileDesc, out FileInfo);
}
public virtual Int32 SetEaEntry(
Object FileNode,
Object FileDesc,
ref Object Context,
String EaName,
Byte[] EaValue,
Boolean NeedEa)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
/* helpers */
/// <summary>
@ -1036,7 +1214,7 @@ namespace Fsp
return (int)Api.FspFileSystemOperationProcessId();
}
/// <summary>
/// Modifies a security descriptor.
/// Modifies a security descriptor. [OBSOLETE]
/// </summary>
/// <remarks>
/// This is a helper for implementing the SetSecurity operation.
@ -1052,6 +1230,7 @@ namespace Fsp
/// </param>
/// <returns>The modified security descriptor.</returns>
/// <seealso cref="SetSecurity"/>
[Obsolete("use ModifySecurityDescriptorEx")]
public static byte[] ModifySecurityDescriptor(
Byte[] SecurityDescriptor,
AccessControlSections Sections,
@ -1071,6 +1250,47 @@ namespace Fsp
SecurityInformation,
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(
Object FileNode,
Object FileDesc,
@ -1232,6 +1452,26 @@ namespace Fsp
return self.ExceptionHandler(ex);
}
}
public Int32 SetEaEntries(
Object FileNode,
Object FileDesc,
IntPtr Ea,
UInt32 EaLength)
{
return Api.FspFileSystemEnumerateEa(
FileNode,
FileDesc,
this.SetEaEntry,
Ea,
EaLength);
}
public static UInt32 GetEaEntrySize(
String EaName,
Byte[] EaValue,
Boolean NeedEa)
{
return FullEaInformation.PackedSize(EaName, EaValue, NeedEa);
}
}
}

View File

@ -1,7 +1,7 @@
/*
* dotnet/FileSystemHost.cs
*
* Copyright 2015-2018 Bill Zissimopoulos
* Copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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;
@ -179,6 +183,14 @@ namespace Fsp
get { return 0 != (_VolumeParams.Flags & VolumeParams.NamedStreams); }
set { _VolumeParams.Flags |= (value ? VolumeParams.NamedStreams : 0); }
}
/// <summary>
/// Gets or sets a value that determines whether the file system supports extended attributes.
/// </summary>
public Boolean ExtendedAttributes
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.ExtendedAttributes); }
set { _VolumeParams.Flags |= (value ? VolumeParams.ExtendedAttributes : 0); }
}
public Boolean PostCleanupWhenModifiedOnly
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.PostCleanupWhenModifiedOnly); }
@ -199,6 +211,16 @@ namespace Fsp
get { return 0 != (_VolumeParams.Flags & VolumeParams.FlushAndPurgeOnCleanup); }
set { _VolumeParams.Flags |= (value ? VolumeParams.FlushAndPurgeOnCleanup : 0); }
}
public Boolean DeviceControl
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.DeviceControl); }
set { _VolumeParams.Flags |= (value ? VolumeParams.DeviceControl : 0); }
}
public Boolean AllowOpenInKernelMode
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.AllowOpenInKernelMode); }
set { _VolumeParams.Flags |= (value ? VolumeParams.AllowOpenInKernelMode : 0); }
}
/// <summary>
/// Gets or sets the prefix for a network file system.
/// </summary>
@ -450,6 +472,8 @@ namespace Fsp
UInt32 FileAttributes,
IntPtr SecurityDescriptor,
UInt64 AllocationSize,
IntPtr Ea,
UInt32 EaLength,
ref FullContext FullContext,
ref OpenFileInfo OpenFileInfo)
{
@ -459,13 +483,15 @@ namespace Fsp
Object FileNode, FileDesc;
String NormalizedName;
Int32 Result;
Result = FileSystem.Create(
Result = FileSystem.CreateEx(
FileName,
CreateOptions,
GrantedAccess,
FileAttributes,
Api.MakeSecurityDescriptor(SecurityDescriptor),
AllocationSize,
Ea,
EaLength,
out FileNode,
out FileDesc,
out OpenFileInfo.FileInfo,
@ -524,6 +550,8 @@ namespace Fsp
UInt32 FileAttributes,
Boolean ReplaceFileAttributes,
UInt64 AllocationSize,
IntPtr Ea,
UInt32 EaLength,
out FileInfo FileInfo)
{
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
@ -531,12 +559,14 @@ namespace Fsp
{
Object FileNode, FileDesc;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
return FileSystem.Overwrite(
return FileSystem.OverwriteEx(
FileNode,
FileDesc,
FileAttributes,
ReplaceFileAttributes,
AllocationSize,
Ea,
EaLength,
out FileInfo);
}
catch (Exception ex)
@ -745,26 +775,6 @@ namespace Fsp
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(
IntPtr FileSystemPtr,
ref FullContext FullContext,
@ -1061,15 +1071,87 @@ namespace Fsp
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);
}
}
private static Int32 GetEa(
IntPtr FileSystemPtr,
ref FullContext FullContext,
IntPtr Ea,
UInt32 EaLength,
out UInt32 PBytesTransferred)
{
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
try
{
Object FileNode, FileDesc;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
return FileSystem.GetEa(
FileNode,
FileDesc,
Ea,
EaLength,
out PBytesTransferred);
}
catch (Exception ex)
{
PBytesTransferred = default(UInt32);
return ExceptionHandler(FileSystem, ex);
}
}
private static Int32 SetEa(
IntPtr FileSystemPtr,
ref FullContext FullContext,
IntPtr Ea,
UInt32 EaLength,
out FileInfo FileInfo)
{
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
try
{
Object FileNode, FileDesc;
Api.GetFullContext(ref FullContext, out FileNode, out FileDesc);
return FileSystem.SetEa(
FileNode,
FileDesc,
Ea,
EaLength,
out FileInfo);
}
catch (Exception ex)
{
FileInfo = default(FileInfo);
return ExceptionHandler(FileSystem, ex);
}
}
static FileSystemHost()
{
_FileSystemInterface.GetVolumeInfo = GetVolumeInfo;
_FileSystemInterface.SetVolumeLabel = SetVolumeLabel;
_FileSystemInterface.GetSecurityByName = GetSecurityByName;
_FileSystemInterface.Create = Create;
_FileSystemInterface.CreateEx = Create;
_FileSystemInterface.Open = Open;
_FileSystemInterface.Overwrite = Overwrite;
_FileSystemInterface.OverwriteEx = Overwrite;
_FileSystemInterface.Cleanup = Cleanup;
_FileSystemInterface.Close = Close;
_FileSystemInterface.Read = Read;
@ -1078,7 +1160,6 @@ namespace Fsp
_FileSystemInterface.GetFileInfo = GetFileInfo;
_FileSystemInterface.SetBasicInfo = SetBasicInfo;
_FileSystemInterface.SetFileSize = SetFileSize;
_FileSystemInterface.CanDelete = CanDelete;
_FileSystemInterface.Rename = Rename;
_FileSystemInterface.GetSecurity = GetSecurity;
_FileSystemInterface.SetSecurity = SetSecurity;
@ -1090,6 +1171,9 @@ namespace Fsp
_FileSystemInterface.GetStreamInfo = GetStreamInfo;
_FileSystemInterface.GetDirInfoByName = GetDirInfoByName;
_FileSystemInterface.Control = Control;
_FileSystemInterface.SetDelete = SetDelete;
_FileSystemInterface.GetEa = GetEa;
_FileSystemInterface.SetEa = SetEa;
_FileSystemInterfacePtr = Marshal.AllocHGlobal(FileSystemInterface.Size);
Marshal.StructureToPtr(_FileSystemInterface, _FileSystemInterfacePtr, false);

View File

@ -1,7 +1,7 @@
/*
* dotnet/Interop.cs
*
* Copyright 2015-2018 Bill Zissimopoulos
* Copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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;
@ -44,8 +48,11 @@ namespace Fsp.Interop
internal const UInt32 AlwaysUseDoubleBuffering = 0x00001000;
internal const UInt32 PassQueryDirectoryFileName = 0x00002000;
internal const UInt32 FlushAndPurgeOnCleanup = 0x00004000;
internal const UInt32 DeviceControl = 0x00008000;
internal const UInt32 UmFileContextIsUserContext2 = 0x00010000;
internal const UInt32 UmFileContextIsFullContext = 0x00020000;
internal const UInt32 AllowOpenInKernelMode = 0x01000000;
internal const UInt32 CasePreservedExtendedAttributes = 0x02000000;
internal const int PrefixSize = 192;
internal const int FileSystemNameSize = 16;
@ -189,6 +196,28 @@ namespace Fsp.Interop
/// Not currently implemented. Set to 0.
/// </summary>
public UInt32 HardLinks;
/// <summary>
/// The extended attribute size of the file.
/// </summary>
public UInt32 EaSize
{
get { return GetEaSize(); }
set { SetEaSize(value); }
}
internal static int EaSizeOffset =
(int)Marshal.OffsetOf(typeof(FileInfo), "HardLinks") + 4;
internal unsafe UInt32 GetEaSize()
{
fixed (FileInfo *P = &this)
return *(UInt32 *)((Int64)(IntPtr)P + EaSizeOffset);
}
internal unsafe void SetEaSize(UInt32 value)
{
fixed (FileInfo *P = &this)
*(UInt32 *)((Int64)(IntPtr)P + EaSizeOffset) = value;
}
}
[StructLayout(LayoutKind.Sequential)]
@ -264,6 +293,53 @@ namespace Fsp.Interop
}
}
[StructLayout(LayoutKind.Sequential)]
internal struct FullEaInformation
{
internal const int EaNameSize = 15 * 1024;
/* Set this to a value smaller than 16384 with sufficient space for additional data.
* This should really be:
* FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX - FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName)
*/
internal UInt32 NextEntryOffset;
internal Byte Flags;
internal Byte EaNameLength;
internal UInt16 EaValueLength;
internal unsafe fixed Byte EaName[EaNameSize];
internal unsafe void Set(String Name, Byte[] Value, Boolean NeedEa)
{
int NameLength = 254 < Name.Length ? 254 : Name.Length;
int ValueLength = EaNameSize - Name.Length - 1 < Value.Length ?
EaNameSize - Name.Length - 1 : Value.Length;
NextEntryOffset = 0;
Flags = NeedEa ? (Byte)0x80/*FILE_NEED_EA*/ : (Byte)0;
EaNameLength = (Byte)NameLength;
EaValueLength = (UInt16)ValueLength;
fixed (Byte *P = EaName)
{
int I = 0, J = 0;
for (; NameLength > I; I++)
P[I] = (Byte)Name[I];
P[I++] = 0;
for (; ValueLength > J; J++)
P[I + J] = Value[J];
}
}
internal static UInt32 PackedSize(String Name, Byte[] Value, Boolean NeedEa)
{
int NameLength = 254 < Name.Length ? 254 : Name.Length;
int ValueLength = EaNameSize - Name.Length - 1 < Value.Length ?
EaNameSize - Name.Length - 1 : Value.Length;
/* magic computations are courtesy of NTFS */
return (UInt32)(5 + NameLength + ValueLength);
}
}
[StructLayout(LayoutKind.Sequential)]
internal struct FullContext
{
@ -466,6 +542,49 @@ namespace Fsp.Interop
IntPtr InputBuffer, UInt32 InputBufferLength,
IntPtr OutputBuffer, UInt32 OutputBufferLength,
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);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate Int32 CreateEx(
IntPtr FileSystem,
[MarshalAs(UnmanagedType.LPWStr)] String FileName,
UInt32 CreateOptions,
UInt32 GrantedAccess,
UInt32 FileAttributes,
IntPtr SecurityDescriptor,
UInt64 AllocationSize,
IntPtr Ea,
UInt32 EaLength,
ref FullContext FullContext,
ref OpenFileInfo OpenFileInfo);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate Int32 OverwriteEx(
IntPtr FileSystem,
ref FullContext FullContext,
UInt32 FileAttributes,
[MarshalAs(UnmanagedType.U1)] Boolean ReplaceFileAttributes,
UInt64 AllocationSize,
IntPtr Ea,
UInt32 EaLength,
out FileInfo FileInfo);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate Int32 GetEa(
IntPtr FileSystem,
ref FullContext FullContext,
IntPtr Ea,
UInt32 EaLength,
out UInt32 PBytesTransferred);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate Int32 SetEa(
IntPtr FileSystem,
ref FullContext FullContext,
IntPtr Ea,
UInt32 EaLength,
out FileInfo FileInfo);
}
internal static int Size = IntPtr.Size * 64;
@ -496,7 +615,12 @@ namespace Fsp.Interop
internal Proto.GetStreamInfo GetStreamInfo;
internal Proto.GetDirInfoByName GetDirInfoByName;
internal Proto.Control Control;
/* NTSTATUS (*Reserved[38])(); */
internal Proto.SetDelete SetDelete;
internal Proto.CreateEx CreateEx;
internal Proto.OverwriteEx OverwriteEx;
internal Proto.GetEa GetEa;
internal Proto.SetEa SetEa;
/* NTSTATUS (*Reserved[33])(); */
}
[SuppressUnmanagedCodeSecurity]
@ -591,6 +715,13 @@ namespace Fsp.Interop
out UInt32 PBytesTransferred);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
internal delegate Boolean FspFileSystemAddEa(
IntPtr SingleEa,
IntPtr Ea,
UInt32 EaLength,
out UInt32 PBytesTransferred);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
internal delegate Boolean FspFileSystemAcquireDirectoryBuffer(
ref IntPtr PDirBuffer,
[MarshalAs(UnmanagedType.U1)] Boolean Reset,
@ -724,6 +855,7 @@ namespace Fsp.Interop
internal static Proto.FspFileSystemResolveReparsePoints FspFileSystemResolveReparsePoints;
internal static Proto.FspFileSystemCanReplaceReparsePoint _FspFileSystemCanReplaceReparsePoint;
internal static Proto.FspFileSystemAddStreamInfo _FspFileSystemAddStreamInfo;
internal static Proto.FspFileSystemAddEa _FspFileSystemAddEa;
internal static Proto.FspFileSystemAcquireDirectoryBuffer FspFileSystemAcquireDirectoryBuffer;
internal static Proto.FspFileSystemFillDirectoryBuffer FspFileSystemFillDirectoryBuffer;
internal static Proto.FspFileSystemReleaseDirectoryBuffer FspFileSystemReleaseDirectoryBuffer;
@ -793,6 +925,62 @@ namespace Fsp.Interop
return _FspFileSystemAddStreamInfo(IntPtr.Zero, Buffer, Length, out PBytesTransferred);
}
internal delegate Int32 EnumerateEa(
Object FileNode,
Object FileDesc,
ref Object Context,
String EaName,
Byte[] EaValue,
Boolean NeedEa);
internal static unsafe Int32 FspFileSystemEnumerateEa(
Object FileNode,
Object FileDesc,
EnumerateEa EnumerateEa,
IntPtr Ea,
UInt32 EaLength)
{
Object Context = null;
FullEaInformation *P = (FullEaInformation *)Ea;
FullEaInformation *EndP = (FullEaInformation *)(Ea.ToInt64() + EaLength);
Int32 Result;
Result = 0/*STATUS_SUCCESS*/;
for (; EndP > P;
P = 0 != P->NextEntryOffset ?
(FullEaInformation *)(((IntPtr)P).ToInt64() + P->NextEntryOffset) :
EndP)
{
String EaName = Marshal.PtrToStringAnsi((IntPtr)P->EaName, P->EaNameLength);
Byte[] EaValue = null;
if (0 != P->EaValueLength)
{
EaValue = new Byte[P->EaValueLength];
Marshal.Copy((IntPtr)(((IntPtr)P->EaName).ToInt64() + P->EaNameLength + 1),
EaValue, 0, P->EaValueLength);
}
Boolean NeedEa = 0 != (0x80/*FILE_NEED_EA*/ & P->Flags);
Result = EnumerateEa(FileNode, FileDesc, ref Context, EaName, EaValue, NeedEa);
if (0 > Result)
break;
}
return Result;
}
internal static unsafe Boolean FspFileSystemAddEa(
ref FullEaInformation EaInfo,
IntPtr Buffer,
UInt32 Length,
out UInt32 PBytesTransferred)
{
fixed (FullEaInformation *P = &EaInfo)
return _FspFileSystemAddEa((IntPtr)P, Buffer, Length, out PBytesTransferred);
}
internal static unsafe Boolean FspFileSystemEndEa(
IntPtr Buffer,
UInt32 Length,
out UInt32 PBytesTransferred)
{
return _FspFileSystemAddEa(IntPtr.Zero, Buffer, Length, out PBytesTransferred);
}
internal unsafe static Object GetUserContext(
IntPtr NativePtr)
{
@ -916,6 +1104,26 @@ namespace Fsp.Interop
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(
Byte[] ReparseData,
@ -1041,6 +1249,7 @@ namespace Fsp.Interop
FspFileSystemResolveReparsePoints = GetEntryPoint<Proto.FspFileSystemResolveReparsePoints>(Module);
_FspFileSystemCanReplaceReparsePoint = GetEntryPoint<Proto.FspFileSystemCanReplaceReparsePoint>(Module);
_FspFileSystemAddStreamInfo = GetEntryPoint<Proto.FspFileSystemAddStreamInfo>(Module);
_FspFileSystemAddEa = GetEntryPoint<Proto.FspFileSystemAddEa>(Module);
FspFileSystemAcquireDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemAcquireDirectoryBuffer>(Module);
FspFileSystemFillDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemFillDirectoryBuffer>(Module);
FspFileSystemReleaseDirectoryBuffer = GetEntryPoint<Proto.FspFileSystemReleaseDirectoryBuffer>(Module);

View File

@ -1,7 +1,7 @@
/*
* dotnet/Service.cs
*
* Copyright 2015-2018 Bill Zissimopoulos
* Copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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;

View File

@ -1,7 +1,7 @@
/**
* @file fsptool/fsptool.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file launcher/launchctl.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -68,8 +72,8 @@ static int call_pipe_and_report(PWSTR PipeBuf, ULONG SendSize, ULONG RecvSize)
NTSTATUS Result;
DWORD LastError, BytesTransferred;
Result = FspCallNamedPipeSecurely(L"" FSP_LAUNCH_PIPE_NAME, PipeBuf, SendSize, PipeBuf, RecvSize,
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, FSP_LAUNCH_PIPE_OWNER);
Result = FspCallNamedPipeSecurelyEx(L"" FSP_LAUNCH_PIPE_NAME, PipeBuf, SendSize, PipeBuf, RecvSize,
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, TRUE, FSP_LAUNCH_PIPE_OWNER);
LastError = FspWin32FromNtStatus(Result);
if (0 != LastError)

View File

@ -1,7 +1,7 @@
/**
* @file launcher/launcher.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -251,6 +255,7 @@ exit:
static BOOL LogonCreateProcess(
PWSTR UserName,
HANDLE Token,
LPCWSTR ApplicationName,
LPWSTR CommandLine,
LPSECURITY_ATTRIBUTES ProcessAttributes,
@ -267,11 +272,20 @@ static BOOL LogonCreateProcess(
if (0 != UserName)
{
if (0 == invariant_wcsicmp(UserName, L"LocalSystem"))
{
UserName = 0;
Token = 0;
}
else
if (0 == invariant_wcsicmp(UserName, L"LocalService") ||
0 == invariant_wcsicmp(UserName, L"NetworkService"))
{
DomainName = L"NT AUTHORITY";
Token = 0;
}
else
if (0 == invariant_wcsicmp(UserName, L"."))
;
else
{
SetLastError(ERROR_ACCESS_DENIED);
@ -295,18 +309,40 @@ static BOOL LogonCreateProcess(
HANDLE LogonToken = 0;
PVOID EnvironmentBlock = 0;
DWORD SessionId;
DWORD LastError;
BOOL Success;
Success = LogonUserW(
UserName,
DomainName,
0,
LOGON32_LOGON_SERVICE,
LOGON32_PROVIDER_DEFAULT,
&LogonToken);
if (!Success)
goto exit;
if (0 == Token)
{
Success = LogonUserW(
UserName,
DomainName,
0,
LOGON32_LOGON_SERVICE,
LOGON32_PROVIDER_DEFAULT,
&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)
{
@ -659,7 +695,7 @@ static NTSTATUS SvcInstanceAccessCheck(HANDLE ClientToken, ULONG DesiredAccess,
return Result;
}
static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName, HANDLE ClientToken,
PWSTR Executable, PWSTR CommandLine, PWSTR WorkDirectory,
HANDLE StdioHandles[2],
PPROCESS_INFORMATION ProcessInfo)
@ -754,7 +790,7 @@ static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
StartupInfoEx.StartupInfo.hStdOutput = ChildHandles[1];
StartupInfoEx.StartupInfo.hStdError = ChildHandles[2];
if (!LogonCreateProcess(UserName,
if (!LogonCreateProcess(UserName, ClientToken,
Executable, CommandLine, 0, 0, TRUE,
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP | EXTENDED_STARTUPINFO_PRESENT,
0, WorkDirectory,
@ -775,7 +811,7 @@ static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
* Not ideal, but...
*/
StartupInfoEx.StartupInfo.cb = sizeof StartupInfoEx.StartupInfo;
if (!LogonCreateProcess(UserName,
if (!LogonCreateProcess(UserName, ClientToken,
Executable, CommandLine, 0, 0, TRUE,
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP,
0, WorkDirectory,
@ -788,7 +824,7 @@ static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
}
else
{
if (!LogonCreateProcess(UserName,
if (!LogonCreateProcess(UserName, ClientToken,
Executable, CommandLine, 0, 0, FALSE,
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP,
0, WorkDirectory,
@ -1005,7 +1041,7 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
if (!NT_SUCCESS(Result))
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,
RedirectStdio ? SvcInstance->StdioHandles : 0, &ProcessInfo);
if (!NT_SUCCESS(Result))
@ -1625,7 +1661,10 @@ static DWORD WINAPI SvcPipeServer(PVOID Context)
ClientToken = 0;
if (!ImpersonateNamedPipeClient(SvcPipe) ||
!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &ClientToken) ||
(
!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY | TOKEN_DUPLICATE, FALSE, &ClientToken) &&
!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &ClientToken)
) ||
!RevertToSelf())
{
LastError = GetLastError();

View File

@ -1,7 +1,7 @@
/**
* @file shared/minimal.h
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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

View File

@ -2,7 +2,7 @@
* @file sys/callbacks.c
* Fast I/O and resource acquisition callbacks.
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -11,9 +11,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -294,7 +298,7 @@ VOID FspPropagateTopFlags(PIRP Irp, PIRP TopLevelIrp)
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 TopLevelFileObject = IoGetCurrentIrpStackLocation(TopLevelIrp)->FileObject;

View File

@ -1,7 +1,7 @@
/**
* @file sys/cleanup.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file sys/close.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file sys/create.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -65,6 +69,16 @@ FSP_DRIVER_DISPATCH FspCreate;
#pragma alloc_text(PAGE, FspCreate)
#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_SIZE (sizeof PREFIXW - sizeof(WCHAR))
@ -82,7 +96,11 @@ enum
RequestFileObject = 2,
RequestState = 3,
/* RequestState */
/* TryOpen RequestState */
RequestFlushImage = 1,
RequestAcceptsSecurityDescriptor = 2,
/* Overwrite RequestState */
RequestPending = 0,
RequestProcessing = 1,
};
@ -122,8 +140,86 @@ static NTSTATUS FspFsvolCreate(
{
PAGED_CODE();
NTSTATUS Result = STATUS_SUCCESS;
BOOLEAN MainFileOpen = FspMainFileOpenCheck(Irp);
NTSTATUS Result;
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)
{
@ -182,7 +278,7 @@ static NTSTATUS FspFsvolCreateNoLock(
ACCESS_MASK GrantedAccess = AccessState->PreviouslyGrantedAccess;
USHORT ShareAccess = IrpSp->Parameters.Create.ShareAccess;
PFILE_FULL_EA_INFORMATION EaBuffer = Irp->AssociatedIrp.SystemBuffer;
//ULONG EaLength = IrpSp->Parameters.Create.EaLength;
ULONG EaLength = IrpSp->Parameters.Create.EaLength;
ULONG Flags = IrpSp->Flags;
KPROCESSOR_MODE RequestorMode =
FlagOn(Flags, SL_FORCE_ACCESS_CHECK) ? UserMode : Irp->RequestorMode;
@ -206,9 +302,23 @@ static NTSTATUS FspFsvolCreateNoLock(
if (FlagOn(CreateOptions, FILE_OPEN_BY_FILE_ID))
return STATUS_NOT_IMPLEMENTED;
/* no EA support currently */
/* was an EA buffer specified? */
if (0 != EaBuffer)
return STATUS_EAS_NOT_SUPPORTED;
{
/* does the file system support EA? */
if (!FsvolDeviceExtension->VolumeParams.ExtendedAttributes)
return STATUS_EAS_NOT_SUPPORTED;
/* do we need EA knowledge? */
if (FlagOn(CreateOptions, FILE_NO_EA_KNOWLEDGE))
return STATUS_ACCESS_DENIED;
/* is the EA buffer valid? */
Result = FspEaBufferFromOriginatingProcessValidate(
EaBuffer, EaLength, (PULONG)&Irp->IoStatus.Information);
if (!NT_SUCCESS(Result))
return Result;
}
/* cannot open a paging file */
if (FlagOn(Flags, SL_OPEN_PAGING_FILE))
@ -445,6 +555,10 @@ static NTSTATUS FspFsvolCreateNoLock(
SecurityDescriptorSize = 0;
FileAttributes = 0;
/* cannot set EA on named stream */
EaBuffer = 0;
EaLength = 0;
/* remember the main file node */
ASSERT(0 == FileNode->MainFileNode);
FileNode->MainFileNode = FileDesc->MainFileObject->FsContext;
@ -462,7 +576,9 @@ static NTSTATUS FspFsvolCreateNoLock(
}
/* create the user-mode file system request */
Result = FspIopCreateRequestEx(Irp, &FileNode->FileName, SecurityDescriptorSize,
Result = FspIopCreateRequestEx(Irp, &FileNode->FileName,
0 != EaBuffer ?
FSP_FSCTL_DEFAULT_ALIGN_UP(SecurityDescriptorSize) + EaLength : SecurityDescriptorSize,
FspFsvolCreateRequestFini, &Request);
if (!NT_SUCCESS(Result))
{
@ -488,19 +604,22 @@ static NTSTATUS FspFsvolCreateNoLock(
FspIopRequestContext(Request, RequestFileDesc) = FileDesc;
/* populate the Create request */
#define NEXTOFS(B) ((B).Offset + FSP_FSCTL_DEFAULT_ALIGN_UP((B).Size))
Request->Kind = FspFsctlTransactCreateKind;
Request->Req.Create.CreateOptions = CreateOptions;
Request->Req.Create.FileAttributes = FileAttributes;
Request->Req.Create.SecurityDescriptor.Offset = 0 == SecurityDescriptorSize ? 0 :
FSP_FSCTL_DEFAULT_ALIGN_UP(Request->FileName.Size);
Request->Req.Create.SecurityDescriptor.Offset = 0 != SecurityDescriptorSize ?
NEXTOFS(Request->FileName) : 0;
Request->Req.Create.SecurityDescriptor.Size = (UINT16)SecurityDescriptorSize;
Request->Req.Create.AllocationSize = AllocationSize;
Request->Req.Create.AccessToken = 0;
Request->Req.Create.DesiredAccess = DesiredAccess;
Request->Req.Create.GrantedAccess = GrantedAccess;
Request->Req.Create.ShareAccess = ShareAccess;
Request->Req.Create.Ea.Offset = 0;
Request->Req.Create.Ea.Size = 0;
Request->Req.Create.Ea.Offset = 0 != EaBuffer ?
(0 != Request->Req.Create.SecurityDescriptor.Offset ?
NEXTOFS(Request->Req.Create.SecurityDescriptor) : NEXTOFS(Request->FileName)) : 0;
Request->Req.Create.Ea.Size = 0 != EaBuffer ? (UINT16)EaLength : 0;
Request->Req.Create.UserMode = UserMode == RequestorMode;
Request->Req.Create.HasTraversePrivilege = HasTraversePrivilege;
Request->Req.Create.HasBackupPrivilege = HasBackupPrivilege;
@ -509,6 +628,10 @@ static NTSTATUS FspFsvolCreateNoLock(
Request->Req.Create.CaseSensitive = CaseSensitive;
Request->Req.Create.HasTrailingBackslash = HasTrailingBackslash;
Request->Req.Create.NamedStream = MainFileName.Length;
#undef NEXTOFS
Request->Req.Create.AcceptsSecurityDescriptor = 0 == Request->Req.Create.NamedStream &&
!!FsvolDeviceExtension->VolumeParams.AllowOpenInKernelMode;
ASSERT(
0 == StreamPart.Length && 0 == MainFileName.Length ||
@ -519,6 +642,11 @@ static NTSTATUS FspFsvolCreateNoLock(
RtlCopyMemory(Request->Buffer + Request->Req.Create.SecurityDescriptor.Offset,
SecurityDescriptor, SecurityDescriptorSize);
/* copy the EA buffer (if any) into the request */
if (0 != EaBuffer)
RtlCopyMemory(Request->Buffer + Request->Req.Create.Ea.Offset,
EaBuffer, EaLength);
/* fix FileNode->FileName if we are doing SL_OPEN_TARGET_DIRECTORY */
if (Request->Req.Create.OpenTargetDirectory)
{
@ -982,6 +1110,7 @@ NTSTATUS FspFsvolCreateComplete(
}
PVOID RequestDeviceObjectValue = FspIopRequestContext(Request, RequestDeviceObject);
FSP_FSCTL_TRANSACT_BUF Ea = Request->Req.Create.Ea;
/* disassociate the FileDesc momentarily from the Request */
FspIopRequestContext(Request, RequestDeviceObject) = 0;
@ -1002,6 +1131,7 @@ NTSTATUS FspFsvolCreateComplete(
Request->Req.Overwrite.FileAttributes = FileAttributes;
Request->Req.Overwrite.AllocationSize = AllocationSize;
Request->Req.Overwrite.Supersede = FILE_SUPERSEDED == Response->IoStatus.Information;
Request->Req.Overwrite.Ea = Ea;
/*
* Post it as BestEffort.
@ -1018,7 +1148,8 @@ NTSTATUS FspFsvolCreateComplete(
* A Reserved request is a special request used when retrying a file open.
*/
BOOLEAN FlushImage = 0 != FspIopRequestContext(Request, RequestState);
BOOLEAN FlushImage =
0 != (RequestFlushImage & (UINT_PTR)FspIopRequestContext(Request, RequestState));
Result = FspFsvolCreateTryOpen(Irp, Response, FileNode, FileDesc, FileObject, FlushImage);
}
@ -1041,8 +1172,16 @@ NTSTATUS FspFsvolCreateComplete(
if (0 == FileNode->MainFileNode)
FspFileNodeOverwriteStreams(FileNode);
FspFileNodeSetFileInfo(FileNode, FileObject, &Response->Rsp.Overwrite.FileInfo, TRUE);
if (0 == FileNode->MainFileNode && FsvolDeviceExtension->VolumeParams.ExtendedAttributes)
{
/* invalidate any existing EA and increment the EA change count */
FspFileNodeSetEa(FileNode, 0, 0);
FileNode->EaChangeCount++;
}
FspFileNodeNotifyChange(FileNode,
FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE,
FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE |
(0 == FileNode->MainFileNode && FsvolDeviceExtension->VolumeParams.ExtendedAttributes ?
FILE_NOTIFY_CHANGE_EA : 0),
FILE_ACTION_MODIFIED,
FALSE);
@ -1086,7 +1225,9 @@ static NTSTATUS FspFsvolCreateTryOpen(PIRP Irp, const FSP_FSCTL_TRANSACT_RSP *Re
FspIopRequestContext(Request, RequestDeviceObject) = RequestDeviceObjectValue;
FspIopRequestContext(Request, RequestFileDesc) = FileDesc;
FspIopRequestContext(Request, RequestFileObject) = FileObject;
FspIopRequestContext(Request, RequestState) = (PVOID)(UINT_PTR)FlushImage;
FspIopRequestContext(Request, RequestState) = (PVOID)(UINT_PTR)(
(FlushImage ? RequestFlushImage : 0) |
(Request->Req.Create.AcceptsSecurityDescriptor ? RequestAcceptsSecurityDescriptor : 0));
}
Result = STATUS_SUCCESS;
@ -1107,8 +1248,28 @@ static NTSTATUS FspFsvolCreateTryOpen(PIRP Irp, const FSP_FSCTL_TRANSACT_RSP *Re
return Result;
}
PSECURITY_DESCRIPTOR OpenDescriptor = 0;
ULONG OpenDescriptorSize = 0;
if (0 != (RequestAcceptsSecurityDescriptor &
(UINT_PTR)FspIopRequestContext(Request, RequestState)) &&
Response->Rsp.Create.Opened.HasSecurityDescriptor &&
0 < Response->Rsp.Create.Opened.SecurityDescriptor.Size &&
Response->Buffer +
Response->Rsp.Create.Opened.SecurityDescriptor.Offset +
Response->Rsp.Create.Opened.SecurityDescriptor.Size <=
(PUINT8)Response + Response->Size &&
RtlValidRelativeSecurityDescriptor(
(PUINT8)Response->Buffer +
Response->Rsp.Create.Opened.SecurityDescriptor.Offset,
Response->Rsp.Create.Opened.SecurityDescriptor.Size, 0))
{
OpenDescriptor = (PSECURITY_DESCRIPTOR)(Response->Buffer +
Response->Rsp.Create.Opened.SecurityDescriptor.Offset);
OpenDescriptorSize = Response->Rsp.Create.Opened.SecurityDescriptor.Size;
}
/*
* FspFileNodeTrySetFileInfoOnOpen sets the FileNode's metadata to values reported
* FspFileNodeTrySetFileInfoAndSecurityOnOpen sets the FileNode's metadata to values reported
* by the user mode file system. It does so only if the file is not already open; the
* reason is that there is a subtle race condition otherwise.
*
@ -1139,12 +1300,13 @@ static NTSTATUS FspFsvolCreateTryOpen(PIRP Irp, const FSP_FSCTL_TRANSACT_RSP *Re
* example, Explorer often opens files to get information about them and may inappropriately
* update the FSD view of the file size during WRITE's.
*
* FspFileNodeTrySetFileInfoOnOpen attempts to mitigate this problem by only updating the
* FileInfo if the file is not already open. This avoids placing stale information in the
* FspFileNodeTrySetFileInfoAndSecurityOnOpen attempts to mitigate this problem by only updating
* the FileInfo if the file is not already open. This avoids placing stale information in the
* FileNode.
*/
FspFileNodeTrySetFileInfoOnOpen(FileNode, FileObject, &Response->Rsp.Create.Opened.FileInfo,
FspFileNodeTrySetFileInfoAndSecurityOnOpen(FileNode, FileObject,
&Response->Rsp.Create.Opened.FileInfo, OpenDescriptor, OpenDescriptorSize,
FILE_CREATED == Response->IoStatus.Information);
if (FlushImage)

View File

@ -1,7 +1,7 @@
/**
* @file sys/debug.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>

View File

@ -1,7 +1,7 @@
/**
* @file sys/devctl.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,13 +10,19 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
static NTSTATUS FspFsvrtDeviceControl(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp);
static NTSTATUS FspFsvolDeviceControl(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp);
FSP_IOCMPL_DISPATCH FspFsvolDeviceControlComplete;
@ -24,6 +30,7 @@ static FSP_IOP_REQUEST_FINI FspFsvolDeviceControlRequestFini;
FSP_DRIVER_DISPATCH FspDeviceControl;
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, FspFsvrtDeviceControl)
#pragma alloc_text(PAGE, FspFsvolDeviceControl)
#pragma alloc_text(PAGE, FspFsvolDeviceControlComplete)
#pragma alloc_text(PAGE, FspFsvolDeviceControlRequestFini)
@ -35,6 +42,28 @@ enum
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(
PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
{
@ -151,6 +180,8 @@ NTSTATUS FspDeviceControl(
{
case FspFsvolDeviceExtensionKind:
FSP_RETURN(Result = FspFsvolDeviceControl(DeviceObject, Irp, IrpSp));
case FspFsvrtDeviceExtensionKind:
FSP_RETURN(Result = FspFsvrtDeviceControl(DeviceObject, Irp, IrpSp));
default:
FSP_RETURN(Result = STATUS_INVALID_DEVICE_REQUEST);
}

View File

@ -1,7 +1,7 @@
/**
* @file sys/device.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -313,7 +317,7 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject)
NTSTATUS Result;
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
LARGE_INTEGER IrpTimeout;
LARGE_INTEGER SecurityTimeout, DirInfoTimeout, StreamInfoTimeout;
LARGE_INTEGER SecurityTimeout, DirInfoTimeout, StreamInfoTimeout, EaTimeout;
/*
* Volume device initialization is a mess, because of the different ways of
@ -375,6 +379,16 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject)
return Result;
FsvolDeviceExtension->InitDoneStrm = 1;
/* create our EA meta cache */
EaTimeout.QuadPart = FspTimeoutFromMillis(FsvolDeviceExtension->VolumeParams.EaTimeout);
/* convert millis to nanos */
Result = FspMetaCacheCreate(
FspFsvolDeviceEaCacheCapacity, FspFsvolDeviceEaCacheItemSizeMax, &EaTimeout,
&FsvolDeviceExtension->EaCache);
if (!NT_SUCCESS(Result))
return Result;
FsvolDeviceExtension->InitDoneEa = 1;
/* initialize the FSRTL Notify mechanism */
Result = FspNotifyInitializeSync(&FsvolDeviceExtension->NotifySync);
if (!NT_SUCCESS(Result))
@ -445,6 +459,10 @@ static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject)
FspNotifyUninitializeSync(&FsvolDeviceExtension->NotifySync);
}
/* delete the EA meta cache */
if (FsvolDeviceExtension->InitDoneEa)
FspMetaCacheDelete(FsvolDeviceExtension->EaCache);
/* delete the stream info meta cache */
if (FsvolDeviceExtension->InitDoneStrm)
FspMetaCacheDelete(FsvolDeviceExtension->StreamInfoCache);

View File

@ -1,7 +1,7 @@
/**
* @file sys/dirctl.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -21,6 +25,7 @@ static NTSTATUS FspFsvolQueryDirectoryCopy(
PUNICODE_STRING DirectoryPattern, BOOLEAN CaseInsensitive,
PUNICODE_STRING DirectoryMarker, PUNICODE_STRING DirectoryMarkerOut,
FILE_INFORMATION_CLASS FileInformationClass, BOOLEAN ReturnSingleEntry,
BOOLEAN ReturnEaSize,
FSP_FSCTL_DIR_INFO **PDirInfo, ULONG DirInfoSize,
PVOID DestBuf, PULONG PDestLen);
static NTSTATUS FspFsvolQueryDirectoryCopyCache(
@ -84,6 +89,7 @@ static NTSTATUS FspFsvolQueryDirectoryCopy(
PUNICODE_STRING DirectoryPattern, BOOLEAN CaseInsensitive,
PUNICODE_STRING DirectoryMarker, PUNICODE_STRING DirectoryMarkerOut,
FILE_INFORMATION_CLASS FileInformationClass, BOOLEAN ReturnSingleEntry,
BOOLEAN ReturnEaSize,
FSP_FSCTL_DIR_INFO **PDirInfo, ULONG DirInfoSize,
PVOID DestBuf, PULONG PDestLen)
{
@ -222,12 +228,18 @@ static NTSTATUS FspFsvolQueryDirectoryCopy(
break;
case FileFullDirectoryInformation:
FILL_INFO(FILE_FULL_DIR_INFORMATION,
Info->EaSize = 0;
Info->EaSize = ReturnEaSize ? DirInfo->FileInfo.EaSize : 0;
/* magic computations are courtesy of NTFS */
if (0 != Info->EaSize)
Info->EaSize += 4;
);
break;
case FileIdFullDirectoryInformation:
FILL_INFO(FILE_ID_FULL_DIR_INFORMATION,
Info->EaSize = 0;
Info->EaSize = ReturnEaSize ? DirInfo->FileInfo.EaSize : 0;
/* magic computations are courtesy of NTFS */
if (0 != Info->EaSize)
Info->EaSize += 4;
Info->FileId.QuadPart = DirInfo->FileInfo.IndexNumber;
);
break;
@ -236,14 +248,20 @@ static NTSTATUS FspFsvolQueryDirectoryCopy(
break;
case FileBothDirectoryInformation:
FILL_INFO(FILE_BOTH_DIR_INFORMATION,
Info->EaSize = 0;
Info->EaSize = ReturnEaSize ? DirInfo->FileInfo.EaSize : 0;
/* magic computations are courtesy of NTFS */
if (0 != Info->EaSize)
Info->EaSize += 4;
Info->ShortNameLength = 0;
RtlZeroMemory(Info->ShortName, sizeof Info->ShortName);
);
break;
case FileIdBothDirectoryInformation:
FILL_INFO(FILE_ID_BOTH_DIR_INFORMATION,
Info->EaSize = 0;
Info->EaSize = ReturnEaSize ? DirInfo->FileInfo.EaSize : 0;
/* magic computations are courtesy of NTFS */
if (0 != Info->EaSize)
Info->EaSize += 4;
Info->ShortNameLength = 0;
RtlZeroMemory(Info->ShortName, sizeof Info->ShortName);
Info->FileId.QuadPart = DirInfo->FileInfo.IndexNumber;
@ -317,6 +335,7 @@ static NTSTATUS FspFsvolQueryDirectoryCopyCache(
Result = FspFsvolQueryDirectoryCopy(DirectoryPattern, CaseInsensitive,
0 != FileDesc->DirInfoCacheHint ? 0 : &FileDesc->DirectoryMarker, &DirectoryMarker,
FileInformationClass, ReturnSingleEntry,
!!FspFsvolDeviceExtension(FileNode->FsvolDeviceObject)->VolumeParams.ExtendedAttributes,
&DirInfo, DirInfoSize,
DestBuf, PDestLen);
@ -350,6 +369,7 @@ static NTSTATUS FspFsvolQueryDirectoryCopyInPlace(
BOOLEAN CaseInsensitive = !FileDesc->CaseSensitive;
PUNICODE_STRING DirectoryPattern = &FileDesc->DirectoryPattern;
UNICODE_STRING DirectoryMarker = FileDesc->DirectoryMarker;
FSP_FILE_NODE *FileNode = FileDesc->FileNode;
FSP_FSCTL_STATIC_ASSERT(
FIELD_OFFSET(FSP_FSCTL_DIR_INFO, FileNameBuf) >=
@ -359,6 +379,7 @@ static NTSTATUS FspFsvolQueryDirectoryCopyInPlace(
Result = FspFsvolQueryDirectoryCopy(DirectoryPattern, CaseInsensitive,
0, &DirectoryMarker,
FileInformationClass, ReturnSingleEntry,
!!FspFsvolDeviceExtension(FileNode->FsvolDeviceObject)->VolumeParams.ExtendedAttributes,
&DirInfo, DirInfoSize,
DestBuf, PDestLen);

View File

@ -1,7 +1,7 @@
/**
* @file sys/driver.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -98,8 +102,8 @@ NTSTATUS DriverEntry(
FspFastIoDispatch.FastIoCheckIfPossible = FspFastIoCheckIfPossible;
//FspFastIoDispatch.FastIoRead = 0;
//FspFastIoDispatch.FastIoWrite = 0;
//FspFastIoDispatch.FastIoQueryBasicInfo = 0;
//FspFastIoDispatch.FastIoQueryStandardInfo = 0;
FspFastIoDispatch.FastIoQueryBasicInfo = FspFastIoQueryBasicInfo;
FspFastIoDispatch.FastIoQueryStandardInfo = FspFastIoQueryStandardInfo;
//FspFastIoDispatch.FastIoLock = 0;
//FspFastIoDispatch.FastIoUnlockSingle = 0;
//FspFastIoDispatch.FastIoUnlockAll = 0;
@ -108,7 +112,7 @@ NTSTATUS DriverEntry(
FspFastIoDispatch.AcquireFileForNtCreateSection = FspAcquireFileForNtCreateSection;
FspFastIoDispatch.ReleaseFileForNtCreateSection = FspReleaseFileForNtCreateSection;
//FspFastIoDispatch.FastIoDetachDevice = 0;
//FspFastIoDispatch.FastIoQueryNetworkOpenInfo = 0;
FspFastIoDispatch.FastIoQueryNetworkOpenInfo = FspFastIoQueryNetworkOpenInfo;
FspFastIoDispatch.AcquireForModWrite = FspAcquireForModWrite;
//FspFastIoDispatch.MdlRead = 0;
//FspFastIoDispatch.MdlReadComplete = 0;
@ -118,7 +122,7 @@ NTSTATUS DriverEntry(
//FspFastIoDispatch.FastIoWriteCompressed = 0;
//FspFastIoDispatch.MdlReadCompleteCompressed = 0;
//FspFastIoDispatch.MdlWriteCompleteCompressed = 0;
//FspFastIoDispatch.FastIoQueryOpen = 0;
FspFastIoDispatch.FastIoQueryOpen = FspFastIoQueryOpen;
FspFastIoDispatch.ReleaseForModWrite = FspReleaseForModWrite;
FspFastIoDispatch.AcquireForCcFlush = FspAcquireForCcFlush;
FspFastIoDispatch.ReleaseForCcFlush = FspReleaseForCcFlush;
@ -165,6 +169,21 @@ NTSTATUS DriverEntry(
&FspFsmupDeviceObject);
if (!NT_SUCCESS(Result))
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);
ASSERT(STATUS_SUCCESS == Result);
Result = FspDeviceInitialize(FspFsctlNetDeviceObject);
@ -229,6 +248,9 @@ static VOID FspDriverMultiVersionInitialize(VOID)
if (RtlIsNtDdiVersionAvailable(NTDDI_WIN8))
FspMvMdlMappingNoWrite = MdlMappingNoWrite;
if (RtlIsNtDdiVersionAvailable(0x0A000005/*NTDDI_WIN10_RS4*/))
FspHasReparsePointCaseSensitivityFix = TRUE;
}
#if defined(FSP_UNLOAD)
@ -266,3 +288,4 @@ CACHE_MANAGER_CALLBACKS FspCacheManagerCallbacks;
ULONG FspProcessorCount;
FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
ULONG FspMvMdlMappingNoWrite = 0;
BOOLEAN FspHasReparsePointCaseSensitivityFix = FALSE;

View File

@ -1,7 +1,7 @@
/**
* @file sys/driver.h
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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
@ -334,6 +338,10 @@ FSP_IOPREP_DISPATCH FspFsvolWritePrepare;
FSP_IOCMPL_DISPATCH FspFsvolWriteComplete;
/* fast I/O and resource acquisition callbacks */
FAST_IO_QUERY_BASIC_INFO FspFastIoQueryBasicInfo;
FAST_IO_QUERY_STANDARD_INFO FspFastIoQueryStandardInfo;
FAST_IO_QUERY_NETWORK_OPEN_INFO FspFastIoQueryNetworkOpenInfo;
FAST_IO_QUERY_OPEN FspFastIoQueryOpen;
FAST_IO_CHECK_IF_POSSIBLE FspFastIoCheckIfPossible;
FAST_IO_ACQUIRE_FILE FspAcquireFileForNtCreateSection;
FAST_IO_RELEASE_FILE FspReleaseFileForNtCreateSection;
@ -444,12 +452,17 @@ enum
BOOLEAN FspFileNameIsValid(PUNICODE_STRING Path, ULONG MaxComponentLength,
PUNICODE_STRING StreamPart, PULONG StreamType);
BOOLEAN FspFileNameIsValidPattern(PUNICODE_STRING Pattern, ULONG MaxComponentLength);
BOOLEAN FspEaNameIsValid(PSTRING Name);
VOID FspFileNameSuffix(PUNICODE_STRING Path, PUNICODE_STRING Remain, PUNICODE_STRING Suffix);
#if 0
NTSTATUS FspFileNameUpcase(
PUNICODE_STRING DestinationName,
PUNICODE_STRING SourceName,
PCWCH UpcaseTable);
VOID FspEaNameUpcase(
PSTRING DestinationName,
PSTRING SourceName,
PCWCH UpcaseTable);
LONG FspFileNameCompare(
PUNICODE_STRING Name1,
PUNICODE_STRING Name2,
@ -462,6 +475,7 @@ BOOLEAN FspFileNameIsPrefix(
PCWCH UpcaseTable);
#else
#define FspFileNameUpcase(D,S,U) (ASSERT(0 == (U)), RtlUpcaseUnicodeString(D,S,FALSE))
#define FspEaNameUpcase(D,S,U) (ASSERT(0 == (U)), RtlUpperString(D,S))
#define FspFileNameCompare(N1,N2,I,U) (ASSERT(0 == (U)), RtlCompareUnicodeString(N1,N2,I))
#define FspFileNameIsPrefix(N1,N2,I,U) (ASSERT(0 == (U)), RtlPrefixUnicodeString(N1,N2,I))
#endif
@ -501,6 +515,14 @@ NTSTATUS FspCcFlushCache(PSECTION_OBJECT_POINTERS SectionObjectPointer,
NTSTATUS FspQuerySecurityDescriptorInfo(SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR SecurityDescriptor, PULONG PLength,
PSECURITY_DESCRIPTOR ObjectsSecurityDescriptor);
NTSTATUS FspEaBufferFromOriginatingProcessValidate(
PFILE_FULL_EA_INFORMATION Buffer,
ULONG Length,
PULONG PErrorOffset);
NTSTATUS FspEaBufferFromFileSystemValidate(
PFILE_FULL_EA_INFORMATION Buffer,
ULONG Length,
PULONG PErrorOffset);
NTSTATUS FspNotifyInitializeSync(PNOTIFY_SYNC *NotifySync);
NTSTATUS FspNotifyFullChangeDirectory(
PNOTIFY_SYNC NotifySync,
@ -559,6 +581,8 @@ NTSTATUS FspOplockFsctrl(
FspNotifyFullChangeDirectory(NS, NL, FC, 0, 0, FALSE, 0, 0, 0, 0)
#define FspNotifyReportChange(NS, NL, FN, FO, NP, F, A)\
FspNotifyFullReportChange(NS, NL, (PSTRING)(FN), FO, 0, (PSTRING)(NP), F, A, 0)
#define FSP_NEXT_EA(Ea, EaEnd) \
(0 != (Ea)->NextEntryOffset ? (PVOID)((PUINT8)(Ea) + (Ea)->NextEntryOffset) : (EaEnd))
/* utility: synchronous work queue */
typedef struct
@ -989,6 +1013,8 @@ enum
FspFsvolDeviceDirInfoCacheItemSizeMax = FSP_FSCTL_ALIGN_UP(16384, PAGE_SIZE),
FspFsvolDeviceStreamInfoCacheCapacity = 100,
FspFsvolDeviceStreamInfoCacheItemSizeMax = FSP_FSCTL_ALIGN_UP(16384, PAGE_SIZE),
FspFsvolDeviceEaCacheCapacity = 100,
FspFsvolDeviceEaCacheItemSizeMax = FSP_FSCTL_ALIGN_UP(16384, PAGE_SIZE),
};
typedef struct
{
@ -1021,7 +1047,7 @@ typedef struct
typedef struct
{
FSP_DEVICE_EXTENSION Base;
UINT32 InitDoneFsvrt:1, InitDoneIoq:1, InitDoneSec:1, InitDoneDir:1, InitDoneStrm:1,
UINT32 InitDoneFsvrt:1, InitDoneIoq:1, InitDoneSec:1, InitDoneDir:1, InitDoneStrm:1, InitDoneEa:1,
InitDoneCtxTab:1, InitDoneTimer:1, InitDoneInfo:1, InitDoneNotify:1, InitDoneStat:1;
PDEVICE_OBJECT FsctlDeviceObject;
PDEVICE_OBJECT FsvrtDeviceObject;
@ -1035,6 +1061,7 @@ typedef struct
FSP_META_CACHE *SecurityCache;
FSP_META_CACHE *DirInfoCache;
FSP_META_CACHE *StreamInfoCache;
FSP_META_CACHE *EaCache;
KSPIN_LOCK ExpirationLock;
WORK_QUEUE_ITEM ExpirationWorkItem;
BOOLEAN ExpirationInProgress;
@ -1258,11 +1285,15 @@ typedef struct FSP_FILE_NODE
UINT64 LastAccessTime;
UINT64 LastWriteTime;
UINT64 ChangeTime;
UINT32 EaSize;
ULONG FileInfoChangeNumber;
UINT64 Security;
ULONG SecurityChangeNumber;
ULONG DirInfoChangeNumber;
ULONG StreamInfoChangeNumber;
UINT64 Ea;
ULONG EaChangeNumber;
ULONG EaChangeCount;
BOOLEAN TruncateOnClose;
FILE_LOCK FileLock;
#if (NTDDI_VERSION < NTDDI_WIN8)
@ -1301,6 +1332,8 @@ typedef struct
UNICODE_STRING DirectoryMarker;
UINT64 DirInfo;
ULONG DirInfoCacheHint;
ULONG EaIndex;
ULONG EaChangeCount;
/* stream support */
HANDLE MainFileHandle;
PFILE_OBJECT MainFileObject;
@ -1378,10 +1411,14 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
VOID FspFileNodeRename(FSP_FILE_NODE *FileNode, PUNICODE_STRING NewFileName);
VOID FspFileNodeGetFileInfo(FSP_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *FileInfo);
BOOLEAN FspFileNodeTryGetFileInfo(FSP_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *FileInfo);
BOOLEAN FspFileNodeTryGetFileInfoByName(PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp,
PUNICODE_STRING FileName, FSP_FSCTL_FILE_INFO *FileInfo);
VOID FspFileNodeSetFileInfo(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, BOOLEAN TruncateOnClose);
BOOLEAN FspFileNodeTrySetFileInfoOnOpen(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, BOOLEAN TruncateOnClose);
BOOLEAN FspFileNodeTrySetFileInfoAndSecurityOnOpen(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo,
const PSECURITY_DESCRIPTOR SecurityDescriptor, ULONG SecurityDescriptorSize,
BOOLEAN TruncateOnClose);
BOOLEAN FspFileNodeTrySetFileInfo(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, ULONG InfoChangeNumber);
VOID FspFileNodeInvalidateFileInfo(FSP_FILE_NODE *FileNode);
@ -1427,6 +1464,17 @@ ULONG FspFileNodeStreamInfoChangeNumber(FSP_FILE_NODE *FileNode)
return FileNode->StreamInfoChangeNumber;
}
VOID FspFileNodeInvalidateStreamInfo(FSP_FILE_NODE *FileNode);
BOOLEAN FspFileNodeReferenceEa(FSP_FILE_NODE *FileNode, PCVOID *PBuffer, PULONG PSize);
VOID FspFileNodeSetEa(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size);
BOOLEAN FspFileNodeTrySetEa(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size,
ULONG EaChangeNumber);
static inline
ULONG FspFileNodeEaChangeNumber(FSP_FILE_NODE *FileNode)
{
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
return FileNode->EaChangeNumber;
}
VOID FspFileNodeNotifyChange(FSP_FILE_NODE *FileNode, ULONG Filter, ULONG Action,
BOOLEAN InvalidateCaches);
NTSTATUS FspFileNodeProcessLockIrp(FSP_FILE_NODE *FileNode, PIRP Irp);
@ -1448,28 +1496,6 @@ NTSTATUS FspMainFileOpen(
NTSTATUS FspMainFileClose(
HANDLE MainFileHandle,
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 FspFileNodeTryAcquireShared(N,F) FspFileNodeTryAcquireSharedF(N, FspFileNodeAcquire ## F, FALSE)
#define FspFileNodeAcquireExclusive(N,F) FspFileNodeAcquireExclusiveF(N, FspFileNodeAcquire ## F)
@ -1481,6 +1507,7 @@ BOOLEAN FspMainFileOpenCheck(PIRP Irp)
#define FspFileNodeDereferenceSecurity(P) FspMetaCacheDereferenceItemBuffer(P)
#define FspFileNodeDereferenceDirInfo(P) FspMetaCacheDereferenceItemBuffer(P)
#define FspFileNodeDereferenceStreamInfo(P) FspMetaCacheDereferenceItemBuffer(P)
#define FspFileNodeDereferenceEa(P) FspMetaCacheDereferenceItemBuffer(P)
#define FspFileNodeUnlockAll(N,F,P) FsRtlFastUnlockAll(&(N)->FileLock, F, P, N)
#if (NTDDI_VERSION < NTDDI_WIN8)
#define FspFileNodeAddrOfOplock(N) (&(N)->Oplock)
@ -1595,6 +1622,7 @@ extern const GUID FspMainFileOpenEcpGuid;
extern ULONG FspProcessorCount;
extern FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
extern ULONG FspMvMdlMappingNoWrite;
extern BOOLEAN FspHasReparsePointCaseSensitivityFix;
/*
* Fixes

View File

@ -1,7 +1,7 @@
/**
* @file sys/ea.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,37 +10,401 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
static VOID FspFsvolQueryEaGetCopy(
BOOLEAN CasePreservedExtendedAttributes,
BOOLEAN ReturnSingleEntry,
PFILE_GET_EA_INFORMATION GetBufBgn, ULONG GetSize,
PFILE_FULL_EA_INFORMATION SrcBufBgn, ULONG SrcSize,
PFILE_FULL_EA_INFORMATION DstBufBgn, ULONG DstSize,
PIO_STATUS_BLOCK IoStatus);
static VOID FspFsvolQueryEaIndexCopy(
BOOLEAN CasePreservedExtendedAttributes,
BOOLEAN ReturnSingleEntry,
BOOLEAN IndexSpecified, PULONG PEaIndex,
PFILE_FULL_EA_INFORMATION SrcBufBgn, ULONG SrcSize,
PFILE_FULL_EA_INFORMATION DstBufBgn, ULONG DstSize,
PIO_STATUS_BLOCK IoStatus);
static VOID FspFsvolQueryEaCopy(
BOOLEAN CasePreservedExtendedAttributes,
PIO_STACK_LOCATION IrpSp,
PFILE_FULL_EA_INFORMATION SrcBufBgn, ULONG SrcSize,
PFILE_FULL_EA_INFORMATION DstBufBgn, ULONG DstSize,
PIO_STATUS_BLOCK IoStatus);
static NTSTATUS FspFsvolQueryEa(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp);
FSP_IOCMPL_DISPATCH FspFsvolQueryEaComplete;
static FSP_IOP_REQUEST_FINI FspFsvolQueryEaRequestFini;
static NTSTATUS FspFsvolSetEa(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp);
FSP_IOCMPL_DISPATCH FspFsvolSetEaComplete;
static FSP_IOP_REQUEST_FINI FspFsvolSetEaRequestFini;
FSP_DRIVER_DISPATCH FspQueryEa;
FSP_DRIVER_DISPATCH FspSetEa;
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, FspFsvolQueryEaGetCopy)
#pragma alloc_text(PAGE, FspFsvolQueryEaIndexCopy)
#pragma alloc_text(PAGE, FspFsvolQueryEa)
#pragma alloc_text(PAGE, FspFsvolQueryEaComplete)
#pragma alloc_text(PAGE, FspFsvolQueryEaRequestFini)
#pragma alloc_text(PAGE, FspFsvolSetEa)
#pragma alloc_text(PAGE, FspFsvolSetEaComplete)
#pragma alloc_text(PAGE, FspFsvolSetEaRequestFini)
#pragma alloc_text(PAGE, FspQueryEa)
#pragma alloc_text(PAGE, FspSetEa)
#endif
static NTSTATUS FspFsvolQueryEa(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
enum
{
/* QueryEa */
RequestFileNode = 0,
RequestEaChangeNumber = 1,
/* SetEa */
//RequestFileNode = 0,
};
static VOID FspFsvolQueryEaGetCopy(
BOOLEAN CasePreservedExtendedAttributes,
BOOLEAN ReturnSingleEntry,
PFILE_GET_EA_INFORMATION GetBufBgn, ULONG GetSize,
PFILE_FULL_EA_INFORMATION SrcBufBgn, ULONG SrcSize,
PFILE_FULL_EA_INFORMATION DstBufBgn, ULONG DstSize,
PIO_STATUS_BLOCK IoStatus)
{
PAGED_CODE();
return STATUS_INVALID_DEVICE_REQUEST;
PFILE_GET_EA_INFORMATION GetBuf, GetBufEnd = (PVOID)((PUINT8)GetBufBgn + GetSize);
PFILE_GET_EA_INFORMATION Get;
PFILE_FULL_EA_INFORMATION SrcBuf, SrcBufEnd = (PVOID)((PUINT8)SrcBufBgn + SrcSize);
PFILE_FULL_EA_INFORMATION DstBuf, DstBufEnd = (PVOID)((PUINT8)DstBufBgn + DstSize);
PFILE_FULL_EA_INFORMATION PrevDstBuf;
PFILE_FULL_EA_INFORMATION Src;
STRING GetName, Name;
ULONG CopyLength;
IoStatus->Information = 0;
DstBuf = DstBufBgn, PrevDstBuf = 0;
for (GetBuf = GetBufBgn; GetBufEnd > GetBuf; GetBuf = FSP_NEXT_EA(GetBuf, GetBufEnd))
{
GetName.Length = GetName.MaximumLength = GetBuf->EaNameLength;
GetName.Buffer = GetBuf->EaName;
/* ignore duplicate names */
for (Get = GetBufBgn; GetBuf > Get; Get = (PVOID)((PUINT8)Get + Get->NextEntryOffset))
{
Name.Length = Name.MaximumLength = Get->EaNameLength;
Name.Buffer = Get->EaName;
if (RtlEqualString(&GetName, &Name, TRUE/* always case-insensitive */))
break;
}
if (GetBuf > Get)
continue;
if (!FspEaNameIsValid(&GetName))
{
IoStatus->Status = STATUS_INVALID_EA_NAME;
IoStatus->Information = (ULONG)((PUINT8)GetBuf - (PUINT8)GetBufBgn);
return;
}
Src = 0;
for (SrcBuf = SrcBufBgn; SrcBufEnd > SrcBuf; SrcBuf = FSP_NEXT_EA(SrcBuf, SrcBufEnd))
{
Name.Length = Name.MaximumLength = SrcBuf->EaNameLength;
Name.Buffer = SrcBuf->EaName;
if (RtlEqualString(&GetName, &Name, TRUE/* always case-insensitive */))
{
Src = SrcBuf;
break;
}
}
if (0 != Src)
CopyLength = FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) +
Src->EaNameLength + 1 + Src->EaValueLength;
else
CopyLength = FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) +
GetBuf->EaNameLength + 1;
if ((PUINT8)DstBuf + CopyLength > (PUINT8)DstBufEnd)
{
IoStatus->Status = STATUS_BUFFER_OVERFLOW;
IoStatus->Information = 0;
return;
}
if (0 != Src)
RtlMoveMemory(DstBuf, Src, CopyLength);
else
{
DstBuf->Flags = 0;
DstBuf->EaNameLength = GetBuf->EaNameLength;
DstBuf->EaValueLength = 0;
RtlCopyMemory(DstBuf->EaName, GetBuf->EaName, GetBuf->EaNameLength + 1);
}
DstBuf->NextEntryOffset = 0;
if (!CasePreservedExtendedAttributes)
{
Name.Length = Name.MaximumLength = DstBuf->EaNameLength;
Name.Buffer = DstBuf->EaName;
FspEaNameUpcase(&Name, &Name, 0);
}
if (0 != PrevDstBuf)
PrevDstBuf->NextEntryOffset = (ULONG)((PUINT8)DstBuf - (PUINT8)PrevDstBuf);
PrevDstBuf = DstBuf;
IoStatus->Information = (ULONG)((PUINT8)DstBuf - (PUINT8)DstBufBgn + CopyLength);
DstBuf = (PVOID)((PUINT8)DstBuf + FSP_FSCTL_ALIGN_UP(CopyLength, sizeof(ULONG)));
if (ReturnSingleEntry)
break;
}
IoStatus->Status = STATUS_SUCCESS;
}
static VOID FspFsvolQueryEaIndexCopy(
BOOLEAN CasePreservedExtendedAttributes,
BOOLEAN ReturnSingleEntry,
BOOLEAN IndexSpecified, PULONG PEaIndex,
PFILE_FULL_EA_INFORMATION SrcBufBgn, ULONG SrcSize,
PFILE_FULL_EA_INFORMATION DstBufBgn, ULONG DstSize,
PIO_STATUS_BLOCK IoStatus)
{
PAGED_CODE();
ULONG EaIndex = 1;
PFILE_FULL_EA_INFORMATION SrcBuf, SrcBufEnd = (PVOID)((PUINT8)SrcBufBgn + SrcSize);
PFILE_FULL_EA_INFORMATION DstBuf, DstBufEnd = (PVOID)((PUINT8)DstBufBgn + DstSize);
PFILE_FULL_EA_INFORMATION PrevDstBuf;
STRING Name;
ULONG CopyLength;
if (IndexSpecified && 0 == *PEaIndex)
{
IoStatus->Status = STATUS_NONEXISTENT_EA_ENTRY;
IoStatus->Information = 0;
return;
}
for (SrcBuf = SrcBufBgn; EaIndex < *PEaIndex && SrcBufEnd > SrcBuf;
SrcBuf = FSP_NEXT_EA(SrcBuf, SrcBufEnd))
EaIndex++;
IoStatus->Information = 0;
DstBuf = DstBufBgn, PrevDstBuf = 0;
for (; SrcBufEnd > SrcBuf; SrcBuf = FSP_NEXT_EA(SrcBuf, SrcBufEnd))
{
CopyLength = FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) +
((PFILE_FULL_EA_INFORMATION)SrcBuf)->EaNameLength + 1 +
((PFILE_FULL_EA_INFORMATION)SrcBuf)->EaValueLength;
if ((PUINT8)DstBuf + CopyLength > (PUINT8)DstBufEnd)
{
if (0 != PrevDstBuf)
break;
IoStatus->Status = STATUS_BUFFER_TOO_SMALL;
IoStatus->Information = 0;
return;
}
RtlMoveMemory(DstBuf, SrcBuf, CopyLength);
DstBuf->NextEntryOffset = 0;
if (!CasePreservedExtendedAttributes)
{
Name.Length = Name.MaximumLength = DstBuf->EaNameLength;
Name.Buffer = DstBuf->EaName;
FspEaNameUpcase(&Name, &Name, 0);
}
if (0 != PrevDstBuf)
PrevDstBuf->NextEntryOffset = (ULONG)((PUINT8)DstBuf - (PUINT8)PrevDstBuf);
PrevDstBuf = DstBuf;
IoStatus->Information = (ULONG)((PUINT8)DstBuf - (PUINT8)DstBufBgn + CopyLength);
DstBuf = (PVOID)((PUINT8)DstBuf + FSP_FSCTL_ALIGN_UP(CopyLength, sizeof(ULONG)));
EaIndex++;
if (ReturnSingleEntry)
break;
}
if (IndexSpecified)
{
if (0 != PrevDstBuf)
{
*PEaIndex = EaIndex;
IoStatus->Status = SrcBufEnd > SrcBuf && !ReturnSingleEntry ?
STATUS_BUFFER_OVERFLOW : STATUS_SUCCESS;
}
else
{
IoStatus->Status = *PEaIndex == EaIndex ?
STATUS_NO_MORE_EAS : STATUS_NONEXISTENT_EA_ENTRY;
IoStatus->Information = 0;
}
}
else
{
if (0 != PrevDstBuf)
{
*PEaIndex = EaIndex;
IoStatus->Status = SrcBufEnd > SrcBuf && !ReturnSingleEntry ?
STATUS_BUFFER_OVERFLOW : STATUS_SUCCESS;
}
else
{
IoStatus->Status = SrcBufBgn == SrcBuf ?
STATUS_NO_EAS_ON_FILE : STATUS_NO_MORE_EAS;
IoStatus->Information = 0;
}
}
}
static VOID FspFsvolQueryEaCopy(
BOOLEAN CasePreservedExtendedAttributes,
PIO_STACK_LOCATION IrpSp,
PFILE_FULL_EA_INFORMATION SrcBufBgn, ULONG SrcSize,
PFILE_FULL_EA_INFORMATION DstBufBgn, ULONG DstSize,
PIO_STATUS_BLOCK IoStatus)
{
PAGED_CODE();
PFILE_OBJECT FileObject = IrpSp->FileObject;
FSP_FILE_NODE *FileNode = FileObject->FsContext;
FSP_FILE_DESC *FileDesc = FileObject->FsContext2;
BOOLEAN RestartScan = BooleanFlagOn(IrpSp->Flags, SL_RESTART_SCAN);
BOOLEAN IndexSpecified = BooleanFlagOn(IrpSp->Flags, SL_INDEX_SPECIFIED);
BOOLEAN ReturnSingleEntry = BooleanFlagOn(IrpSp->Flags, SL_RETURN_SINGLE_ENTRY);
PFILE_GET_EA_INFORMATION EaList = IrpSp->Parameters.QueryEa.EaList;
ULONG EaListLength = IrpSp->Parameters.QueryEa.EaListLength;
ULONG EaIndex;
ASSERT(FileNode == FileDesc->FileNode);
if (0 != EaList)
{
FspFsvolQueryEaGetCopy(
CasePreservedExtendedAttributes,
ReturnSingleEntry,
EaList, EaListLength,
SrcBufBgn, SrcSize,
DstBufBgn, DstSize,
IoStatus);
}
else
{
if (!IndexSpecified &&
!RestartScan &&
0 != FileDesc->EaIndex &&
FileNode->EaChangeCount != FileDesc->EaChangeCount)
{
IoStatus->Status = STATUS_EA_CORRUPT_ERROR;
IoStatus->Information = 0;
return;
}
if (IndexSpecified)
EaIndex = IrpSp->Parameters.QueryEa.EaIndex;
else if (RestartScan)
EaIndex = 0;
else
EaIndex = FileDesc->EaIndex;
FspFsvolQueryEaIndexCopy(
CasePreservedExtendedAttributes,
ReturnSingleEntry,
IndexSpecified, &EaIndex,
SrcBufBgn, SrcSize,
DstBufBgn, DstSize,
IoStatus);
if (NT_SUCCESS(IoStatus->Status) || STATUS_BUFFER_OVERFLOW == IoStatus->Status)
{
FileDesc->EaIndex = EaIndex;
FileDesc->EaChangeCount = FileNode->EaChangeCount;
}
}
}
static NTSTATUS FspFsvolQueryEa(
PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
{
PAGED_CODE();
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
/* do we support Ea? */
if (!FsvolDeviceExtension->VolumeParams.ExtendedAttributes)
return STATUS_INVALID_DEVICE_REQUEST;
/* is this a valid FileObject? */
if (!FspFileNodeIsValid(IrpSp->FileObject->FsContext))
return STATUS_INVALID_DEVICE_REQUEST;
NTSTATUS Result;
PFILE_OBJECT FileObject = IrpSp->FileObject;
FSP_FILE_NODE *FileNode = FileObject->FsContext;
FSP_FILE_DESC *FileDesc = FileObject->FsContext2;
PVOID Buffer = Irp->UserBuffer;
ULONG Length = IrpSp->Parameters.QueryEa.Length;
PVOID EaBuffer;
ULONG EaBufferSize;
FSP_FSCTL_TRANSACT_REQ *Request;
ASSERT(FileNode == FileDesc->FileNode);
FspFileNodeAcquireExclusive(FileNode, Main);
if (FspFileNodeReferenceEa(FileNode, &EaBuffer, &EaBufferSize))
{
FspFsvolQueryEaCopy(
!!FsvolDeviceExtension->VolumeParams.CasePreservedExtendedAttributes,
IrpSp,
EaBuffer, EaBufferSize,
Buffer, Length,
&Irp->IoStatus);
FspFileNodeDereferenceEa(EaBuffer);
FspFileNodeRelease(FileNode, Main);
return Irp->IoStatus.Status;
}
FspFileNodeConvertExclusiveToShared(FileNode, Main);
FspFileNodeAcquireShared(FileNode, Pgio);
Result = FspBufferUserBuffer(Irp, Length, IoWriteAccess);
if (!NT_SUCCESS(Result))
{
FspFileNodeRelease(FileNode, Full);
return Result;
}
Result = FspIopCreateRequestEx(Irp, 0, 0, FspFsvolQueryEaRequestFini, &Request);
if (!NT_SUCCESS(Result))
{
FspFileNodeRelease(FileNode, Full);
return Result;
}
Request->Kind = FspFsctlTransactQueryEaKind;
Request->Req.QueryEa.UserContext = FileNode->UserContext;
Request->Req.QueryEa.UserContext2 = FileDesc->UserContext2;
FspFileNodeSetOwner(FileNode, Full, Request);
FspIopRequestContext(Request, RequestFileNode) = FileNode;
return FSP_STATUS_IOQ_POST;
}
NTSTATUS FspFsvolQueryEaComplete(
@ -48,15 +412,155 @@ NTSTATUS FspFsvolQueryEaComplete(
{
FSP_ENTER_IOC(PAGED_CODE());
FSP_LEAVE_IOC("%s", "");
if (!NT_SUCCESS(Response->IoStatus.Status))
{
Irp->IoStatus.Information = 0;
Result = Response->IoStatus.Status;
FSP_RETURN();
}
PDEVICE_OBJECT FsvolDeviceObject = IrpSp->DeviceObject;
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
PFILE_OBJECT FileObject = IrpSp->FileObject;
FSP_FILE_NODE *FileNode = FileObject->FsContext;
PVOID Buffer = Irp->AssociatedIrp.SystemBuffer;
ULONG Length = IrpSp->Parameters.QueryEa.Length;
PVOID EaBuffer = 0;
ULONG EaBufferSize = 0;
FSP_FSCTL_TRANSACT_REQ *Request = FspIrpRequest(Irp);
BOOLEAN Success;
if (0 != FspIopRequestContext(Request, RequestFileNode))
{
/* check that the EA buffer we got back is valid */
if (Response->Buffer + Response->Rsp.QueryEa.Ea.Size >
(PUINT8)Response + Response->Size)
{
Irp->IoStatus.Information = 0;
Result = STATUS_EA_LIST_INCONSISTENT;
FSP_RETURN();
}
Result = FspEaBufferFromFileSystemValidate(
(PVOID)Response->Buffer, /* FspEaBufferFromFileSystemValidate may alter the buffer! */
Response->Rsp.QueryEa.Ea.Size,
(PULONG)&Irp->IoStatus.Information);
if (!NT_SUCCESS(Result))
FSP_RETURN();
FspIopRequestContext(Request, RequestEaChangeNumber) = (PVOID)
FspFileNodeEaChangeNumber(FileNode);
FspIopRequestContext(Request, RequestFileNode) = 0;
FspFileNodeReleaseOwner(FileNode, Full, Request);
}
Success = DEBUGTEST(90) && FspFileNodeTryAcquireExclusive(FileNode, Main);
if (!Success)
{
FspIopRetryCompleteIrp(Irp, Response, &Result);
FSP_RETURN();
}
Success = !FspFileNodeTrySetEa(FileNode,
Response->Buffer, Response->Rsp.QueryEa.Ea.Size,
(ULONG)(UINT_PTR)FspIopRequestContext(Request, RequestEaChangeNumber));
Success = Success && FspFileNodeReferenceEa(FileNode, &EaBuffer, &EaBufferSize);
if (Success)
{
FspFsvolQueryEaCopy(
!!FsvolDeviceExtension->VolumeParams.CasePreservedExtendedAttributes,
IrpSp,
EaBuffer, EaBufferSize,
Buffer, Length,
&Irp->IoStatus);
FspFileNodeDereferenceEa(EaBuffer);
}
else
{
EaBuffer = (PVOID)Response->Buffer;
EaBufferSize = Response->Rsp.QueryEa.Ea.Size;
FspFsvolQueryEaCopy(
!!FsvolDeviceExtension->VolumeParams.CasePreservedExtendedAttributes,
IrpSp,
EaBuffer, EaBufferSize,
Buffer, Length,
&Irp->IoStatus);
}
FspFileNodeRelease(FileNode, Main);
Result = Irp->IoStatus.Status;
FSP_LEAVE_IOC("FileObject=%p",
IrpSp->FileObject);
}
static NTSTATUS FspFsvolSetEa(
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
static VOID FspFsvolQueryEaRequestFini(FSP_FSCTL_TRANSACT_REQ *Request, PVOID Context[4])
{
PAGED_CODE();
return STATUS_INVALID_DEVICE_REQUEST;
FSP_FILE_NODE *FileNode = Context[RequestFileNode];
if (0 != FileNode)
FspFileNodeReleaseOwner(FileNode, Full, Request);
}
static NTSTATUS FspFsvolSetEa(
PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
{
PAGED_CODE();
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
/* do we support Ea? */
if (!FsvolDeviceExtension->VolumeParams.ExtendedAttributes)
return STATUS_INVALID_DEVICE_REQUEST;
/* is this a valid FileObject? */
if (!FspFileNodeIsValid(IrpSp->FileObject->FsContext))
return STATUS_INVALID_DEVICE_REQUEST;
NTSTATUS Result;
PFILE_OBJECT FileObject = IrpSp->FileObject;
FSP_FILE_NODE *FileNode = FileObject->FsContext;
FSP_FILE_DESC *FileDesc = FileObject->FsContext2;
PVOID Buffer;
ULONG Length = IrpSp->Parameters.SetEa.Length;
FSP_FSCTL_TRANSACT_REQ *Request;
ASSERT(FileNode == FileDesc->FileNode);
Result = FspBufferUserBuffer(Irp, Length, IoReadAccess);
if (!NT_SUCCESS(Result))
return Result;
Buffer = Irp->AssociatedIrp.SystemBuffer;
Result = FspEaBufferFromOriginatingProcessValidate(
Buffer, Length, (PULONG)&Irp->IoStatus.Information);
if (!NT_SUCCESS(Result))
return Result;
FspFileNodeAcquireExclusive(FileNode, Full);
Result = FspIopCreateRequestEx(Irp, 0, Length, FspFsvolSetEaRequestFini,
&Request);
if (!NT_SUCCESS(Result))
{
FspFileNodeRelease(FileNode, Full);
return Result;
}
Request->Kind = FspFsctlTransactSetEaKind;
Request->Req.SetEa.UserContext = FileNode->UserContext;
Request->Req.SetEa.UserContext2 = FileDesc->UserContext2;
Request->Req.SetEa.Ea.Offset = 0;
Request->Req.SetEa.Ea.Size = (UINT16)Length;
RtlCopyMemory(Request->Buffer, Buffer, Length);
FspFileNodeSetOwner(FileNode, Full, Request);
FspIopRequestContext(Request, RequestFileNode) = FileNode;
return FSP_STATUS_IOQ_POST;
}
NTSTATUS FspFsvolSetEaComplete(
@ -64,7 +568,65 @@ NTSTATUS FspFsvolSetEaComplete(
{
FSP_ENTER_IOC(PAGED_CODE());
FSP_LEAVE_IOC("%s", "");
if (!NT_SUCCESS(Response->IoStatus.Status))
{
Irp->IoStatus.Information = 0;
Result = Response->IoStatus.Status;
FSP_RETURN();
}
PFILE_OBJECT FileObject = IrpSp->FileObject;
FSP_FILE_NODE *FileNode = FileObject->FsContext;
FSP_FSCTL_TRANSACT_REQ *Request = FspIrpRequest(Irp);
BOOLEAN EaValid;
FspFileNodeSetFileInfo(FileNode, FileObject, &Response->Rsp.SetEa.FileInfo, FALSE);
EaValid = FALSE;
if (0 < Response->Rsp.SetEa.Ea.Size &&
Response->Buffer + Response->Rsp.SetEa.Ea.Size <=
(PUINT8)Response + Response->Size)
{
Result = FspEaBufferFromFileSystemValidate(
(PVOID)Response->Buffer, /* FspEaBufferFromFileSystemValidate may alter the buffer! */
Response->Rsp.SetEa.Ea.Size,
(PULONG)&Irp->IoStatus.Information);
EaValid = NT_SUCCESS(Result);
}
if (EaValid)
{
/* if the EA buffer that we got back is valid, update the cached EA */
FspFileNodeSetEa(FileNode,
Response->Buffer, Response->Rsp.SetEa.Ea.Size);
}
else
{
/* if the EA buffer that we got back is not valid, invalidate the cached EA */
FspFileNodeSetEa(FileNode, 0, 0);
}
FileNode->EaChangeCount++;
FspFileNodeNotifyChange(FileNode, FILE_NOTIFY_CHANGE_EA, FILE_ACTION_MODIFIED, FALSE);
FspIopRequestContext(Request, RequestFileNode) = 0;
FspFileNodeReleaseOwner(FileNode, Full, Request);
Irp->IoStatus.Information = 0;
Result = STATUS_SUCCESS;
FSP_LEAVE_IOC("FileObject=%p",
IrpSp->FileObject);
}
static VOID FspFsvolSetEaRequestFini(FSP_FSCTL_TRANSACT_REQ *Request, PVOID Context[4])
{
PAGED_CODE();
FSP_FILE_NODE *FileNode = Context[RequestFileNode];
if (0 != FileNode)
FspFileNodeReleaseOwner(FileNode, Full, Request);
}
NTSTATUS FspQueryEa(
@ -80,7 +642,8 @@ NTSTATUS FspQueryEa(
FSP_RETURN(Result = STATUS_INVALID_DEVICE_REQUEST);
}
FSP_LEAVE_MJ("%s", "");
FSP_LEAVE_MJ("FileObject=%p",
IrpSp->FileObject);
}
NTSTATUS FspSetEa(
@ -96,5 +659,6 @@ NTSTATUS FspSetEa(
FSP_RETURN(Result = STATUS_INVALID_DEVICE_REQUEST);
}
FSP_LEAVE_MJ("%s", "");
FSP_LEAVE_MJ("FileObject=%p",
IrpSp->FileObject);
}

View File

@ -1,7 +1,7 @@
/**
* @file sys/file.c
*
* @copyright 2015-2018 Bill Zissimopoulos
* @copyright 2015-2019 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
@ -10,9 +10,13 @@
* General Public License version 3 as published by the Free Software
* Foundation.
*
* Licensees holding a valid commercial license may use this file in
* accordance with the commercial license agreement provided with the
* software.
* Licensees holding a valid commercial license may use this software
* in accordance with the commercial license agreement provided in
* 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>
@ -57,10 +61,14 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
VOID FspFileNodeRename(FSP_FILE_NODE *FileNode, PUNICODE_STRING NewFileName);
VOID FspFileNodeGetFileInfo(FSP_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *FileInfo);
BOOLEAN FspFileNodeTryGetFileInfo(FSP_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *FileInfo);
BOOLEAN FspFileNodeTryGetFileInfoByName(PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp,
PUNICODE_STRING FileName, FSP_FSCTL_FILE_INFO *FileInfo);
VOID FspFileNodeSetFileInfo(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, BOOLEAN TruncateOnClose);
BOOLEAN FspFileNodeTrySetFileInfoOnOpen(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, BOOLEAN TruncateOnClose);
BOOLEAN FspFileNodeTrySetFileInfoAndSecurityOnOpen(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo,
const PSECURITY_DESCRIPTOR SecurityDescriptor, ULONG SecurityDescriptorSize,
BOOLEAN TruncateOnClose);
BOOLEAN FspFileNodeTrySetFileInfo(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, ULONG InfoChangeNumber);
VOID FspFileNodeInvalidateFileInfo(FSP_FILE_NODE *FileNode);
@ -81,6 +89,10 @@ VOID FspFileNodeSetStreamInfo(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size
BOOLEAN FspFileNodeTrySetStreamInfo(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size,
ULONG StreamInfoChangeNumber);
VOID FspFileNodeInvalidateStreamInfo(FSP_FILE_NODE *FileNode);
BOOLEAN FspFileNodeReferenceEa(FSP_FILE_NODE *FileNode, PCVOID *PBuffer, PULONG PSize);
VOID FspFileNodeSetEa(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size);
BOOLEAN FspFileNodeTrySetEa(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size,
ULONG EaChangeNumber);
VOID FspFileNodeNotifyChange(FSP_FILE_NODE *FileNode, ULONG Filter, ULONG Action,
BOOLEAN InvalidateCaches);
NTSTATUS FspFileNodeProcessLockIrp(FSP_FILE_NODE *FileNode, PIRP Irp);
@ -132,8 +144,9 @@ VOID FspFileNodeOplockComplete(PVOID Context, PIRP Irp);
#pragma alloc_text(PAGE, FspFileNodeRename)
#pragma alloc_text(PAGE, FspFileNodeGetFileInfo)
#pragma alloc_text(PAGE, FspFileNodeTryGetFileInfo)
#pragma alloc_text(PAGE, FspFileNodeTryGetFileInfoByName)
#pragma alloc_text(PAGE, FspFileNodeSetFileInfo)
#pragma alloc_text(PAGE, FspFileNodeTrySetFileInfoOnOpen)
#pragma alloc_text(PAGE, FspFileNodeTrySetFileInfoAndSecurityOnOpen)
#pragma alloc_text(PAGE, FspFileNodeTrySetFileInfo)
#pragma alloc_text(PAGE, FspFileNodeInvalidateFileInfo)
#pragma alloc_text(PAGE, FspFileNodeReferenceSecurity)
@ -149,6 +162,9 @@ VOID FspFileNodeOplockComplete(PVOID Context, PIRP Irp);
// !#pragma alloc_text(PAGE, FspFileNodeSetStreamInfo)
// !#pragma alloc_text(PAGE, FspFileNodeTrySetStreamInfo)
// !#pragma alloc_text(PAGE, FspFileNodeInvalidateStreamInfo)
#pragma alloc_text(PAGE, FspFileNodeReferenceEa)
#pragma alloc_text(PAGE, FspFileNodeSetEa)
#pragma alloc_text(PAGE, FspFileNodeTrySetEa)
#pragma alloc_text(PAGE, FspFileNodeNotifyChange)
#pragma alloc_text(PAGE, FspFileNodeProcessLockIrp)
#pragma alloc_text(PAGE, FspFileNodeCompleteLockIrp)
@ -352,6 +368,7 @@ VOID FspFileNodeDelete(FSP_FILE_NODE *FileNode)
FsRtlTeardownPerStreamContexts(&FileNode->Header);
FspMetaCacheInvalidateItem(FsvolDeviceExtension->EaCache, FileNode->Ea);
FspMetaCacheInvalidateItem(FsvolDeviceExtension->StreamInfoCache, FileNode->NonPaged->StreamInfo);
FspMetaCacheInvalidateItem(FsvolDeviceExtension->DirInfoCache, FileNode->NonPaged->DirInfo);
FspMetaCacheInvalidateItem(FsvolDeviceExtension->SecurityCache, FileNode->Security);
@ -1614,6 +1631,7 @@ VOID FspFileNodeGetFileInfo(FSP_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *FileIn
FileInfo->LastAccessTime = FileNode->LastAccessTime;
FileInfo->LastWriteTime = FileNode->LastWriteTime;
FileInfo->ChangeTime = FileNode->ChangeTime;
FileInfo->EaSize = FileNode->EaSize;
}
BOOLEAN FspFileNodeTryGetFileInfo(FSP_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *FileInfo)
@ -1636,6 +1654,78 @@ BOOLEAN FspFileNodeTryGetFileInfo(FSP_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *
return TRUE;
}
BOOLEAN FspFileNodeTryGetFileInfoByName(PDEVICE_OBJECT FsvolDeviceObject, PIRP Irp,
PUNICODE_STRING FileName, FSP_FSCTL_FILE_INFO *FileInfo)
{
PAGED_CODE();
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
ACCESS_MASK DesiredAccess = AccessState->RemainingDesiredAccess;
ACCESS_MASK GrantedAccess = AccessState->PreviouslyGrantedAccess;
KPROCESSOR_MODE RequestorMode =
FlagOn(IrpSp->Flags, SL_FORCE_ACCESS_CHECK) ? UserMode : Irp->RequestorMode;
BOOLEAN HasTraversePrivilege =
BooleanFlagOn(AccessState->Flags, TOKEN_HAS_TRAVERSE_PRIVILEGE);
FSP_FILE_NODE *FileNode;
PVOID SecurityBuffer;
BOOLEAN Result;
if (UserMode == RequestorMode)
{
/* user mode: allow only FILE_READ_ATTRIBUTES with traverse privilege */
if (FILE_READ_ATTRIBUTES != DesiredAccess || !HasTraversePrivilege)
return FALSE;
}
else
/* kernel mode: anything goes! */
DesiredAccess = 0;
FspFsvolDeviceLockContextTable(FsvolDeviceObject);
FileNode = FspFsvolDeviceLookupContextByName(FsvolDeviceObject, FileName);
if (0 != FileNode)
FspFileNodeReference(FileNode);
FspFsvolDeviceUnlockContextTable(FsvolDeviceObject);
Result = FALSE;
if (0 != FileNode)
{
FspFileNodeAcquireShared(FileNode, Main);
if (0 != DesiredAccess)
{
ASSERT(FILE_READ_ATTRIBUTES == DesiredAccess);
if (FspFileNodeReferenceSecurity(FileNode, &SecurityBuffer, 0))
{
NTSTATUS AccessStatus;
Result = SeAccessCheck(
SecurityBuffer,
&AccessState->SubjectSecurityContext,
TRUE,
DesiredAccess,
GrantedAccess,
0,
IoGetFileObjectGenericMapping(),
RequestorMode,
&GrantedAccess,
&AccessStatus);
FspFileNodeDereferenceSecurity(SecurityBuffer);
Result = Result && FspFileNodeTryGetFileInfo(FileNode, FileInfo);
}
}
else
Result = FspFileNodeTryGetFileInfo(FileNode, FileInfo);
FspFileNodeRelease(FileNode, Main);
FspFileNodeDereference(FileNode);
}
return Result;
}
VOID FspFileNodeSetFileInfo(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, BOOLEAN TruncateOnClose)
{
@ -1689,6 +1779,7 @@ VOID FspFileNodeSetFileInfo(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
MainFileNode->LastAccessTime = FileInfo->LastAccessTime;
MainFileNode->LastWriteTime = FileInfo->LastWriteTime;
MainFileNode->ChangeTime = FileInfo->ChangeTime;
MainFileNode->EaSize = FileInfo->EaSize;
if (0 != CcFileObject)
{
@ -1746,8 +1837,10 @@ VOID FspFileNodeSetFileInfo(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
}
}
BOOLEAN FspFileNodeTrySetFileInfoOnOpen(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo, BOOLEAN TruncateOnClose)
BOOLEAN FspFileNodeTrySetFileInfoAndSecurityOnOpen(FSP_FILE_NODE *FileNode, PFILE_OBJECT CcFileObject,
const FSP_FSCTL_FILE_INFO *FileInfo,
const PSECURITY_DESCRIPTOR SecurityDescriptor, ULONG SecurityDescriptorSize,
BOOLEAN TruncateOnClose)
{
PAGED_CODE();
@ -1780,6 +1873,8 @@ BOOLEAN FspFileNodeTrySetFileInfoOnOpen(FSP_FILE_NODE *FileNode, PFILE_OBJECT Cc
}
FspFileNodeSetFileInfo(FileNode, CcFileObject, FileInfo, TruncateOnClose);
if (0 != SecurityDescriptor)
FspFileNodeSetSecurity(FileNode, SecurityDescriptor, SecurityDescriptorSize);
return TRUE;
}
@ -2030,6 +2125,48 @@ VOID FspFileNodeInvalidateStreamInfo(FSP_FILE_NODE *FileNode)
FspMetaCacheInvalidateItem(FsvolDeviceExtension->StreamInfoCache, StreamInfo);
}
BOOLEAN FspFileNodeReferenceEa(FSP_FILE_NODE *FileNode, PCVOID *PBuffer, PULONG PSize)
{
PAGED_CODE();
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension =
FspFsvolDeviceExtension(FileNode->FsvolDeviceObject);
return FspMetaCacheReferenceItemBuffer(FsvolDeviceExtension->EaCache,
FileNode->Ea, PBuffer, PSize);
}
VOID FspFileNodeSetEa(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size)
{
PAGED_CODE();
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension =
FspFsvolDeviceExtension(FileNode->FsvolDeviceObject);
FspMetaCacheInvalidateItem(FsvolDeviceExtension->EaCache, FileNode->Ea);
FileNode->Ea = 0 != Buffer ?
FspMetaCacheAddItem(FsvolDeviceExtension->EaCache, Buffer, Size) : 0;
FileNode->EaChangeNumber++;
}
BOOLEAN FspFileNodeTrySetEa(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size,
ULONG EaChangeNumber)
{
PAGED_CODE();
if (FspFileNodeEaChangeNumber(FileNode) != EaChangeNumber)
return FALSE;
FspFileNodeSetEa(FileNode, Buffer, Size);
return TRUE;
}
VOID FspFileNodeNotifyChange(FSP_FILE_NODE *FileNode, ULONG Filter, ULONG Action,
BOOLEAN InvalidateCaches)
{

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