Compare commits

..

26 Commits

Author SHA1 Message Date
c61679a35d tools: build.bat: make cab file from unsigned drivers 2022-12-05 13:06:18 +00:00
619e41a18e changelog: update for v1.12.22335 2022-12-01 11:09:58 +00:00
80fa156e7b tools: build.bat: remove SHA1 signatures 2022-12-01 10:59:48 +00:00
e1b2e77df0 build: version: 2022.2 2022-10-18 12:19:36 +01:00
4783902d1d tools: make-release.ps1 2022-10-12 16:57:43 +01:00
4cd2b8c612 tools: make-release.ps1 2022-10-12 16:35:40 +01:00
dacaff41e4 changelog: update for v1.12B2 2022-10-12 15:33:18 +01:00
be27a82879 dll: FspCreateDirectoryFileW
On Windows/ARM64 CreateFileW is no longer able to create directories
using the flags FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_POSIX_SEMANTICS.
The new FspCreateDirectoryFileW implements the same semantics and replaces
the previous CreateFileW call.
2022-10-07 11:47:25 +01:00
b9ca46694e sys: FspFileNodeRenameCheck: fix handle oplock break 2022-10-04 15:44:27 +01:00
e50d7adc50 tools: run-tests: retire some tests
Retire some tests that are no longer useful.
This should shorten CI time considerably.
2022-10-04 13:44:31 +01:00
7f73192f8d sys: FspVolumeCreate
If we have an fsvrt device, mount it 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.
2022-10-02 20:10:32 +01:00
d71049225e sys: FSP_DEVICE_EXTENSION: remove unused SiloContainerId 2022-10-02 17:35:07 +01:00
c15006cce8 appveyor: silo testing 2022-09-28 19:06:16 +01:00
53b44dcb5c tst: winfsp-tests: silo testing 2022-09-28 18:46:17 +01:00
a3765d6360 sys: silo: FspSiloPostInitialize 2022-09-27 19:55:08 +01:00
6c6dd8abcc tools: run-tests: disable exec tests for mountmgr 2022-09-26 17:51:05 +01:00
16dd729fc7 tools: run-tests: disable exec tests for mountmgr 2022-09-26 17:50:19 +01:00
a2d49a1ded build: version: 2022.2 Beta2 2022-09-26 17:35:57 +01:00
9ede097e73 changelog: update for v1.12B2 2022-09-26 17:34:36 +01:00
2c3800077f tst: passthrough: GetFileInfoInternal: fix IndexNumber 2022-09-26 17:26:25 +01:00
84b3f98d38 Merge branch 'pvt-fuse-mountmgr' 2022-09-26 17:01:35 +01:00
16734bf37a Merge pull request #450 from chyyran/patch-doc-add-winfsp-rs
doc: Add winfsp-rs to file system libraries
2022-09-26 15:31:26 +01:00
ea189c5b68 dll: fuse: fix mountmgr directory mount points under Cygwin 2022-09-26 15:26:34 +01:00
7735506cc7 legal: add Ronny Chan to contributors 2022-09-25 22:14:11 -04:00
ca3170c293 doc: Add winfsp-rs to file system libraries 2022-09-25 22:09:40 -04:00
ba13995d10 update changelog 2022-09-14 12:26:40 +01:00
24 changed files with 749 additions and 67 deletions

View File

