mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-03 09:22:57 -05:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
dacaff41e4 | |||
be27a82879 | |||
b9ca46694e | |||
e50d7adc50 | |||
7f73192f8d | |||
d71049225e | |||
c15006cce8 | |||
53b44dcb5c | |||
a3765d6360 | |||
6c6dd8abcc | |||
16dd729fc7 | |||
a2d49a1ded | |||
9ede097e73 | |||
2c3800077f | |||
84b3f98d38 | |||
16734bf37a | |||
ea189c5b68 | |||
7735506cc7 | |||
ca3170c293 | |||
ba13995d10 |
19
Changelog.md
19
Changelog.md
@ -1,7 +1,24 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## v1.12B1 (2022.2)
|
||||
## v1.12B2 (2022.2 Beta2)
|
||||
|
||||
- [NEW] WinFsp now supports mounting as directory using the Mount Manager. Use the syntax `\\.\C:\Path\To\Mount\Directory`.
|
||||
|
||||
- [NEW] A new registry setting `MountUseMountmgrFromFSD` has been added. See [WinFsp Registry Settings](https://github.com/winfsp/winfsp/wiki/WinFsp-Registry-Settings) for details.
|
||||
|
||||
- [FIX] A problem with Windows containers has been fixed. (GitHub issue #438.)
|
||||
|
||||
- [FIX] File systems can now be mounted as directories on ARM64. (GitHub issue #448.)
|
||||
|
||||
- [FIX] The passthrough file system now reports correct `IndexNumber`. (GitHub issue #325.)
|
||||
|
||||
- [BUILD] Product configuration for the relative paths to the File System Driver, Network Provider and EventLog is now possible via the file `build.version.props` located in `build\VStudio`.
|
||||
|
||||
|
||||
## v1.12B1 (2022.2 Beta1)
|
||||
|
||||
- [NEW] WinFsp now supports mounting as directory using the Mount Manager. Use the syntax `\\.\C:\Path\To\Mount\Directory`.
|
||||
|
||||
- [NEW] A new registry setting `MountUseMountmgrFromFSD` has been added. See [WinFsp Registry Settings](https://github.com/winfsp/winfsp/wiki/WinFsp-Registry-Settings) for details.
|
||||
|
||||
|
@ -68,6 +68,7 @@ CONTRIBUTOR LIST
|
||||
|John Tyner |jtyner at gmail.com
|
||||
|Paweł Wegner (Google LLC, https://google.com) |lemourin at google.com
|
||||
|Pedro Frejo (Arpa System, https://arpasystem.com) |pedro.frejo at arpasystem.com
|
||||
|Ronny Chan |ronny at ronnychan.ca
|
||||
|Sam Kelly (DuroSoft Technologies LLC, https://durosoft.com) |sam at durosoft.com
|
||||
|Santiago Ganis |sganis at gmail.com
|
||||
|Tobias Urlaub |saibotu at outlook.de
|
||||
|
10
appveyor.yml
10
appveyor.yml
@ -17,19 +17,25 @@ environment:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
CONFIGURATION: Debug
|
||||
TESTING: Func
|
||||
DOCKER_TESTING: None
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
CONFIGURATION: Release
|
||||
TESTING: Func
|
||||
DOCKER_TESTING: None
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
CONFIGURATION: Release
|
||||
TESTING: Func
|
||||
DOCKER_TESTING: None
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
CONFIGURATION: Release
|
||||
TESTING: Func
|
||||
DOCKER_TESTING: Func
|
||||
#- CONFIGURATION: Release
|
||||
# TESTING: Avast
|
||||
# DOCKER_TESTING: None
|
||||
#- CONFIGURATION: Release
|
||||
# TESTING: Perf
|
||||
# DOCKER_TESTING: None
|
||||
|
||||
init:
|
||||
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
@ -81,6 +87,7 @@ test_script:
|
||||
- if %TESTING%==Func start /wait msiexec /i "Test.Filter.Driver\HCK Filter.Driver Content-x86_en-us.msi" /qn
|
||||
- if %TESTING%==Func tools\nmake-ext-test.bat %CONFIGURATION%
|
||||
#- ps: . "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\gflags.exe" /k +spp *
|
||||
- if %DOCKER_TESTING%==Func docker run -d --name=Container0 --isolation=process "-vC:\Program Files (x86)\WinFsp:C:\Program Files (x86)\WinFsp:RO" "-vC:\projects:C:\projects:RO" mcr.microsoft.com/windows/servercore:ltsc2019 cmd.exe /c waitfor 7BF47D72F6664550B03248ECFE77C7DD
|
||||
- if %TESTING%==Func tools\run-tests.bat %CONFIGURATION%
|
||||
- if %TESTING%==Func tools\run-tests.bat %CONFIGURATION% ifstest
|
||||
- if %TESTING%==Func tools\run-tests.bat %CONFIGURATION% sample
|
||||
@ -88,6 +95,9 @@ test_script:
|
||||
- if %TESTING%==Avast choco install avastfreeantivirus && fltmc instances -v "C:"
|
||||
- if %TESTING%==Avast tools\run-tests.bat %CONFIGURATION% avast-tests
|
||||
- if %TESTING%==Perf tools\run-perf-tests.bat %CONFIGURATION% baseline > perf-tests.csv && type perf-tests.csv & appveyor PushArtifact perf-tests.csv
|
||||
- if %DOCKER_TESTING%==Func docker exec Container0 cmd.exe /c C:\projects\winfsp\build\VStudio\build\%CONFIGURATION%\winfsp-tests-x64.exe +*
|
||||
#- if %DOCKER_TESTING%==Func docker run -d --name=Container1 --isolation=process "-vC:\Program Files (x86)\WinFsp:C:\Program Files (x86)\WinFsp:RO" "-vC:\projects:C:\projects:RO" mcr.microsoft.com/windows/servercore:ltsc2019 cmd.exe /c waitfor 7BF47D72F6664550B03248ECFE77C7DD
|
||||
#- if %DOCKER_TESTING%==Func docker exec Container1 cmd.exe /c C:\projects\winfsp\build\VStudio\build\%CONFIGURATION%\winfsp-tests-x64.exe +*
|
||||
- choco uninstall winfsp -y
|
||||
|
||||
on_finish:
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
<MyCanonicalVersion>1.12</MyCanonicalVersion>
|
||||
|
||||
<MyProductVersion>2022.2 Beta1</MyProductVersion>
|
||||
<MyProductVersion>2022.2 Beta2</MyProductVersion>
|
||||
<MyProductStage>Beta</MyProductStage>
|
||||
|
||||
<MyCrossCert>DigiCertGlobalG3CodeSigningECCSHA3842021CA1.cer</MyCrossCert>
|
||||
|
@ -34,3 +34,4 @@ This document contains a list of known open-source file systems and file system
|
||||
- https://github.com/billziss-gh/fusepy[Python: fusepy] - Simple ctypes bindings for FUSE
|
||||
- https://github.com/pleiszenburg/refuse[Python: refuse] - Simple cross-plattform ctypes bindings for libfuse / FUSE for macOS / WinFsp
|
||||
- https://github.com/Scille/winfspy[Python: winfspy] - WinFSP binding for Python
|
||||
- https://github.com/SnowflakePowered/winfsp-rs[Rust: winfsp-rs] - WinFSP binding for Rust
|
||||
|
@ -538,7 +538,8 @@ static NTSTATUS GetFileInfoInternal(HANDLE Handle, FSP_FSCTL_FILE_INFO *FileInfo
|
||||
FileInfo->LastAccessTime = ((PLARGE_INTEGER)&ByHandleFileInfo.ftLastAccessTime)->QuadPart;
|
||||
FileInfo->LastWriteTime = ((PLARGE_INTEGER)&ByHandleFileInfo.ftLastWriteTime)->QuadPart;
|
||||
FileInfo->ChangeTime = FileInfo->LastWriteTime;
|
||||
FileInfo->IndexNumber = 0;
|
||||
FileInfo->IndexNumber =
|
||||
((UINT64)ByHandleFileInfo.nFileIndexHigh << 32) | (UINT64)ByHandleFileInfo.nFileIndexLow;
|
||||
FileInfo->HardLinks = 0;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -180,7 +180,7 @@ FSP_FUSE_API struct fuse_chan *fsp_fuse_mount(struct fsp_fuse_env *env,
|
||||
const char *mountpoint, struct fuse_args *args)
|
||||
{
|
||||
struct fuse_chan *ch = 0;
|
||||
WCHAR TempMountPointBuf[MAX_PATH], MountPointBuf[MAX_PATH];
|
||||
WCHAR TempMountPointBuf[MAX_PATH], MountPointBuf[MAX_PATH + 4];
|
||||
int Size;
|
||||
|
||||
if (0 == mountpoint || '\0' == mountpoint[0] ||
|
||||
@ -212,6 +212,33 @@ FSP_FUSE_API struct fuse_chan *fsp_fuse_mount(struct fsp_fuse_env *env,
|
||||
MountPointBuf[6] = '\0';
|
||||
Size = 7 * sizeof(WCHAR);
|
||||
}
|
||||
else if (
|
||||
(
|
||||
'\\' == mountpoint[0] &&
|
||||
'\\' == mountpoint[1] &&
|
||||
('?' == mountpoint[2] || '.' == mountpoint[2]) &&
|
||||
'\\' == mountpoint[3]
|
||||
) &&
|
||||
(
|
||||
('A' <= mountpoint[4] && mountpoint[4] <= 'Z') ||
|
||||
('a' <= mountpoint[4] && mountpoint[4] <= 'z')
|
||||
) &&
|
||||
':' == mountpoint[5] && '\\' == mountpoint[6])
|
||||
{
|
||||
MountPointBuf[0] = '\\';
|
||||
MountPointBuf[1] = '\\';
|
||||
MountPointBuf[2] = mountpoint[2];
|
||||
MountPointBuf[3] = '\\';
|
||||
|
||||
Size = 0;
|
||||
if (0 != MultiByteToWideChar(CP_UTF8, 0, mountpoint + 4, -1, TempMountPointBuf, MAX_PATH))
|
||||
Size = GetFullPathNameW(TempMountPointBuf, MAX_PATH, MountPointBuf + 4, 0);
|
||||
|
||||
if (0 == Size || MAX_PATH <= Size)
|
||||
goto fail;
|
||||
|
||||
Size = (Size + 4 + 1) * sizeof(WCHAR);
|
||||
}
|
||||
else if (
|
||||
(
|
||||
('A' <= mountpoint[0] && mountpoint[0] <= 'Z') ||
|
||||
|
@ -90,6 +90,12 @@ ULONG FspLdapGetDefaultNamingContext(PVOID Ldap, PWSTR *PValue);
|
||||
ULONG FspLdapGetTrustPosixOffset(PVOID Ldap, PWSTR Context, PWSTR Domain, PWSTR *PValue);
|
||||
|
||||
PWSTR FspDiagIdent(VOID);
|
||||
HANDLE FspCreateDirectoryFileW(
|
||||
PWSTR FileName,
|
||||
DWORD DesiredAccess,
|
||||
DWORD ShareAccess,
|
||||
PSECURITY_ATTRIBUTES SecurityAttributes,
|
||||
DWORD FlagsAndAttributes);
|
||||
NTSTATUS FspGetModuleVersion(PWSTR ModuleFileName, PUINT32 PVersion);
|
||||
NTSTATUS FspGetModuleFileName(
|
||||
HMODULE Module,
|
||||
|
@ -488,14 +488,12 @@ static NTSTATUS FspMountSet_Directory(PWSTR VolumeName, PWSTR MountPoint,
|
||||
SecurityAttributes.nLength = sizeof SecurityAttributes;
|
||||
SecurityAttributes.lpSecurityDescriptor = SecurityDescriptor;
|
||||
|
||||
MountHandle = CreateFileW(MountPoint,
|
||||
MountHandle = FspCreateDirectoryFileW(MountPoint,
|
||||
FILE_WRITE_ATTRIBUTES,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
&SecurityAttributes,
|
||||
CREATE_NEW,
|
||||
FILE_ATTRIBUTE_DIRECTORY |
|
||||
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_POSIX_SEMANTICS | FILE_FLAG_DELETE_ON_CLOSE,
|
||||
0);
|
||||
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_POSIX_SEMANTICS | FILE_FLAG_DELETE_ON_CLOSE);
|
||||
if (INVALID_HANDLE_VALUE == MountHandle)
|
||||
{
|
||||
Result = FspNtStatusFromWin32(GetLastError());
|
||||
|
139
src/dll/util.c
139
src/dll/util.c
@ -64,6 +64,145 @@ PWSTR FspDiagIdent(VOID)
|
||||
return FspDiagIdentBuf;
|
||||
}
|
||||
|
||||
static INIT_ONCE FspCreateDirectoryFileInitOnce = INIT_ONCE_STATIC_INIT;
|
||||
static NTSTATUS (NTAPI *FspNtCreateFile)(
|
||||
PHANDLE FileHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
PIO_STATUS_BLOCK IoStatusBlock,
|
||||
PLARGE_INTEGER AllocationSize,
|
||||
ULONG FileAttributes,
|
||||
ULONG ShareAccess,
|
||||
ULONG CreateDisposition,
|
||||
ULONG CreateOptions,
|
||||
PVOID EaBuffer,
|
||||
ULONG EaLength);
|
||||
|
||||
static BOOL WINAPI FspCreateDirectoryFileInitialize(
|
||||
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
||||
{
|
||||
HANDLE Handle;
|
||||
|
||||
Handle = GetModuleHandleW(L"ntdll.dll");
|
||||
if (0 != Handle)
|
||||
FspNtCreateFile = (PVOID)GetProcAddress(Handle, "NtCreateFile");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HANDLE FspCreateDirectoryFileW(
|
||||
PWSTR FileName,
|
||||
DWORD DesiredAccess,
|
||||
DWORD ShareAccess,
|
||||
PSECURITY_ATTRIBUTES SecurityAttributes,
|
||||
DWORD FlagsAndAttributes)
|
||||
{
|
||||
InitOnceExecuteOnce(&FspCreateDirectoryFileInitOnce, FspCreateDirectoryFileInitialize, 0, 0);
|
||||
if (0 == FspNtCreateFile)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FUNCTION);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
HANDLE Handle = INVALID_HANDLE_VALUE, ParentHandle = INVALID_HANDLE_VALUE;
|
||||
PWSTR FullFileName = 0;
|
||||
WCHAR *FilePart, FilePartChar;
|
||||
DWORD Length;
|
||||
UNICODE_STRING UFullFileName;
|
||||
OBJECT_ATTRIBUTES Obja;
|
||||
ULONG CreateFlags;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
|
||||
Length = GetFullPathNameW(FileName, 0, 0, 0);
|
||||
if (0 == Length)
|
||||
goto exit;
|
||||
|
||||
FullFileName = MemAlloc((Length + 1) * sizeof(WCHAR));
|
||||
if (0 == FullFileName)
|
||||
{
|
||||
SetLastError(ERROR_NO_SYSTEM_RESOURCES);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
Length = GetFullPathNameW(FileName, Length + 1, FullFileName, &FilePart);
|
||||
if (0 == Length)
|
||||
goto exit;
|
||||
|
||||
FilePartChar = *FilePart;
|
||||
*FilePart = L'\0';
|
||||
|
||||
ParentHandle = CreateFileW(
|
||||
FullFileName,
|
||||
0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
0,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS,
|
||||
0);
|
||||
if (INVALID_HANDLE_VALUE == ParentHandle)
|
||||
goto exit;
|
||||
|
||||
*FilePart = FilePartChar;
|
||||
|
||||
UFullFileName.Length = UFullFileName.MaximumLength = (USHORT)(lstrlenW(FilePart) * sizeof(WCHAR));
|
||||
UFullFileName.Buffer = FilePart;
|
||||
|
||||
memset(&Obja, 0, sizeof Obja);
|
||||
Obja.Length = sizeof Obja;
|
||||
Obja.ObjectName = &UFullFileName;
|
||||
Obja.Attributes =
|
||||
(!(FlagsAndAttributes & FILE_FLAG_POSIX_SEMANTICS) ? OBJ_CASE_INSENSITIVE : 0) |
|
||||
(SecurityAttributes->bInheritHandle ? OBJ_INHERIT : 0);
|
||||
Obja.RootDirectory = ParentHandle;
|
||||
Obja.SecurityDescriptor = SecurityAttributes->lpSecurityDescriptor;
|
||||
|
||||
DesiredAccess |=
|
||||
SYNCHRONIZE |
|
||||
FILE_READ_ATTRIBUTES |
|
||||
((FlagsAndAttributes & FILE_FLAG_DELETE_ON_CLOSE) ? DELETE : 0);
|
||||
|
||||
CreateFlags =
|
||||
FILE_DIRECTORY_FILE |
|
||||
((FlagsAndAttributes & FILE_FLAG_WRITE_THROUGH) ? FILE_WRITE_THROUGH : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_OVERLAPPED) ? FILE_SYNCHRONOUS_IO_NONALERT : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_NO_BUFFERING) ? FILE_NO_INTERMEDIATE_BUFFERING : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_RANDOM_ACCESS) ? FILE_RANDOM_ACCESS : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_SEQUENTIAL_SCAN) ? FILE_SEQUENTIAL_ONLY : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_DELETE_ON_CLOSE) ? FILE_DELETE_ON_CLOSE : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_BACKUP_SEMANTICS) ? FILE_OPEN_FOR_BACKUP_INTENT : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_OPEN_REPARSE_POINT) ? FILE_OPEN_REPARSE_POINT : 0) |
|
||||
((FlagsAndAttributes & FILE_FLAG_OPEN_NO_RECALL) ? FILE_OPEN_NO_RECALL : 0);
|
||||
|
||||
IoStatus.Status = FspNtCreateFile(
|
||||
&Handle,
|
||||
DesiredAccess,
|
||||
&Obja,
|
||||
&IoStatus,
|
||||
0,
|
||||
FlagsAndAttributes & (0x7fff & ~FILE_ATTRIBUTE_DIRECTORY),
|
||||
ShareAccess,
|
||||
FILE_CREATE,
|
||||
CreateFlags,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(IoStatus.Status))
|
||||
{
|
||||
SetLastError(FspWin32FromNtStatus(IoStatus.Status));
|
||||
Handle = INVALID_HANDLE_VALUE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
SetLastError(0);
|
||||
|
||||
exit:
|
||||
if (INVALID_HANDLE_VALUE != ParentHandle)
|
||||
CloseHandle(ParentHandle);
|
||||
|
||||
MemFree(FullFileName);
|
||||
|
||||
return Handle;
|
||||
}
|
||||
|
||||
FSP_API NTSTATUS FspCallNamedPipeSecurely(PWSTR PipeName,
|
||||
PVOID InBuffer, ULONG InBufferSize, PVOID OutBuffer, ULONG OutBufferSize,
|
||||
PULONG PBytesTransferred, ULONG Timeout,
|
||||
|
@ -150,6 +150,10 @@ NTSTATUS DriverEntry(
|
||||
goto exit;
|
||||
InitDoneDevices = TRUE;
|
||||
|
||||
Result = FspSiloPostInitialize();
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
|
||||
Result = STATUS_SUCCESS;
|
||||
|
||||
exit:
|
||||
|
@ -754,6 +754,7 @@ NTSTATUS FspSiloGetGlobals(FSP_SILO_GLOBALS **PGlobals);
|
||||
VOID FspSiloDereferenceGlobals(FSP_SILO_GLOBALS *Globals);
|
||||
VOID FspSiloGetContainerId(GUID *ContainerId);
|
||||
NTSTATUS FspSiloInitialize(FSP_SILO_INIT_CALLBACK Init, FSP_SILO_FINI_CALLBACK Fini);
|
||||
NTSTATUS FspSiloPostInitialize(VOID);
|
||||
VOID FspSiloFinalize(VOID);
|
||||
|
||||
/* process buffers */
|
||||
@ -1181,7 +1182,6 @@ typedef struct
|
||||
KSPIN_LOCK SpinLock;
|
||||
LONG RefCount;
|
||||
UINT32 Kind;
|
||||
GUID SiloContainerId;
|
||||
/* IoTimer emulation */
|
||||
FSP_DEVICE_TIMER DeviceTimer;
|
||||
} FSP_DEVICE_EXTENSION;
|
||||
|
@ -1475,7 +1475,7 @@ NTSTATUS FspFileNodeRenameCheck(PDEVICE_OBJECT FsvolDeviceObject, PIRP OplockIrp
|
||||
{
|
||||
Result = NT_SUCCESS(Result) ? STATUS_OPLOCK_BREAK_IN_PROGRESS : Result;
|
||||
DescendantFileNodes[DescendantFileNodeIndex] =
|
||||
(PVOID)((UINT_PTR)DescendantFileNode | 2);
|
||||
(PVOID)((UINT_PTR)DescendantFileNode | 4);
|
||||
}
|
||||
else
|
||||
Result = STATUS_ACCESS_DENIED;
|
||||
|
@ -22,9 +22,11 @@
|
||||
#include <sys/driver.h>
|
||||
|
||||
NTSTATUS FspSiloInitialize(FSP_SILO_INIT_CALLBACK Init, FSP_SILO_FINI_CALLBACK Fini);
|
||||
NTSTATUS FspSiloPostInitialize(VOID);
|
||||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
#pragma alloc_text(INIT, FspSiloInitialize)
|
||||
#pragma alloc_text(INIT, FspSiloPostInitialize)
|
||||
#endif
|
||||
|
||||
typedef PEJOB FSP_PESILO;
|
||||
@ -293,15 +295,11 @@ NTSTATUS FspSiloInitialize(FSP_SILO_INIT_CALLBACK Init, FSP_SILO_FINI_CALLBACK F
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
|
||||
Result = CALL(PsStartSiloMonitor)(Monitor);
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
|
||||
FspSiloMonitor = Monitor;
|
||||
FspSiloInitCallback = Init;
|
||||
FspSiloFiniCallback = Fini;
|
||||
|
||||
FspSiloInitDone = TRUE;
|
||||
|
||||
Result = STATUS_SUCCESS;
|
||||
|
||||
exit:
|
||||
@ -316,10 +314,23 @@ NTSTATUS FspSiloInitialize(FSP_SILO_INIT_CALLBACK Init, FSP_SILO_FINI_CALLBACK F
|
||||
return Result;
|
||||
}
|
||||
|
||||
NTSTATUS FspSiloPostInitialize(VOID)
|
||||
{
|
||||
if (!FspSiloInitDone)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
return CALL(PsStartSiloMonitor)(FspSiloMonitor);
|
||||
}
|
||||
|
||||
VOID FspSiloFinalize(VOID)
|
||||
{
|
||||
if (!FspSiloInitDone)
|
||||
return;
|
||||
|
||||
CALL(PsUnregisterSiloMonitor)(FspSiloMonitor);
|
||||
|
||||
FspSiloMonitor = 0;
|
||||
FspSiloInitCallback = 0;
|
||||
FspSiloFiniCallback = 0;
|
||||
FspSiloInitDone = FALSE;
|
||||
}
|
||||
|
@ -113,6 +113,57 @@ NTSTATUS FspVolumeCreate(
|
||||
|
||||
FspSiloDereferenceGlobals(Globals);
|
||||
|
||||
if (NT_SUCCESS(Result))
|
||||
{
|
||||
/*
|
||||
* If we have an fsvrt device, mount it NOW via opening the volume. This ensures
|
||||
* that the fsvrt is mounted by the correct fsvol device early on and remedies
|
||||
* a rare case where NTFS crashes the system when it attempts to mount our fsvrt.
|
||||
*
|
||||
* We use IoCreateFileEx with FILE_READ_DATA to ensure that the I/O Manager will
|
||||
* mount the fsvrt device.
|
||||
*
|
||||
* We ignore the IoCreateFileEx return code as it is only used for its side effect
|
||||
* of mounting the fsvrt. In the unlikely event that IoCreateFileEx fails, the
|
||||
* system will retry the mount when a file is accessed, etc.
|
||||
*/
|
||||
|
||||
PDEVICE_OBJECT FsvolDeviceObject = IrpSp->FileObject->FsContext2;
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
|
||||
PDEVICE_OBJECT FsvrtDeviceObject = FsvolDeviceExtension->FsvrtDeviceObject;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
HANDLE Handle;
|
||||
|
||||
if (0 != FsvrtDeviceObject)
|
||||
{
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&FsvolDeviceExtension->VolumeName,
|
||||
OBJ_KERNEL_HANDLE,
|
||||
0/*RootDirectory*/,
|
||||
0/*SecurityDescriptor*/);
|
||||
IoStatus.Status = IoCreateFileEx(
|
||||
&Handle,
|
||||
FILE_READ_DATA,
|
||||
&ObjectAttributes,
|
||||
&IoStatus,
|
||||
0/*AllocationSize*/,
|
||||
0/*FileAttributes*/,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
FILE_OPEN,
|
||||
0/*CreateOptions*/,
|
||||
0/*EaBuffer*/,
|
||||
0/*EaLength*/,
|
||||
CreateFileTypeNone,
|
||||
0/*InternalParameters*/,
|
||||
0/*Options*/,
|
||||
0/*DriverContext*/);
|
||||
if (NT_SUCCESS(IoStatus.Status))
|
||||
ObCloseHandle(Handle, KernelMode);
|
||||
}
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,8 @@ set Config=Debug
|
||||
set Suffix=x64
|
||||
set Deploy=C:\Deploy\winfsp
|
||||
set Target=Win10DBG
|
||||
set Chkpnt=winfsp
|
||||
set Chkpnt=docker+winfsp
|
||||
set CImage=mcr.microsoft.com/windows/servercore:1909
|
||||
if not X%1==X set Target=%1
|
||||
if not X%2==X set Chkpnt=%2
|
||||
|
||||
@ -15,6 +16,10 @@ if not X%2==X set Chkpnt=%2
|
||||
echo regsvr32 /s winfsp-x64.dll
|
||||
) > %~dp0..\build\VStudio\build\%Config%\deploy-setup.bat
|
||||
|
||||
(
|
||||
echo docker run -it --rm --isolation=process -v%Deploy%:%Deploy%:RW %CImage% cmd.exe /k cd %Deploy%
|
||||
) > %~dp0..\build\VStudio\build\%Config%\docker-run.bat
|
||||
|
||||
set Files=
|
||||
for %%f in (
|
||||
%~dp0..\build\VStudio\build\%Config%\
|
||||
@ -23,6 +28,7 @@ for %%f in (
|
||||
winfsp-tests-%Suffix%.exe
|
||||
memfs-%Suffix%.exe
|
||||
deploy-setup.bat
|
||||
docker-run.bat
|
||||
) do (
|
||||
set File=%%~f
|
||||
if [!File:~-1!] == [\] (
|
||||
|
@ -47,32 +47,32 @@ set dfl_tests=^
|
||||
winfsp-tests-x64-external-share ^
|
||||
memfs-x64-disk-fsx ^
|
||||
memfs-x64-net-fsx ^
|
||||
memfs-x64-disk-standby ^
|
||||
memfs-x64-net-standby ^
|
||||
RETIRED-memfs-x64-disk-standby ^
|
||||
RETIRED-memfs-x64-net-standby ^
|
||||
memfs-x64-net-use ^
|
||||
memfs-x64-disk-winfstest ^
|
||||
memfs-x64-net-winfstest ^
|
||||
fscrash-x64 ^
|
||||
winfsp-tests-x86 ^
|
||||
winfsp-tests-x86-case-randomize ^
|
||||
winfsp-tests-x86-flushpurge ^
|
||||
winfsp-tests-x86-legacy-unlink-rename ^
|
||||
winfsp-tests-x86-mountpoint-drive ^
|
||||
winfsp-tests-x86-mountpoint-dir ^
|
||||
winfsp-tests-x86-mountpoint-dir-case-sensitive ^
|
||||
winfsp-tests-x86-mountmgr-drive ^
|
||||
winfsp-tests-x86-mountmgr-dir ^
|
||||
winfsp-tests-x86-mountmgrfsd-drive ^
|
||||
winfsp-tests-x86-mountmgrfsd-dir ^
|
||||
winfsp-tests-x86-no-traverse ^
|
||||
winfsp-tests-x86-oplock ^
|
||||
winfsp-tests-x86-notify ^
|
||||
RETIRED-winfsp-tests-x86-case-randomize ^
|
||||
RETIRED-winfsp-tests-x86-flushpurge ^
|
||||
RETIRED-winfsp-tests-x86-legacy-unlink-rename ^
|
||||
RETIRED-winfsp-tests-x86-mountpoint-drive ^
|
||||
RETIRED-winfsp-tests-x86-mountpoint-dir ^
|
||||
RETIRED-winfsp-tests-x86-mountpoint-dir-case-sensitive ^
|
||||
RETIRED-winfsp-tests-x86-mountmgr-drive ^
|
||||
RETIRED-winfsp-tests-x86-mountmgr-dir ^
|
||||
RETIRED-winfsp-tests-x86-mountmgrfsd-drive ^
|
||||
RETIRED-winfsp-tests-x86-mountmgrfsd-dir ^
|
||||
RETIRED-winfsp-tests-x86-no-traverse ^
|
||||
RETIRED-winfsp-tests-x86-oplock ^
|
||||
RETIRED-winfsp-tests-x86-notify ^
|
||||
winfsp-tests-x86-external ^
|
||||
winfsp-tests-x86-external-share ^
|
||||
memfs-x86-disk-fsx ^
|
||||
memfs-x86-net-fsx ^
|
||||
memfs-x86-disk-standby ^
|
||||
memfs-x86-net-standby ^
|
||||
RETIRED-memfs-x86-disk-standby ^
|
||||
RETIRED-memfs-x86-net-standby ^
|
||||
memfs-x86-net-use ^
|
||||
memfs-x86-disk-winfstest ^
|
||||
memfs-x86-net-winfstest ^
|
||||
@ -123,20 +123,25 @@ set opt_tests=^
|
||||
|
||||
set tests=
|
||||
for %%f in (%dfl_tests%) do (
|
||||
set test=%%f
|
||||
if NOT "XRETIRED-!test:RETIRED-=!"=="X!test!" (
|
||||
if X%2==X (
|
||||
set tests=!tests! %%f
|
||||
) else (
|
||||
set test=%%f
|
||||
if "X%2!test:%2=!"=="X!test!" set tests=!tests! %%f
|
||||
)
|
||||
)
|
||||
)
|
||||
for %%f in (%opt_tests%) do (
|
||||
set test=%%f
|
||||
if NOT "XRETIRED-!test:RETIRED-=!"=="X!test!" (
|
||||
if X%2==X (
|
||||
rem
|
||||
) else (
|
||||
set test=%%f
|
||||
if "X%2!test:%2=!"=="X!test!" set tests=!tests! %%f
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
set testpass=0
|
||||
@ -159,11 +164,12 @@ for %%f in (%tests%) do (
|
||||
set "endtimecalc=!endtime:%time:~8,1%=%%100)*100+1!" & set "begtimecalc=!begtime:%time:~8,1%=%%100)*100+1!"
|
||||
set /A "duration=((((10!endtimecalc:%time:~2,1%=%%100)*60+1!%%100)-((((10!begtimecalc:%time:~2,1%=%%100)*60+1!%%100), duration-=(duration>>31)*24*60*60*100"
|
||||
set /A "duration=10*duration"
|
||||
set /A "durationSec=duration/1000"
|
||||
|
||||
if !ERRORLEVEL_save! neq 0 (
|
||||
set /a testfail=testfail+1
|
||||
|
||||
echo === Failed %%f ^(!duration! ms^)
|
||||
echo === Failed %%f ^(!durationSec!s^)
|
||||
|
||||
if defined APPVEYOR (
|
||||
appveyor UpdateTest "%%f" -FileName None -Framework None -Outcome Failed -Duration !duration!
|
||||
@ -171,7 +177,7 @@ for %%f in (%tests%) do (
|
||||
) else (
|
||||
set /a testpass=testpass+1
|
||||
|
||||
echo === Passed %%f ^(!duration! ms^)
|
||||
echo === Passed %%f ^(!durationSec!s^)
|
||||
|
||||
if defined APPVEYOR (
|
||||
appveyor UpdateTest "%%f" -FileName None -Framework None -Outcome Passed -Duration !duration!
|
||||
@ -241,25 +247,25 @@ if !ERRORLEVEL! neq 0 goto fail
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x64-mountmgr-drive
|
||||
winfsp-tests-x64 --mountpoint=\\.\X: --resilient * +ea*
|
||||
winfsp-tests-x64 --mountpoint=\\.\X: --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x64-mountmgr-dir
|
||||
winfsp-tests-x64 --mountpoint=\\.\%cd%\mnt --resilient * +ea*
|
||||
winfsp-tests-x64 --mountpoint=\\.\%cd%\mnt --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x64-mountmgrfsd-drive
|
||||
reg add HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /t REG_DWORD /d 1 /f /reg:32
|
||||
winfsp-tests-x64 --mountpoint=\\.\X: --resilient * +ea*
|
||||
winfsp-tests-x64 --mountpoint=\\.\X: --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
reg delete HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /f /reg:32
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x64-mountmgrfsd-dir
|
||||
reg add HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /t REG_DWORD /d 1 /f /reg:32
|
||||
winfsp-tests-x64 --mountpoint=\\.\%cd%\mnt --resilient * +ea*
|
||||
winfsp-tests-x64 --mountpoint=\\.\%cd%\mnt --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
reg delete HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /f /reg:32
|
||||
exit /b 0
|
||||
@ -315,25 +321,25 @@ if !ERRORLEVEL! neq 0 goto fail
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x86-mountmgr-drive
|
||||
winfsp-tests-x86 --mountpoint=\\.\X: --resilient * +ea*
|
||||
winfsp-tests-x86 --mountpoint=\\.\X: --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x86-mountmgr-dir
|
||||
winfsp-tests-x86 --mountpoint=\\.\%cd%\mnt --resilient * +ea*
|
||||
winfsp-tests-x86 --mountpoint=\\.\%cd%\mnt --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x86-mountmgrfsd-drive
|
||||
reg add HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /t REG_DWORD /d 1 /f /reg:32
|
||||
winfsp-tests-x86 --mountpoint=\\.\X: --resilient * +ea*
|
||||
winfsp-tests-x86 --mountpoint=\\.\X: --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
reg delete HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /f /reg:32
|
||||
exit /b 0
|
||||
|
||||
:winfsp-tests-x86-mountmgrfsd-dir
|
||||
reg add HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /t REG_DWORD /d 1 /f /reg:32
|
||||
winfsp-tests-x86 --mountpoint=\\.\%cd%\mnt --resilient * +ea*
|
||||
winfsp-tests-x86 --mountpoint=\\.\%cd%\mnt --resilient * +ea* -exec*
|
||||
if !ERRORLEVEL! neq 0 goto fail
|
||||
reg delete HKLM\Software\WinFsp /v MountUseMountmgrFromFSD /f /reg:32
|
||||
exit /b 0
|
||||
|
@ -62,7 +62,8 @@ static NTSTATUS GetFileInfoInternal(HANDLE Handle, FSP_FSCTL_FILE_INFO *FileInfo
|
||||
FileInfo->LastAccessTime = ((PLARGE_INTEGER)&ByHandleFileInfo.ftLastAccessTime)->QuadPart;
|
||||
FileInfo->LastWriteTime = ((PLARGE_INTEGER)&ByHandleFileInfo.ftLastWriteTime)->QuadPart;
|
||||
FileInfo->ChangeTime = FileInfo->LastWriteTime;
|
||||
FileInfo->IndexNumber = 0;
|
||||
FileInfo->IndexNumber =
|
||||
((UINT64)ByHandleFileInfo.nFileIndexHigh << 32) | (UINT64)ByHandleFileInfo.nFileIndexLow;
|
||||
FileInfo->HardLinks = 0;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -158,7 +158,10 @@ static void posix_map_sid_test(void)
|
||||
|
||||
CloseHandle(Token);
|
||||
|
||||
for (size_t i = 0; sizeof map / sizeof map[0] > i; i++)
|
||||
size_t n = sizeof map / sizeof map[0];
|
||||
if (RunningInContainer)
|
||||
n -= 2; /* container: disable tests for "user manager\containeradministrator" */
|
||||
for (size_t i = 0; n > i; i++)
|
||||
{
|
||||
Success = ConvertStringSidToSidW(map[i].SidStr, &Sid0);
|
||||
ASSERT(Success);
|
||||
|
@ -254,8 +254,13 @@ static void volpath_mount_test(void)
|
||||
/*
|
||||
* This test does FspFileSystemSetMountPoint and therefore
|
||||
* cannot be used with --external or --mountpoint.
|
||||
*
|
||||
* Also the MountMgr appears to be buggy and fail with spurious
|
||||
* STATUS_NOT_SUPPORTED and STATUS_INVALID_PARAMETER error codes
|
||||
* under Windows Containers (at least with ServerCore 1909). So
|
||||
* disable if RunningInContainer.
|
||||
*/
|
||||
if (NtfsTests || OptMountPoint)
|
||||
if (NtfsTests || OptMountPoint || RunningInContainer)
|
||||
return;
|
||||
|
||||
if (WinFspDiskTests)
|
||||
@ -322,7 +327,12 @@ void volpath_tests(void)
|
||||
/*
|
||||
* This test does FspFileSystemSetMountPoint and therefore
|
||||
* cannot be used with --external or --mountpoint.
|
||||
*
|
||||
* Also the MountMgr appears to be buggy and fail with spurious
|
||||
* STATUS_NOT_SUPPORTED and STATUS_INVALID_PARAMETER error codes
|
||||
* under Windows Containers (at least with ServerCore 1909). So
|
||||
* disable if RunningInContainer.
|
||||
*/
|
||||
if (!NtfsTests && !OptMountPoint)
|
||||
if (!NtfsTests && !OptMountPoint && !RunningInContainer)
|
||||
TEST(volpath_mount_test);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
int NtfsTests = 0;
|
||||
int WinFspDiskTests = 1;
|
||||
int WinFspNetTests = 1;
|
||||
int RunningInContainer = 0;
|
||||
|
||||
BOOLEAN OptExternal = FALSE;
|
||||
BOOLEAN OptFuseExternal = FALSE;
|
||||
@ -258,6 +259,12 @@ int main(int argc, char *argv[])
|
||||
if (0 == getenv("WINFSP_TESTS_EXCEPTION_FILTER_DISABLE"))
|
||||
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
|
||||
|
||||
RunningInContainer = ERROR_SUCCESS == RegGetValueW(
|
||||
HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control",
|
||||
L"ContainerType",
|
||||
RRF_RT_REG_DWORD, 0,
|
||||
0, 0);
|
||||
|
||||
for (int argi = 1; argc > argi; argi++)
|
||||
{
|
||||
const char *a = argv[argi];
|
||||
@ -266,6 +273,7 @@ int main(int argc, char *argv[])
|
||||
if (0 == strcmp("--ntfs", a) || 0 == strcmp("--external", a))
|
||||
{
|
||||
OptExternal = TRUE;
|
||||
OptFuseExternal = FALSE;
|
||||
NtfsTests = 1;
|
||||
WinFspDiskTests = 0;
|
||||
WinFspNetTests = 0;
|
||||
@ -404,6 +412,10 @@ int main(int argc, char *argv[])
|
||||
if (!NtfsTests && OptShareName)
|
||||
ABORT("option --share requires --ntfs/--external");
|
||||
|
||||
if (RunningInContainer)
|
||||
/* container: disable network file system tests */
|
||||
WinFspNetTests = 0;
|
||||
|
||||
DisableBackupRestorePrivileges();
|
||||
|
||||
AddNetShareIfNeeded();
|
||||
|
@ -213,6 +213,7 @@ VOID GetTestDirectoryEx(PWSTR DirBuf, ULONG DirBufSize, PWSTR DriveBuf);
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
extern int RunningInContainer;
|
||||
|
||||
extern BOOLEAN OptExternal;
|
||||
extern BOOLEAN OptFuseExternal;
|
||||
|
Reference in New Issue
Block a user