mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 00:13:01 -05:00
sys: fsext: FspFsextProviderTransact
This commit is contained in:
parent
3d9fc467ef
commit
39c189aff7
@ -53,6 +53,9 @@ typedef struct
|
||||
|
||||
FSP_DDI_DEF(NTSTATUS, FspFsextProviderRegister,
|
||||
FSP_FSEXT_PROVIDER *Provider)
|
||||
FSP_DDI_DEF(NTSTATUS, FspFsextProviderTransact,
|
||||
PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject,
|
||||
FSP_FSCTL_TRANSACT_RSP *Response, FSP_FSCTL_TRANSACT_REQ **PRequest)
|
||||
|
||||
FSP_DDI_DEF(NTSTATUS, FspPosixMapUidToSid,
|
||||
UINT32 Uid,
|
||||
|
Binary file not shown.
Binary file not shown.
@ -132,3 +132,56 @@ NTSTATUS FspFsextProviderRegister(FSP_FSEXT_PROVIDER *Provider)
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
NTSTATUS FspFsextProviderTransact(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject,
|
||||
FSP_FSCTL_TRANSACT_RSP *Response, FSP_FSCTL_TRANSACT_REQ **PRequest)
|
||||
{
|
||||
/*
|
||||
* This function uses IoBuildDeviceIoControlRequest to build an IRP and then send it
|
||||
* to the WinFsp driver. IoBuildDeviceIoControlRequest places the IRP in the IRP queue
|
||||
* thus allowing it to be cancelled with CancelSynchronousIo.
|
||||
*
|
||||
* Special kernel APC's must be enabled:
|
||||
* See https://www.osr.com/blog/2018/02/14/beware-iobuilddeviceiocontrolrequest/
|
||||
*/
|
||||
ASSERT(!KeAreAllApcsDisabled());
|
||||
|
||||
NTSTATUS Result;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
|
||||
if (0 != PRequest)
|
||||
*PRequest = 0;
|
||||
|
||||
if (0 == DeviceObject)
|
||||
DeviceObject = IoGetRelatedDeviceObject(FileObject);
|
||||
|
||||
Irp = IoBuildDeviceIoControlRequest(FSP_FSCTL_TRANSACT_INTERNAL,
|
||||
DeviceObject,
|
||||
Response,
|
||||
0 != Response ? Response->Size : 0,
|
||||
PRequest,
|
||||
0 != PRequest ? sizeof(PVOID) : 0,
|
||||
FALSE,
|
||||
0,
|
||||
&IoStatus);
|
||||
if (0 == Irp)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/*
|
||||
* IoBuildDeviceIoControlRequest builds an IOCTL IRP without a FileObject.
|
||||
* Patch it so that it is an FSCTL IRP with a FileObject. Mark it as
|
||||
* IRP_SYNCHRONOUS_API so that CancelSynchronousIo can cancel it.
|
||||
*/
|
||||
Irp->Flags |= IRP_SYNCHRONOUS_API;
|
||||
IrpSp = IoGetNextIrpStackLocation(Irp);
|
||||
IrpSp->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
|
||||
IrpSp->MinorFunction = IRP_MN_USER_FS_REQUEST;
|
||||
IrpSp->FileObject = FileObject;
|
||||
|
||||
Result = IoCallDriver(DeviceObject, Irp);
|
||||
ASSERT(STATUS_PENDING != Result);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
0
tools/build-sample.bat
Normal file → Executable file
0
tools/build-sample.bat
Normal file → Executable file
0
tools/fsreg.bat
Normal file → Executable file
0
tools/fsreg.bat
Normal file → Executable file
0
tools/impdef.bat
Normal file → Executable file
0
tools/impdef.bat
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user