FsRtlOplockFsctrl performs various opportunistic lock (oplock) operations on behalf of a file system or filter driver.
NTSTATUS FsRtlOplockFsctrl( POPLOCK Oplock, PIRP Irp, ULONG OpenCount );
Opaque opportunistic lock pointer for the file. This pointer must have been initialized by a previous call to FsRtlInitializeOplock.
Pointer to the IRP for the I/O operation. This parameter is required and cannot be NULL.
Number of user handles for the file, if an exclusive opportunistic lock is being requested. Setting a nonzero value for a level 2, R, or RH oplock request indicates that there are byte-range locks on the file. For information about oplock types, see Oplock Semantics Overview.
FsRtlOplockFsctrl returns one of the following NTSTATUS values:
||For an IRP_MJ_CREATE request, STATUS_SUCCESS indicates that the requested filter opportunistic lock was granted. For a FSCTL operation, the meaning of STATUS_SUCCESS depends on the FSCTL code. For more information, see the reference pages for the FSCTL codes listed in the following Remarks section.|
||The I/O operation was canceled. STATUS_CANCELLED is an error code.|
||The FSCTL code for the I/O operation was not one of the valid values listed in the following Remarks section. STATUS_INVALID_PARAMETER is an error code.|
||The opportunistic lock could not be granted. STATUS_OPLOCK_NOT_GRANTED is an error code.|
||Used only for FSCTL operations. The meaning of STATUS_PENDING depends on the FSCTL code. For more information, see the reference pages for the FSCTL codes listed in the following Remarks section. STATUS_PENDING is a success code.|
||A new opportunistic lock (oplock) could not be granted. The IRP is an IRP_MJ_CREATE request and FILE_OPEN_REQUIRING_OPLOCK was specified in the create options parameter for the operation. STATUS_CANNOT_BREAK_OPLOCK is a success code.|
File systems and filter drivers call FsRtlOplockFsctrl to perform various opportunistic lock operations for a create or file system control I/O operation. The IRP pointed to by the Irp parameter must be a valid IRP for an IRP_MJ_FILE_SYSTEM_CONTROL or IRP_MJ_CREATE operation.
If the IRP is an IRP_MJ_FILE_SYSTEM_CONTROL request, FsRtlOplockFsctrl can be used with the following FSCTL codes. The FSCTL code is set in IrpSp->Parameters.FileSystemControl.FsControlCode. For more information about file system control parameters, see the reference entry for IRP_MJ_FILE_SYSTEM_CONTROL.
For detailed information about these FSCTLs and about opportunistic locks in general, see the Microsoft Windows SDK documentation.
If the IRP is an IRP_MJ_CREATE request, FsRtlOplockFsctrl can be used to request a pending filter opportunistic lock if all of the following conditions are true:
- The value of the OpenCount parameter must be 1.
- The value of the DesiredAccess parameter for the IRP_MJ_CREATE request must be FILE_READ_ATTRIBUTES.
- The value of the ShareAccess parameter for the IRP_MJ_CREATE request must be FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE.
Minifilters should call FltOplockFsctrl instead of FsRtlOplockFsctrl.
|Header||ntifs.h (include Ntifs.h)|
Send feedback about: