mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-03 17:32:57 -05:00
sys: IRP_MJ_LOCK_CONTROL
This commit is contained in:
@ -7,7 +7,8 @@
|
||||
#include <sys/driver.h>
|
||||
|
||||
static NTSTATUS FspFsvolLockControl(
|
||||
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp);
|
||||
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp,
|
||||
PBOOLEAN PIrpRelinquished);
|
||||
FSP_IOCMPL_DISPATCH FspFsvolLockControlComplete;
|
||||
FSP_DRIVER_DISPATCH FspLockControl;
|
||||
|
||||
@ -18,11 +19,27 @@ FSP_DRIVER_DISPATCH FspLockControl;
|
||||
#endif
|
||||
|
||||
static NTSTATUS FspFsvolLockControl(
|
||||
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
|
||||
PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp,
|
||||
PBOOLEAN PIrpRelinquished)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
/* is this a valid FileObject? */
|
||||
if (!FspFileNodeIsValid(IrpSp->FileObject->FsContext))
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
NTSTATUS Result;
|
||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||
|
||||
/* only regular files can be locked */
|
||||
if (FileNode->IsDirectory)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
/* let the FSRTL package handle this one! */
|
||||
Result = FspFileNodeProcessLockIrp(FileNode, Irp, PIrpRelinquished);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
NTSTATUS FspFsvolLockControlComplete(
|
||||
@ -30,21 +47,36 @@ NTSTATUS FspFsvolLockControlComplete(
|
||||
{
|
||||
FSP_ENTER_IOC(PAGED_CODE());
|
||||
|
||||
FSP_LEAVE_IOC("%s", "");
|
||||
FSP_LEAVE_IOC("FileObject=%p, "
|
||||
"Key=%#lx, ByteOffset=%#lx:%#lx, Length=%ld",
|
||||
IrpSp->FileObject,
|
||||
IrpSp->Parameters.LockControl.Key,
|
||||
IrpSp->Parameters.LockControl.ByteOffset.HighPart,
|
||||
IrpSp->Parameters.LockControl.ByteOffset.LowPart,
|
||||
IrpSp->Parameters.LockControl.Length);
|
||||
}
|
||||
|
||||
NTSTATUS FspLockControl(
|
||||
PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
BOOLEAN IrpRelinquished = FALSE;
|
||||
|
||||
FSP_ENTER_MJ(PAGED_CODE());
|
||||
|
||||
switch (FspDeviceExtension(DeviceObject)->Kind)
|
||||
{
|
||||
case FspFsvolDeviceExtensionKind:
|
||||
FSP_RETURN(Result = FspFsvolLockControl(DeviceObject, Irp, IrpSp));
|
||||
FSP_RETURN(Result = FspFsvolLockControl(DeviceObject, Irp, IrpSp, &IrpRelinquished));
|
||||
default:
|
||||
FSP_RETURN(Result = STATUS_INVALID_DEVICE_REQUEST);
|
||||
}
|
||||
|
||||
FSP_LEAVE_MJ("%s", "");
|
||||
FSP_LEAVE_MJ_COND(!IrpRelinquished && STATUS_PENDING != Result,
|
||||
"FileObject=%p, "
|
||||
"Key=%#lx, ByteOffset=%#lx:%#lx, Length=%ld",
|
||||
IrpSp->FileObject,
|
||||
IrpSp->Parameters.LockControl.Key,
|
||||
IrpSp->Parameters.LockControl.ByteOffset.HighPart,
|
||||
IrpSp->Parameters.LockControl.ByteOffset.LowPart,
|
||||
IrpSp->Parameters.LockControl.Length);
|
||||
}
|
||||
|
Reference in New Issue
Block a user