CallbackRegistry

Control over registry operations in Windows and .NET applications

OnEnumerateDirectoryC event/delegate/callback

Filter:

Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET   

CallbackRegistry     See also    

Overview

This callback is called during directory enumeration.

Declaration

[Pascal]
    property OnEnumerateDirectoryC : TCbFltEnumerateDirectoryEventC;
    TCbFltEnumerateDirectoryEventC = procedure(Sender : TObject; DirectoryName: TCBString; FileName: TCBString; var CreationTime: TDateTime; var LastAccessTime: TDateTime; var LastWriteTime: TDateTime; var EndOfFile: Int64; var AllocationSize: Int64; var FileId: Int64; var FileAttributes: LongWord; var UserContext: pointer; var EnumerationContext: pointer; var ProcessRequest: boolean) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*CbFltEnumerateDirectoryEventC)(CallbackRegistry* Sender, LPCWSTR DirectoryName, LPCWSTR FileName, FILETIME * CreationTime, FILETIME * LastAccessTime, FILETIME * LastWriteTime, __int64 * EndOfFile, __int64 * AllocationSize, __int64 * FileId, DWORD * FileAttributes, PVOID* UserContext, PVOID* EnumerationContext, LPBOOL RequestAccepted);

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbFltEnumerateDirectoryEventC)(System::TObject* Sender, TCBString DirectoryName, TCBString FileName, TDateTime & CreationTime, TDateTime & LastAccessTime, TDateTime & LastWriteTime, __int64 & EndOfFile, __int64 & AllocationSize, __int64 & FileId, unsigned long & FileAttributes, void * UserContext, void * EnumerationContext, bool &ProcessRequest);

[C++ (.NET)]
    public delegate void CbFltEnumerateDirectoryEventC(CallbackRegistry^ Sender, String^ DirectoryName, String^ FileName, DateTime% CreationTime, DateTime% LastAccessTime, DateTime% LastWriteTime, Int64% EndOfFile, Int64% AllocationSize, Int64% FileId, UInt32% FileAttributes, IntPtr% UserContext, IntPtr% EnumerationContext, bool% ProcessRequest);

[C#]
    delegate void CbFltEnumerateDirectoryEventC(CallbackRegistry Sender, string DirectoryName, string FileName, ref DateTime CreationTime, ref DateTime LastAccessTime, ref DateTime LastWriteTime, ref Int64 EndOfFile, ref Int64 AllocationSize, ref Int64 FileId, ref UInt32 FileAttributes, ref IntPtr UserContext, ref IntPtr EnumerationContext, ref bool ProcessRequest);

[VB.NET]
    Delegate Sub CbFltEnumerateDirectoryEventC(ByVal Sender As CallbackRegistry, ByVal DirectoryName As String, ByVal FileName As String, ByRef CreationTime As DateTime, ByRef LastAccessTime As DateTime, ByRef LastWriteTime As DateTime, ByRef EndOfFile As Int64, ByRef AllocationSize As Int64, ByRef FileId As Int64, ByRef FileAttributes As UInt32, ByRef UserContext As IntPtr, ByRef EnumerationContext As IntPtr, ByRef ProcessRequest As Boolean)

Parameters

  • Sender - reference to the class that called the delegate/event handler
  • DirectoryName - contains the name of the directory, in which enumeration is done
  • FileName - the name of the found file or directory
  • CreationTime - the time of the object creation
  • LastAccessTime - the time of last access to the object
  • LastWriteTime - the time of last modification of the object
  • EndOfFile - the size of the file
  • AllocationSize - the size of the space, allocated for the file
  • FileId - Currently unused.
  • FileAttributes - the attributes of the file or directory
  • UserContext - the placeholder for the application-defined data specific to directory being opened
  • EnumerationContext - the placeholder for the application-defined data specific to particular enumeration procedure
  • ProcessRequest (RequestAccepted) - specifies, whether the request results (contained in other parameters) must be passed to the OS

Description

This callback is called when the OS enumerates files and subdirectories in the given directory. The callback is called after it has been processed by the file system. The user can hide the reported file form the OS by setting ProcessRequest parameter to false.

The application can use UserContext to store the reference to some information, identifying the directory which is opened in particular for enumeration (such as file/directory handle or database record ID or reference to the stream class etc). The value, set in the event handler, is later passed to operations related to this directory.
EnumerationContext is used to store application-defined data during particular enumeration. There can be several enumerations performed on single opened directory so UserContext and EnumerationConext are separated.
Read more about contexts.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CallbackRegistry.

See also

OnCloseEnumerationC

Back to top