The IRP_MJ_SET_INFORMATION request is sent by the I/O Manager and other operating system components, as well as other kernel-mode drivers. It can be sent, for example, when a user-mode application has called a Microsoft Win32 function such as SetEndOfFile or when a kernel-mode component has called ZwSetInformationFile.
The file system driver should extract and decode the file object to determine whether it represents a user file or directory open. If it does, the file system driver should process the request as appropriate and complete the IRP.
The following types of information can be set on files and directories:
FileLinkInformation (for file systems that allow cycles to be created in the directory hierarchy)
The following types of information can be set only on files:
FileLinkInformation (for file systems, such as NTFS, that do not allow cycles to be created in the directory hierarchy)
The filter driver must pass this IRP down to the next-lower driver on the stack.
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 set file information request:
Pointer to the target device object.
Pointer to an input buffer that contains the file or directory information to be set. This information is stored in one of the following structures:
Pointer to an IO_STATUS_BLOCK structure that receives the final completion status and information about the requested operation. For more information, see the description of the IoStatusBlock parameter to ZwSetInformationFile.
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_SET_INFORMATION and should not be used.
A flag for end-of-file operations. This determines the use of the EndOfFile member FILE_END_OF_FILE_INFORMATION structure when FileInformationClass == FileEndOfFileInformation. If TRUE, a new valid data length for the file will be set from EndOfFile only if it increases the current valid data length. If FALSE, a new file size is set from EndOfFile.
Reserved for system use.
Reserved for system use.
Specifies the type of information to be set for the file. One of the following:
Set FILE_ALLOCATION_INFORMATION for the file.
Set FILE_BASIC_INFORMATION for the file.
Set FILE_DISPOSITION_INFORMATION for the file.
Set FILE_END_OF_FILE_INFORMATION for the file.
Set FILE_LINK_INFORMATION for the file.
Set FILE_POSITION_INFORMATION for the file.
Set FILE_RENAME_INFORMATION for the file.
Set FILE_VALID_DATA_LENGTH_INFORMATION for the file.
For rename or link operations. If Irp->AssociatedIrp.SystemBuffer->FileName contains a fully qualified file name, or if Irp->AssociatedIrp.SystemBuffer->RootDirectory is non-NULL, this member is a file object pointer for the parent directory of the file that is the target of the operation. Otherwise it is NULL.
Length, in bytes, of the buffer pointed to by Irp->AssociatedIrp.SystemBuffer.
Set to TRUE to specify that if a file with the same name already exists, it should be replaced with the given file. Set to FALSE if the rename operation should fail if a file with the given name already exists.
The AdvanceOnly member is set to TRUE by the cache manager to notify the file system to advance the current valid data length on the disk to the new valid data length in EndOfFile. If AdvanceOnly is FALSE, a new file size, in the EndOfFile member, is being set which can be larger or smaller than the current file size.