diff --git a/src/sys/driver.h b/src/sys/driver.h index b4027313..3eebb40d 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -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 diff --git a/src/sys/util.c b/src/sys/util.c index 4a889ea5..20ef03f5 100644 --- a/src/sys/util.c +++ b/src/sys/util.c @@ -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,