The IRP_MJ_LOCK_CONTROL request is sent by the I/O Manager and other operating system components, as well as other kernel-mode drivers.
The file system driver should extract and decode the file object to determine whether the target device object is the file system's control device object. If this is the case, the file system driver should complete the IRP as appropriate without processing the lock request.
Otherwise, if the request has been issued on a handle that represents a user file open, the file system driver should perform the operation indicated by the minor function code and complete the IRP. If not, the driver should fail the IRP.
The following are the valid minor function codes:
Indicates a byte-range lock request, possibly on behalf of a user-mode application that has called the Microsoft Win32 LockFile function.
Indicates a request to release all byte-range locks for a file, usually because the last outstanding handle to a file object is being closed.
Indicates a request to release all byte-range locks with a specified key value.
Indicates a request to release a single byte-range lock, possibly on behalf of a user-mode application that has called the Microsoft Win32 UnlockFile function.
File system filter drivers should pass the IRP down to the next-lower driver on the stack after performing any needed processing.
A file system or filter driver calls IoGetCurrentIrpStackLocation with the given IRP to get a pointer to its own stack location in the IRP, shown in the following list as IrpSp. (The IRP is shown as Irp.) The driver can use the information that is set in the following members of the IRP and the IRP stack location in processing a lock control request:
Pointer to the target device object.
Pointer to an IO_STATUS_BLOCK structure that receives the final completion status and information about the requested operation.
Pointer to the file object that is associated with DeviceObject.
The IrpSp->FileObject parameter contains a pointer to the RelatedFileObject field, which is also a FILE_OBECT structure. The RelatedFileObject field of the FILE_OBJECT structure is not valid during the processing of IRP_MJ_LOCK_CONTROL and should not be used.
One or more of the following:
If this flag is set, an exclusive byte-range lock is requested. Otherwise, a shared lock is requested.
If this flag is set, the lock request should fail if it cannot be granted immediately.
Specifies one of the following:
Starting byte offset within the file of the byte range to be locked or unlocked.
Key for the byte-range lock.
Length, in bytes, of the byte range to be locked or unlocked.
Build date: 1/29/2014