mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 17:32:29 -05:00
sys: WIP
This commit is contained in:
parent
869793ea69
commit
2d98e2a42d
@ -32,4 +32,30 @@ extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid =
|
|||||||
#define FSP_FSCTL_CREATE_BUFFER_SIZE 64
|
#define FSP_FSCTL_CREATE_BUFFER_SIZE 64
|
||||||
#define FSP_FSCTL_TRANSACT_BUFFER_SIZE 4096
|
#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;
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,10 +100,11 @@ static NTSTATUS FspFsvrtDeleteVolume(
|
|||||||
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
|
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
|
||||||
{
|
{
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
FSP_FSVRT_DEVICE_EXTENSION *FsvrtDeviceExtension = FspFsvrtDeviceExtension(DeviceObject);
|
||||||
|
|
||||||
|
/* access check */
|
||||||
Result = FspSecuritySubjectContextAccessCheck(
|
Result = FspSecuritySubjectContextAccessCheck(
|
||||||
FspFsvrtDeviceExtension(DeviceObject)->SecurityDescriptorBuf,
|
FsvrtDeviceExtension->SecurityDescriptorBuf, FILE_WRITE_DATA, Irp->RequestorMode);
|
||||||
FILE_WRITE_DATA, Irp->RequestorMode);
|
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
@ -113,12 +114,21 @@ static NTSTATUS FspFsvrtDeleteVolume(
|
|||||||
static NTSTATUS FspFsvrtTransact(
|
static NTSTATUS FspFsvrtTransact(
|
||||||
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
|
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)
|
||||||
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
|
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
|
FSP_FSVRT_DEVICE_EXTENSION *FsvrtDeviceExtension = FspFsvrtDeviceExtension(DeviceObject);
|
||||||
|
|
||||||
/* access check */
|
/* access check */
|
||||||
Result = FspSecuritySubjectContextAccessCheck(
|
Result = FspSecuritySubjectContextAccessCheck(
|
||||||
FspFsvrtDeviceExtension(DeviceObject)->SecurityDescriptorBuf,
|
FsvrtDeviceExtension->SecurityDescriptorBuf, FILE_WRITE_DATA, Irp->RequestorMode);
|
||||||
FILE_WRITE_DATA, Irp->RequestorMode);
|
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user