@ -1,7 +1,56 @@
# Changelog
## v1.12B1 (2022.2)
## v1.12.22339 (2022.2 Update1)
*Note: This release (`v1.12.22339`) is the same as the previous release (`v1.12`) except that: (1) the kernel-mode drivers are now digitally signed only with the Microsoft Attestation signature, and that: (2) no release assets are digitally signed with SHA-1. (This change was necessary to fix a problem in older versions of Windows such as Windows 7.)*
- [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.12 (2022.2)
- [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.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.

View File

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

View File

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

View File

@ -20,8 +20,8 @@
<MyCanonicalVersion>1.12</MyCanonicalVersion>
<MyProductVersion>2022.2 Beta1</MyProductVersion>
<MyProductStage>Beta</MyProductStage>
<MyProductVersion>2022.2</MyProductVersion>
<MyProductStage>Gold</MyProductStage>
<MyCrossCert>DigiCertGlobalG3CodeSigningECCSHA3842021CA1.cer</MyCrossCert>
<MyCertIssuer>DigiCert</MyCertIssuer>

View File

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

View File

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

View File

@ -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') ||

View File

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

View File

@ -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());

View File

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

View File

@ -150,6 +150,10 @@ NTSTATUS DriverEntry(
goto exit;
InitDoneDevices = TRUE;
Result = FspSiloPostInitialize();
if (!NT_SUCCESS(Result))
goto exit;
Result = STATUS_SUCCESS;
exit:

View File

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

View File

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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -78,13 +78,19 @@ if X%SignedPackage%==X (
launchctl-a64.exe launchctl-x64.exe launchctl-x86.exe^
fsptool-a64.exe fsptool-x64.exe fsptool-x86.exe^
memfs-a64.exe memfs-x64.exe memfs-x86.exe memfs-dotnet-msil.exe
signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha1 /t http://timestamp.digicert.com !signfiles!
if errorlevel 1 set /a signfail=signfail+1
signtool sign /as /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 !signfiles!
signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 !signfiles!
if errorlevel 1 set /a signfail=signfail+1
popd
pushd build\%Configuration%
mkdir unsigned
for %%f in (!signfiles!) do (
copy "%%f" unsigned >nul
)
pushd unsigned
signtool remove /q /s !signfiles!
if errorlevel 1 set /a signfail=signfail+1
popd
echo .OPTION EXPLICIT >driver.ddf
echo .Set CabinetFileCountThreshold=0 >>driver.ddf
echo .Set FolderFileCountThreshold=0 >>driver.ddf
@ -99,13 +105,13 @@ if X%SignedPackage%==X (
echo .Set DiskDirectory1=. >>driver.ddf
echo .Set DestinationDir=a64 >>driver.ddf
echo driver-a64.inf >>driver.ddf
echo %MyProductFileName%-a64.sys >>driver.ddf
echo unsigned\%MyProductFileName%-a64.sys >>driver.ddf
echo .Set DestinationDir=x64 >>driver.ddf
echo driver-x64.inf >>driver.ddf
echo %MyProductFileName%-x64.sys >>driver.ddf
echo unsigned\%MyProductFileName%-x64.sys >>driver.ddf
echo .Set DestinationDir=x86 >>driver.ddf
echo driver-x86.inf >>driver.ddf
echo %MyProductFileName%-x86.sys >>driver.ddf
echo unsigned\%MyProductFileName%-x86.sys >>driver.ddf
makecab /F driver.ddf
signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 driver.cab
if errorlevel 1 set /a signfail=signfail+1
@ -116,10 +122,8 @@ devenv winfsp.sln /build "Installer.%Configuration%|x86"
if errorlevel 1 goto fail
for %%f in (build\%Configuration%\%MyProductFileName%-*.msi) do (
signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha1 /t http://timestamp.digicert.com /d %MsiName% %%f
signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d %MsiName% %%f
if errorlevel 1 set /a signfail=signfail+1
REM signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d %MsiName% %%f
REM if errorlevel 1 set /a signfail=signfail+1
)
if not %signfail%==0 echo SIGNING FAILED! The product has been successfully built, but not signed.

View File

@ -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!] == [\] (

341
tools/make-release.ps1 Normal file
View File

@ -0,0 +1,341 @@
param (
[string]$StateFile = "release.state"
)
function Write-Stdout ($Message) {
[System.Console]::WriteLine($Message)
}
function Write-Stderr ($Message) {
[System.Console]::Error.WriteLine($Message)
}
function Git-Describe {
$GitDesc = git describe --long --dirty
if ($GitDesc -match "^(.+)-([0-9]+)-g([0-9A-Fa-f]+)-?(dirty)?$") {
$matches[1]
$matches[2]
$matches[3]
$matches[4]
}
}
function Git-Dirty {
$Dirty = $False
git status --porcelain=v2 2>$null | ForEach-Object {
$Dirty = $True
}
return $Dirty
}
function Git-LogGrep ($Tag) {
git log -n 1 --grep $Tag
}
function Get-ReleaseInfo ($Tag) {
$Found = 0
$ReleaseInfo = [PSCustomObject]@{
Tag = ""
ProductVersion = ""
Prerelease = $False
PreviousTag = ""
PreviousProductVersion = ""
Text = @()
}
foreach ($Line in Get-Content "$ProjectRoot\Changelog.md") {
if ($Line -match "^## (v[^ ]+) *\(([^)]+)\)") {
if ($Found) {
$Found = 2
$PreviousTag = $matches[1]
$PreviousProductVersion = $matches[2]
if ($PreviousTag -match "^v[0-9.]+$") {
$ReleaseInfo.PreviousTag = $PreviousTag
$ReleaseInfo.PreviousProductVersion = $PreviousProductVersion
break
}
} elseif ($Tag -eq $matches[1]) {
$Found = 1
$ReleaseInfo.Tag = $matches[1]
$ReleaseInfo.ProductVersion = $matches[2]
$ReleaseInfo.Prerelease = !($ReleaseInfo.Tag -match "^v[0-9.]+$")
}
} elseif (1 -eq $Found) {
$ReleaseInfo.Text += $Line
}
}
if ($Found) {
return $ReleaseInfo
}
}
function Get-FileVersion ($FileName) {
return [System.Diagnostics.FileVersionInfo]::GetVersionInfo($FileName).FileVersion
}
function Task ($ScriptBlock) {
$Name = (Get-PSCallStack)[1].FunctionName
if ($State -contains $Name) {
return
}
Write-Stdout $Name
Invoke-Command -ScriptBlock $ScriptBlock
Write-Stdout "$Name COMPLETE"
Add-Content $StateFile -Value $Name
exit 0
}
function Check-Prerequisites {
$Name = (Get-PSCallStack)[0].FunctionName
# check git.exe
if (!(Get-Command "git.exe" -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find git.exe"
exit 1
}
# check gh.exe
if (!(Get-Command "gh.exe" -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find gh.exe"
exit 1
}
# check choco.exe
if (!(Get-Command "choco.exe" -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find choco.exe"
exit 1
}
# check git tag
$Tag, $CommitCount, $Commit, $_ = Git-Describe
if ("0" -ne $CommitCount) {
Write-Stderr "error: cannot find clean git tag"
exit 1
}
# check release info
$script:ReleaseInfo = Get-ReleaseInfo $Tag
if (!$script:ReleaseInfo) {
Write-Stderr "error: cannot get release info for tag $Tag"
exit 1
}
# check winfsp.sym
if (!(Test-Path "$ProjectRoot\..\winfsp.sym" -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find winfsp.sym repository"
exit 1
}
# check winfsp.sym git status
Push-Location "$ProjectRoot\..\winfsp.sym"
$SymDirty = Git-Dirty
Pop-Location
if ($SymDirty) {
Write-Stderr "error: winfsp.sym repository is dirty"
exit 1
}
if ($State -contains $Name) {
if (!($State -contains "$Tag-$CommitCount-g$Commit")) {
Write-Stderr "error: invalid state for tag $Tag"
exit 1
}
} else {
Add-Content $StateFile -Value $Name
Add-Content $StateFile -Value "$Tag-$CommitCount-g$Commit"
}
}
function Check-Assets {
# check winfsp.msi
if (!(Test-Path "$ProjectRoot\build\VStudio\build\Release\winfsp*.msi" -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find winfsp*.msi"
exit 1
}
# check winfsp-tests.zip
if (!(Test-Path "$ProjectRoot\build\VStudio\build\Release\winfsp-tests*.zip" -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find winfsp-tests*.zip"
exit 1
}
# check winfsp.nupkg
if (!(Test-Path "$ProjectRoot\build\VStudio\build\Release\winfsp*.nupkg" -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find winfsp*.nupkg"
exit 1
}
# check winfsp signature
if ("Valid" -ne (Get-AuthenticodeSignature "$ProjectRoot\build\VStudio\build\Release\winfsp-x64.sys" -ErrorAction SilentlyContinue).Status) {
Write-Stderr "error: invalid winfsp signature"
exit 1
}
}
function Build-AssetsPhase1 {
Task -ScriptBlock {
Push-Location "$ProjectRoot"
tools\build.bat Release
if ($LastExitCode -ne 0) {
Write-Stderr "error: cannot build assets"
exit 1
}
Pop-Location
Write-Stdout @"
Upload file driver.cab to Microsoft Partner Center for attestation signing.
When the file has been signed, download and extract to ~\Downloads\drivers
"@
}
}
function Build-AssetsPhase2 {
Task -ScriptBlock {
Check-Assets
# check signed drivers folder
if (!(Test-Path ~\Downloads\drivers -ErrorAction SilentlyContinue)) {
Write-Stderr "error: cannot find ~\Downloads\drivers"
exit 1
}
$SignedPackage = Resolve-Path ~\Downloads\drivers
$VerX64 = Get-FileVersion "$ProjectRoot\build\VStudio\build\Release\winfsp-x64.sys"
if ($VerX64 -ne (Get-FileVersion "$SignedPackage\x64\winfsp-x64.sys")) {
Write-Stderr "error: incompatible versions in ~\Downloads\drivers"
exit 1
}
Push-Location "$ProjectRoot"
tools\build.bat Release $SignedPackage
if ($LastExitCode -ne 0) {
Write-Stderr "error: cannot build assets"
exit 1
}
Pop-Location
Write-Stdout @"
Assets have been built and signed. You may want to perform some smoke testing.
"@
}
}
function Make-GitHubRelease {
Task -ScriptBlock {
Check-Assets
if ((Resolve-Path "$ProjectRoot\build\VStudio\build\Release\winfsp*.msi") -match "\\winfsp-(.+)\.msi") {
$Version = $matches[1]
}
$DownloadColor = "blue"
$PrereleaseOpt = ""
if ($ReleaseInfo.Prerelease) {
$DownloadColor = "e52e4b"
$PrereleaseOpt = "-p"
}
$ReleaseNotes = @"
[![Download WinFsp](https://img.shields.io/badge/-Download%20WinFsp-$DownloadColor.svg?style=for-the-badge&labelColor=grey&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0ODAgNDgwIj48cGF0aCBkPSJNMzg3LjAwMiAyMDEuMDAxQzM3Mi45OTggMTMyLjAwMiAzMTIuOTk4IDgwIDI0MCA4MGMtNTcuOTk4IDAtMTA3Ljk5OCAzMi45OTgtMTMyLjk5OCA4MS4wMDFDNDcuMDAyIDE2Ny4wMDIgMCAyMTcuOTk4IDAgMjgwYzAgNjUuOTk2IDUzLjk5OSAxMjAgMTIwIDEyMGgyNjBjNTUgMCAxMDAtNDUgMTAwLTEwMCAwLTUyLjk5OC00MC45OTYtOTYuMDAxLTkyLjk5OC05OC45OTl6TTIwOCAyNTJ2LTc2aDY0djc2aDY4TDI0MCAzNTIgMTQwIDI1Mmg2OHoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=)](https://github.com/billziss-gh/winfsp/releases/download/$($ReleaseInfo.Tag)/winfsp-$Version.msi)
[VirusTotal Scan Results]()
## CHANGES SINCE WINFSP $($ReleaseInfo.PreviousProductVersion)
$($ReleaseInfo.Text -join "`n")
"@
gh release create $ReleaseInfo.Tag --draft --title "WinFsp $($ReleaseInfo.ProductVersion)" --notes "$ReleaseNotes" $PrereleaseOpt (Resolve-Path "$ProjectRoot\build\VStudio\build\Release\winfsp*.msi") (Resolve-Path "$ProjectRoot\build\VStudio\build\Release\winfsp-tests*.zip")
if ($LastExitCode -ne 0) {
Write-Stderr "error: cannot create GitHub release"
exit 1
}
Write-Stdout @"
Draft GitHub release for tag $($ReleaseInfo.Tag) has been created.
Publish the release on GitHub and update the VirusTotal link.
"@
}
}
function Upload-Symbols {
Task -ScriptBlock {
Check-Assets
# check winfsp.sym git log
Push-Location "$ProjectRoot\..\winfsp.sym"
$SymHasTag = Git-LogGrep $ReleaseInfo.Tag
Pop-Location
if ($SymHasTag) {
Write-Stderr "warning: winfsp.sym repository already has commit for tag $($ReleaseInfo.Tag)"
} else {
Push-Location "$ProjectRoot\..\winfsp.sym"
.\tools\symadd.ps1 ..\winfsp\build\VStudio\build\Release -PdbKind Private
if ($LastExitCode -ne 0) {
Write-Stderr "error: cannot add files to winfsp.sym repository"
exit 1
}
git add .
if ($LastExitCode -ne 0) {
Write-Stderr "error: cannot add files to winfsp.sym repository staging area"
exit 1
}
git commit -m $ReleaseInfo.Tag
if ($LastExitCode -ne 0) {
Write-Stderr "error: cannot commit files to winfsp.sym repository"
exit 1
}
Pop-Location
Write-Stdout @"
Commit for $($ReleaseInfo.Tag) symbols has been created.
Push the winfsp.sym repository to GitHub.
"@
}
}
}
function Make-ChocoRelease {
Task -ScriptBlock {
Check-Assets
Push-Location "$ProjectRoot\build\VStudio\build\Release"
choco push
if ($LastExitCode -ne 0) {
Write-Stderr "error: cannot push to Chocolatey"
exit 1
}
Pop-Location
Write-Stdout @"
Chocolatey release for $($ReleaseInfo.Tag) has been pushed.
"@
}
}
$ProjectRoot = Split-Path $PSScriptRoot
$StateFile = Join-Path $pwd $StateFile
Write-Stdout "Using state file $StateFile"
$State = @(Get-Content $StateFile -ErrorAction Ignore)
Check-Prerequisites
# Workflow tasks
Build-AssetsPhase1
Build-AssetsPhase2
Make-GitHubRelease
Upload-Symbols
Make-ChocoRelease

View File

@ -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,19 +123,24 @@ set opt_tests=^
set tests=
for %%f in (%dfl_tests%) do (
if X%2==X (
set tests=!tests! %%f
) else (
set test=%%f
if "X%2!test:%2=!"=="X!test!" set tests=!tests! %%f
set test=%%f
if NOT "XRETIRED-!test:RETIRED-=!"=="X!test!" (
if X%2==X (
set tests=!tests! %%f
) else (
if "X%2!test:%2=!"=="X!test!" set tests=!tests! %%f
)
)
)
for %%f in (%opt_tests%) do (
if X%2==X (
rem
) else (
set test=%%f
if "X%2!test:%2=!"=="X!test!" set tests=!tests! %%f
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
)
)
)
@ -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

View File

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

View File

@ -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);

View File

@ -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);
}

View File

@ -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();

View File

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