mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-03 09:22:57 -05:00
Merge branch 'pvt-reject-irp'
This commit is contained in:
@ -273,6 +273,11 @@ static DWORD WINAPI FspFileSystemDispatcherThread(PVOID FileSystem0)
|
||||
OperationContext.Response = Response;
|
||||
TlsSetValue(FspFileSystemTlsKey, &OperationContext);
|
||||
|
||||
Result = FspFsctlTransact(FileSystem->VolumeHandle, 0, 0, 0, 0, FALSE);
|
||||
/* send a Transact0 to inform the FSD that the dispatcher is ready */
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
|
||||
memset(Response, 0, sizeof *Response);
|
||||
for (;;)
|
||||
{
|
||||
|
@ -284,6 +284,11 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(FSP_DEVICE_REJECT_EARLY_IRP)
|
||||
if (!FspFsvolDeviceReadyToAcceptIrp(FsvolDeviceObject))
|
||||
return STATUS_CANCELLED;
|
||||
#endif
|
||||
|
||||
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
|
||||
ULONG CreateDisposition = (IrpSp->Parameters.Create.Options >> 24) & 0xff;
|
||||
ULONG CreateOptions = IrpSp->Parameters.Create.Options;
|
||||
|
@ -1028,6 +1028,7 @@ NTSTATUS FspStatisticsCopy(FSP_STATISTICS *Statistics, PVOID Buffer, PULONG PLen
|
||||
#define FspStatisticsAdd(S,F,V) ((S)->F += (V))
|
||||
|
||||
/* device management */
|
||||
#define FSP_DEVICE_REJECT_EARLY_IRP
|
||||
enum
|
||||
{
|
||||
FspFsvolDeviceSecurityCacheCapacity = 100,
|
||||
@ -1082,6 +1083,9 @@ typedef struct
|
||||
FSP_FSEXT_PROVIDER *Provider;
|
||||
UNICODE_STRING VolumePrefix;
|
||||
UNICODE_PREFIX_TABLE_ENTRY VolumePrefixEntry;
|
||||
#if defined(FSP_DEVICE_REJECT_EARLY_IRP)
|
||||
LONG ReadyToAcceptIrp;
|
||||
#endif
|
||||
FSP_IOQ *Ioq;
|
||||
FSP_META_CACHE *SecurityCache;
|
||||
FSP_META_CACHE *DirInfoCache;
|
||||
@ -1181,6 +1185,24 @@ VOID FspFsvolDeviceGetVolumeInfo(PDEVICE_OBJECT DeviceObject, FSP_FSCTL_VOLUME_I
|
||||
BOOLEAN FspFsvolDeviceTryGetVolumeInfo(PDEVICE_OBJECT DeviceObject, FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
VOID FspFsvolDeviceSetVolumeInfo(PDEVICE_OBJECT DeviceObject, const FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
VOID FspFsvolDeviceInvalidateVolumeInfo(PDEVICE_OBJECT DeviceObject);
|
||||
#if defined(FSP_DEVICE_REJECT_EARLY_IRP)
|
||||
static inline
|
||||
BOOLEAN FspFsvolDeviceReadyToAcceptIrp(PDEVICE_OBJECT DeviceObject)
|
||||
{
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||
if (!FsvolDeviceExtension->VolumeParams.RejectIrpPriorToTransact0)
|
||||
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.RejectIrpPriorToTransact0)
|
||||
return;
|
||||
InterlockedExchange(&FsvolDeviceExtension->ReadyToAcceptIrp, 1);
|
||||
}
|
||||
#endif
|
||||
static inline
|
||||
BOOLEAN FspFsvolDeviceVolumePrefixInString(PDEVICE_OBJECT DeviceObject, PUNICODE_STRING String)
|
||||
{
|
||||
|
@ -286,6 +286,11 @@ static NTSTATUS FspFsvolQueryVolumeInformation(
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
#if defined(FSP_DEVICE_REJECT_EARLY_IRP)
|
||||
if (!FspFsvolDeviceReadyToAcceptIrp(FsvolDeviceObject))
|
||||
return STATUS_CANCELLED;
|
||||
#endif
|
||||
|
||||
NTSTATUS Result;
|
||||
PUINT8 Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
PUINT8 BufferEnd = Buffer + IrpSp->Parameters.QueryVolume.Length;
|
||||
@ -414,6 +419,11 @@ static NTSTATUS FspFsvolSetVolumeInformation(
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
#if defined(FSP_DEVICE_REJECT_EARLY_IRP)
|
||||
if (!FspFsvolDeviceReadyToAcceptIrp(FsvolDeviceObject))
|
||||
return STATUS_CANCELLED;
|
||||
#endif
|
||||
|
||||
NTSTATUS Result;
|
||||
FS_INFORMATION_CLASS FsInformationClass = IrpSp->Parameters.SetVolume.FsInformationClass;
|
||||
PVOID Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
@ -277,6 +277,10 @@ static NTSTATUS FspVolumeCreateNoLock(
|
||||
RtlInitEmptyUnicodeString(&FsvolDeviceExtension->VolumeName,
|
||||
FsvolDeviceExtension->VolumeNameBuf, sizeof FsvolDeviceExtension->VolumeNameBuf);
|
||||
RtlCopyUnicodeString(&FsvolDeviceExtension->VolumeName, &VolumeName);
|
||||
#if defined(FSP_DEVICE_REJECT_EARLY_IRP)
|
||||
if (!FsvolDeviceExtension->VolumeParams.RejectIrpPriorToTransact0)
|
||||
FsvolDeviceExtension->ReadyToAcceptIrp = 1;
|
||||
#endif
|
||||
Result = FspDeviceInitialize(FsvolDeviceObject);
|
||||
if (NT_SUCCESS(Result))
|
||||
{
|
||||
@ -767,6 +771,11 @@ NTSTATUS FspVolumeTransact(
|
||||
if (!FspDeviceReference(FsvolDeviceObject))
|
||||
return STATUS_CANCELLED;
|
||||
|
||||
#if defined(FSP_DEVICE_REJECT_EARLY_IRP)
|
||||
if (0 == InputBufferLength && 0 == OutputBufferLength)
|
||||
FspFsvolDeviceSetReadyToAcceptIrp(FsvolDeviceObject);
|
||||
#endif
|
||||
|
||||
NTSTATUS Result;
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
|
||||
PUINT8 BufferEnd;
|
||||
|
Reference in New Issue
Block a user