Export (0) Print
Expand All
Expand Minimize

FsRtlNotifyFilterChangeDirectory routine

The FsRtlNotifyFilterChangeDirectory routine creates a notify structure for an IRP_MN_NOTIFY_CHANGE_DIRECTORY request and adds it to the specified notify list.

Syntax


VOID FsRtlNotifyFilterChangeDirectory(
  _In_      PNOTIFY_SYNC NotifySync,
  _In_      PLIST_ENTRY NotifyList,
  _In_      PVOID FsContext,
  _In_      PSTRING FullDirectoryName,
  _In_      BOOLEAN WatchTree,
  _In_      BOOLEAN IgnoreBuffer,
  _In_      ULONG CompletionFilter,
  _In_opt_  PIRP NotifyIrp,
  _In_opt_  PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback,
  _In_opt_  PSECURITY_SUBJECT_CONTEXT SubjectContext,
  _In_opt_  PFILTER_REPORT_CHANGE FilterCallback
);

Parameters

NotifySync [in]

Pointer to an opaque synchronization object for the change directory notify list that is pointed to by the NotifyList parameter.

NotifyList [in]

Pointer to the head of the change directory notify list for the current volume. Each element in the list is an opaque notify structure.

FsContext [in]

Pointer to a unique value assigned by the file system to identify the notify structure to be created as belonging to a particular file object. If a TraverseCallback routine is supplied, FsContext is passed as the NotifyContext parameter to that routine.

FullDirectoryName [in]

Pointer to an ANSI or Unicode string that contains the full name for the directory associated with this notify structure. Ignored if NotifyIrp is NULL.

WatchTree [in]

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. Ignored if NotifyIrp is NULL.

IgnoreBuffer [in]

Set to TRUE to ignore any user buffers and force the directory to be reenumerated. This action speeds the operation. Ignored if NotifyIrp is NULL.

CompletionFilter [in]

Bitmask of flags that specify the types of changes to files or directories that should cause the IRPs in the notify list to be completed. The possible flag values are described following.

FlagMeaning

FILE_NOTIFY_CHANGE_FILE_NAME

A file has been added, deleted, or renamed in this directory.

FILE_NOTIFY_CHANGE_DIR_NAME

A subdirectory has been created, removed, or renamed.

FILE_NOTIFY_CHANGE_NAME

This directory's name has changed.

FILE_NOTIFY_CHANGE_ATTRIBUTES

The value of an attribute of this file, such as last access time, has changed.

FILE_NOTIFY_CHANGE_SIZE

This file's size has changed.

FILE_NOTIFY_CHANGE_LAST_WRITE

This file's last modification time has changed.

FILE_NOTIFY_CHANGE_LAST_ACCESS

This file's last access time has changed.

FILE_NOTIFY_CHANGE_CREATION

This file's creation time has changed.

FILE_NOTIFY_CHANGE_EA

This file's extended attributes have been modified.

FILE_NOTIFY_CHANGE_SECURITY

This file's security information has changed.

FILE_NOTIFY_CHANGE_STREAM_NAME

A file stream has been added, deleted, or renamed in this directory.

FILE_NOTIFY_CHANGE_STREAM_SIZE

This file stream's size has changed.

FILE_NOTIFY_CHANGE_STREAM_WRITE

This file stream's data has changed.

 

CompletionFilter is ignored if NotifyIrp is NULL.

NotifyIrp [in, optional]

Pointer to the IRP to be added to the notify list. If NotifyIrp is NULL, this means that the file stream represented by the file object (identified by the FsContext parameter) is being deleted.

TraverseCallback [in, optional]

Optional pointer to a callback routine to be invoked when a change occurs in a subdirectory being watched in a directory tree. This lets the file system check whether the watcher has traverse access to that directory. Such a caller-supplied routine is declared as follows:


NTSTATUS
(*PCHECK_FOR_TRAVERSE_ACCESS) (
    IN PVOID NotifyContext,                     // FsContext
    IN PVOID TargetContext,                     // Context pointer
    IN PSECURITY_SUBJECT_CONTEXT SubjectContext // SubjectContext
    );

For more information about the TargetContext parameter, see the TargetContext parameter of FsRtlNotifyFullReportChange. TraverseCallback is ignored if NotifyIrp is NULL.

SubjectContext [in, optional]

Pointer to a context structure to be passed to TraverseCallback. FsRtlNotifyFilterChangeDirectory releases the context and frees the structure after using it. Ignored if NotifyIrp is NULL. If a TraverseCallback routine is supplied, SubjectContext is passed as the SubjectContext parameter to that routine.

FilterCallback [in, optional]

Optional pointer to a callback routine to be invoked when a change occurs to the directory. If this callback routine returns TRUE, FsRtlNotifyFilterReportChange completes the pending IRP_MN_NOTIFY_CHANGE_DIRECTORY requests in the notify list; otherwise, it does not. Such a caller-supplied routine is declared as follows:


BOOLEAN
(*PFILTER_REPORT_CHANGE) (
    IN PVOID NotifyContext,                     // FsContext
    IN PVOID FilterContext                      // Context pointer
    );

Return value

None

Remarks

FsRtlNotifyFilterChangeDirectory is called by a file system that has received an IRP with major function code IRP_MJ_DIRECTORY_CONTROL, minor function code IRP_MN_NOTIFY_CHANGE_DIRECTORY.

The file system calls FsRtlNotifyFilterChangeDirectory to create a notify structure to hold the IRP and add the notify structure to the notify list for the current volume.

If NotifyIrp is NULL, FsRtlNotifyFilterChangeDirectory checks whether the notify list already contains any pending IRPs whose file objects match the given FsContext value and, if so, completes the IRPs with STATUS_DELETE_PENDING.

If NotifyIrp is not NULL, FsRtlNotifyFilterChangeDirectory does the following:

  • Checks whether the IRP's file object has undergone cleanup. If so, FsRtlNotifyFilterChangeDirectory completes the IRP with status STATUS_NOTIFY_CLEANUP and does not add it to the notify list.

  • If the IRP's file object has not undergone cleanup, FsRtlNotifyFilterChangeDirectory checks whether the notify list already contains a notify structure for the given FsContext value. If such a notify structure is found, and there are pending changes to report, FsRtlNotifyFilterChangeDirectory completes NotifyIrp. If a notify structure is found, but there are no pending changes to report, FsRtlNotifyFilterChangeDirectory marks the IRP pointed to by NotifyIrp as pending and inserts it into the list of notify IRPs in the notify structure. If no such notify structure is found, FsRtlNotifyFilterChangeDirectory marks the IRP pointed to by NotifyIrp as pending, creates a notify structure, and inserts it into the notify list.

When a change occurs to the directory, the file system calls FsRtlNotifyFilterReportChange to complete the pending IRP_MN_NOTIFY_CHANGE_DIRECTORY requests in the notify list.

Requirements

Version

This routine is available on Update Rollup for Windows 2000 Service Pack 4 (SP4) and on Windows XP and later.

Header

Ntifs.h (include Ntifs.h)

Library

Ntoskrnl.lib

IRQL

< APC_LEVEL

See also

FsRtlNotifyFilterReportChange
FsRtlNotifyFullChangeDirectory
FsRtlNotifyFullReportChange
IRP_MJ_DIRECTORY_CONTROL
SECURITY_SUBJECT_CONTEXT

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft