From 490d021b226bd487dd11ba5e860c10d643da934c Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Wed, 11 Aug 2021 16:27:29 +0100 Subject: [PATCH] dll: mount: MountDoNotUseLauncher registry setting --- Changelog.asciidoc | 2 ++ src/dll/mount.c | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Changelog.asciidoc b/Changelog.asciidoc index 99fd01c3..b6c1078e 100644 --- a/Changelog.asciidoc +++ b/Changelog.asciidoc @@ -12,6 +12,8 @@ Changes since v1.9: ** Going forward this behavior will change. The user and group mode permissions will not be considered together even in the case where the user SID and group SID are the same. This will resolve the access denied errors. ** However to preserve backward compatibility (there might be some file systems that rely on the old behavior) we will do so in stages. For release v1.10 (2021.1) there is a new registry setting under `HKLM\SOFTWARE\WinFsp` (or `HKLM\SOFTWARE\WOW6432Node\WinFsp` on a 64-bit system) called `DistinctPermsForSameOwnerGroup`, which if set to 1 will direct WinFsp-FUSE to use the new behavior. The default value is 0 which directs WinFsp-FUSE to use the old behavior. This default will change in a future release. +* [NEW] A new registry setting under `HKLM\SOFTWARE\WinFsp` (or `HKLM\SOFTWARE\WOW6432Node\WinFsp` on a 64-bit system) called `MountDoNotUseLauncher` has been introduced, which if set to 1 will disable the use of the Launcher during mounting. The default value is 0 which allows the use of the Launcher during mounting in those rare cases when necessary. (In general the Launcher is not necessary for mounting. However when running a file system in the Windows Service context (session 0) under an account that is not LocalSystem (e.g. `NT AUTHORITY\NETWORK SERVICE`), the Launcher is used to create global drives.) + * [FIX] File share access when overwriting a file (e.g. when using `TRUNCATE_EXISTING`) is now done in a manner compatible with NTFS (previously there were cases when overwriting a file where behavior diverged from the NTFS one). (See GitHub issue #364.) * [FIX] Fixed a problem in the file system shutdown protocol which resolves an occasional access violation in the user mode file system process. Previously it was possible for a file system to crash when stopping itself using `FspFileSystemStopDispatcher`; this problem has been rectified. (See GitHub issue #369.) diff --git a/src/dll/mount.c b/src/dll/mount.c index c91c79b5..94dea8be 100644 --- a/src/dll/mount.c +++ b/src/dll/mount.c @@ -28,6 +28,29 @@ static NTSTATUS (NTAPI *FspNtMakeTemporaryObject)( HANDLE Handle); static NTSTATUS (NTAPI *FspNtClose)( HANDLE Handle); +static BOOLEAN FspMountDoNotUseLauncher; + +static VOID FspMountInitializeFromRegistry(VOID) +{ + HKEY RegKey; + LONG Result; + DWORD Size; + DWORD MountDoNotUseLauncher; + + MountDoNotUseLauncher = 0; + + Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\" FSP_FSCTL_PRODUCT_NAME, + 0, KEY_READ | KEY_WOW64_32KEY, &RegKey); + if (ERROR_SUCCESS == Result) + { + Size = sizeof MountDoNotUseLauncher; + Result = RegGetValueW(RegKey, 0, L"MountDoNotUseLauncher", + RRF_RT_REG_DWORD, 0, &MountDoNotUseLauncher, &Size); + RegCloseKey(RegKey); + } + + FspMountDoNotUseLauncher = !!MountDoNotUseLauncher; +} static BOOL WINAPI FspMountInitialize( PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) @@ -49,6 +72,8 @@ static BOOL WINAPI FspMountInitialize( } } + FspMountInitializeFromRegistry(); + return TRUE; } @@ -366,7 +391,7 @@ static NTSTATUS FspMountSet_Drive(PWSTR VolumeName, PWSTR MountPoint, PHANDLE PM Result = FspServiceContextCheck(0, &IsLocalSystem); IsServiceContext = NT_SUCCESS(Result) && !IsLocalSystem; - if (IsServiceContext) + if (IsServiceContext && !FspMountDoNotUseLauncher) { /* * If the current process is in the service context but not LocalSystem,