sys: oplocks: WIP

This commit is contained in:
Bill Zissimopoulos 2016-11-07 22:23:20 -08:00
parent 8395b22ddc
commit 2d98cda607
2 changed files with 92 additions and 6 deletions

View File

@ -514,11 +514,24 @@ NTSTATUS FspNotifyFullReportChange(
ULONG FilterMatch,
ULONG Action,
PVOID TargetContext);
NTSTATUS FspOplockFsctrlEx(
NTSTATUS FspOplockFsctrlF(
POPLOCK Oplock,
PIRP Irp,
ULONG OpenCount,
BOOLEAN Create);
NTSTATUS FspCheckOplock(
POPLOCK Oplock,
PIRP Irp,
PVOID Context,
POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine,
POPLOCK_FS_PREPOST_IRP PostIrpRoutine);
NTSTATUS FspCheckOplockEx(
POPLOCK Oplock,
PIRP Irp,
ULONG Flags,
PVOID Context,
POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine,
POPLOCK_FS_PREPOST_IRP PostIrpRoutine);
#define FspNotifyUninitializeSync(NS)\
FsRtlNotifyUninitializeSync(NS)
#define FspNotifyCleanupAll(NS, NL)\
@ -532,9 +545,9 @@ NTSTATUS FspOplockFsctrlEx(
#define FspNotifyReportChange(NS, NL, FN, FO, NP, F, A)\
FspNotifyFullReportChange(NS, NL, (PSTRING)(FN), FO, 0, (PSTRING)(NP), F, A, 0)
#define FspOplockFsctrlCreate(OL, I, OC)\
FspOplockFsctrlEx(OL, I, OC, TRUE)
FspOplockFsctrlF(OL, I, OC, TRUE)
#define FspOplockFsctrl(OL, I, OC)\
FspOplockFsctrlEx(OL, I, OC, FALSE)
FspOplockFsctrlF(OL, I, OC, FALSE)
/* utility: synchronous work queue */
typedef struct

View File

@ -67,7 +67,20 @@ NTSTATUS FspNotifyFullReportChange(
ULONG FilterMatch,
ULONG Action,
PVOID TargetContext);
NTSTATUS FspOplockFsctrlEx(
NTSTATUS FspCheckOplock(
POPLOCK Oplock,
PIRP Irp,
PVOID Context,
POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine,
POPLOCK_FS_PREPOST_IRP PostIrpRoutine);
NTSTATUS FspCheckOplockEx(
POPLOCK Oplock,
PIRP Irp,
ULONG Flags,
PVOID Context,
POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine,
POPLOCK_FS_PREPOST_IRP PostIrpRoutine);
NTSTATUS FspOplockFsctrlF(
POPLOCK Oplock,
PIRP Irp,
ULONG OpenCount,
@ -109,7 +122,9 @@ NTSTATUS FspIrpHookNext(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context);
#pragma alloc_text(PAGE, FspNotifyInitializeSync)
#pragma alloc_text(PAGE, FspNotifyFullChangeDirectory)
#pragma alloc_text(PAGE, FspNotifyFullReportChange)
#pragma alloc_text(PAGE, FspOplockFsctrlEx)
#pragma alloc_text(PAGE, FspCheckOplock)
#pragma alloc_text(PAGE, FspCheckOplockEx)
#pragma alloc_text(PAGE, FspOplockFsctrlF)
#pragma alloc_text(PAGE, FspInitializeSynchronousWorkItem)
#pragma alloc_text(PAGE, FspExecuteSynchronousWorkItem)
#pragma alloc_text(PAGE, FspExecuteSynchronousWorkItemRoutine)
@ -646,7 +661,65 @@ NTSTATUS FspNotifyFullReportChange(
return Result;
}
NTSTATUS FspOplockFsctrlEx(
NTSTATUS FspCheckOplock(
POPLOCK Oplock,
PIRP Irp,
PVOID Context,
POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine,
POPLOCK_FS_PREPOST_IRP PostIrpRoutine)
{
PAGED_CODE();
NTSTATUS Result;
try
{
Result = FsRtlCheckOplock(
Oplock,
Irp,
Context,
CompletionRoutine,
PostIrpRoutine);
}
except (EXCEPTION_EXECUTE_HANDLER)
{
Result = GetExceptionCode();
}
return Result;
}
NTSTATUS FspCheckOplockEx(
POPLOCK Oplock,
PIRP Irp,
ULONG Flags,
PVOID Context,
POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine,
POPLOCK_FS_PREPOST_IRP PostIrpRoutine)
{
PAGED_CODE();
NTSTATUS Result;
try
{
Result = FsRtlCheckOplockEx(
Oplock,
Irp,
Flags,
Context,
CompletionRoutine,
PostIrpRoutine);
}
except (EXCEPTION_EXECUTE_HANDLER)
{
Result = GetExceptionCode();
}
return Result;
}
NTSTATUS FspOplockFsctrlF(
POPLOCK Oplock,
PIRP Irp,
ULONG OpenCount,