diff --git a/inc/winfsp/fsctl.h b/inc/winfsp/fsctl.h index d6d7b0a7..96a0d7bb 100644 --- a/inc/winfsp/fsctl.h +++ b/inc/winfsp/fsctl.h @@ -12,9 +12,9 @@ // {6F9D25FA-6DEE-4A9D-80F5-E98E14F35E54} extern const __declspec(selectany) GUID FspFsctlDeviceClassGuid = { 0x6f9d25fa, 0x6dee, 0x4a9d, { 0x80, 0xf5, 0xe9, 0x8e, 0x14, 0xf3, 0x5e, 0x54 } }; -// {B48171C3-DD50-4852-83A3-344C50D93B17} -extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid = - { 0xb48171c3, 0xdd50, 0x4852, { 0x83, 0xa3, 0x34, 0x4c, 0x50, 0xd9, 0x3b, 0x17 } }; +// {B48171C3-DD50-4852-83A3-344C50D93B17} +extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid = + { 0xb48171c3, 0xdd50, 0x4852, { 0x83, 0xa3, 0x34, 0x4c, 0x50, 0xd9, 0x3b, 0x17 } }; #define FSP_FSCTL_DISK_DEVICE_NAME "WinFsp.Disk" #define FSP_FSCTL_NET_DEVICE_NAME "WinFsp.Net" @@ -32,30 +32,30 @@ extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid = #define FSP_FSCTL_CREATE_BUFFER_SIZE 64 #define FSP_FSCTL_TRANSACT_BUFFER_SIZE 4096 -/* marshalling */ -#pragma warning(push) -#pragma warning(disable:4200) /* zero-sized array in struct/union */ -typedef struct -{ - ULONG Size; - UINT_PTR Hint; - UINT8 Kind; - union - { - UINT8 Placeholder; // !!!: REMOVE - } Req; -} FSP_TRANSACT_REQ; -typedef struct -{ - ULONG Size; - UINT_PTR Hint; - IO_STATUS_BLOCK IoStatus; - UINT8 Kind; - union - { - UINT8 Placeholder; // !!!: REMOVE - } Req; -} FSP_TRANSACT_RSP; +/* marshalling */ +#pragma warning(push) +#pragma warning(disable:4200) /* zero-sized array in struct/union */ +typedef struct +{ + ULONG Size; + UINT_PTR Hint; + UINT8 Kind; + union + { + UINT8 Placeholder; // !!!: REMOVE + } Req; +} FSP_TRANSACT_REQ; +typedef struct +{ + ULONG Size; + UINT_PTR Hint; + IO_STATUS_BLOCK IoStatus; + UINT8 Kind; + union + { + UINT8 Placeholder; // !!!: REMOVE + } Req; +} FSP_TRANSACT_RSP; #pragma warning(pop) #endif diff --git a/src/sys/driver.h b/src/sys/driver.h index cb2b45b3..09dffdbc 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -81,9 +81,9 @@ !NT_SUCCESS(Result) ? 0 : Irp->IoStatus.Information);\ if (STATUS_PENDING == Result) \ { \ - if (0 == (IrpSp->Control & SL_PENDING_RETURNED))\ - { \ - /* if the IRP has not been marked pending already */\ + if (0 == (IrpSp->Control & SL_PENDING_RETURNED))\ + { \ + /* if the IRP has not been marked pending already */\ ASSERT(FspFsvolDeviceExtensionKind == FspDeviceExtension(DeviceObject)->Kind);\ FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension =\ FspFsvolDeviceExtension(DeviceObject);\ diff --git a/src/sys/fsctl.c b/src/sys/fsctl.c index c4fe4afb..cf49bf9b 100644 --- a/src/sys/fsctl.c +++ b/src/sys/fsctl.c @@ -114,13 +114,13 @@ static NTSTATUS FspFsvrtDeleteVolume( static NTSTATUS FspFsvrtTransact( PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp) { - /* check parameters */ - ULONG InputBufferLength = IrpSp->Parameters.FileSystemControl.InputBufferLength; - ULONG OutputBufferLength = IrpSp->Parameters.FileSystemControl.OutputBufferLength; - PVOID SystemBuffer = Irp->AssociatedIrp.SystemBuffer; - if (sizeof(FSP_TRANSACT_RSP) > InputBufferLength || 0 == SystemBuffer) - return STATUS_INVALID_PARAMETER; - if (FSP_FSCTL_TRANSACT_BUFFER_SIZE > OutputBufferLength) + /* check parameters */ + ULONG InputBufferLength = IrpSp->Parameters.FileSystemControl.InputBufferLength; + ULONG OutputBufferLength = IrpSp->Parameters.FileSystemControl.OutputBufferLength; + PVOID SystemBuffer = Irp->AssociatedIrp.SystemBuffer; + if (sizeof(FSP_TRANSACT_RSP) > InputBufferLength || 0 == SystemBuffer) + return STATUS_INVALID_PARAMETER; + if (FSP_FSCTL_TRANSACT_BUFFER_SIZE > OutputBufferLength) return STATUS_BUFFER_TOO_SMALL; NTSTATUS Result; @@ -135,24 +135,24 @@ static NTSTATUS FspFsvrtTransact( if (!NT_SUCCESS(Result)) return Result; - /* process any user-mode file system responses */ - Response = SystemBuffer; - SystemBufferEnd = (PUINT8)SystemBuffer + InputBufferLength; - for (;;) - { - if ((PUINT8)Response + sizeof(Response->Size) > SystemBufferEnd || - sizeof(FSP_TRANSACT_RSP) > Response->Size || - (PUINT8)Response + Response->Size > SystemBufferEnd) - break; - - ProcessIrp = FspIoqEndProcessingIrp(&FsvrtDeviceExtension->Ioq, Response->Hint); - if (0 == ProcessIrp) - /* either IRP was canceled or a bogus IrpHint was provided */ - continue; - - //FspDispatchProcessedIrp(ProcessIrp, Response); - - Response = (PVOID)((PUINT8)Response + Response->Size); + /* process any user-mode file system responses */ + Response = SystemBuffer; + SystemBufferEnd = (PUINT8)SystemBuffer + InputBufferLength; + for (;;) + { + if ((PUINT8)Response + sizeof(Response->Size) > SystemBufferEnd || + sizeof(FSP_TRANSACT_RSP) > Response->Size || + (PUINT8)Response + Response->Size > SystemBufferEnd) + break; + + ProcessIrp = FspIoqEndProcessingIrp(&FsvrtDeviceExtension->Ioq, Response->Hint); + if (0 == ProcessIrp) + /* either IRP was canceled or a bogus IrpHint was provided */ + continue; + + //FspDispatchProcessedIrp(ProcessIrp, Response); + + Response = (PVOID)((PUINT8)Response + Response->Size); } if (FspIoqPostIrp(&FsvrtDeviceExtension->TransactIoq, Irp))