dll: mount: MountDoNotUseLauncher registry setting

This commit is contained in:
Bill Zissimopoulos
2021-08-11 16:27:29 +01:00
parent 2d41693f3c
commit 490d021b22
2 changed files with 28 additions and 1 deletions

View File

@ -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,