OnEnumerateHardLinks event/delegate/callback


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

CBFSConnect     See also    


The event is fired when the OS needs to enumerate hard links of the given file.


    property OnEnumerateHardLinks : TCBEnumerateHardLinksEvent;
    TCBEnumerateHardLinksEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; HandleInfo: TCBHandleInfo; HardLinksEnumerationInfo: TCBHardLinksEnumerationInfo; var LinkName: TCBString; var ParentId: Int64; var LinkNameFound: boolean ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void (__stdcall *CBEnumerateHardLinksEvent)(void* Sender, CBFileInfo* FileInfo, CBHandleInfo* HandleInfo, CBHardLinksEnumerationInfo* HardLinksEnumerationInfo, LPWSTR LinkName, LPSHORT LinkNameLength, __int64 * ParentId, LPBOOL LinkNameFound );

[C++ (VCL)]
    typedef void (__closure *TCBEnumerateHardLinksEvent)( System::TObject* Sender, TCBFileInfo* FileInfo, TCBHandleInfo* HandleInfo, TCBHardLinksEnumerationInfo* HardLinksEnumerationInfo, TCBString & LinkName, __int64 & ParentId, bool & LinkNameFound );

[C++ (.NET)]
    public __delegate void CBEnumerateHardLinksEvent( CBFSConnect^ Sender, CBFileInfo^ FileInfo, CBHandleInfo^ HandleInfo, CBHardLinksEnumerationInfo^ HardLinksEnumerationInfo, String^% LinkName, Int64% ParentId, bool% LinkNameFound );

    public void CBEnumerateHardLinksEvent( CBFSConnect Sender, CBFileInfo FileInfo, CBHandleInfo HandleInfo, CBHardLinksEnumerationInfo EnumerationInfo, ref String LinkName, ref Int64 ParentId, ref bool LinkNameFound );

    Sub CBEnumerateHardLinksEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As TCBFileInfo, ByVal HandleInfo As CBHandleInfo, ByVal HardLinksEnumerationInfo As CBHardLinksEnumerationInfo, ByRef LinkName As String, ByRef ParentId As Int64, ByRef LinkNameFound As Boolean )

    void ICbFsEnumerateEvents.onEnumerateHardLinks( String fileName, CBFileInfo fileInfo, CBHandleInfo handleInfo, CBHardLinksEnumerationInfo hardLinksEnumerationInfo, stringRef LinkName, longRef ParentId, boolRef LinkNameFound );


  • Sender - reference to the class that called the delegate/event handler.
  • FileInfo - information about the file whose links are enumerated.
  • HandleInfo - information about particular file handle which was opened for the purpose of hard link enumeration
  • HardLinksEnumerationInfo - information about current enumeration
  • LinkName - set this parameter to the name of the hard link.
    [C++ (Lib)] The buffer of size MaxFileNameLength +1 characters is passed by the caller. The event handler must put the file name to this buffer.
  • FileNameLength - place the length of the link name (in characters without trailing NULL), stored in LinkName, to this parameter
  • ParentId - The ID of the directory, in which the reported hard link resides. For the root directory ("\") return 0x7FFFFFFFFFFFFFFF .
  • LinkNameFound - set this parameter to true if the link has been found and the information is provided or set it to false if the link enumeration has been ended and no link name is returned.


This event is fired when the OS wants to enumerate the links of the existing file. Read more about hard links.

Context in EnumerationInfo can be used to store information, which speeds up subsequent enumeration calls. The application can use this context to store the reference to some information, identifying the search (such as file ID or handle or database record ID etc). The value, set in the event handler, is later passed to all operations, related to this enumeration, i.e. subsequent calls to OnEnumerateHardLinks and OnCloseHardLinksEnumeration event handlers.
Read more about contexts.

The entry to be reported is identified by the data that the application stores in Enumeration Context. It is the application's job to track what entry it needs to report next.

Error handling

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

See also