IRP_MJ_DIRECTORY_CONTROL

 IRP_MJ_DIRECTORY_CONTROL
When Sent
The IRP_MJ_DIRECTORY_CONTROL 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 ReadDirectoryChangesW or FindNextVolumeMountPoint or when a kernel-mode component has called ZwQueryDirectoryFile.

Operation: File System Drivers
The file system driver should check the minor function code to determine which directory control operation is requested. The following are the valid minor function codes:

IRP_MN_NOTIFY_CHANGE_DIRECTORY
Indicates a request for notification of changes to the directory. Usually, instead of satisfying this request immediately, the file system driver holds the IRP in a private queue. When a change occurs to the directory, the file system driver performs the notification, and dequeues and completes the IRP.
IRP_MN_QUERY_DIRECTORY
Indicates a directory query request. The types of information that can be queried are file-system-dependent, but generally include the following:
FileBothDirectoryInformation

FileDirectoryInformation

FileFullDirectoryInformation

FileIdBothDirectoryInformation

FileIdFullDirectoryInformation

FileNamesInformation

FileObjectIdInformation

FileReparsePointInformation

Note The FileQuotaInformation information class is obsolete. IRP_MJ_QUERY_QUOTA should be used instead.

After performing the requested operation, the file system driver should complete the IRP.

Operation: File System Filter Drivers
The filter driver must pass this IRP down to the next-lower driver on the stack.

Parameters
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 directory control request:

DeviceObject
Pointer to the target device object.
Irp->IoStatus
Pointer to an IO_STATUS_BLOCK structure that receives the final completion status and information about the requested operation.
Irp->UserBuffer
Pointer to a caller-supplied output buffer that receives the requested information about the contents of the directory.
IrpSp->FileObject
Pointer to the file object that is associated with DeviceObject.
IrpSp->Flags
The following flags can be set for IRP_MN_QUERY_DIRECTORY. Flag Meaning
SL_INDEX_SPECIFIED
Begin the scan at the entry in the directory whose index is given by IrpSp->Parameters.QueryDirectory.FileIndex.
SL_RESTART_SCAN
Begin the scan at the first entry in the directory. If this flag is not set, resume the scan from a previous IRP_MN_QUERY_DIRECTORY request.
SL_RETURN_SINGLE_ENTRY
Return only the first entry that is found.


The following flag can be set for IRP_MN_NOTIFY_CHANGE_DIRECTORY: Flag Meaning
SL_WATCH_TREE
Set to TRUE if all subdirectories of this directory should also be watched. Set to FALSE if only the directory itself is to be watched.



IrpSp->MajorFunction
Specifies IRP_MJ_DIRECTORY_CONTROL.
IrpSp->MinorFunction
One of the following:
IRP_MN_NOTIFY_CHANGE_DIRECTORY
IRP_MN_QUERY_DIRECTORY

IrpSp->Parameters.NotifyDirectory.CompletionFilter
For more information, see the description of the CompletionFilter parameter to FsRtlNotifyFullChangeDirectory.
IrpSp->Parameters.NotifyDirectory.Length
Length in bytes of the buffer pointed to by Irp->UserBuffer.
IrpSp->Parameters.QueryDirectory.FileIndex
Index of the file at which to begin the directory scan. Ignored if the SL_INDEX_SPECIFIED flag is not set. This parameter cannot be specified in any Win32 function or kernel-mode support routine. Currently it is used only by the NT virtual DOS machine (NTVDM), which exists only on 32-bit NT-based platforms.
IrpSp->Parameters.QueryDirectory.FileInformationClass
Specifies one of the values described below. Value Meaning
FileBothDirectoryInformation
Return a FILE_BOTH_DIR_INFORMATION structure for each file.
FileDirectoryInformation
Return a FILE_DIRECTORY_INFORMATION structure for each file.
FileFullDirectoryInformation
Return a FILE_FULL_DIR_INFORMATION structure for each file.
FileIdBothDirectoryInformation
Return a FILE_ID_BOTH_DIR_INFORMATION structure for each file.
FileIdFullDirectoryInformation
Return a FILE_ID_FULL_DIR_INFORMATION structure for each file.
FileNamesInformation
Return a FILE_NAMES_INFORMATION structure for each file.
FileObjectIdInformation
Return a FILE_OBJECTID_INFORMATION structure for each file.
FileQuotaInformation
This information class is obsolete. IRP_MJ_QUERY_QUOTA should be used instead.
FileReparsePointInformation
Return a single FILE_REPARSE_POINT_INFORMATION structure for the directory.


IrpSp->Parameters.QueryDirectory.FileName
Optional name of a file within the specified directory.
IrpSp->Parameters.QueryDirectory.Length
Length in bytes of the buffer pointed to by Irp->UserBuffer.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值