FSCTL_REQUEST_OPLOCK_LEVEL_2 control code

The FSCTL_REQUEST_OPLOCK_LEVEL_2 control code requests a level 2 opportunistic lock (oplock) on a file.

To process this control code, a minifilter calls FltOplockFsctrl with the following parameters. A file system or legacy filter driver calls FsRtlOplockFsctrl.

For more information about opportunistic locking and about the FSCTL_REQUEST_OPLOCK_LEVEL_2 control code, see the Microsoft Windows SDK documentation.

Parameters

  • Oplock: Opaque oplock object pointer for the file.

  • CallbackData: FltOplockFsctrl only. Callback data (FLT_CALLBACK_DATA) structure for an IRP_MJ_FILE_SYSTEM_CONTROL FSCTL request. The FsControlCode parameter for the operation must be FSCTL_REQUEST_OPLOCK_LEVEL_2.

  • Irp: FsRtlOplockFsctrl only. IRP for an IRP_MJ_FILE_SYSTEM_CONTROL FSCTL request. The FsControlCode parameter for the operation must be FSCTL_REQUEST_OPLOCK_LEVEL_2.

  • OpenCount: Specifies the locking state of the file. Set this parameter to a nonzero ULONG value if there are byte-range locks on the file, or zero otherwise.

Status block

FltOplockFsctrl returns FLT_PREOP_PENDING for this operation if the oplock was granted. Otherwise, it returns FLT_PREOP_COMPLETE.

FsRtlOplockFsctrl returns one of the following NTSTATUS values for this operation:

Code Meaning
STATUS_PENDING The oplock was granted. This is a success code.
STATUS_CANCELLED The IRP was canceled before the FSCTL_REQUEST_OPLOCK_LEVEL_2 operation was completed. This is an error code.
STATUS_OPLOCK_NOT_GRANTED The oplock could not be granted. This is an error code.

Requirements

Requirement type Requirement
Header Ntifs.h (include Ntifs.h or Fltkernel.h)

See also

FLT_CALLBACK_DATA

FLT_PARAMETERS

FLT_PARAMETERS for IRP_MJ_FILE_SYSTEM_CONTROL

FltOplockFsctrl

FSCTL_OPBATCH_ACK_CLOSE_PENDING

FSCTL_OPLOCK_BREAK_ACK_NO_2

FSCTL_OPLOCK_BREAK_ACKNOWLEDGE

FSCTL_OPLOCK_BREAK_NOTIFY

FSCTL_REQUEST_BATCH_OPLOCK

FSCTL_REQUEST_FILTER_OPLOCK

FSCTL_REQUEST_OPLOCK_LEVEL_1

FsRtlOplockFsctrl

IRP_MJ_FILE_SYSTEM_CONTROL