AfterEnumerateDirectory Event

Fires after a directory entry is returned during directory enumeration.

Syntax

ANSI (Cross Platform)
virtual int FireAfterEnumerateDirectory(CBFilterAfterEnumerateDirectoryEventParams *e);
typedef struct {
const char *DirectoryName;
const char *FileName;
int64 *pCreationTime;
int64 *pLastAccessTime;
int64 *pLastWriteTime;
int64 *pChangeTime;
int64 *pSize;
int64 *pAllocationSize;
int64 *pFileId;
int Attributes;
int Status;
void *DirectoryContext;
void *HandleContext;
void *EnumerationContext;
int ProcessRequest;
int ResultCode; int reserved; } CBFilterAfterEnumerateDirectoryEventParams; Unicode (Windows) virtual INT FireAfterEnumerateDirectory(CBFilterAfterEnumerateDirectoryEventParams *e);
typedef struct {
LPCWSTR DirectoryName;
LPCWSTR FileName;
LONG64 *pCreationTime;
LONG64 *pLastAccessTime;
LONG64 *pLastWriteTime;
LONG64 *pChangeTime;
LONG64 *pSize;
LONG64 *pAllocationSize;
LONG64 *pFileId;
INT Attributes;
INT Status;
LPVOID DirectoryContext;
LPVOID HandleContext;
LPVOID EnumerationContext;
BOOL ProcessRequest;
INT ResultCode; INT reserved; } CBFilterAfterEnumerateDirectoryEventParams;
#define EID_CBFILTER_AFTERENUMERATEDIRECTORY 8

virtual INT CBFSFILTER_CALL FireAfterEnumerateDirectory(LPWSTR &lpszDirectoryName, LPWSTR &lpszFileName, LONG64 &lCreationTime, LONG64 &lLastAccessTime, LONG64 &lLastWriteTime, LONG64 &lChangeTime, LONG64 &lSize, LONG64 &lAllocationSize, LONG64 &lFileId, INT &iAttributes, INT &iStatus, LPVOID &lpDirectoryContext, LPVOID &lpHandleContext, LPVOID &lpEnumerationContext, BOOL &bProcessRequest, INT &iResultCode);

Remarks

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 as a number of 100-nanosecond intervals since Jan 1, 1601 00:00:00 UTC, i.e., as FILETIME.

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 C++ Edition - Version 20.0 [Build 8317]