mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
inc,sys,tst: FSP_FSCTL_VOLUME_PARAMS::RejectIrpPriorToTransact
This commit is contained in:
parent
9e32fed598
commit
51350d5a42
@ -101,7 +101,7 @@
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>MEMFS_STANDALONE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
@ -117,7 +117,7 @@
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>MEMFS_STANDALONE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
@ -135,7 +135,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>MEMFS_STANDALONE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
@ -155,7 +155,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>MEMFS_STANDALONE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\..\src;..\..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
@ -176,7 +176,8 @@ enum
|
|||||||
UINT32 CasePreservedExtendedAttributes:1; /* preserve case of EA (default is UPPERCASE) */\
|
UINT32 CasePreservedExtendedAttributes:1; /* preserve case of EA (default is UPPERCASE) */\
|
||||||
UINT32 WslFeatures:1; /* support features required for WSLinux */\
|
UINT32 WslFeatures:1; /* support features required for WSLinux */\
|
||||||
UINT32 DirectoryMarkerAsNextOffset:1; /* directory marker is next offset instead of last name */\
|
UINT32 DirectoryMarkerAsNextOffset:1; /* directory marker is next offset instead of last name */\
|
||||||
UINT32 KmReservedFlags:4;\
|
UINT32 RejectIrpPriorToTransact:1; /* reject IRP's prior to first FSP_FSCTL_TRANSACT */\
|
||||||
|
UINT32 KmReservedFlags:3;\
|
||||||
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */\
|
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */\
|
||||||
WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];
|
WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];
|
||||||
#define FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN\
|
#define FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN\
|
||||||
|
@ -284,6 +284,9 @@ static NTSTATUS FspFsvolCreateNoLock(
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!FspFsvolDeviceReadyToAcceptIrp(FsvolDeviceObject))
|
||||||
|
return STATUS_CANCELLED;
|
||||||
|
|
||||||
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
|
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
|
||||||
ULONG CreateDisposition = (IrpSp->Parameters.Create.Options >> 24) & 0xff;
|
ULONG CreateDisposition = (IrpSp->Parameters.Create.Options >> 24) & 0xff;
|
||||||
ULONG CreateOptions = IrpSp->Parameters.Create.Options;
|
ULONG CreateOptions = IrpSp->Parameters.Create.Options;
|
||||||
|
@ -1082,6 +1082,7 @@ typedef struct
|
|||||||
FSP_FSEXT_PROVIDER *Provider;
|
FSP_FSEXT_PROVIDER *Provider;
|
||||||
UNICODE_STRING VolumePrefix;
|
UNICODE_STRING VolumePrefix;
|
||||||
UNICODE_PREFIX_TABLE_ENTRY VolumePrefixEntry;
|
UNICODE_PREFIX_TABLE_ENTRY VolumePrefixEntry;
|
||||||
|
LONG ReadyToAcceptIrp;
|
||||||
FSP_IOQ *Ioq;
|
FSP_IOQ *Ioq;
|
||||||
FSP_META_CACHE *SecurityCache;
|
FSP_META_CACHE *SecurityCache;
|
||||||
FSP_META_CACHE *DirInfoCache;
|
FSP_META_CACHE *DirInfoCache;
|
||||||
@ -1182,6 +1183,22 @@ BOOLEAN FspFsvolDeviceTryGetVolumeInfo(PDEVICE_OBJECT DeviceObject, FSP_FSCTL_VO
|
|||||||
VOID FspFsvolDeviceSetVolumeInfo(PDEVICE_OBJECT DeviceObject, const FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
VOID FspFsvolDeviceSetVolumeInfo(PDEVICE_OBJECT DeviceObject, const FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||||
VOID FspFsvolDeviceInvalidateVolumeInfo(PDEVICE_OBJECT DeviceObject);
|
VOID FspFsvolDeviceInvalidateVolumeInfo(PDEVICE_OBJECT DeviceObject);
|
||||||
static inline
|
static inline
|
||||||
|
BOOLEAN FspFsvolDeviceReadyToAcceptIrp(PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
|
if (!FsvolDeviceExtension->VolumeParams.RejectIrpPriorToTransact)
|
||||||
|
return TRUE;
|
||||||
|
return 0 != InterlockedCompareExchange(&FsvolDeviceExtension->ReadyToAcceptIrp, 0, 0);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
|
VOID FspFsvolDeviceSetReadyToAcceptIrp(PDEVICE_OBJECT DeviceObject)
|
||||||
|
{
|
||||||
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
|
if (!FsvolDeviceExtension->VolumeParams.RejectIrpPriorToTransact)
|
||||||
|
return;
|
||||||
|
InterlockedExchange(&FsvolDeviceExtension->ReadyToAcceptIrp, 1);
|
||||||
|
}
|
||||||
|
static inline
|
||||||
BOOLEAN FspFsvolDeviceVolumePrefixInString(PDEVICE_OBJECT DeviceObject, PUNICODE_STRING String)
|
BOOLEAN FspFsvolDeviceVolumePrefixInString(PDEVICE_OBJECT DeviceObject, PUNICODE_STRING String)
|
||||||
{
|
{
|
||||||
return RtlPrefixUnicodeString(&FspFsvolDeviceExtension(DeviceObject)->VolumePrefix, String,
|
return RtlPrefixUnicodeString(&FspFsvolDeviceExtension(DeviceObject)->VolumePrefix, String,
|
||||||
|
@ -286,6 +286,9 @@ static NTSTATUS FspFsvolQueryVolumeInformation(
|
|||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
if (!FspFsvolDeviceReadyToAcceptIrp(FsvolDeviceObject))
|
||||||
|
return STATUS_CANCELLED;
|
||||||
|
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
PUINT8 Buffer = Irp->AssociatedIrp.SystemBuffer;
|
PUINT8 Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||||
PUINT8 BufferEnd = Buffer + IrpSp->Parameters.QueryVolume.Length;
|
PUINT8 BufferEnd = Buffer + IrpSp->Parameters.QueryVolume.Length;
|
||||||
@ -414,6 +417,9 @@ static NTSTATUS FspFsvolSetVolumeInformation(
|
|||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
if (!FspFsvolDeviceReadyToAcceptIrp(FsvolDeviceObject))
|
||||||
|
return STATUS_CANCELLED;
|
||||||
|
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
FS_INFORMATION_CLASS FsInformationClass = IrpSp->Parameters.SetVolume.FsInformationClass;
|
FS_INFORMATION_CLASS FsInformationClass = IrpSp->Parameters.SetVolume.FsInformationClass;
|
||||||
PVOID Buffer = Irp->AssociatedIrp.SystemBuffer;
|
PVOID Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
@ -277,6 +277,8 @@ static NTSTATUS FspVolumeCreateNoLock(
|
|||||||
RtlInitEmptyUnicodeString(&FsvolDeviceExtension->VolumeName,
|
RtlInitEmptyUnicodeString(&FsvolDeviceExtension->VolumeName,
|
||||||
FsvolDeviceExtension->VolumeNameBuf, sizeof FsvolDeviceExtension->VolumeNameBuf);
|
FsvolDeviceExtension->VolumeNameBuf, sizeof FsvolDeviceExtension->VolumeNameBuf);
|
||||||
RtlCopyUnicodeString(&FsvolDeviceExtension->VolumeName, &VolumeName);
|
RtlCopyUnicodeString(&FsvolDeviceExtension->VolumeName, &VolumeName);
|
||||||
|
if (!FsvolDeviceExtension->VolumeParams.RejectIrpPriorToTransact)
|
||||||
|
FsvolDeviceExtension->ReadyToAcceptIrp = 1;
|
||||||
Result = FspDeviceInitialize(FsvolDeviceObject);
|
Result = FspDeviceInitialize(FsvolDeviceObject);
|
||||||
if (NT_SUCCESS(Result))
|
if (NT_SUCCESS(Result))
|
||||||
{
|
{
|
||||||
@ -767,6 +769,8 @@ NTSTATUS FspVolumeTransact(
|
|||||||
if (!FspDeviceReference(FsvolDeviceObject))
|
if (!FspDeviceReference(FsvolDeviceObject))
|
||||||
return STATUS_CANCELLED;
|
return STATUS_CANCELLED;
|
||||||
|
|
||||||
|
FspFsvolDeviceSetReadyToAcceptIrp(FsvolDeviceObject);
|
||||||
|
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
|
||||||
PUINT8 BufferEnd;
|
PUINT8 BufferEnd;
|
||||||
|
@ -34,6 +34,12 @@
|
|||||||
FSP_FSCTL_STATIC_ASSERT(MEMFS_MAX_PATH > MAX_PATH,
|
FSP_FSCTL_STATIC_ASSERT(MEMFS_MAX_PATH > MAX_PATH,
|
||||||
"MEMFS_MAX_PATH must be greater than MAX_PATH.");
|
"MEMFS_MAX_PATH must be greater than MAX_PATH.");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define the MEMFS_STANDALONE macro when building MEMFS as a standalone file system.
|
||||||
|
* This macro should be defined in the Visual Studio project settings, Makefile, etc.
|
||||||
|
*/
|
||||||
|
//#define MEMFS_STANDALONE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define the MEMFS_NAME_NORMALIZATION macro to include name normalization support.
|
* Define the MEMFS_NAME_NORMALIZATION macro to include name normalization support.
|
||||||
*/
|
*/
|
||||||
@ -74,7 +80,15 @@ FSP_FSCTL_STATIC_ASSERT(MEMFS_MAX_PATH > MAX_PATH,
|
|||||||
*/
|
*/
|
||||||
#define MEMFS_WSL
|
#define MEMFS_WSL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* Define the MEMFS_REJECT_EARLY_IRP macro to reject IRP's sent
|
||||||
|
* to the file system prior to FSP_FSCTL_TRANSACT.
|
||||||
|
*/
|
||||||
|
#if defined(MEMFS_STANDALONE)
|
||||||
|
#define MEMFS_REJECT_EARLY_IRP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
* Define the DEBUG_BUFFER_CHECK macro on Windows 8 or above. This includes
|
* Define the DEBUG_BUFFER_CHECK macro on Windows 8 or above. This includes
|
||||||
* a check for the Write buffer to ensure that it is read-only.
|
* a check for the Write buffer to ensure that it is read-only.
|
||||||
*
|
*
|
||||||
@ -2387,6 +2401,9 @@ NTSTATUS MemfsCreateFunnel(
|
|||||||
VolumeParams.WslFeatures = 1;
|
VolumeParams.WslFeatures = 1;
|
||||||
#endif
|
#endif
|
||||||
VolumeParams.AllowOpenInKernelMode = 1;
|
VolumeParams.AllowOpenInKernelMode = 1;
|
||||||
|
#if defined(MEMFS_REJECT_EARLY_IRP)
|
||||||
|
VolumeParams.RejectIrpPriorToTransact = 1;
|
||||||
|
#endif
|
||||||
if (0 != VolumePrefix)
|
if (0 != VolumePrefix)
|
||||||
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
|
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
|
||||||
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR),
|
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user