mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-03 17:32:57 -05:00
Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
b9915dcaa7 | |||
a7febb8265 | |||
d6aaf0088a | |||
f05af124e7 | |||
886b7cf9f7 | |||
e111451475 | |||
0c38f92082 | |||
9bd9cf4fbd | |||
2f026cbc6f | |||
68d8ade667 | |||
d9c450ecf4 | |||
e6d2ef9274 | |||
299f371dee | |||
bb8aee8673 | |||
08bf8e14ce | |||
ef1912bd8a | |||
ff155694ce | |||
e6ed6dbf4f | |||
f13b98c880 | |||
5d3b37122c | |||
9d1c892d68 | |||
7008871ed7 | |||
2a3eabfab2 | |||
35255526d3 | |||
b2e474658d | |||
4fe85222b1 | |||
fd3e5bad43 | |||
ea873ece22 | |||
42e01a9b27 | |||
c1c9dca94b | |||
dcabdff422 | |||
a2ec40008f | |||
f3819ba839 | |||
ead599e337 | |||
eb88f25f40 | |||
c2b066a054 | |||
266e0f4bab | |||
d02030897d | |||
c87ff75b8f | |||
2ca33665ef | |||
391dcf8a21 | |||
69d68eb22f |
12
.github/ISSUE_TEMPLATE.md
vendored
Normal file
12
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
(Enter your issue here.)
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Before submitting this issue please review this checklist. Ideally all checkmarks should be checked upon submitting. (Use an x inside square brackets like so: [x])
|
||||||
|
|
||||||
|
- [ ] **Issue type**: Please consider posting only bug reports or enhancement requests. Questions are better in the [WinFsp Google Group](https://groups.google.com/forum/#!forum/winfsp).
|
||||||
|
- [ ] **No Duplicate**: Ensure that your issue has not been filed before. (Check open and closed issues.)
|
||||||
|
- [ ] **Description**: Provide a descriptive title and a detailed explanation of the problem you are experiencing (for a bug report) or you are trying to solve (for an enhancement request).
|
||||||
|
- [ ] **Reproduce**: For bug reports provide detailed information on how to reproduce the problem. For enhancement requests you do not need to provide this information, unless you find it relevant.
|
||||||
|
- [ ] **Behaviors**: Provide information on the expected and actual behaviors.
|
||||||
|
- [ ] **Environment**: For bug reports provide information about your OS version and build (e.g. 10.0.14393) and WinFsp version and build (e.g. 2017.2 or 1.2.17341). For enhancement requests you do not need to provide this information, unless you find it relevant.
|
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
(Enter your PR description here.)
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Before submitting this PR please review this checklist. Ideally all checkmarks should be checked upon submitting. (Use an x inside square brackets like so: [x])
|
||||||
|
|
||||||
|
- [ ] **Contributing**: You MUST read and be willing to accept the [CONTRIBUTOR AGREEMENT](https://github.com/billziss-gh/winfsp/blob/master/Contributors.asciidoc). The agreement gives joint copyright interests in your contributions to you and the original WinFsp author. If you have already accepted the [CONTRIBUTOR AGREEMENT](https://github.com/billziss-gh/winfsp/blob/master/Contributors.asciidoc) you do not need to do so again.
|
||||||
|
- [ ] **Topic branch**: Avoid creating the PR off the master branch of your fork. Consider creating a topic branch and request a pull from that. This allows you to add commits to the master branch of your fork without affecting this PR.
|
||||||
|
- [ ] **No tabs**: Consistently use SPACES everywhere. NO TABS, unless the file format requires it (e.g. Makefile).
|
||||||
|
- [ ] **Style**: Follow the same code style as the rest of the project.
|
||||||
|
- [ ] **Tests**: Include tests to the extent that it is possible, especially if you add a new feature.
|
||||||
|
- [ ] **Quality**: Your design and code should be of high quality and something that you are proud of.
|
@ -1,6 +1,43 @@
|
|||||||
= Changelog
|
= Changelog
|
||||||
|
|
||||||
|
|
||||||
|
v1.3B1 (2018.1 B1)::
|
||||||
|
|
||||||
|
Changes since v1.2POST1:
|
||||||
|
|
||||||
|
- The WinFsp Launcher can now be controlled by the new `FspLaunch` API. File systems can be started, stopped, queried and listed using `FspLaunchStart`, `FspLaunchStop`, `FspLaunchGetInfo` and `FspLaunchGetNameList`.
|
||||||
|
- The WinFsp launcher now supports new registry settings `RunAs` and `WorkDirectory`. `RunAs` allows the laucher to launch a file system process under the service accounts LocalService and NetworkService. `WorkDirectory` can be used to specify the work directory for a newly launched file system process.
|
||||||
|
- The MEMFS sample file systems are now launched under the LocalService account.
|
||||||
|
- The WinFsp network provider is now added first in the provider order list. Previously it was added last. (GitHub PR #131; thanks @felfert.)
|
||||||
|
- The WinFsp installer now uses the Wix `Provides` dependency extension to provide a `WinFsp` dependency key. (GitHub PR #129; thanks @felfert.)
|
||||||
|
|
||||||
|
|
||||||
|
v1.2POST1 (2017.2; issue #127)::
|
||||||
|
|
||||||
|
Changes since v1.1:
|
||||||
|
|
||||||
|
- WinFsp-FUSE now supports BSD flags (Windows file attributes) during `getattr` and `fgetattr`. It also adds the `chflags` operation. BSD flags support requires use of the `FSP_FUSE_CAP_STAT_EX` capability and the new `struct fuse_stat_ex` which includes an `st_flags` field. If the preprocessor macro `FSP_FUSE_USE_STAT_EX` is defined before inclusion of `<fuse.h>` then `struct fuse_stat` will also be defined to include the `st_flags` field.
|
||||||
|
- WinFsp-FUSE also adds the following OSXFUSE operations: `setcrtime`, `setchgtime`. These can be used to set the creation (birth) time and change (ctime) time of a file.
|
||||||
|
- New `GetDirInfoByName` file system operation adds fast queries of directory info by file name rather than pattern [e.g. `FindFirstFileW(L"foobar", FindData)`]. Tests with fsbench showed that such queries are sped up by an order of magnitude when using `GetDirInfoByName` in MEMFS. Case-sensitive FUSE file systems get this optimization for free. The .NET layer also adds `GetDirInfoByName`.
|
||||||
|
- New `FspFileSystemOperationProcessId` API adds support for getting the originating process ID (PID) during `Create`, `Open` and `Rename` calls. FUSE file systems can now access `fuse_context::pid`. The .NET layer also adds `GetOperationProcessId`.
|
||||||
|
- New command line tool `fsptool` allows command line access to some WinFsp features.
|
||||||
|
- The WinFsp launcher now passes the name of the user who launched the file system as a special parameter %U. This is useful to file systems that use the launcher infrastructure, such as SSHFS-Win. [Please note that in earlier betas the user name was passed as parameter %3; the previous method was insecure and is no longer supported.]
|
||||||
|
- Important GitHub issues fixed: #96, #97, #103, #107, #127
|
||||||
|
|
||||||
|
|
||||||
|
v1.2 (2017.2)::
|
||||||
|
|
||||||
|
Changes since v1.1:
|
||||||
|
|
||||||
|
- WinFsp-FUSE now supports BSD flags (Windows file attributes) during `getattr` and `fgetattr`. It also adds the `chflags` operation. BSD flags support requires use of the `FSP_FUSE_CAP_STAT_EX` capability and the new `struct fuse_stat_ex` which includes an `st_flags` field. If the preprocessor macro `FSP_FUSE_USE_STAT_EX` is defined before inclusion of `<fuse.h>` then `struct fuse_stat` will also be defined to include the `st_flags` field.
|
||||||
|
- WinFsp-FUSE also adds the following OSXFUSE operations: `setcrtime`, `setchgtime`. These can be used to set the creation (birth) time and change (ctime) time of a file.
|
||||||
|
- New `GetDirInfoByName` file system operation adds fast queries of directory info by file name rather than pattern [e.g. `FindFirstFileW(L"foobar", FindData)`]. Tests with fsbench showed that such queries are sped up by an order of magnitude when using `GetDirInfoByName` in MEMFS. Case-sensitive FUSE file systems get this optimization for free. The .NET layer also adds `GetDirInfoByName`.
|
||||||
|
- New `FspFileSystemOperationProcessId` API adds support for getting the originating process ID (PID) during `Create`, `Open` and `Rename` calls. FUSE file systems can now access `fuse_context::pid`. The .NET layer also adds `GetOperationProcessId`.
|
||||||
|
- New command line tool `fsptool` allows command line access to some WinFsp features.
|
||||||
|
- The WinFsp launcher now passes the name of the user who launched the file system as a special parameter %U. This is useful to file systems that use the launcher infrastructure, such as SSHFS-Win. [Please note that in earlier betas the user name was passed as parameter %3; the previous method was insecure and is no longer supported.]
|
||||||
|
- Important GitHub issues fixed: #96, #97, #103, #107
|
||||||
|
|
||||||
|
|
||||||
v1.2B3 (2017.2 B3)::
|
v1.2B3 (2017.2 B3)::
|
||||||
|
|
||||||
Changes since v1.1:
|
Changes since v1.1:
|
||||||
|
@ -55,6 +55,7 @@ CONTRIBUTOR LIST
|
|||||||
----------------
|
----------------
|
||||||
|===
|
|===
|
||||||
|Bill Zissimopoulos |billziss at navimatics.com
|
|Bill Zissimopoulos |billziss at navimatics.com
|
||||||
|
|Fritz Elfert |fritz-github at fritz-elfert.de
|
||||||
|John Oberschelp |john at oberschelp.net
|
|John Oberschelp |john at oberschelp.net
|
||||||
|Sam Kelly (DuroSoft Technologies LLC, https://durosoft.com) |sam at durosoft.com
|
|Sam Kelly (DuroSoft Technologies LLC, https://durosoft.com) |sam at durosoft.com
|
||||||
|Tobias Urlaub |saibotu at outlook.de
|
|Tobias Urlaub |saibotu at outlook.de
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file CustomActions.cpp
|
* @file CustomActions.cpp
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
|
||||||
|
xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension">
|
||||||
<Product
|
<Product
|
||||||
Id="*"
|
Id="*"
|
||||||
Name="$(var.MyProductName) $(var.MyProductVersion)"
|
Name="$(var.MyProductName) $(var.MyProductVersion)"
|
||||||
@ -53,8 +54,8 @@
|
|||||||
Key="[P.RegistryKey]"
|
Key="[P.RegistryKey]"
|
||||||
Name="InstallDir"
|
Name="InstallDir"
|
||||||
Type="string"
|
Type="string"
|
||||||
Value="[INSTALLDIR]"
|
Value="[INSTALLDIR]" />
|
||||||
KeyPath="yes" />
|
<dep:Provides Key="WinFsp" />
|
||||||
</Component>
|
</Component>
|
||||||
<Component Id="C.License.txt">
|
<Component Id="C.License.txt">
|
||||||
<File Name="License.txt" Source="..\..\..\License.txt" KeyPath="yes" />
|
<File Name="License.txt" Source="..\..\..\License.txt" KeyPath="yes" />
|
||||||
@ -187,6 +188,10 @@
|
|||||||
Type="string"
|
Type="string"
|
||||||
Name="CommandLine"
|
Name="CommandLine"
|
||||||
Value="-i -F NTFS -n 65536 -s 67108864 -u %1 -m %2" />
|
Value="-i -F NTFS -n 65536 -s 67108864 -u %1 -m %2" />
|
||||||
|
<RegistryValue
|
||||||
|
Type="string"
|
||||||
|
Name="RunAs"
|
||||||
|
Value="LocalService" />
|
||||||
<RegistryValue
|
<RegistryValue
|
||||||
Type="string"
|
Type="string"
|
||||||
Name="Security"
|
Name="Security"
|
||||||
@ -213,6 +218,10 @@
|
|||||||
Type="string"
|
Type="string"
|
||||||
Name="CommandLine"
|
Name="CommandLine"
|
||||||
Value="-i -F NTFS -n 65536 -s 67108864 -u %1 -m %2" />
|
Value="-i -F NTFS -n 65536 -s 67108864 -u %1 -m %2" />
|
||||||
|
<RegistryValue
|
||||||
|
Type="string"
|
||||||
|
Name="RunAs"
|
||||||
|
Value="LocalService" />
|
||||||
<RegistryValue
|
<RegistryValue
|
||||||
Type="string"
|
Type="string"
|
||||||
Name="Security"
|
Name="Security"
|
||||||
@ -239,6 +248,10 @@
|
|||||||
Type="string"
|
Type="string"
|
||||||
Name="CommandLine"
|
Name="CommandLine"
|
||||||
Value="-i -F NTFS -n 65536 -s 67108864 -u %1 -m %2" />
|
Value="-i -F NTFS -n 65536 -s 67108864 -u %1 -m %2" />
|
||||||
|
<RegistryValue
|
||||||
|
Type="string"
|
||||||
|
Name="RunAs"
|
||||||
|
Value="LocalService" />
|
||||||
<RegistryValue
|
<RegistryValue
|
||||||
Type="string"
|
Type="string"
|
||||||
Name="Security"
|
Name="Security"
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
|
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
|
||||||
<Name>WixUIExtension</Name>
|
<Name>WixUIExtension</Name>
|
||||||
</WixExtension>
|
</WixExtension>
|
||||||
|
<WixExtension Include="WixDependencyExtension">
|
||||||
|
<HintPath>$(WixExtDir)\WixDependencyExtension.dll</HintPath>
|
||||||
|
<Name>WixDependencyExtension</Name>
|
||||||
|
</WixExtension>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(WixTargetsPath)" />
|
<Import Project="$(WixTargetsPath)" />
|
||||||
<!--
|
<!--
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;userenv.lib</AdditionalDependencies>
|
||||||
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -134,7 +134,7 @@
|
|||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;userenv.lib</AdditionalDependencies>
|
||||||
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -159,7 +159,7 @@
|
|||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;userenv.lib</AdditionalDependencies>
|
||||||
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -184,7 +184,7 @@
|
|||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies);rpcrt4.lib;userenv.lib</AdditionalDependencies>
|
||||||
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
<StripPrivateSymbols>$(OutDir)$(TargetName).public.pdb</StripPrivateSymbols>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
<MyCompanyName>Navimatics Corporation</MyCompanyName>
|
<MyCompanyName>Navimatics Corporation</MyCompanyName>
|
||||||
<MyCopyright>2015-$([System.DateTime]::Now.ToString(`yyyy`)) Bill Zissimopoulos</MyCopyright>
|
<MyCopyright>2015-$([System.DateTime]::Now.ToString(`yyyy`)) Bill Zissimopoulos</MyCopyright>
|
||||||
|
|
||||||
<MyCanonicalVersion>1.2</MyCanonicalVersion>
|
<MyCanonicalVersion>1.3</MyCanonicalVersion>
|
||||||
|
|
||||||
<MyProductVersion>2017.2 B3</MyProductVersion>
|
<MyProductVersion>2018.1 B1</MyProductVersion>
|
||||||
<MyProductStage>Beta</MyProductStage>
|
<MyProductStage>Beta</MyProductStage>
|
||||||
|
|
||||||
<MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion>
|
<MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion>
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
<ClCompile Include="..\..\src\dll\fuse\fuse_intf.c" />
|
<ClCompile Include="..\..\src\dll\fuse\fuse_intf.c" />
|
||||||
<ClCompile Include="..\..\src\dll\fuse\fuse_main.c" />
|
<ClCompile Include="..\..\src\dll\fuse\fuse_main.c" />
|
||||||
<ClCompile Include="..\..\src\dll\fuse\fuse_opt.c" />
|
<ClCompile Include="..\..\src\dll\fuse\fuse_opt.c" />
|
||||||
|
<ClCompile Include="..\..\src\dll\launch.c" />
|
||||||
<ClCompile Include="..\..\src\dll\np.c" />
|
<ClCompile Include="..\..\src\dll\np.c" />
|
||||||
<ClCompile Include="..\..\src\dll\posix.c" />
|
<ClCompile Include="..\..\src\dll\posix.c" />
|
||||||
<ClCompile Include="..\..\src\dll\security.c" />
|
<ClCompile Include="..\..\src\dll\security.c" />
|
||||||
@ -51,6 +52,7 @@
|
|||||||
<ClCompile Include="..\..\src\dll\path.c" />
|
<ClCompile Include="..\..\src\dll\path.c" />
|
||||||
<ClCompile Include="..\..\src\dll\service.c" />
|
<ClCompile Include="..\..\src\dll\service.c" />
|
||||||
<ClCompile Include="..\..\src\dll\util.c" />
|
<ClCompile Include="..\..\src\dll\util.c" />
|
||||||
|
<ClCompile Include="..\..\src\dll\wksid.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="..\..\src\dll\fuse\fuse.pc.in">
|
<CustomBuild Include="..\..\src\dll\fuse\fuse.pc.in">
|
||||||
|
@ -112,6 +112,12 @@
|
|||||||
<ClCompile Include="..\..\src\dll\fuse\fuse_compat.c">
|
<ClCompile Include="..\..\src\dll\fuse\fuse_compat.c">
|
||||||
<Filter>Source\fuse</Filter>
|
<Filter>Source\fuse</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\dll\wksid.c">
|
||||||
|
<Filter>Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\dll\launch.c">
|
||||||
|
<Filter>Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\src\dll\library.def">
|
<None Include="..\..\src\dll\library.def">
|
||||||
|
@ -28,7 +28,7 @@ if ($key.Count -eq 1) {
|
|||||||
-File "$file"
|
-File "$file"
|
||||||
}
|
}
|
||||||
} elseif ($key.Count -eq 0) {
|
} elseif ($key.Count -eq 0) {
|
||||||
Write-Warning "$packageName has already been uninstalled by other means."
|
# Write-Warning "$packageName is not installed"
|
||||||
} elseif ($key.Count -gt 1) {
|
} elseif ($key.Count -gt 1) {
|
||||||
Write-Warning "Too many matching packages found! Package may not be uninstalled."
|
Write-Warning "Too many matching packages found! Package may not be uninstalled."
|
||||||
Write-Warning "Please alert package maintainer the following packages were matched:"
|
Write-Warning "Please alert package maintainer the following packages were matched:"
|
@ -1,16 +1,14 @@
|
|||||||
$ErrorActionPreference = 'Stop';
|
$ErrorActionPreference = 'Stop';
|
||||||
|
|
||||||
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
||||||
$fileLocation = @(Get-ChildItem $toolsDir -filter winfsp-*.msi)[0].FullName
|
. "$toolsdir\chocolateyHelper.ps1"
|
||||||
|
|
||||||
$packageArgs = @{
|
$packageArgs = @{
|
||||||
packageName = 'winfsp'
|
packageName = 'winfsp'
|
||||||
fileType = 'msi'
|
fileType = 'msi'
|
||||||
file = $fileLocation
|
file = @(Get-ChildItem $toolsDir -filter winfsp-*.msi)[0].FullName
|
||||||
silentArgs = "/qn /norestart INSTALLLEVEL=1000"
|
silentArgs = "/qn /norestart INSTALLLEVEL=1000"
|
||||||
validExitCodes = @(0, 3010, 1641)
|
validExitCodes = @(0, 3010, 1641)
|
||||||
}
|
}
|
||||||
|
|
||||||
Install-ChocolateyInstallPackage @packageArgs
|
Install-ChocolateyInstallPackage @packageArgs
|
||||||
|
|
||||||
Remove-Item -Force $packageArgs.file
|
Remove-Item -Force $packageArgs.file
|
||||||
|
4
build/choco/chocolateyUninstall.ps1
Normal file
4
build/choco/chocolateyUninstall.ps1
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
$ErrorActionPreference = 'Stop';
|
||||||
|
|
||||||
|
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
||||||
|
. "$toolsdir\chocolateyHelper.ps1"
|
@ -50,7 +50,8 @@ To verify installation:
|
|||||||
<file src="LICENSE.txt" target="tools" />
|
<file src="LICENSE.txt" target="tools" />
|
||||||
<file src="VERIFICATION.txt" target="tools" />
|
<file src="VERIFICATION.txt" target="tools" />
|
||||||
<file src="chocolateyInstall.ps1" target="tools" />
|
<file src="chocolateyInstall.ps1" target="tools" />
|
||||||
<file src="chocolateyBeforeModify.ps1" target="tools" />
|
<file src="chocolateyUninstall.ps1" target="tools" />
|
||||||
|
<file src="chocolateyHelper.ps1" target="tools" />
|
||||||
<file src="winfsp-$version$.msi" target="tools" />
|
<file src="winfsp-$version$.msi" target="tools" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/callstack.c
|
* @file tlib/callstack.c
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tlib/callstack.h>
|
#include <tlib/callstack.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/callstack.h
|
* @file tlib/callstack.h
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TLIB_CALLSTACK_H_INCLUDED
|
#ifndef TLIB_CALLSTACK_H_INCLUDED
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/injected/allfunc.h
|
* @file tlib/injected/allfunc.h
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TLIB_INJECTED_ALLFUNC_H_INCLUDED
|
#ifndef TLIB_INJECTED_ALLFUNC_H_INCLUDED
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/injected/curlfunc.c
|
* @file tlib/injected/curlfunc.c
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tlib/injected/curlfunc.h>
|
#include <tlib/injected/curlfunc.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/injected/curlfunc.h
|
* @file tlib/injected/curlfunc.h
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TLIB_INJECTED_CURLFUNC_H_INCLUDED
|
#ifndef TLIB_INJECTED_CURLFUNC_H_INCLUDED
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/injected/stdfunc.c
|
* @file tlib/injected/stdfunc.c
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tlib/injected/stdfunc.h>
|
#include <tlib/injected/stdfunc.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/injected/stdfunc.h
|
* @file tlib/injected/stdfunc.h
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TLIB_INJECTED_STDFUNC_H_INCLUDED
|
#ifndef TLIB_INJECTED_STDFUNC_H_INCLUDED
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/injection.c
|
* @file tlib/injection.c
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tlib/injection.h>
|
#include <tlib/injection.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/injection.h
|
* @file tlib/injection.h
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* NOTE: This header may usefully be included multiple times.
|
/* NOTE: This header may usefully be included multiple times.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/testsuite.c
|
* @file tlib/testsuite.c
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tlib/testsuite.h>
|
#include <tlib/testsuite.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file tlib/testsuite.h
|
* @file tlib/testsuite.h
|
||||||
*
|
*
|
||||||
* @copyright 2014-2017 Bill Zissimopoulos
|
* @copyright 2014-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TLIB_TESTSUITE_H_INCLUDED
|
#ifndef TLIB_TESTSUITE_H_INCLUDED
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @file fuse/winfsp_fuse.h
|
* @file fuse/winfsp_fuse.h
|
||||||
* WinFsp FUSE compatible API.
|
* WinFsp FUSE compatible API.
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file winfsp/fsctl.h
|
* @file winfsp/fsctl.h
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* In order to use the WinFsp API the user mode file system must include <winfsp/winfsp.h>
|
* In order to use the WinFsp API the user mode file system must include <winfsp/winfsp.h>
|
||||||
* and link with the winfsp_x64.dll (or winfsp_x86.dll) library.
|
* and link with the winfsp_x64.dll (or winfsp_x86.dll) library.
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -1675,6 +1675,19 @@ FSP_API VOID FspServiceStop(FSP_SERVICE *Service);
|
|||||||
* TRUE if the process is running in running user interactive mode.
|
* TRUE if the process is running in running user interactive mode.
|
||||||
*/
|
*/
|
||||||
FSP_API BOOLEAN FspServiceIsInteractive(VOID);
|
FSP_API BOOLEAN FspServiceIsInteractive(VOID);
|
||||||
|
/**
|
||||||
|
* Check if the supplied token is from the service context.
|
||||||
|
*
|
||||||
|
* @param Token
|
||||||
|
* Token to check. Pass NULL to check the current process token.
|
||||||
|
* @param PIsLocalSystem
|
||||||
|
* Pointer to a boolean that will receive a TRUE value if the token belongs to LocalSystem
|
||||||
|
* and FALSE otherwise. May be NULL.
|
||||||
|
* @return
|
||||||
|
* STATUS_SUCCESS if the token is from the service context. STATUS_ACCESS_DENIED if it is not.
|
||||||
|
* Other error codes are possible.
|
||||||
|
*/
|
||||||
|
FSP_API NTSTATUS FspServiceContextCheck(HANDLE Token, PBOOLEAN PIsLocalSystem);
|
||||||
/**
|
/**
|
||||||
* Log a service message.
|
* Log a service message.
|
||||||
*
|
*
|
||||||
@ -1690,6 +1703,133 @@ FSP_API BOOLEAN FspServiceIsInteractive(VOID);
|
|||||||
FSP_API VOID FspServiceLog(ULONG Type, PWSTR Format, ...);
|
FSP_API VOID FspServiceLog(ULONG Type, PWSTR Format, ...);
|
||||||
FSP_API VOID FspServiceLogV(ULONG Type, PWSTR Format, va_list ap);
|
FSP_API VOID FspServiceLogV(ULONG Type, PWSTR Format, va_list ap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group Launch Control
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 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 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 FspLaunchCallLauncherPipe(
|
||||||
|
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
|
||||||
|
PWSTR Buffer, PULONG PSize, 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 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 FspLaunchStart(
|
||||||
|
PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv0,
|
||||||
|
BOOLEAN HasSecret,
|
||||||
|
PULONG PLauncherError);
|
||||||
|
/**
|
||||||
|
* Stop a service instance.
|
||||||
|
*
|
||||||
|
* @param ClassName
|
||||||
|
* Class name of the service instance to stop.
|
||||||
|
* @param InstanceName
|
||||||
|
* Instance name of the service instance to stop.
|
||||||
|
* @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 FspLaunchStop(
|
||||||
|
PWSTR ClassName, PWSTR InstanceName,
|
||||||
|
PULONG PLauncherError);
|
||||||
|
/**
|
||||||
|
* Get information about a service instance.
|
||||||
|
*
|
||||||
|
* The information is a list of NULL-terminated strings: the class name of the service instance,
|
||||||
|
* the instance name of the service instance and the full command line used to start the service
|
||||||
|
* instance.
|
||||||
|
*
|
||||||
|
* @param ClassName
|
||||||
|
* Class name of the service instance to stop.
|
||||||
|
* @param InstanceName
|
||||||
|
* Instance name of the service instance to stop.
|
||||||
|
* @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 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 FspLaunchGetInfo(
|
||||||
|
PWSTR ClassName, PWSTR InstanceName,
|
||||||
|
PWSTR Buffer, PULONG PSize,
|
||||||
|
PULONG PLauncherError);
|
||||||
|
/**
|
||||||
|
* List service instances.
|
||||||
|
*
|
||||||
|
* The information is a list of pairs of NULL-terminated strings. Each pair contains the class
|
||||||
|
* name and instance name of a service instance. All currently running service instances are
|
||||||
|
* listed.
|
||||||
|
*
|
||||||
|
* @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 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 FspLaunchGetNameList(
|
||||||
|
PWSTR Buffer, PULONG PSize,
|
||||||
|
PULONG PLauncherError);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utility
|
* Utility
|
||||||
*/
|
*/
|
||||||
@ -1700,6 +1840,7 @@ FSP_API VOID FspEventLogV(ULONG Type, PWSTR Format, va_list ap);
|
|||||||
FSP_API VOID FspDebugLogSetHandle(HANDLE Handle);
|
FSP_API VOID FspDebugLogSetHandle(HANDLE Handle);
|
||||||
FSP_API VOID FspDebugLog(const char *Format, ...);
|
FSP_API VOID FspDebugLog(const char *Format, ...);
|
||||||
FSP_API VOID FspDebugLogSD(const char *Format, PSECURITY_DESCRIPTOR SecurityDescriptor);
|
FSP_API VOID FspDebugLogSD(const char *Format, PSECURITY_DESCRIPTOR SecurityDescriptor);
|
||||||
|
FSP_API VOID FspDebugLogSid(const char *format, PSID Sid);
|
||||||
FSP_API VOID FspDebugLogFT(const char *Format, PFILETIME FileTime);
|
FSP_API VOID FspDebugLogFT(const char *Format, PFILETIME FileTime);
|
||||||
FSP_API VOID FspDebugLogRequest(FSP_FSCTL_TRANSACT_REQ *Request);
|
FSP_API VOID FspDebugLogRequest(FSP_FSCTL_TRANSACT_REQ *Request);
|
||||||
FSP_API VOID FspDebugLogResponse(FSP_FSCTL_TRANSACT_RSP *Response);
|
FSP_API VOID FspDebugLogResponse(FSP_FSCTL_TRANSACT_RSP *Response);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @file winfsp/winfsp.hpp
|
* @file winfsp/winfsp.hpp
|
||||||
* WinFsp C++ Layer.
|
* WinFsp C++ Layer.
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file cygfuse/cygfuse.c
|
* @file cygfuse/cygfuse.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/debug.c
|
* @file dll/debug.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -63,6 +63,21 @@ FSP_API VOID FspDebugLogSD(const char *format, PSECURITY_DESCRIPTOR SecurityDesc
|
|||||||
FspDebugLog(format, "invalid security descriptor");
|
FspDebugLog(format, "invalid security descriptor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FSP_API VOID FspDebugLogSid(const char *format, PSID Sid)
|
||||||
|
{
|
||||||
|
char *S;
|
||||||
|
|
||||||
|
if (0 == Sid)
|
||||||
|
FspDebugLog(format, "null SID");
|
||||||
|
else if (ConvertSidToStringSidA(Sid, &S))
|
||||||
|
{
|
||||||
|
FspDebugLog(format, S);
|
||||||
|
LocalFree(S);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
FspDebugLog(format, "invalid SID");
|
||||||
|
}
|
||||||
|
|
||||||
FSP_API VOID FspDebugLogFT(const char *format, PFILETIME FileTime)
|
FSP_API VOID FspDebugLogFT(const char *format, PFILETIME FileTime)
|
||||||
{
|
{
|
||||||
SYSTEMTIME SystemTime;
|
SYSTEMTIME SystemTime;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/dirbuf.c
|
* @file dll/dirbuf.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/eventlog.c
|
* @file dll/eventlog.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
74
src/dll/fs.c
74
src/dll/fs.c
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fs.c
|
* @file dll/fs.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -187,17 +187,62 @@ FSP_API VOID FspFileSystemDelete(FSP_FILE_SYSTEM *FileSystem)
|
|||||||
MemFree(FileSystem);
|
MemFree(FileSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS FspFileSystemLauncherDefineDosDevice(
|
||||||
|
WCHAR Sign, PWSTR MountPoint, PWSTR VolumeName)
|
||||||
|
{
|
||||||
|
if (2 != lstrlenW(MountPoint) ||
|
||||||
|
FSP_FSCTL_VOLUME_NAME_SIZEMAX / sizeof(WCHAR) <= lstrlenW(VolumeName))
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
WCHAR Argv0[4];
|
||||||
|
PWSTR Argv[2];
|
||||||
|
NTSTATUS Result;
|
||||||
|
ULONG ErrorCode;
|
||||||
|
|
||||||
|
Argv0[0] = Sign;
|
||||||
|
Argv0[1] = MountPoint[0];
|
||||||
|
Argv0[2] = MountPoint[1];
|
||||||
|
Argv0[3] = L'\0';
|
||||||
|
|
||||||
|
Argv[0] = Argv0;
|
||||||
|
Argv[1] = VolumeName;
|
||||||
|
|
||||||
|
Result = FspLaunchCallLauncherPipe('D', 2, Argv, 0, 0, 0, &ErrorCode);
|
||||||
|
return !NT_SUCCESS(Result) ? Result : FspNtStatusFromWin32(ErrorCode);
|
||||||
|
}
|
||||||
|
|
||||||
static NTSTATUS FspFileSystemSetMountPoint_Drive(PWSTR MountPoint, PWSTR VolumeName,
|
static NTSTATUS FspFileSystemSetMountPoint_Drive(PWSTR MountPoint, PWSTR VolumeName,
|
||||||
PHANDLE PMountHandle)
|
PHANDLE PMountHandle)
|
||||||
{
|
{
|
||||||
|
NTSTATUS Result;
|
||||||
|
BOOLEAN IsLocalSystem, IsServiceContext;
|
||||||
|
|
||||||
*PMountHandle = 0;
|
*PMountHandle = 0;
|
||||||
|
|
||||||
if (!DefineDosDeviceW(DDD_RAW_TARGET_PATH, MountPoint, VolumeName))
|
Result = FspServiceContextCheck(0, &IsLocalSystem);
|
||||||
return FspNtStatusFromWin32(GetLastError());
|
IsServiceContext = NT_SUCCESS(Result) && !IsLocalSystem;
|
||||||
|
if (IsServiceContext)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* If the current process is in the service context but not LocalSystem,
|
||||||
|
* ask the launcher to DefineDosDevice for us. This is because the launcher
|
||||||
|
* runs in the LocalSystem context and can create global drives.
|
||||||
|
*
|
||||||
|
* In this case the launcher will also add DELETE access to the drive symlink
|
||||||
|
* for us, so that we can make it temporary below.
|
||||||
|
*/
|
||||||
|
Result = FspFileSystemLauncherDefineDosDevice(L'+', MountPoint, VolumeName);
|
||||||
|
if (!NT_SUCCESS(Result))
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!DefineDosDeviceW(DDD_RAW_TARGET_PATH, MountPoint, VolumeName))
|
||||||
|
return FspNtStatusFromWin32(GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
if (0 != FspNtOpenSymbolicLinkObject)
|
if (0 != FspNtOpenSymbolicLinkObject)
|
||||||
{
|
{
|
||||||
NTSTATUS Result;
|
|
||||||
WCHAR SymlinkBuf[6];
|
WCHAR SymlinkBuf[6];
|
||||||
UNICODE_STRING Symlink;
|
UNICODE_STRING Symlink;
|
||||||
OBJECT_ATTRIBUTES Obja;
|
OBJECT_ATTRIBUTES Obja;
|
||||||
@ -224,6 +269,13 @@ static NTSTATUS FspFileSystemSetMountPoint_Drive(PWSTR MountPoint, PWSTR VolumeN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* HACK:
|
||||||
|
*
|
||||||
|
* Handles do not use the low 2 bits (unless they are console handles).
|
||||||
|
* Abuse this fact to remember that we are running in the service context.
|
||||||
|
*/
|
||||||
|
*PMountHandle = (HANDLE)(UINT_PTR)((DWORD)(UINT_PTR)*PMountHandle | IsServiceContext);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,8 +463,18 @@ exit:
|
|||||||
|
|
||||||
static VOID FspFileSystemRemoveMountPoint_Drive(PWSTR MountPoint, PWSTR VolumeName, HANDLE MountHandle)
|
static VOID FspFileSystemRemoveMountPoint_Drive(PWSTR MountPoint, PWSTR VolumeName, HANDLE MountHandle)
|
||||||
{
|
{
|
||||||
DefineDosDeviceW(DDD_RAW_TARGET_PATH | DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE,
|
BOOLEAN IsServiceContext = 0 != ((DWORD)(UINT_PTR)MountHandle & 1);
|
||||||
MountPoint, VolumeName);
|
MountHandle = (HANDLE)(UINT_PTR)((DWORD)(UINT_PTR)MountHandle & ~1);
|
||||||
|
if (IsServiceContext)
|
||||||
|
/*
|
||||||
|
* If the current process is in the service context but not LocalSystem,
|
||||||
|
* ask the launcher to DefineDosDevice for us. This is because the launcher
|
||||||
|
* runs in the LocalSystem context and can remove global drives.
|
||||||
|
*/
|
||||||
|
FspFileSystemLauncherDefineDosDevice(L'-', MountPoint, VolumeName);
|
||||||
|
else
|
||||||
|
DefineDosDeviceW(DDD_RAW_TARGET_PATH | DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE,
|
||||||
|
MountPoint, VolumeName);
|
||||||
|
|
||||||
if (0 != MountHandle)
|
if (0 != MountHandle)
|
||||||
FspNtClose(MountHandle);
|
FspNtClose(MountHandle);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fsctl.c
|
* @file dll/fsctl.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -284,7 +284,7 @@ static NTSTATUS FspFsctlFixServiceSecurity(HANDLE SvcHandle)
|
|||||||
* This function adds an ACE that allows Everyone to start a service.
|
* This function adds an ACE that allows Everyone to start a service.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PSID WorldSid = 0;
|
PSID WorldSid;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor = 0;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = 0;
|
||||||
PSECURITY_DESCRIPTOR NewSecurityDescriptor = 0;
|
PSECURITY_DESCRIPTOR NewSecurityDescriptor = 0;
|
||||||
EXPLICIT_ACCESSW AccessEntry;
|
EXPLICIT_ACCESSW AccessEntry;
|
||||||
@ -296,18 +296,12 @@ static NTSTATUS FspFsctlFixServiceSecurity(HANDLE SvcHandle)
|
|||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
|
||||||
/* get the Everyone (World) SID */
|
/* get the Everyone (World) SID */
|
||||||
Size = SECURITY_MAX_SID_SIZE;
|
WorldSid = FspWksidGet(WinWorldSid);
|
||||||
WorldSid = MemAlloc(Size);
|
|
||||||
if (0 == WorldSid)
|
if (0 == WorldSid)
|
||||||
{
|
{
|
||||||
Result = STATUS_INSUFFICIENT_RESOURCES;
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (!CreateWellKnownSid(WinWorldSid, 0, WorldSid, &Size))
|
|
||||||
{
|
|
||||||
Result = FspNtStatusFromWin32(GetLastError());
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the service security descriptor DACL */
|
/* get the service security descriptor DACL */
|
||||||
Size = 0;
|
Size = 0;
|
||||||
@ -394,7 +388,6 @@ static NTSTATUS FspFsctlFixServiceSecurity(HANDLE SvcHandle)
|
|||||||
exit:
|
exit:
|
||||||
LocalFree(NewSecurityDescriptor);
|
LocalFree(NewSecurityDescriptor);
|
||||||
MemFree(SecurityDescriptor);
|
MemFree(SecurityDescriptor);
|
||||||
MemFree(WorldSid);
|
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fsop.c
|
* @file dll/fsop.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fuse/fuse.c
|
* @file dll/fuse/fuse.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fuse/fuse_compat.c
|
* @file dll/fuse/fuse_compat.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fuse/fuse_intf.c
|
* @file dll/fuse/fuse_intf.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -765,9 +765,9 @@ static NTSTATUS fsp_fuse_intf_Create(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
|
|
||||||
memset(&fi, 0, sizeof fi);
|
memset(&fi, 0, sizeof fi);
|
||||||
if ('C' == f->env->environment) /* Cygwin */
|
if ('C' == f->env->environment) /* Cygwin */
|
||||||
fi.flags = 0x0200 | 2 /*O_CREAT|O_RDWR*/;
|
fi.flags = 0x0200 | 0x0800 | 2 /*O_CREAT|O_EXCL|O_RDWR*/;
|
||||||
else
|
else
|
||||||
fi.flags = 0x0100 | 2 /*O_CREAT|O_RDWR*/;
|
fi.flags = 0x0100 | 0x0400 | 2 /*O_CREAT|O_EXCL|O_RDWR*/;
|
||||||
|
|
||||||
if (CreateOptions & FILE_DIRECTORY_FILE)
|
if (CreateOptions & FILE_DIRECTORY_FILE)
|
||||||
{
|
{
|
||||||
@ -821,16 +821,25 @@ static NTSTATUS fsp_fuse_intf_Create(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
|
|
||||||
Opened = TRUE;
|
Opened = TRUE;
|
||||||
|
|
||||||
if (Uid != context->uid || Gid != context->gid)
|
if (0 != FileAttributes &&
|
||||||
if (0 != f->ops.chown)
|
0 != (f->conn_want & FSP_FUSE_CAP_STAT_EX) && 0 != f->ops.chflags)
|
||||||
{
|
{
|
||||||
err = f->ops.chown(contexthdr->PosixPath, Uid, Gid);
|
err = f->ops.chflags(contexthdr->PosixPath,
|
||||||
if (0 != err)
|
fsp_fuse_intf_MapFileAttributesToFlags(CreateOptions & FILE_DIRECTORY_FILE ?
|
||||||
{
|
FileAttributes : FileAttributes | FILE_ATTRIBUTE_ARCHIVE));
|
||||||
Result = fsp_fuse_ntstatus_from_errno(f->env, err);
|
Result = fsp_fuse_ntstatus_from_errno(f->env, err);
|
||||||
goto exit;
|
if (!NT_SUCCESS(Result) && STATUS_INVALID_DEVICE_REQUEST != Result)
|
||||||
}
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((Uid != context->uid || Gid != context->gid) &&
|
||||||
|
0 != f->ops.chown)
|
||||||
|
{
|
||||||
|
err = f->ops.chown(contexthdr->PosixPath, Uid, Gid);
|
||||||
|
Result = fsp_fuse_ntstatus_from_errno(f->env, err);
|
||||||
|
if (!NT_SUCCESS(Result) && STATUS_INVALID_DEVICE_REQUEST != Result)
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ignore fuse_file_info::direct_io, fuse_file_info::keep_cache.
|
* Ignore fuse_file_info::direct_io, fuse_file_info::keep_cache.
|
||||||
@ -1015,6 +1024,22 @@ static NTSTATUS fsp_fuse_intf_Overwrite(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
|
if (0 != FileAttributes &&
|
||||||
|
0 != (f->conn_want & FSP_FUSE_CAP_STAT_EX) && 0 != f->ops.chflags)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The code below is not strictly correct. File attributes should be
|
||||||
|
* replaced when ReplaceFileAttributes is TRUE and merged (or'ed) when
|
||||||
|
* ReplaceFileAttributes is FALSE. I am punting on this detail for now.
|
||||||
|
*/
|
||||||
|
|
||||||
|
err = f->ops.chflags(filedesc->PosixPath,
|
||||||
|
fsp_fuse_intf_MapFileAttributesToFlags(FileAttributes | FILE_ATTRIBUTE_ARCHIVE));
|
||||||
|
Result = fsp_fuse_ntstatus_from_errno(f->env, err);
|
||||||
|
if (!NT_SUCCESS(Result) && STATUS_INVALID_DEVICE_REQUEST != Result)
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
return fsp_fuse_intf_GetFileInfoEx(FileSystem, filedesc->PosixPath, &fi,
|
return fsp_fuse_intf_GetFileInfoEx(FileSystem, filedesc->PosixPath, &fi,
|
||||||
&Uid, &Gid, &Mode, FileInfo);
|
&Uid, &Gid, &Mode, FileInfo);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fuse/fuse_main.c
|
* @file dll/fuse/fuse_main.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fuse/fuse_opt.c
|
* @file dll/fuse/fuse_opt.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/fuse/library.h
|
* @file dll/fuse/library.h
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
152
src/dll/launch.c
Normal file
152
src/dll/launch.c
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/**
|
||||||
|
* @file dll/launch.c
|
||||||
|
*
|
||||||
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* This file is part of WinFsp.
|
||||||
|
*
|
||||||
|
* You can redistribute it and/or modify it under the terms of the GNU
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dll/library.h>
|
||||||
|
#include <launcher/launcher.h>
|
||||||
|
|
||||||
|
FSP_API NTSTATUS FspLaunchCallLauncherPipe(
|
||||||
|
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
|
||||||
|
PWSTR Buffer, PULONG PSize, PULONG PLauncherError)
|
||||||
|
{
|
||||||
|
PWSTR PipeBuf = 0, P;
|
||||||
|
ULONG Length, BytesTransferred;
|
||||||
|
NTSTATUS Result;
|
||||||
|
ULONG ErrorCode;
|
||||||
|
|
||||||
|
if (0 != PSize)
|
||||||
|
*PSize = 0;
|
||||||
|
*PLauncherError = 0;
|
||||||
|
|
||||||
|
PipeBuf = MemAlloc(LAUNCHER_PIPE_BUFFER_SIZE);
|
||||||
|
if (0 == PipeBuf)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
P = PipeBuf;
|
||||||
|
*P++ = Command;
|
||||||
|
for (ULONG I = 0; Argc > I; I++)
|
||||||
|
if (0 != Argv[I])
|
||||||
|
{
|
||||||
|
Length = 0 == Argl || -1 == Argl[I] ? lstrlenW(Argv[I]) : Argl[I];
|
||||||
|
if (LAUNCHER_PIPE_BUFFER_SIZE < ((ULONG)(P - PipeBuf) + Length + 1) * sizeof(WCHAR))
|
||||||
|
{
|
||||||
|
Result = STATUS_INVALID_PARAMETER;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
memcpy(P, Argv[I], Length * sizeof(WCHAR)); P += Length; *P++ = L'\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = FspCallNamedPipeSecurely(L"" LAUNCHER_PIPE_NAME,
|
||||||
|
PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), PipeBuf, LAUNCHER_PIPE_BUFFER_SIZE,
|
||||||
|
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, LAUNCHER_PIPE_OWNER);
|
||||||
|
if (!NT_SUCCESS(Result))
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
Result = STATUS_SUCCESS;
|
||||||
|
ErrorCode = ERROR_BROKEN_PIPE; /* protocol error! */
|
||||||
|
if (sizeof(WCHAR) <= BytesTransferred)
|
||||||
|
{
|
||||||
|
if (LauncherSuccess == PipeBuf[0])
|
||||||
|
{
|
||||||
|
ErrorCode = 0;
|
||||||
|
|
||||||
|
if (0 != PSize)
|
||||||
|
{
|
||||||
|
BytesTransferred -= sizeof(WCHAR);
|
||||||
|
memcpy(Buffer, PipeBuf, *PSize < BytesTransferred ? *PSize : BytesTransferred);
|
||||||
|
*PSize = BytesTransferred;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (LauncherFailure == PipeBuf[0])
|
||||||
|
{
|
||||||
|
ErrorCode = 0;
|
||||||
|
|
||||||
|
for (PWSTR P = PipeBuf + 1, EndP = PipeBuf + BytesTransferred / sizeof(WCHAR); EndP > P; P++)
|
||||||
|
{
|
||||||
|
if (L'0' > *P || *P > L'9')
|
||||||
|
break;
|
||||||
|
ErrorCode = 10 * ErrorCode + (*P - L'0');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == ErrorCode)
|
||||||
|
ErrorCode = ERROR_BROKEN_PIPE; /* protocol error! */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*PLauncherError = ErrorCode;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
MemFree(PipeBuf);
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
FSP_API NTSTATUS FspLaunchStart(
|
||||||
|
PWSTR ClassName, PWSTR InstanceName, ULONG Argc, PWSTR *Argv0,
|
||||||
|
BOOLEAN HasSecret,
|
||||||
|
PULONG PLauncherError)
|
||||||
|
{
|
||||||
|
PWSTR Argv[9 + 2];
|
||||||
|
|
||||||
|
if (9 < Argc)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
Argv[0] = ClassName;
|
||||||
|
Argv[1] = InstanceName;
|
||||||
|
memcpy(Argv + 2, Argv, Argc * sizeof(PWSTR));
|
||||||
|
|
||||||
|
return FspLaunchCallLauncherPipe(
|
||||||
|
HasSecret ? LauncherSvcInstanceStartWithSecret : LauncherSvcInstanceStart,
|
||||||
|
Argc + 2, Argv, 0, 0, 0, PLauncherError);
|
||||||
|
}
|
||||||
|
|
||||||
|
FSP_API NTSTATUS FspLaunchStop(
|
||||||
|
PWSTR ClassName, PWSTR InstanceName,
|
||||||
|
PULONG PLauncherError)
|
||||||
|
{
|
||||||
|
PWSTR Argv[2];
|
||||||
|
|
||||||
|
Argv[0] = ClassName;
|
||||||
|
Argv[1] = InstanceName;
|
||||||
|
|
||||||
|
return FspLaunchCallLauncherPipe(LauncherSvcInstanceStop,
|
||||||
|
2, Argv, 0, 0, 0, PLauncherError);
|
||||||
|
}
|
||||||
|
|
||||||
|
FSP_API NTSTATUS FspLaunchGetInfo(
|
||||||
|
PWSTR ClassName, PWSTR InstanceName,
|
||||||
|
PWSTR Buffer, PULONG PSize,
|
||||||
|
PULONG PLauncherError)
|
||||||
|
{
|
||||||
|
PWSTR Argv[2];
|
||||||
|
|
||||||
|
Argv[0] = ClassName;
|
||||||
|
Argv[1] = InstanceName;
|
||||||
|
|
||||||
|
return FspLaunchCallLauncherPipe(LauncherSvcInstanceInfo,
|
||||||
|
2, Argv, 0, Buffer, PSize, PLauncherError);
|
||||||
|
}
|
||||||
|
|
||||||
|
FSP_API NTSTATUS FspLaunchGetNameList(
|
||||||
|
PWSTR Buffer, PULONG PSize,
|
||||||
|
PULONG PLauncherError)
|
||||||
|
{
|
||||||
|
return FspLaunchCallLauncherPipe(LauncherSvcInstanceList,
|
||||||
|
0, 0, 0, Buffer, PSize, PLauncherError);
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/library.c
|
* @file dll/library.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -44,6 +44,7 @@ BOOL WINAPI DllMain(HINSTANCE Instance, DWORD Reason, PVOID Reserved)
|
|||||||
FspServiceFinalize(Dynamic);
|
FspServiceFinalize(Dynamic);
|
||||||
FspEventLogFinalize(Dynamic);
|
FspEventLogFinalize(Dynamic);
|
||||||
FspPosixFinalize(Dynamic);
|
FspPosixFinalize(Dynamic);
|
||||||
|
FspWksidFinalize(Dynamic);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/library.h
|
* @file dll/library.h
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -31,11 +31,15 @@
|
|||||||
FspDebugLog("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", __VA_ARGS__)
|
FspDebugLog("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", __VA_ARGS__)
|
||||||
#define DEBUGLOGSD(fmt, SD) \
|
#define DEBUGLOGSD(fmt, SD) \
|
||||||
FspDebugLogSD("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", SD)
|
FspDebugLogSD("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", SD)
|
||||||
|
#define DEBUGLOGSID(fmt, Sid) \
|
||||||
|
FspDebugLogSid("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", Sid)
|
||||||
#else
|
#else
|
||||||
#define DEBUGLOG(fmt, ...) ((void)0)
|
#define DEBUGLOG(fmt, ...) ((void)0)
|
||||||
#define DEBUGLOGSD(fmt, SD) ((void)0)
|
#define DEBUGLOGSD(fmt, SD) ((void)0)
|
||||||
|
#define DEBUGLOGSID(fmt, Sid) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
VOID FspWksidFinalize(BOOLEAN Dynamic);
|
||||||
VOID FspPosixFinalize(BOOLEAN Dynamic);
|
VOID FspPosixFinalize(BOOLEAN Dynamic);
|
||||||
VOID FspEventLogFinalize(BOOLEAN Dynamic);
|
VOID FspEventLogFinalize(BOOLEAN Dynamic);
|
||||||
VOID FspServiceFinalize(BOOLEAN Dynamic);
|
VOID FspServiceFinalize(BOOLEAN Dynamic);
|
||||||
@ -49,6 +53,9 @@ NTSTATUS FspNpUnregister(VOID);
|
|||||||
NTSTATUS FspEventLogRegister(VOID);
|
NTSTATUS FspEventLogRegister(VOID);
|
||||||
NTSTATUS FspEventLogUnregister(VOID);
|
NTSTATUS FspEventLogUnregister(VOID);
|
||||||
|
|
||||||
|
PSID FspWksidNew(WELL_KNOWN_SID_TYPE WellKnownSidType, PNTSTATUS PResult);
|
||||||
|
PSID FspWksidGet(WELL_KNOWN_SID_TYPE WellKnownSidType);
|
||||||
|
|
||||||
PWSTR FspDiagIdent(VOID);
|
PWSTR FspDiagIdent(VOID);
|
||||||
|
|
||||||
VOID FspFileSystemPeekInDirectoryBuffer(PVOID *PDirBuffer,
|
VOID FspFileSystemPeekInDirectoryBuffer(PVOID *PDirBuffer,
|
||||||
|
144
src/dll/np.c
144
src/dll/np.c
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/np.c
|
* @file dll/np.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include <dll/library.h>
|
#include <dll/library.h>
|
||||||
#include <launcher/launcher.h>
|
#include <launcher/launcher.h>
|
||||||
#include <lmcons.h>
|
|
||||||
#include <npapi.h>
|
#include <npapi.h>
|
||||||
#include <wincred.h>
|
#include <wincred.h>
|
||||||
|
|
||||||
@ -36,6 +35,12 @@
|
|||||||
*/
|
*/
|
||||||
#define FSP_NP_CREDENTIAL_MANAGER
|
#define FSP_NP_CREDENTIAL_MANAGER
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define the following macro to register ourselves as the first network provider.
|
||||||
|
* Otherwise we will be registered as the last network provider.
|
||||||
|
*/
|
||||||
|
#define FSP_NP_ORDER_FIRST
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
FSP_NP_CREDENTIALS_NONE = 0,
|
FSP_NP_CREDENTIALS_NONE = 0,
|
||||||
@ -169,45 +174,17 @@ static inline BOOLEAN FspNpParseRemoteUserName(PWSTR RemoteName,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline BOOLEAN FspNpGetLocalUserName(
|
static inline DWORD FspNpCallLauncherPipe(
|
||||||
PWSTR UserName, ULONG UserNameSize/* in chars */)
|
WCHAR Command, ULONG Argc, PWSTR *Argv, ULONG *Argl,
|
||||||
|
PWSTR Buffer, PULONG PSize)
|
||||||
{
|
{
|
||||||
return GetUserName(UserName, &UserNameSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline DWORD FspNpCallLauncherPipe(PWSTR PipeBuf, ULONG SendSize, ULONG RecvSize)
|
|
||||||
{
|
|
||||||
DWORD NpResult;
|
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
DWORD BytesTransferred;
|
ULONG ErrorCode;
|
||||||
|
|
||||||
Result = FspCallNamedPipeSecurely(L"" LAUNCHER_PIPE_NAME, PipeBuf, SendSize, PipeBuf, RecvSize,
|
Result = FspLaunchCallLauncherPipe(Command, Argc, Argv, Argl, Buffer, PSize, &ErrorCode);
|
||||||
&BytesTransferred, NMPWAIT_USE_DEFAULT_WAIT, LAUNCHER_PIPE_OWNER);
|
return !NT_SUCCESS(Result) ?
|
||||||
|
WN_NO_NETWORK :
|
||||||
if (!NT_SUCCESS(Result))
|
(ERROR_BROKEN_PIPE == ErrorCode ? WN_NO_NETWORK : ErrorCode);
|
||||||
NpResult = WN_NO_NETWORK;
|
|
||||||
else if (sizeof(WCHAR) > BytesTransferred)
|
|
||||||
NpResult = WN_NO_NETWORK;
|
|
||||||
else if (LauncherSuccess == PipeBuf[0])
|
|
||||||
NpResult = WN_SUCCESS;
|
|
||||||
else if (LauncherFailure == PipeBuf[0])
|
|
||||||
{
|
|
||||||
NpResult = 0;
|
|
||||||
for (PWSTR P = PipeBuf + 1, EndP = PipeBuf + BytesTransferred / sizeof(WCHAR); EndP > P; P++)
|
|
||||||
{
|
|
||||||
if (L'0' > *P || *P > L'9')
|
|
||||||
break;
|
|
||||||
|
|
||||||
NpResult = 10 * NpResult + (*P - L'0');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 == NpResult)
|
|
||||||
NpResult = WN_NO_NETWORK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
NpResult = WN_NO_NETWORK;
|
|
||||||
|
|
||||||
return NpResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS FspNpGetVolumeList(
|
static NTSTATUS FspNpGetVolumeList(
|
||||||
@ -496,9 +473,10 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
|
|||||||
WCHAR LocalNameBuf[3];
|
WCHAR LocalNameBuf[3];
|
||||||
PWSTR ClassName, InstanceName, RemoteName, P;
|
PWSTR ClassName, InstanceName, RemoteName, P;
|
||||||
ULONG ClassNameLen, InstanceNameLen;
|
ULONG ClassNameLen, InstanceNameLen;
|
||||||
WCHAR LocalUserName[UNLEN + 1];
|
|
||||||
DWORD CredentialsKind;
|
DWORD CredentialsKind;
|
||||||
PWSTR PipeBuf = 0;
|
ULONG Argc;
|
||||||
|
PWSTR Argv[6];
|
||||||
|
ULONG Argl[6];
|
||||||
#if defined(FSP_NP_CREDENTIAL_MANAGER)
|
#if defined(FSP_NP_CREDENTIAL_MANAGER)
|
||||||
PCREDENTIALW Credential = 0;
|
PCREDENTIALW Credential = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -525,9 +503,6 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
|
|||||||
return WN_ALREADY_CONNECTED;
|
return WN_ALREADY_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FspNpGetLocalUserName(LocalUserName, sizeof LocalUserName / sizeof LocalUserName[0]))
|
|
||||||
LocalUserName[0] = L'\0';
|
|
||||||
|
|
||||||
FspNpGetCredentialsKind(lpRemoteName, &CredentialsKind);
|
FspNpGetCredentialsKind(lpRemoteName, &CredentialsKind);
|
||||||
|
|
||||||
#if defined(FSP_NP_CREDENTIAL_MANAGER)
|
#if defined(FSP_NP_CREDENTIAL_MANAGER)
|
||||||
@ -567,33 +542,24 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PipeBuf = MemAlloc(LAUNCHER_PIPE_BUFFER_SIZE);
|
Argc = 0;
|
||||||
if (0 == PipeBuf)
|
Argv[Argc] = ClassName; Argl[Argc] = ClassNameLen; Argc++;
|
||||||
{
|
Argv[Argc] = InstanceName; Argl[Argc] = InstanceNameLen; Argc++;
|
||||||
NpResult = WN_OUT_OF_MEMORY;
|
Argv[Argc] = RemoteName; Argl[Argc] = -1; Argc++;
|
||||||
goto exit;
|
Argv[Argc] = LocalNameBuf; Argl[Argc] = -1; Argc++;
|
||||||
}
|
|
||||||
|
|
||||||
/* we do not explicitly check, but assumption is it all fits in LAUNCHER_PIPE_BUFFER_SIZE */
|
|
||||||
P = PipeBuf;
|
|
||||||
*P++ = FSP_NP_CREDENTIALS_NONE != CredentialsKind ?
|
|
||||||
LauncherSvcInstanceStartWithSecret : LauncherSvcInstanceStart;
|
|
||||||
memcpy(P, ClassName, ClassNameLen * sizeof(WCHAR)); P += ClassNameLen; *P++ = L'\0';
|
|
||||||
memcpy(P, InstanceName, InstanceNameLen * sizeof(WCHAR)); P += InstanceNameLen; *P++ = L'\0';
|
|
||||||
lstrcpyW(P, RemoteName); P += lstrlenW(RemoteName) + 1;
|
|
||||||
lstrcpyW(P, LocalNameBuf); P += lstrlenW(LocalNameBuf) + 1;
|
|
||||||
lstrcpyW(P, LocalUserName); P += lstrlenW(LocalUserName) + 1;
|
|
||||||
if (FSP_NP_CREDENTIALS_USERPASS == CredentialsKind)
|
if (FSP_NP_CREDENTIALS_USERPASS == CredentialsKind)
|
||||||
{
|
{
|
||||||
lstrcpyW(P, lpUserName); P += lstrlenW(lpUserName) + 1;
|
Argv[Argc] = lpUserName; Argl[Argc] = -1; Argc++;
|
||||||
}
|
}
|
||||||
if (FSP_NP_CREDENTIALS_NONE != CredentialsKind)
|
if (FSP_NP_CREDENTIALS_NONE != CredentialsKind)
|
||||||
{
|
{
|
||||||
lstrcpyW(P, lpPassword); P += lstrlenW(lpPassword) + 1;
|
Argv[Argc] = lpPassword; Argl[Argc] = -1; Argc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
NpResult = FspNpCallLauncherPipe(
|
NpResult = FspNpCallLauncherPipe(
|
||||||
PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), LAUNCHER_PIPE_BUFFER_SIZE);
|
FSP_NP_CREDENTIALS_NONE != CredentialsKind ?
|
||||||
|
LauncherSvcInstanceStartWithSecret : LauncherSvcInstanceStart,
|
||||||
|
Argc, Argv, Argl, 0, 0);
|
||||||
switch (NpResult)
|
switch (NpResult)
|
||||||
{
|
{
|
||||||
case WN_SUCCESS:
|
case WN_SUCCESS:
|
||||||
@ -639,13 +605,13 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
P = PipeBuf;
|
Argc = 0;
|
||||||
*P++ = LauncherSvcInstanceInfo;
|
Argv[Argc] = ClassName; Argl[Argc] = ClassNameLen; Argc++;
|
||||||
memcpy(P, ClassName, ClassNameLen * sizeof(WCHAR)); P += ClassNameLen; *P++ = L'\0';
|
Argv[Argc] = InstanceName; Argl[Argc] = InstanceNameLen; Argc++;
|
||||||
memcpy(P, InstanceName, InstanceNameLen * sizeof(WCHAR)); P += InstanceNameLen; *P++ = L'\0';
|
|
||||||
|
|
||||||
if (WN_SUCCESS != FspNpCallLauncherPipe(
|
if (WN_SUCCESS != FspNpCallLauncherPipe(
|
||||||
PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), LAUNCHER_PIPE_BUFFER_SIZE))
|
LauncherSvcInstanceInfo,
|
||||||
|
Argc, Argv, Argl, 0, 0))
|
||||||
{
|
{
|
||||||
/* looks like the file system is gone! */
|
/* looks like the file system is gone! */
|
||||||
NpResult = WN_NO_NETWORK;
|
NpResult = WN_NO_NETWORK;
|
||||||
@ -689,8 +655,6 @@ DWORD APIENTRY NPAddConnection(LPNETRESOURCEW lpNetResource, LPWSTR lpPassword,
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
MemFree(PipeBuf);
|
|
||||||
|
|
||||||
#if defined(FSP_NP_CREDENTIAL_MANAGER)
|
#if defined(FSP_NP_CREDENTIAL_MANAGER)
|
||||||
if (0 != Credential)
|
if (0 != Credential)
|
||||||
CredFree(Credential);
|
CredFree(Credential);
|
||||||
@ -779,9 +743,11 @@ DWORD APIENTRY NPCancelConnection(LPWSTR lpName, BOOL fForce)
|
|||||||
DWORD NpResult;
|
DWORD NpResult;
|
||||||
WCHAR RemoteNameBuf[sizeof(((FSP_FSCTL_VOLUME_PARAMS *)0)->Prefix) / sizeof(WCHAR)];
|
WCHAR RemoteNameBuf[sizeof(((FSP_FSCTL_VOLUME_PARAMS *)0)->Prefix) / sizeof(WCHAR)];
|
||||||
DWORD RemoteNameSize;
|
DWORD RemoteNameSize;
|
||||||
PWSTR ClassName, InstanceName, RemoteName, P;
|
PWSTR ClassName, InstanceName, RemoteName;
|
||||||
ULONG ClassNameLen, InstanceNameLen;
|
ULONG ClassNameLen, InstanceNameLen;
|
||||||
PWSTR PipeBuf = 0;
|
ULONG Argc;
|
||||||
|
PWSTR Argv[2];
|
||||||
|
ULONG Argl[2];
|
||||||
|
|
||||||
if (FspNpCheckLocalName(lpName))
|
if (FspNpCheckLocalName(lpName))
|
||||||
{
|
{
|
||||||
@ -801,17 +767,13 @@ DWORD APIENTRY NPCancelConnection(LPWSTR lpName, BOOL fForce)
|
|||||||
&ClassName, &ClassNameLen, &InstanceName, &InstanceNameLen))
|
&ClassName, &ClassNameLen, &InstanceName, &InstanceNameLen))
|
||||||
return WN_BAD_NETNAME;
|
return WN_BAD_NETNAME;
|
||||||
|
|
||||||
PipeBuf = MemAlloc(LAUNCHER_PIPE_BUFFER_SIZE);
|
Argc = 0;
|
||||||
if (0 == PipeBuf)
|
Argv[Argc] = ClassName; Argl[Argc] = ClassNameLen; Argc++;
|
||||||
return WN_OUT_OF_MEMORY;
|
Argv[Argc] = InstanceName; Argl[Argc] = InstanceNameLen; Argc++;
|
||||||
|
|
||||||
P = PipeBuf;
|
|
||||||
*P++ = LauncherSvcInstanceStop;
|
|
||||||
memcpy(P, ClassName, ClassNameLen * sizeof(WCHAR)); P += ClassNameLen; *P++ = L'\0';
|
|
||||||
memcpy(P, InstanceName, InstanceNameLen * sizeof(WCHAR)); P += InstanceNameLen; *P++ = L'\0';
|
|
||||||
|
|
||||||
NpResult = FspNpCallLauncherPipe(
|
NpResult = FspNpCallLauncherPipe(
|
||||||
PipeBuf, (ULONG)(P - PipeBuf) * sizeof(WCHAR), LAUNCHER_PIPE_BUFFER_SIZE);
|
LauncherSvcInstanceStop,
|
||||||
|
Argc, Argv, Argl, 0, 0);
|
||||||
switch (NpResult)
|
switch (NpResult)
|
||||||
{
|
{
|
||||||
case WN_SUCCESS:
|
case WN_SUCCESS:
|
||||||
@ -824,8 +786,6 @@ DWORD APIENTRY NPCancelConnection(LPWSTR lpName, BOOL fForce)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemFree(PipeBuf);
|
|
||||||
|
|
||||||
return NpResult;
|
return NpResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1028,7 +988,7 @@ NTSTATUS FspNpRegister(VOID)
|
|||||||
WCHAR ProviderPath[MAX_PATH];
|
WCHAR ProviderPath[MAX_PATH];
|
||||||
WCHAR RegBuffer[1024];
|
WCHAR RegBuffer[1024];
|
||||||
PWSTR P, Part;
|
PWSTR P, Part;
|
||||||
DWORD RegResult, RegType, RegBufferSize;
|
DWORD RegResult, RegType, RegBufferSize, RegBufferOffset;
|
||||||
HKEY RegKey;
|
HKEY RegKey;
|
||||||
BOOLEAN FoundProvider;
|
BOOLEAN FoundProvider;
|
||||||
|
|
||||||
@ -1094,15 +1054,20 @@ NTSTATUS FspNpRegister(VOID)
|
|||||||
return FspNtStatusFromWin32(RegResult);
|
return FspNtStatusFromWin32(RegResult);
|
||||||
|
|
||||||
RegBufferSize = sizeof RegBuffer - sizeof L"," FSP_NP_NAME;
|
RegBufferSize = sizeof RegBuffer - sizeof L"," FSP_NP_NAME;
|
||||||
|
#ifdef FSP_NP_ORDER_FIRST
|
||||||
|
RegBufferOffset = sizeof "" FSP_NP_NAME;
|
||||||
|
#else
|
||||||
|
RegBufferOffset = 0;
|
||||||
|
#endif
|
||||||
RegResult = RegQueryValueExW(RegKey,
|
RegResult = RegQueryValueExW(RegKey,
|
||||||
L"ProviderOrder", 0, &RegType, (PVOID)RegBuffer, &RegBufferSize);
|
L"ProviderOrder", 0, &RegType, (PVOID)&RegBuffer[RegBufferOffset], &RegBufferSize);
|
||||||
if (ERROR_SUCCESS != RegResult)
|
if (ERROR_SUCCESS != RegResult)
|
||||||
goto close_and_exit;
|
goto close_and_exit;
|
||||||
RegBufferSize /= sizeof(WCHAR);
|
RegBufferSize /= sizeof(WCHAR);
|
||||||
|
|
||||||
FoundProvider = FALSE;
|
FoundProvider = FALSE;
|
||||||
RegBuffer[RegBufferSize] = L'\0';
|
RegBuffer[RegBufferSize + RegBufferOffset] = L'\0';
|
||||||
P = RegBuffer, Part = P;
|
P = &RegBuffer[RegBufferOffset], Part = P;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (L',' == *P || '\0' == *P)
|
if (L',' == *P || '\0' == *P)
|
||||||
@ -1119,8 +1084,11 @@ NTSTATUS FspNpRegister(VOID)
|
|||||||
|
|
||||||
if (!FoundProvider)
|
if (!FoundProvider)
|
||||||
{
|
{
|
||||||
P--;
|
#ifdef FSP_NP_ORDER_FIRST
|
||||||
memcpy(P, L"," FSP_NP_NAME, sizeof L"," FSP_NP_NAME);
|
memcpy((PWSTR)RegBuffer, L"" FSP_NP_NAME ",", sizeof L"" FSP_NP_NAME);
|
||||||
|
#else
|
||||||
|
memcpy(--P, L"," FSP_NP_NAME, sizeof L"," FSP_NP_NAME);
|
||||||
|
#endif
|
||||||
|
|
||||||
RegBufferSize = lstrlenW(RegBuffer);
|
RegBufferSize = lstrlenW(RegBuffer);
|
||||||
RegBufferSize++;
|
RegBufferSize++;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/ntstatus.c
|
* @file dll/ntstatus.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/path.c
|
* @file dll/path.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* [SNAME]
|
* [SNAME]
|
||||||
* https://www.cygwin.com/cygwin-ug-net/using-specialnames.html
|
* https://www.cygwin.com/cygwin-ug-net/using-specialnames.html
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -453,9 +453,12 @@ FSP_API NTSTATUS FspPosixMapPermissionsToSecurityDescriptor(
|
|||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
Result = FspPosixMapUidToSid(0x10100, &WorldSid);
|
WorldSid = FspWksidGet(WinWorldSid);
|
||||||
if (!NT_SUCCESS(Result))
|
if (0 == WorldSid)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
OwnerPerm = (Mode & 0700) >> 6;
|
OwnerPerm = (Mode & 0700) >> 6;
|
||||||
GroupPerm = (Mode & 0070) >> 3;
|
GroupPerm = (Mode & 0070) >> 3;
|
||||||
@ -579,9 +582,6 @@ exit:
|
|||||||
|
|
||||||
MemFree(Acl);
|
MemFree(Acl);
|
||||||
|
|
||||||
if (0 != WorldSid)
|
|
||||||
FspDeleteSid(WorldSid, FspPosixMapUidToSid);
|
|
||||||
|
|
||||||
if (0 != GroupSid)
|
if (0 != GroupSid)
|
||||||
FspDeleteSid(GroupSid, FspPosixMapUidToSid);
|
FspDeleteSid(GroupSid, FspPosixMapUidToSid);
|
||||||
|
|
||||||
@ -649,13 +649,19 @@ FSP_API NTSTATUS FspPosixMapSecurityDescriptorToPermissions(
|
|||||||
|
|
||||||
if (0 != Acl)
|
if (0 != Acl)
|
||||||
{
|
{
|
||||||
Result = FspPosixMapUidToSid(0x10100, &WorldSid);
|
WorldSid = FspWksidGet(WinWorldSid);
|
||||||
if (!NT_SUCCESS(Result))
|
if (0 == WorldSid)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
Result = FspPosixMapUidToSid(11, &AuthUsersSid);
|
AuthUsersSid = FspWksidGet(WinAuthenticatedUserSid);
|
||||||
if (!NT_SUCCESS(Result))
|
if (0 == AuthUsersSid)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
OwnerAllow = OwnerDeny = GroupAllow = GroupDeny = WorldAllow = WorldDeny = 0;
|
OwnerAllow = OwnerDeny = GroupAllow = GroupDeny = WorldAllow = WorldDeny = 0;
|
||||||
|
|
||||||
@ -771,12 +777,6 @@ FSP_API NTSTATUS FspPosixMapSecurityDescriptorToPermissions(
|
|||||||
Result = STATUS_SUCCESS;
|
Result = STATUS_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (0 != AuthUsersSid)
|
|
||||||
FspDeleteSid(AuthUsersSid, FspPosixMapUidToSid);
|
|
||||||
|
|
||||||
if (0 != WorldSid)
|
|
||||||
FspDeleteSid(WorldSid, FspPosixMapUidToSid);
|
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
lasterror:
|
lasterror:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/security.c
|
* @file dll/security.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/service.c
|
* @file dll/service.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -566,6 +566,106 @@ FSP_API BOOLEAN FspServiceIsInteractive(VOID)
|
|||||||
return IsInteractive;
|
return IsInteractive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FSP_API NTSTATUS FspServiceContextCheck(HANDLE Token, PBOOLEAN PIsLocalSystem)
|
||||||
|
{
|
||||||
|
NTSTATUS Result;
|
||||||
|
PSID LocalSystemSid, ServiceSid;
|
||||||
|
BOOLEAN IsLocalSystem = FALSE;
|
||||||
|
BOOL HasServiceSid = FALSE;
|
||||||
|
HANDLE ProcessToken = 0, ImpersonationToken = 0;
|
||||||
|
DWORD SessionId, Size;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
TOKEN_USER V;
|
||||||
|
UINT8 B[128];
|
||||||
|
} UserInfoBuf;
|
||||||
|
PTOKEN_USER UserInfo = &UserInfoBuf.V;
|
||||||
|
|
||||||
|
LocalSystemSid = FspWksidGet(WinLocalSystemSid);
|
||||||
|
ServiceSid = FspWksidGet(WinServiceSid);
|
||||||
|
if (0 == LocalSystemSid || 0 == ServiceSid)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == Token)
|
||||||
|
{
|
||||||
|
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_DUPLICATE, &ProcessToken) ||
|
||||||
|
!DuplicateToken(ProcessToken, SecurityImpersonation, &ImpersonationToken))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Token = ImpersonationToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenSessionId, &SessionId, sizeof SessionId, &Size))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != SessionId)
|
||||||
|
{
|
||||||
|
Result = STATUS_ACCESS_DENIED;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenUser, UserInfo, sizeof UserInfoBuf, &Size))
|
||||||
|
{
|
||||||
|
if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInfo = MemAlloc(Size);
|
||||||
|
if (0 == UserInfo)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenUser, UserInfo, Size, &Size))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IsLocalSystem = EqualSid(LocalSystemSid, UserInfo->User.Sid);
|
||||||
|
if (IsLocalSystem)
|
||||||
|
{
|
||||||
|
Result = STATUS_SUCCESS;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CheckTokenMembership(Token, ServiceSid, &HasServiceSid))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = HasServiceSid ? STATUS_SUCCESS : STATUS_ACCESS_DENIED;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
if (0 != PIsLocalSystem)
|
||||||
|
*PIsLocalSystem = NT_SUCCESS(Result) ? IsLocalSystem : FALSE;
|
||||||
|
|
||||||
|
if (UserInfo != &UserInfoBuf.V)
|
||||||
|
MemFree(UserInfo);
|
||||||
|
|
||||||
|
if (0 != ImpersonationToken)
|
||||||
|
CloseHandle(ImpersonationToken);
|
||||||
|
|
||||||
|
if (0 != ProcessToken)
|
||||||
|
CloseHandle(ProcessToken);
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
FSP_API VOID FspServiceLog(ULONG Type, PWSTR Format, ...)
|
FSP_API VOID FspServiceLog(ULONG Type, PWSTR Format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file dll/util.c
|
* @file dll/util.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -97,24 +97,14 @@ FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
|
|||||||
{
|
{
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor = 0;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = 0;
|
||||||
PSID OwnerSid, WellKnownSid = 0;
|
PSID OwnerSid, WellKnownSid = 0;
|
||||||
DWORD SidSize, LastError;
|
DWORD LastError;
|
||||||
|
|
||||||
/* if it is a small number treat it like a well known SID */
|
/* if it is a small number treat it like a well known SID */
|
||||||
if (1024 > (INT_PTR)Sid)
|
if (1024 > (INT_PTR)Sid)
|
||||||
{
|
{
|
||||||
SidSize = SECURITY_MAX_SID_SIZE;
|
WellKnownSid = FspWksidNew((INT_PTR)Sid, &Result);
|
||||||
WellKnownSid = MemAlloc(SidSize);
|
|
||||||
if (0 == WellKnownSid)
|
if (0 == WellKnownSid)
|
||||||
{
|
|
||||||
Result = STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
goto sid_exit;
|
goto sid_exit;
|
||||||
}
|
|
||||||
|
|
||||||
if (!CreateWellKnownSid((INT_PTR)Sid, 0, WellKnownSid, &SidSize))
|
|
||||||
{
|
|
||||||
Result = FspNtStatusFromWin32(GetLastError());
|
|
||||||
goto sid_exit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LastError = GetSecurityInfo(Pipe, SE_FILE_OBJECT,
|
LastError = GetSecurityInfo(Pipe, SE_FILE_OBJECT,
|
||||||
|
108
src/dll/wksid.c
Normal file
108
src/dll/wksid.c
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/**
|
||||||
|
* @file dll/wksid.c
|
||||||
|
*
|
||||||
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* This file is part of WinFsp.
|
||||||
|
*
|
||||||
|
* You can redistribute it and/or modify it under the terms of the GNU
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dll/library.h>
|
||||||
|
|
||||||
|
static INIT_ONCE FspWksidInitOnce = INIT_ONCE_STATIC_INIT;
|
||||||
|
static PSID FspWksidWorld;
|
||||||
|
static PSID FspWksidAuthenticatedUser;
|
||||||
|
static PSID FspWksidLocalSystem;
|
||||||
|
static PSID FspWksidService;
|
||||||
|
|
||||||
|
static BOOL WINAPI FspWksidInitialize(
|
||||||
|
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
||||||
|
{
|
||||||
|
FspWksidWorld = FspWksidNew(WinWorldSid, 0);
|
||||||
|
FspWksidAuthenticatedUser = FspWksidNew(WinAuthenticatedUserSid, 0);
|
||||||
|
FspWksidLocalSystem = FspWksidNew(WinLocalSystemSid, 0);
|
||||||
|
FspWksidService = FspWksidNew(WinServiceSid, 0);
|
||||||
|
|
||||||
|
//DEBUGLOGSID("FspWksidWorld=%s", FspWksidWorld);
|
||||||
|
//DEBUGLOGSID("FspWksidAuthenticatedUser=%s", FspWksidAuthenticatedUser);
|
||||||
|
//DEBUGLOGSID("FspWksidLocalSystem=%s", FspWksidLocalSystem);
|
||||||
|
//DEBUGLOGSID("FspWksidService=%s", FspWksidService);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID FspWksidFinalize(BOOLEAN Dynamic)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* This function is called during DLL_PROCESS_DETACH. We must therefore keep
|
||||||
|
* finalization tasks to a minimum.
|
||||||
|
*
|
||||||
|
* We must deregister our event source (if any). We only do so if the library
|
||||||
|
* is being explicitly unloaded (rather than the process exiting).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (Dynamic)
|
||||||
|
{
|
||||||
|
MemFree(FspWksidWorld); FspWksidWorld = 0;
|
||||||
|
MemFree(FspWksidAuthenticatedUser); FspWksidAuthenticatedUser = 0;
|
||||||
|
MemFree(FspWksidLocalSystem); FspWksidLocalSystem = 0;
|
||||||
|
MemFree(FspWksidService); FspWksidService = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PSID FspWksidNew(WELL_KNOWN_SID_TYPE WellKnownSidType, PNTSTATUS PResult)
|
||||||
|
{
|
||||||
|
NTSTATUS Result;
|
||||||
|
PSID Sid;
|
||||||
|
DWORD Size;
|
||||||
|
|
||||||
|
Size = SECURITY_MAX_SID_SIZE;
|
||||||
|
Sid = MemAlloc(Size);
|
||||||
|
if (0 == Sid)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CreateWellKnownSid(WellKnownSidType, 0, Sid, &Size))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
MemFree(Sid); Sid = 0;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
if (0 != PResult)
|
||||||
|
*PResult = Result;
|
||||||
|
|
||||||
|
return Sid;
|
||||||
|
}
|
||||||
|
|
||||||
|
PSID FspWksidGet(WELL_KNOWN_SID_TYPE WellKnownSidType)
|
||||||
|
{
|
||||||
|
InitOnceExecuteOnce(&FspWksidInitOnce, FspWksidInitialize, 0, 0);
|
||||||
|
|
||||||
|
switch (WellKnownSidType)
|
||||||
|
{
|
||||||
|
case WinWorldSid:
|
||||||
|
return FspWksidWorld;
|
||||||
|
case WinAuthenticatedUserSid:
|
||||||
|
return FspWksidAuthenticatedUser;
|
||||||
|
case WinLocalSystemSid:
|
||||||
|
return FspWksidLocalSystem;
|
||||||
|
case WinServiceSid:
|
||||||
|
return FspWksidService;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dotnet/FileSystemBase+Const.cs
|
* dotnet/FileSystemBase+Const.cs
|
||||||
*
|
*
|
||||||
* Copyright 2015-2017 Bill Zissimopoulos
|
* Copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dotnet/FileSystemBase.cs
|
* dotnet/FileSystemBase.cs
|
||||||
*
|
*
|
||||||
* Copyright 2015-2017 Bill Zissimopoulos
|
* Copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dotnet/FileSystemHost.cs
|
* dotnet/FileSystemHost.cs
|
||||||
*
|
*
|
||||||
* Copyright 2015-2017 Bill Zissimopoulos
|
* Copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dotnet/Interop.cs
|
* dotnet/Interop.cs
|
||||||
*
|
*
|
||||||
* Copyright 2015-2017 Bill Zissimopoulos
|
* Copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dotnet/Service.cs
|
* dotnet/Service.cs
|
||||||
*
|
*
|
||||||
* Copyright 2015-2017 Bill Zissimopoulos
|
* Copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file fsptool/fsptool.c
|
* @file fsptool/fsptool.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file launcher/launchctl.c
|
* @file launcher/launchctl.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file launcher/launcher.c
|
* @file launcher/launcher.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -16,17 +16,30 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <launcher/launcher.h>
|
#include <launcher/launcher.h>
|
||||||
|
#include <aclapi.h>
|
||||||
#include <sddl.h>
|
#include <sddl.h>
|
||||||
|
#include <userenv.h>
|
||||||
|
|
||||||
#define PROGNAME "WinFsp.Launcher"
|
#define PROGNAME "WinFsp.Launcher"
|
||||||
|
|
||||||
BOOL CreateOverlappedPipe(
|
static NTSTATUS (NTAPI *SvcNtOpenSymbolicLinkObject)(
|
||||||
PHANDLE PReadPipe, PHANDLE PWritePipe, PSECURITY_ATTRIBUTES SecurityAttributes, DWORD Size,
|
PHANDLE LinkHandle,
|
||||||
|
ACCESS_MASK DesiredAccess,
|
||||||
|
POBJECT_ATTRIBUTES ObjectAttributes);
|
||||||
|
static NTSTATUS (NTAPI *SvcNtClose)(
|
||||||
|
HANDLE Handle);
|
||||||
|
|
||||||
|
static BOOL CreateOverlappedPipe(
|
||||||
|
PHANDLE PReadPipe, PHANDLE PWritePipe,
|
||||||
|
DWORD Size,
|
||||||
|
BOOL ReadInherit, BOOL WriteInherit,
|
||||||
DWORD ReadMode, DWORD WriteMode)
|
DWORD ReadMode, DWORD WriteMode)
|
||||||
{
|
{
|
||||||
RPC_STATUS RpcStatus;
|
RPC_STATUS RpcStatus;
|
||||||
UUID Uuid;
|
UUID Uuid;
|
||||||
WCHAR PipeNameBuf[MAX_PATH];
|
WCHAR PipeNameBuf[MAX_PATH];
|
||||||
|
SECURITY_ATTRIBUTES ReadSecurityAttributes = { sizeof(SECURITY_ATTRIBUTES), 0, ReadInherit };
|
||||||
|
SECURITY_ATTRIBUTES WriteSecurityAttributes = { sizeof(SECURITY_ATTRIBUTES), 0, WriteInherit };
|
||||||
HANDLE ReadPipe, WritePipe;
|
HANDLE ReadPipe, WritePipe;
|
||||||
DWORD LastError;
|
DWORD LastError;
|
||||||
|
|
||||||
@ -46,13 +59,13 @@ BOOL CreateOverlappedPipe(
|
|||||||
ReadPipe = CreateNamedPipeW(PipeNameBuf,
|
ReadPipe = CreateNamedPipeW(PipeNameBuf,
|
||||||
PIPE_ACCESS_INBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE | ReadMode,
|
PIPE_ACCESS_INBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE | ReadMode,
|
||||||
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS,
|
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS,
|
||||||
1, Size, Size, 120 * 1000, SecurityAttributes);
|
1, Size, Size, 120 * 1000, &ReadSecurityAttributes);
|
||||||
if (INVALID_HANDLE_VALUE == ReadPipe)
|
if (INVALID_HANDLE_VALUE == ReadPipe)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
WritePipe = CreateFileW(PipeNameBuf,
|
WritePipe = CreateFileW(PipeNameBuf,
|
||||||
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
SecurityAttributes, OPEN_EXISTING, WriteMode, 0);
|
&WriteSecurityAttributes, OPEN_EXISTING, WriteMode, 0);
|
||||||
if (INVALID_HANDLE_VALUE == WritePipe)
|
if (INVALID_HANDLE_VALUE == WritePipe)
|
||||||
{
|
{
|
||||||
LastError = GetLastError();
|
LastError = GetLastError();
|
||||||
@ -67,6 +80,279 @@ BOOL CreateOverlappedPipe(
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS GetTokenUserName(HANDLE Token, PWSTR *PUserName)
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
TOKEN_USER V;
|
||||||
|
UINT8 B[128];
|
||||||
|
} UserInfoBuf;
|
||||||
|
PTOKEN_USER UserInfo = &UserInfoBuf.V;
|
||||||
|
WCHAR Name[256], Domn[256];
|
||||||
|
DWORD UserSize, NameSize, DomnSize;
|
||||||
|
SID_NAME_USE Use;
|
||||||
|
PWSTR P;
|
||||||
|
NTSTATUS Result;
|
||||||
|
|
||||||
|
*PUserName = 0;
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenUser, UserInfo, sizeof UserInfoBuf, &UserSize))
|
||||||
|
{
|
||||||
|
if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInfo = MemAlloc(UserSize);
|
||||||
|
if (0 == UserInfo)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenUser, UserInfo, UserSize, &UserSize))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NameSize = sizeof Name / sizeof Name[0];
|
||||||
|
DomnSize = sizeof Domn / sizeof Domn[0];
|
||||||
|
if (!LookupAccountSidW(0, UserInfo->User.Sid, Name, &NameSize, Domn, &DomnSize, &Use))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
NameSize = lstrlenW(Name);
|
||||||
|
DomnSize = lstrlenW(Domn);
|
||||||
|
|
||||||
|
P = *PUserName = MemAlloc((DomnSize + 1 + NameSize + 1) * sizeof(WCHAR));
|
||||||
|
if (0 == P)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 < DomnSize)
|
||||||
|
{
|
||||||
|
memcpy(P, Domn, DomnSize * sizeof(WCHAR));
|
||||||
|
P[DomnSize] = L'\\';
|
||||||
|
P += DomnSize + 1;
|
||||||
|
}
|
||||||
|
memcpy(P, Name, NameSize * sizeof(WCHAR));
|
||||||
|
P[NameSize] = L'\0';
|
||||||
|
|
||||||
|
Result = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
if (UserInfo != &UserInfoBuf.V)
|
||||||
|
MemFree(UserInfo);
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NTSTATUS AddAccessForTokenUser(HANDLE Handle, DWORD Access, HANDLE Token)
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
TOKEN_USER V;
|
||||||
|
UINT8 B[128];
|
||||||
|
} UserInfoBuf;
|
||||||
|
PTOKEN_USER UserInfo = &UserInfoBuf.V;
|
||||||
|
PSECURITY_DESCRIPTOR SecurityDescriptor = 0;
|
||||||
|
PSECURITY_DESCRIPTOR NewSecurityDescriptor = 0;
|
||||||
|
EXPLICIT_ACCESSW AccessEntry;
|
||||||
|
DWORD Size, LastError;
|
||||||
|
NTSTATUS Result;
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenUser, UserInfo, sizeof UserInfoBuf, &Size))
|
||||||
|
{
|
||||||
|
if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInfo = MemAlloc(Size);
|
||||||
|
if (0 == UserInfo)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenUser, UserInfo, Size, &Size))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetKernelObjectSecurity(Handle, DACL_SECURITY_INFORMATION, 0, 0, &Size))
|
||||||
|
{
|
||||||
|
Result = STATUS_INVALID_PARAMETER;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
SecurityDescriptor = MemAlloc(Size);
|
||||||
|
if (0 == SecurityDescriptor)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetKernelObjectSecurity(Handle, DACL_SECURITY_INFORMATION, SecurityDescriptor, Size, &Size))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccessEntry.grfAccessPermissions = Access;
|
||||||
|
AccessEntry.grfAccessMode = GRANT_ACCESS;
|
||||||
|
AccessEntry.grfInheritance = NO_INHERITANCE;
|
||||||
|
AccessEntry.Trustee.pMultipleTrustee = 0;
|
||||||
|
AccessEntry.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
||||||
|
AccessEntry.Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
||||||
|
AccessEntry.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
|
||||||
|
AccessEntry.Trustee.ptstrName = UserInfo->User.Sid;
|
||||||
|
|
||||||
|
LastError = BuildSecurityDescriptorW(0, 0, 1, &AccessEntry, 0, 0, SecurityDescriptor,
|
||||||
|
&Size, &NewSecurityDescriptor);
|
||||||
|
if (0 != LastError)
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(LastError);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SetKernelObjectSecurity(Handle, DACL_SECURITY_INFORMATION, NewSecurityDescriptor))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
LocalFree(NewSecurityDescriptor);
|
||||||
|
MemFree(SecurityDescriptor);
|
||||||
|
if (UserInfo != &UserInfoBuf.V)
|
||||||
|
MemFree(UserInfo);
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL LogonCreateProcess(
|
||||||
|
PWSTR UserName,
|
||||||
|
LPCWSTR ApplicationName,
|
||||||
|
LPWSTR CommandLine,
|
||||||
|
LPSECURITY_ATTRIBUTES ProcessAttributes,
|
||||||
|
LPSECURITY_ATTRIBUTES ThreadAttributes,
|
||||||
|
BOOL InheritHandles,
|
||||||
|
DWORD CreationFlags,
|
||||||
|
LPVOID Environment,
|
||||||
|
LPCWSTR CurrentDirectory,
|
||||||
|
LPSTARTUPINFOW StartupInfo,
|
||||||
|
LPPROCESS_INFORMATION ProcessInformation)
|
||||||
|
{
|
||||||
|
PWSTR DomainName = 0;
|
||||||
|
|
||||||
|
if (0 != UserName)
|
||||||
|
{
|
||||||
|
if (0 == invariant_wcsicmp(UserName, L"LocalSystem"))
|
||||||
|
UserName = 0;
|
||||||
|
else
|
||||||
|
if (0 == invariant_wcsicmp(UserName, L"LocalService") ||
|
||||||
|
0 == invariant_wcsicmp(UserName, L"NetworkService"))
|
||||||
|
DomainName = L"NT AUTHORITY";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_ACCESS_DENIED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == UserName)
|
||||||
|
/* without a user name go ahead and call CreateProcessW */
|
||||||
|
return CreateProcessW(
|
||||||
|
ApplicationName,
|
||||||
|
CommandLine,
|
||||||
|
ProcessAttributes,
|
||||||
|
ThreadAttributes,
|
||||||
|
InheritHandles,
|
||||||
|
CreationFlags,
|
||||||
|
Environment,
|
||||||
|
CurrentDirectory,
|
||||||
|
StartupInfo,
|
||||||
|
ProcessInformation);
|
||||||
|
|
||||||
|
HANDLE LogonToken = 0;
|
||||||
|
PVOID EnvironmentBlock = 0;
|
||||||
|
DWORD LastError;
|
||||||
|
BOOL Success;
|
||||||
|
|
||||||
|
Success = LogonUserW(
|
||||||
|
UserName,
|
||||||
|
DomainName,
|
||||||
|
0,
|
||||||
|
LOGON32_LOGON_SERVICE,
|
||||||
|
LOGON32_PROVIDER_DEFAULT,
|
||||||
|
&LogonToken);
|
||||||
|
if (!Success)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
if (0 == Environment)
|
||||||
|
{
|
||||||
|
Success = CreateEnvironmentBlock(&EnvironmentBlock, LogonToken, FALSE);
|
||||||
|
if (!Success)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
CreationFlags |= CREATE_UNICODE_ENVIRONMENT;
|
||||||
|
Environment = EnvironmentBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
Success = ImpersonateLoggedOnUser(LogonToken);
|
||||||
|
if (!Success)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
Success = CreateProcessAsUserW(
|
||||||
|
LogonToken,
|
||||||
|
ApplicationName,
|
||||||
|
CommandLine,
|
||||||
|
ProcessAttributes,
|
||||||
|
ThreadAttributes,
|
||||||
|
InheritHandles,
|
||||||
|
CreationFlags,
|
||||||
|
Environment,
|
||||||
|
CurrentDirectory,
|
||||||
|
StartupInfo,
|
||||||
|
ProcessInformation);
|
||||||
|
|
||||||
|
if (!RevertToSelf())
|
||||||
|
/* should not happen! */
|
||||||
|
ExitProcess(GetLastError());
|
||||||
|
|
||||||
|
exit:
|
||||||
|
if (!Success)
|
||||||
|
LastError = GetLastError();
|
||||||
|
|
||||||
|
if (0 != EnvironmentBlock)
|
||||||
|
DestroyEnvironmentBlock(EnvironmentBlock);
|
||||||
|
if (0 != LogonToken)
|
||||||
|
CloseHandle(LogonToken);
|
||||||
|
|
||||||
|
if (!Success)
|
||||||
|
SetLastError(LastError);
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
HANDLE Process;
|
HANDLE Process;
|
||||||
@ -75,7 +361,7 @@ typedef struct
|
|||||||
|
|
||||||
static VOID CALLBACK KillProcessWait(PVOID Context, BOOLEAN Timeout);
|
static VOID CALLBACK KillProcessWait(PVOID Context, BOOLEAN Timeout);
|
||||||
|
|
||||||
VOID KillProcess(ULONG ProcessId, HANDLE Process, ULONG Timeout)
|
static VOID KillProcess(ULONG ProcessId, HANDLE Process, ULONG Timeout)
|
||||||
{
|
{
|
||||||
if (GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, ProcessId))
|
if (GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, ProcessId))
|
||||||
{
|
{
|
||||||
@ -142,6 +428,17 @@ typedef struct
|
|||||||
static CRITICAL_SECTION SvcInstanceLock;
|
static CRITICAL_SECTION SvcInstanceLock;
|
||||||
static HANDLE SvcInstanceEvent;
|
static HANDLE SvcInstanceEvent;
|
||||||
static LIST_ENTRY SvcInstanceList = { &SvcInstanceList, &SvcInstanceList };
|
static LIST_ENTRY SvcInstanceList = { &SvcInstanceList, &SvcInstanceList };
|
||||||
|
static DWORD SvcInstanceTlsKey = TLS_OUT_OF_INDEXES;
|
||||||
|
|
||||||
|
static inline PWSTR SvcInstanceUserName(VOID)
|
||||||
|
{
|
||||||
|
return TlsGetValue(SvcInstanceTlsKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline VOID SvcInstanceSetUserName(PWSTR UserName)
|
||||||
|
{
|
||||||
|
TlsSetValue(SvcInstanceTlsKey, UserName);
|
||||||
|
}
|
||||||
|
|
||||||
static VOID CALLBACK SvcInstanceTerminated(PVOID Context, BOOLEAN Timeout);
|
static VOID CALLBACK SvcInstanceTerminated(PVOID Context, BOOLEAN Timeout);
|
||||||
|
|
||||||
@ -210,6 +507,14 @@ static NTSTATUS SvcInstanceReplaceArguments(PWSTR String, ULONG Argc, PWSTR *Arg
|
|||||||
else
|
else
|
||||||
Length += SvcInstanceArgumentLength(EmptyArg);
|
Length += SvcInstanceArgumentLength(EmptyArg);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (L'U' == *P)
|
||||||
|
{
|
||||||
|
if (0 != SvcInstanceUserName())
|
||||||
|
Length += SvcInstanceArgumentLength(SvcInstanceUserName());
|
||||||
|
else
|
||||||
|
Length += SvcInstanceArgumentLength(EmptyArg);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Length++;
|
Length++;
|
||||||
break;
|
break;
|
||||||
@ -236,6 +541,14 @@ static NTSTATUS SvcInstanceReplaceArguments(PWSTR String, ULONG Argc, PWSTR *Arg
|
|||||||
else
|
else
|
||||||
Q = SvcInstanceArgumentCopy(Q, EmptyArg);
|
Q = SvcInstanceArgumentCopy(Q, EmptyArg);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (L'U' == *P)
|
||||||
|
{
|
||||||
|
if (0 != SvcInstanceUserName())
|
||||||
|
Q = SvcInstanceArgumentCopy(Q, SvcInstanceUserName());
|
||||||
|
else
|
||||||
|
Q = SvcInstanceArgumentCopy(Q, EmptyArg);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
*Q++ = *P;
|
*Q++ = *P;
|
||||||
break;
|
break;
|
||||||
@ -251,6 +564,67 @@ static NTSTATUS SvcInstanceReplaceArguments(PWSTR String, ULONG Argc, PWSTR *Arg
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS SvcInstanceAddUserRights(HANDLE Token,
|
||||||
|
PSECURITY_DESCRIPTOR SecurityDescriptor, PSECURITY_DESCRIPTOR *PNewSecurityDescriptor)
|
||||||
|
{
|
||||||
|
PSECURITY_DESCRIPTOR NewSecurityDescriptor;
|
||||||
|
TOKEN_USER *User = 0;
|
||||||
|
EXPLICIT_ACCESSW AccessEntry;
|
||||||
|
DWORD Size, LastError;
|
||||||
|
NTSTATUS Result;
|
||||||
|
|
||||||
|
*PNewSecurityDescriptor = 0;
|
||||||
|
|
||||||
|
if (GetTokenInformation(Token, TokenUser, 0, 0, &Size))
|
||||||
|
{
|
||||||
|
Result = STATUS_INVALID_PARAMETER;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
User = MemAlloc(Size);
|
||||||
|
if (0 == User)
|
||||||
|
{
|
||||||
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetTokenInformation(Token, TokenUser, User, Size, &Size))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccessEntry.grfAccessPermissions = SERVICE_QUERY_STATUS | SERVICE_STOP;
|
||||||
|
AccessEntry.grfAccessMode = GRANT_ACCESS;
|
||||||
|
AccessEntry.grfInheritance = NO_INHERITANCE;
|
||||||
|
AccessEntry.Trustee.pMultipleTrustee = 0;
|
||||||
|
AccessEntry.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
|
||||||
|
AccessEntry.Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
||||||
|
AccessEntry.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
|
||||||
|
AccessEntry.Trustee.ptstrName = User->User.Sid;
|
||||||
|
|
||||||
|
LastError = BuildSecurityDescriptorW(0, 0, 1, &AccessEntry, 0, 0, SecurityDescriptor,
|
||||||
|
&Size, &NewSecurityDescriptor);
|
||||||
|
if (0 != LastError)
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(LastError);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
*PNewSecurityDescriptor = NewSecurityDescriptor;
|
||||||
|
Result = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
MemFree(User);
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
static NTSTATUS SvcInstanceAccessCheck(HANDLE ClientToken, ULONG DesiredAccess,
|
static NTSTATUS SvcInstanceAccessCheck(HANDLE ClientToken, ULONG DesiredAccess,
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||||
{
|
{
|
||||||
@ -279,18 +653,35 @@ static NTSTATUS SvcInstanceAccessCheck(HANDLE ClientToken, ULONG DesiredAccess,
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS SvcInstanceCreateProcess(PWSTR Executable, PWSTR CommandLine,
|
static NTSTATUS SvcInstanceCreateProcess(PWSTR UserName,
|
||||||
|
PWSTR Executable, PWSTR CommandLine, PWSTR WorkDirectory,
|
||||||
HANDLE StdioHandles[2],
|
HANDLE StdioHandles[2],
|
||||||
PPROCESS_INFORMATION ProcessInfo)
|
PPROCESS_INFORMATION ProcessInfo)
|
||||||
{
|
{
|
||||||
|
WCHAR WorkDirectoryBuf[MAX_PATH];
|
||||||
STARTUPINFOEXW StartupInfoEx;
|
STARTUPINFOEXW StartupInfoEx;
|
||||||
HANDLE ChildHandles[3] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0/* DO NOT CLOSE!*/ };
|
HANDLE ChildHandles[3] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0/* DO NOT CLOSE!*/ };
|
||||||
HANDLE ParentHandles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
|
HANDLE ParentHandles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
|
||||||
SECURITY_ATTRIBUTES PipeAttributes = { sizeof(SECURITY_ATTRIBUTES), 0, TRUE };
|
|
||||||
PPROC_THREAD_ATTRIBUTE_LIST AttrList = 0;
|
PPROC_THREAD_ATTRIBUTE_LIST AttrList = 0;
|
||||||
SIZE_T Size;
|
SIZE_T Size;
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
|
||||||
|
if (0 != WorkDirectory && L'.' == WorkDirectory[0] && L'\0' == WorkDirectory[1])
|
||||||
|
{
|
||||||
|
PWSTR Backslash = 0, P;
|
||||||
|
|
||||||
|
if (0 == GetModuleFileNameW(0, WorkDirectoryBuf, MAX_PATH))
|
||||||
|
return FspNtStatusFromWin32(GetLastError());
|
||||||
|
|
||||||
|
for (P = WorkDirectoryBuf; *P; P++)
|
||||||
|
if (L'\\' == *P)
|
||||||
|
Backslash = P;
|
||||||
|
if (0 != Backslash && WorkDirectoryBuf < Backslash && L':' != Backslash[-1])
|
||||||
|
*Backslash = L'\0';
|
||||||
|
|
||||||
|
WorkDirectory = WorkDirectoryBuf;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&StartupInfoEx, 0, sizeof StartupInfoEx);
|
memset(&StartupInfoEx, 0, sizeof StartupInfoEx);
|
||||||
StartupInfoEx.StartupInfo.cb = sizeof StartupInfoEx.StartupInfo;
|
StartupInfoEx.StartupInfo.cb = sizeof StartupInfoEx.StartupInfo;
|
||||||
|
|
||||||
@ -304,16 +695,16 @@ NTSTATUS SvcInstanceCreateProcess(PWSTR Executable, PWSTR CommandLine,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* create stdin read/write ends; make them inheritable */
|
/* create stdin read/write ends; make them inheritable */
|
||||||
if (!CreateOverlappedPipe(&ChildHandles[0], &ParentHandles[0], &PipeAttributes, 0,
|
if (!CreateOverlappedPipe(&ChildHandles[0], &ParentHandles[0],
|
||||||
0, 0))
|
0, TRUE, FALSE, 0, 0))
|
||||||
{
|
{
|
||||||
Result = FspNtStatusFromWin32(GetLastError());
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create stdout read/write ends; make them inheritable */
|
/* create stdout read/write ends; make them inheritable */
|
||||||
if (!CreateOverlappedPipe(&ParentHandles[1], &ChildHandles[1], &PipeAttributes, 0,
|
if (!CreateOverlappedPipe(&ParentHandles[1], &ChildHandles[1],
|
||||||
FILE_FLAG_OVERLAPPED, 0))
|
0, FALSE, TRUE, FILE_FLAG_OVERLAPPED, 0))
|
||||||
{
|
{
|
||||||
Result = FspNtStatusFromWin32(GetLastError());
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -357,18 +748,44 @@ NTSTATUS SvcInstanceCreateProcess(PWSTR Executable, PWSTR CommandLine,
|
|||||||
StartupInfoEx.StartupInfo.hStdOutput = ChildHandles[1];
|
StartupInfoEx.StartupInfo.hStdOutput = ChildHandles[1];
|
||||||
StartupInfoEx.StartupInfo.hStdError = ChildHandles[2];
|
StartupInfoEx.StartupInfo.hStdError = ChildHandles[2];
|
||||||
|
|
||||||
if (!CreateProcessW(Executable, CommandLine, 0, 0, TRUE,
|
if (!LogonCreateProcess(UserName,
|
||||||
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP | EXTENDED_STARTUPINFO_PRESENT, 0, 0,
|
Executable, CommandLine, 0, 0, TRUE,
|
||||||
|
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP | EXTENDED_STARTUPINFO_PRESENT,
|
||||||
|
0, WorkDirectory,
|
||||||
&StartupInfoEx.StartupInfo, ProcessInfo))
|
&StartupInfoEx.StartupInfo, ProcessInfo))
|
||||||
{
|
{
|
||||||
Result = FspNtStatusFromWin32(GetLastError());
|
if (ERROR_NO_SYSTEM_RESOURCES != GetLastError())
|
||||||
goto exit;
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On Win7 CreateProcessW with EXTENDED_STARTUPINFO_PRESENT
|
||||||
|
* may fail with ERROR_NO_SYSTEM_RESOURCES.
|
||||||
|
*
|
||||||
|
* In that case go ahead and retry with a CreateProcessW with
|
||||||
|
* bInheritHandles==TRUE, but without EXTENDED_STARTUPINFO_PRESENT.
|
||||||
|
* Not ideal, but...
|
||||||
|
*/
|
||||||
|
StartupInfoEx.StartupInfo.cb = sizeof StartupInfoEx.StartupInfo;
|
||||||
|
if (!LogonCreateProcess(UserName,
|
||||||
|
Executable, CommandLine, 0, 0, TRUE,
|
||||||
|
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP,
|
||||||
|
0, WorkDirectory,
|
||||||
|
&StartupInfoEx.StartupInfo, ProcessInfo))
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!CreateProcessW(Executable, CommandLine, 0, 0, FALSE,
|
if (!LogonCreateProcess(UserName,
|
||||||
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP, 0, 0,
|
Executable, CommandLine, 0, 0, FALSE,
|
||||||
|
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP,
|
||||||
|
0, WorkDirectory,
|
||||||
&StartupInfoEx.StartupInfo, ProcessInfo))
|
&StartupInfoEx.StartupInfo, ProcessInfo))
|
||||||
{
|
{
|
||||||
Result = FspNtStatusFromWin32(GetLastError());
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
@ -411,10 +828,11 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
|||||||
HKEY RegKey = 0;
|
HKEY RegKey = 0;
|
||||||
DWORD RegResult, RegSize;
|
DWORD RegResult, RegSize;
|
||||||
DWORD ClassNameSize, InstanceNameSize;
|
DWORD ClassNameSize, InstanceNameSize;
|
||||||
WCHAR Executable[MAX_PATH], CommandLineBuf[512], SecurityBuf[512];
|
WCHAR Executable[MAX_PATH], CommandLineBuf[512], WorkDirectory[MAX_PATH],
|
||||||
|
SecurityBuf[512], RunAsBuf[64];
|
||||||
PWSTR CommandLine, Security;
|
PWSTR CommandLine, Security;
|
||||||
DWORD JobControl, Credentials;
|
DWORD JobControl, Credentials;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor = 0;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = 0, NewSecurityDescriptor;
|
||||||
PWSTR Argv[10];
|
PWSTR Argv[10];
|
||||||
PROCESS_INFORMATION ProcessInfo;
|
PROCESS_INFORMATION ProcessInfo;
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
@ -488,6 +906,16 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
|||||||
CommandLine[-1] = L'\0';
|
CommandLine[-1] = L'\0';
|
||||||
CommandLine = CommandLineBuf;
|
CommandLine = CommandLineBuf;
|
||||||
|
|
||||||
|
RegSize = sizeof WorkDirectory;
|
||||||
|
WorkDirectory[0] = L'\0';
|
||||||
|
RegResult = RegGetValueW(RegKey, ClassName, L"WorkDirectory", RRF_RT_REG_SZ, 0,
|
||||||
|
WorkDirectory, &RegSize);
|
||||||
|
if (ERROR_SUCCESS != RegResult && ERROR_FILE_NOT_FOUND != RegResult)
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(RegResult);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
Security = SecurityBuf + lstrlenW(SecurityBuf);
|
Security = SecurityBuf + lstrlenW(SecurityBuf);
|
||||||
RegSize = (DWORD)(sizeof SecurityBuf - (Security - SecurityBuf) * sizeof(WCHAR));
|
RegSize = (DWORD)(sizeof SecurityBuf - (Security - SecurityBuf) * sizeof(WCHAR));
|
||||||
RegResult = RegGetValueW(RegKey, ClassName, L"Security", RRF_RT_REG_SZ, 0,
|
RegResult = RegGetValueW(RegKey, ClassName, L"Security", RRF_RT_REG_SZ, 0,
|
||||||
@ -498,6 +926,16 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegSize = sizeof RunAsBuf;
|
||||||
|
RunAsBuf[0] = L'\0';
|
||||||
|
RegResult = RegGetValueW(RegKey, ClassName, L"RunAs", RRF_RT_REG_SZ, 0,
|
||||||
|
RunAsBuf, &RegSize);
|
||||||
|
if (ERROR_SUCCESS != RegResult && ERROR_FILE_NOT_FOUND != RegResult)
|
||||||
|
{
|
||||||
|
Result = FspNtStatusFromWin32(RegResult);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
RegSize = sizeof JobControl;
|
RegSize = sizeof JobControl;
|
||||||
JobControl = 1; /* default is YES! */
|
JobControl = 1; /* default is YES! */
|
||||||
RegResult = RegGetValueW(RegKey, ClassName, L"JobControl", RRF_RT_REG_DWORD, 0,
|
RegResult = RegGetValueW(RegKey, ClassName, L"JobControl", RRF_RT_REG_DWORD, 0,
|
||||||
@ -529,6 +967,14 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
|||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
Result = SvcInstanceAddUserRights(ClientToken, SecurityDescriptor, &NewSecurityDescriptor);
|
||||||
|
if (!NT_SUCCESS(Result))
|
||||||
|
goto exit;
|
||||||
|
LocalFree(SecurityDescriptor);
|
||||||
|
SecurityDescriptor = NewSecurityDescriptor;
|
||||||
|
|
||||||
|
//FspDebugLogSD(__FUNCTION__ ": SDDL = %s\n", SecurityDescriptor);
|
||||||
|
|
||||||
ClassNameSize = (lstrlenW(ClassName) + 1) * sizeof(WCHAR);
|
ClassNameSize = (lstrlenW(ClassName) + 1) * sizeof(WCHAR);
|
||||||
InstanceNameSize = (lstrlenW(InstanceName) + 1) * sizeof(WCHAR);
|
InstanceNameSize = (lstrlenW(InstanceName) + 1) * sizeof(WCHAR);
|
||||||
|
|
||||||
@ -553,7 +999,8 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
|||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
Result = SvcInstanceCreateProcess(Executable, SvcInstance->CommandLine,
|
Result = SvcInstanceCreateProcess(L'\0' != RunAsBuf[0] ? RunAsBuf : 0,
|
||||||
|
Executable, SvcInstance->CommandLine, L'\0' != WorkDirectory[0] ? WorkDirectory : 0,
|
||||||
RedirectStdio ? SvcInstance->StdioHandles : 0, &ProcessInfo);
|
RedirectStdio ? SvcInstance->StdioHandles : 0, &ProcessInfo);
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -624,6 +1071,9 @@ exit:
|
|||||||
|
|
||||||
LeaveCriticalSection(&SvcInstanceLock);
|
LeaveCriticalSection(&SvcInstanceLock);
|
||||||
|
|
||||||
|
FspServiceLog(EVENTLOG_INFORMATION_TYPE,
|
||||||
|
L"create %s\\%s = %lx", ClassName, InstanceName, Result);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,6 +1107,9 @@ static VOID CALLBACK SvcInstanceTerminated(PVOID Context, BOOLEAN Timeout)
|
|||||||
{
|
{
|
||||||
SVC_INSTANCE *SvcInstance = Context;
|
SVC_INSTANCE *SvcInstance = Context;
|
||||||
|
|
||||||
|
FspServiceLog(EVENTLOG_INFORMATION_TYPE,
|
||||||
|
L"terminated %s\\%s", SvcInstance->ClassName, SvcInstance->InstanceName);
|
||||||
|
|
||||||
SvcInstanceRelease(SvcInstance);
|
SvcInstanceRelease(SvcInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,6 +1205,10 @@ exit:
|
|||||||
|
|
||||||
SvcInstanceRelease(SvcInstance);
|
SvcInstanceRelease(SvcInstance);
|
||||||
|
|
||||||
|
if (STATUS_TIMEOUT == Result)
|
||||||
|
/* convert to an error! */
|
||||||
|
Result = 0x80070000 | ERROR_TIMEOUT;
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -885,6 +1342,53 @@ NTSTATUS SvcInstanceStopAndWaitAll(VOID)
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS SvcDefineDosDevice(HANDLE ClientToken,
|
||||||
|
PWSTR DeviceName, PWSTR TargetPath)
|
||||||
|
{
|
||||||
|
NTSTATUS Result;
|
||||||
|
|
||||||
|
if (L'+' != DeviceName[0] && L'-' != DeviceName[0])
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
Result = FspServiceContextCheck(ClientToken, 0);
|
||||||
|
if (!NT_SUCCESS(Result))
|
||||||
|
return Result;
|
||||||
|
|
||||||
|
if (!DefineDosDeviceW(
|
||||||
|
DDD_RAW_TARGET_PATH |
|
||||||
|
(L'+' == DeviceName[0] ? 0 : DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE),
|
||||||
|
DeviceName + 1, TargetPath))
|
||||||
|
return FspNtStatusFromWin32(GetLastError());
|
||||||
|
|
||||||
|
if (L'+' == DeviceName[0] && 0 != SvcNtOpenSymbolicLinkObject)
|
||||||
|
{
|
||||||
|
/* The drive symlink now exists; add DELETE access to it for the ClientToken. */
|
||||||
|
WCHAR SymlinkBuf[6];
|
||||||
|
UNICODE_STRING Symlink;
|
||||||
|
OBJECT_ATTRIBUTES Obja;
|
||||||
|
HANDLE MountHandle;
|
||||||
|
|
||||||
|
memcpy(SymlinkBuf, L"\\??\\X:", sizeof SymlinkBuf);
|
||||||
|
SymlinkBuf[4] = DeviceName[1];
|
||||||
|
Symlink.Length = Symlink.MaximumLength = sizeof SymlinkBuf;
|
||||||
|
Symlink.Buffer = SymlinkBuf;
|
||||||
|
|
||||||
|
memset(&Obja, 0, sizeof Obja);
|
||||||
|
Obja.Length = sizeof Obja;
|
||||||
|
Obja.ObjectName = &Symlink;
|
||||||
|
Obja.Attributes = OBJ_CASE_INSENSITIVE;
|
||||||
|
|
||||||
|
Result = SvcNtOpenSymbolicLinkObject(&MountHandle, READ_CONTROL | WRITE_DAC, &Obja);
|
||||||
|
if (NT_SUCCESS(Result))
|
||||||
|
{
|
||||||
|
AddAccessForTokenUser(MountHandle, DELETE, ClientToken);
|
||||||
|
SvcNtClose(MountHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static HANDLE SvcJob, SvcThread, SvcEvent;
|
static HANDLE SvcJob, SvcThread, SvcEvent;
|
||||||
static DWORD SvcThreadId;
|
static DWORD SvcThreadId;
|
||||||
static HANDLE SvcPipe = INVALID_HANDLE_VALUE;
|
static HANDLE SvcPipe = INVALID_HANDLE_VALUE;
|
||||||
@ -918,6 +1422,10 @@ static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
if (0 == SvcInstanceEvent)
|
if (0 == SvcInstanceEvent)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
SvcInstanceTlsKey = TlsAlloc();
|
||||||
|
if (TLS_OUT_OF_INDEXES == SvcInstanceTlsKey)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
SvcJob = CreateJobObjectW(0, 0);
|
SvcJob = CreateJobObjectW(0, 0);
|
||||||
if (0 != SvcJob)
|
if (0 != SvcJob)
|
||||||
{
|
{
|
||||||
@ -980,6 +1488,9 @@ fail:
|
|||||||
if (0 != SvcJob)
|
if (0 != SvcJob)
|
||||||
CloseHandle(SvcJob);
|
CloseHandle(SvcJob);
|
||||||
|
|
||||||
|
if (TLS_OUT_OF_INDEXES != SvcInstanceTlsKey)
|
||||||
|
TlsFree(SvcInstanceTlsKey);
|
||||||
|
|
||||||
if (0 != SvcInstanceEvent)
|
if (0 != SvcInstanceEvent)
|
||||||
CloseHandle(SvcInstanceEvent);
|
CloseHandle(SvcInstanceEvent);
|
||||||
|
|
||||||
@ -1023,6 +1534,9 @@ static NTSTATUS SvcStop(FSP_SERVICE *Service)
|
|||||||
if (0 != SvcJob)
|
if (0 != SvcJob)
|
||||||
CloseHandle(SvcJob);
|
CloseHandle(SvcJob);
|
||||||
|
|
||||||
|
if (TLS_OUT_OF_INDEXES != SvcInstanceTlsKey)
|
||||||
|
TlsFree(SvcInstanceTlsKey);
|
||||||
|
|
||||||
if (0 != SvcInstanceEvent)
|
if (0 != SvcInstanceEvent)
|
||||||
CloseHandle(SvcInstanceEvent);
|
CloseHandle(SvcInstanceEvent);
|
||||||
|
|
||||||
@ -1194,13 +1708,17 @@ static VOID SvcPipeTransact(HANDLE ClientToken, PWSTR PipeBuf, PULONG PSize)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PWSTR P = PipeBuf, PipeBufEnd = PipeBuf + *PSize / sizeof(WCHAR);
|
PWSTR P = PipeBuf, PipeBufEnd = PipeBuf + *PSize / sizeof(WCHAR);
|
||||||
PWSTR ClassName, InstanceName;
|
PWSTR ClassName, InstanceName, UserName;
|
||||||
|
PWSTR DeviceName, TargetPath;
|
||||||
ULONG Argc; PWSTR Argv[9];
|
ULONG Argc; PWSTR Argv[9];
|
||||||
BOOLEAN HasSecret = FALSE;
|
BOOLEAN HasSecret = FALSE;
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
|
||||||
*PSize = 0;
|
*PSize = 0;
|
||||||
|
|
||||||
|
GetTokenUserName(ClientToken, &UserName);
|
||||||
|
SvcInstanceSetUserName(UserName);
|
||||||
|
|
||||||
switch (*P++)
|
switch (*P++)
|
||||||
{
|
{
|
||||||
case LauncherSvcInstanceStartWithSecret:
|
case LauncherSvcInstanceStartWithSecret:
|
||||||
@ -1253,6 +1771,17 @@ static VOID SvcPipeTransact(HANDLE ClientToken, PWSTR PipeBuf, PULONG PSize)
|
|||||||
SvcPipeTransactResult(Result, PipeBuf, PSize);
|
SvcPipeTransactResult(Result, PipeBuf, PSize);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LauncherDefineDosDevice:
|
||||||
|
DeviceName = SvcPipeTransactGetPart(&P, PipeBufEnd);
|
||||||
|
TargetPath = SvcPipeTransactGetPart(&P, PipeBufEnd);
|
||||||
|
|
||||||
|
Result = STATUS_INVALID_PARAMETER;
|
||||||
|
if (0 != DeviceName && 0 != TargetPath)
|
||||||
|
Result = SvcDefineDosDevice(ClientToken, DeviceName, TargetPath);
|
||||||
|
|
||||||
|
SvcPipeTransactResult(Result, PipeBuf, PSize);
|
||||||
|
break;
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
case LauncherQuit:
|
case LauncherQuit:
|
||||||
SetEvent(SvcEvent);
|
SetEvent(SvcEvent);
|
||||||
@ -1264,10 +1793,26 @@ static VOID SvcPipeTransact(HANDLE ClientToken, PWSTR PipeBuf, PULONG PSize)
|
|||||||
SvcPipeTransactResult(STATUS_INVALID_PARAMETER, PipeBuf, PSize);
|
SvcPipeTransactResult(STATUS_INVALID_PARAMETER, PipeBuf, PSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SvcInstanceSetUserName(0);
|
||||||
|
MemFree(UserName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wmain(int argc, wchar_t **argv)
|
int wmain(int argc, wchar_t **argv)
|
||||||
{
|
{
|
||||||
|
HANDLE Handle = GetModuleHandleW(L"ntdll.dll");
|
||||||
|
if (0 != Handle)
|
||||||
|
{
|
||||||
|
SvcNtOpenSymbolicLinkObject = (PVOID)GetProcAddress(Handle, "NtOpenSymbolicLinkObject");
|
||||||
|
SvcNtClose = (PVOID)GetProcAddress(Handle, "NtClose");
|
||||||
|
|
||||||
|
if (0 == SvcNtOpenSymbolicLinkObject || 0 == SvcNtClose)
|
||||||
|
{
|
||||||
|
SvcNtOpenSymbolicLinkObject = 0;
|
||||||
|
SvcNtClose = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FspServiceRun(L"" PROGNAME, SvcStart, SvcStop, 0);
|
return FspServiceRun(L"" PROGNAME, SvcStart, SvcStop, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file launcher/launcher.h
|
* @file launcher/launcher.h
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#define LAUNCHER_PIPE_NAME "\\\\.\\pipe\\WinFsp.{14E7137D-22B4-437A-B0C1-D21D1BDF3767}"
|
#define LAUNCHER_PIPE_NAME "\\\\.\\pipe\\WinFsp.{14E7137D-22B4-437A-B0C1-D21D1BDF3767}"
|
||||||
#define LAUNCHER_PIPE_BUFFER_SIZE 4096
|
#define LAUNCHER_PIPE_BUFFER_SIZE 4096
|
||||||
#define LAUNCHER_PIPE_DEFAULT_TIMEOUT 3000
|
#define LAUNCHER_PIPE_DEFAULT_TIMEOUT (2 * 15000 + 1000)
|
||||||
|
|
||||||
#define LAUNCHER_START_WITH_SECRET_TIMEOUT 15000
|
#define LAUNCHER_START_WITH_SECRET_TIMEOUT 15000
|
||||||
|
|
||||||
@ -62,6 +62,7 @@ enum
|
|||||||
LauncherSvcInstanceStop = 'T', /* requires: SERVICE_STOP */
|
LauncherSvcInstanceStop = 'T', /* requires: SERVICE_STOP */
|
||||||
LauncherSvcInstanceInfo = 'I', /* requires: SERVICE_QUERY_STATUS */
|
LauncherSvcInstanceInfo = 'I', /* requires: SERVICE_QUERY_STATUS */
|
||||||
LauncherSvcInstanceList = 'L', /* requires: none*/
|
LauncherSvcInstanceList = 'L', /* requires: none*/
|
||||||
|
LauncherDefineDosDevice = 'D',
|
||||||
LauncherQuit = 'Q', /* DEBUG version only */
|
LauncherQuit = 'Q', /* DEBUG version only */
|
||||||
|
|
||||||
LauncherSuccess = '$',
|
LauncherSuccess = '$',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file shared/minimal.h
|
* @file shared/minimal.h
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @file sys/callbacks.c
|
* @file sys/callbacks.c
|
||||||
* Fast I/O and resource acquisition callbacks.
|
* Fast I/O and resource acquisition callbacks.
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/cleanup.c
|
* @file sys/cleanup.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/close.c
|
* @file sys/close.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/create.c
|
* @file sys/create.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/debug.c
|
* @file sys/debug.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/devctl.c
|
* @file sys/devctl.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/device.c
|
* @file sys/device.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/dirctl.c
|
* @file sys/dirctl.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -611,7 +611,7 @@ static NTSTATUS FspFsvolQueryDirectoryRetry(
|
|||||||
if (0 != FileDesc->DirectoryMarker.Buffer)
|
if (0 != FileDesc->DirectoryMarker.Buffer)
|
||||||
{
|
{
|
||||||
ASSERT(
|
ASSERT(
|
||||||
FsvolDeviceExtension->VolumeParams.MaxComponentLength >=
|
FsvolDeviceExtension->VolumeParams.MaxComponentLength * sizeof(WCHAR) >=
|
||||||
FileDesc->DirectoryMarker.Length);
|
FileDesc->DirectoryMarker.Length);
|
||||||
|
|
||||||
Request->Req.QueryDirectory.Marker.Offset =
|
Request->Req.QueryDirectory.Marker.Offset =
|
||||||
@ -921,7 +921,7 @@ NTSTATUS FspFsvolDirectoryControlComplete(
|
|||||||
if (0 != FileDesc->DirectoryMarker.Buffer)
|
if (0 != FileDesc->DirectoryMarker.Buffer)
|
||||||
{
|
{
|
||||||
ASSERT(
|
ASSERT(
|
||||||
FsvolDeviceExtension->VolumeParams.MaxComponentLength >=
|
FsvolDeviceExtension->VolumeParams.MaxComponentLength * sizeof(WCHAR) >=
|
||||||
FileDesc->DirectoryMarker.Length);
|
FileDesc->DirectoryMarker.Length);
|
||||||
|
|
||||||
Request->Req.QueryDirectory.Marker.Offset =
|
Request->Req.QueryDirectory.Marker.Offset =
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/driver.c
|
* @file sys/driver.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/driver.h
|
* @file sys/driver.h
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/ea.c
|
* @file sys/ea.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/file.c
|
* @file sys/file.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
@ -2166,7 +2166,7 @@ NTSTATUS FspFileDescSetDirectoryMarker(FSP_FILE_DESC *FileDesc,
|
|||||||
FspFsvolDeviceExtension(FileDesc->FileNode->FsvolDeviceObject);
|
FspFsvolDeviceExtension(FileDesc->FileNode->FsvolDeviceObject);
|
||||||
UNICODE_STRING DirectoryMarker;
|
UNICODE_STRING DirectoryMarker;
|
||||||
|
|
||||||
if (FsvolDeviceExtension->VolumeParams.MaxComponentLength < FileName->Length)
|
if (FsvolDeviceExtension->VolumeParams.MaxComponentLength * sizeof(WCHAR) < FileName->Length)
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
|
||||||
DirectoryMarker.Length = DirectoryMarker.MaximumLength = FileName->Length;
|
DirectoryMarker.Length = DirectoryMarker.MaximumLength = FileName->Length;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/fileinfo.c
|
* @file sys/fileinfo.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/flush.c
|
* @file sys/flush.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/fsctl.c
|
* @file sys/fsctl.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/iop.c
|
* @file sys/iop.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/ioq.c
|
* @file sys/ioq.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/lockctl.c
|
* @file sys/lockctl.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/meta.c
|
* @file sys/meta.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/name.c
|
* @file sys/name.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/psbuffer.c
|
* @file sys/psbuffer.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/read.c
|
* @file sys/read.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/security.c
|
* @file sys/security.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/shutdown.c
|
* @file sys/shutdown.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/statistics.c
|
* @file sys/statistics.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/util.c
|
* @file sys/util.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/volinfo.c
|
* @file sys/volinfo.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/volume.c
|
* @file sys/volume.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/wq.c
|
* @file sys/wq.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file sys/write.c
|
* @file sys/write.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
17
tools/fix-source-copyright
Normal file
17
tools/fix-source-copyright
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
OWNER="Bill Zissimopoulos"
|
||||||
|
MATCH="(@c|C)opyright ([0-9]+)(-[0-9]+)? ${OWNER}(. All rights reserved.)?"
|
||||||
|
SUBST="\1opyright \2-$(date +%Y) ${OWNER}\4"
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
echo "usage: $(basename $0) tree" 1>&2
|
||||||
|
echo "WARNING: this will in-place edit your source files!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" == Darwin* ]]; then
|
||||||
|
git grep -lz "$@" | xargs -0 sed -E -i "" -e "s/$MATCH/$SUBST/"
|
||||||
|
else
|
||||||
|
git grep -lz "$@" | xargs -0 sed -E -i"" -e "s/$MATCH/$SUBST/"
|
||||||
|
fi
|
@ -657,7 +657,7 @@ exit /b 0
|
|||||||
|
|
||||||
:sample-passthrough-dotnet
|
:sample-passthrough-dotnet
|
||||||
call :__run_sample_test passthrough-dotnet anycpu passthrough-dotnet winfsp-tests-x64 ^
|
call :__run_sample_test passthrough-dotnet anycpu passthrough-dotnet winfsp-tests-x64 ^
|
||||||
"-create_backup_test -create_restore_test -create_namelen_test -delete_access_test"
|
"-create_backup_test -create_restore_test -create_namelen_test -delete_access_test -querydir_namelen_test"
|
||||||
if !ERRORLEVEL! neq 0 goto fail
|
if !ERRORLEVEL! neq 0 goto fail
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ L:
|
|||||||
"%ProjRoot%\build\VStudio\build\%Configuration%\%4.exe" ^
|
"%ProjRoot%\build\VStudio\build\%Configuration%\%4.exe" ^
|
||||||
--external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^
|
--external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^
|
||||||
-create_allocation_test -create_notraverse_test -create_backup_test -create_restore_test -create_namelen_test ^
|
-create_allocation_test -create_notraverse_test -create_backup_test -create_restore_test -create_namelen_test ^
|
||||||
-getfileinfo_name_test -delete_access_test -delete_mmap_test -rename_flipflop_test -rename_mmap_test -setsecurity_test -exec_rename_dir_test ^
|
-getfileinfo_name_test -delete_access_test -delete_mmap_test -rename_flipflop_test -rename_mmap_test -setsecurity_test -querydir_namelen_test -exec_rename_dir_test ^
|
||||||
-reparse* -stream*
|
-reparse* -stream*
|
||||||
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1
|
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1
|
||||||
popd
|
popd
|
||||||
@ -784,8 +784,8 @@ cd L: >nul 2>nul || (echo Unable to find drive L: >&2 & goto fail)
|
|||||||
L:
|
L:
|
||||||
"%ProjRoot%\build\VStudio\build\%Configuration%\%3.exe" ^
|
"%ProjRoot%\build\VStudio\build\%Configuration%\%3.exe" ^
|
||||||
--external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^
|
--external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^
|
||||||
-create_allocation_test -create_notraverse_test -create_backup_test -create_restore_test -create_namelen_test ^
|
-create_fileattr_test -create_allocation_test -create_notraverse_test -create_backup_test -create_restore_test -create_namelen_test ^
|
||||||
-getfileinfo_name_test -setfileinfo_test -delete_access_test -delete_mmap_test -rename_flipflop_test -rename_mmap_test -setsecurity_test -exec_rename_dir_test ^
|
-getfileinfo_name_test -setfileinfo_test -delete_access_test -delete_mmap_test -rename_flipflop_test -rename_mmap_test -setsecurity_test -querydir_namelen_test -exec_rename_dir_test ^
|
||||||
-reparse* -stream*
|
-reparse* -stream*
|
||||||
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1
|
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1
|
||||||
popd
|
popd
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file fsbench.c
|
* @file fsbench.c
|
||||||
*
|
*
|
||||||
* @copyright 2015-2017 Bill Zissimopoulos
|
* @copyright 2015-2018 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This file is part of WinFsp.
|
* This file is part of WinFsp.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user