AfterEnumerateDirectory Event

Fires after a directory entry is returned during directory enumeration.


public class DefaultCbfilterEventListener implements CbfilterEventListener {
  public void afterEnumerateDirectory(CbfilterAfterEnumerateDirectoryEvent e) {}

public class CbfilterAfterEnumerateDirectoryEvent {
  public String directoryName;
  public String fileName;
  public java.util.Date creationTime;
  public java.util.Date lastAccessTime;
  public java.util.Date lastWriteTime;
  public java.util.Date changeTime;
  public long size;
  public long allocationSize;
  public long fileId;
  public int attributes;
  public int status;
  public long directoryContext;
  public long handleContext;
  public long enumerationContext;
  public boolean processRequest;
  public int resultCode;


This event fires after a directory entry (i.e., a file or subdirectory) is returned during enumeration of the directory specified by DirectoryName.

Applications may use this event to modify the entry's metadata before it gets reported to the requestor, or even prevent the entry from being reported in the first place.

Applications only need to handle this event if they've added a standard filter rule that includes the FS_CE_AFTER_ENUMERATE_DIRECTORY flag.

The FileName parameter reflects the name of the directory entry.

The CreationTime, LastAccessTime, LastWriteTime, and ChangeTime parameters specify the entry's time values, specified in UTC.

The Size parameter specifies the size of the file, in bytes; it must always be 0 for subdirectories.

The AllocationSize parameter specifies the amount of space allocated for the file, in bytes; it must always be 0 for subdirectories.

The FileId parameter specifies the unique Id of the entry, as reported by the filesystem (or, for virtual files, by the application itself). This Id is used by the network redirector, and some third-party applications, to open files and directories by Id instead of by name. The root directory always uses the predefined Id 0x7FFFFFFFFFFFFFFF.

The Attributes parameter specifies the entry's attributes; please refer to Microsoft's File Attribute Constants article for attribute descriptions.

The Status parameter contains an NT status code that indicates the outcome of the operation; 0 indicates success. To convert this value to a Win32 error code, call the NtStatusToWin32Error method. Please note that this event won't fire for failed requests unless the ProcessFailedRequests property is enabled. Applications may change this parameter's value if they want a different NT status code to be returned.

The DirectoryContext, HandleContext, and EnumerationContext parameters are placeholders for application-defined data associated with the directory, specific handle, and enumeration; respectively. (For general-purpose events, the DirectoryContext is called FileContext instead.) DirectoryContext corresponds to the FileContext in the file/directory creation, opening, and closing events. Please refer to the Contexts topic for more information.

The ProcessRequest parameter controls whether the directory entry should actually be reported to the requestor; it is true by default. Setting this parameter to false will "hide" the directory entry (i.e., prevent it from being reported).

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

This event is fired synchronously; please refer to the Event Types topic for more information.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Filter 2020 Java Edition - Version 20.0 [Build 8124]