Discuss this help topic in CBFS Forum

OnEnumerateHardLinks event/delegate/callback

Filter:

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

CallbackFileSystem     See also    

Overview

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

Declaration

[Pascal]
    property OnEnumerateHardLinks : TCbFsEnumerateHardLinksEvent;
    TCbFsEnumerateHardLinksEvent = procedure( Sender : TObject; FileInfo: TCbFsFileInfo; HandleInfo: TCbFsHandleInfo; HardLinksEnumerationInfo: TCbFsHardLinksEnumerationInfo; var LinkName: TCBString; var ParentId: Int64; var LinkNameFound: boolean ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void (__stdcall *CbFsEnumerateHardLinksEvent)(void* Sender, CbFsFileInfo* FileInfo, CbFsHandleInfo* HandleInfo, CbFsHardLinksEnumerationInfo* HardLinksEnumerationInfo, LPWSTR LinkName, LPSHORT LinkNameLength, __int64 * ParentId, LPBOOL LinkNameFound );

[C++ (VCL)]
    typedef void (__closure *TCbFsEnumerateHardLinksEvent)( System::TObject* Sender, TCbFsFileInfo* FileInfo, TCbFsHandleInfo* HandleInfo, TCbFsHardLinksEnumerationInfo* HardLinksEnumerationInfo, TCBString & LinkName, __int64 & ParentId, bool & LinkNameFound );

[C++ (.NET)]
    public __delegate void CbFsEnumerateHardLinksEvent( CallbackFileSystem^ Sender, CbFsFileInfo^ FileInfo, CbFsHandleInfo^ HandleInfo, CbFsHardLinksEnumerationInfo^ HardLinksEnumerationInfo, String^% LinkName, Int64% ParentId, bool% LinkNameFound );

[C#]
    public void CbFsEnumerateHardLinksEvent( CallbackFileSystem Sender, CbFsFileInfo FileInfo, CbFsHandleInfo HandleInfo, CbFsHardLinksEnumerationInfo EnumerationInfo, ref String LinkName, ref Int64 ParentId, ref bool LinkNameFound );

[VB.NET]
    Sub CbFsEnumerateHardLinksEvent( ByVal Sender As CallbackFileSystem, ByVal FileInfo As TCbFsFileInfo, ByVal HandleInfo As CbFsHandleInfo, ByVal HardLinksEnumerationInfo As CbFsHardLinksEnumerationInfo, ByRef LinkName As String, ByRef ParentId As Int64, ByRef LinkNameFound As Boolean )

[Java]
    void ICbFsEnumerateEvents.onEnumerateHardLinks( String fileName, CbFsFileInfo fileInfo, CbFsHandleInfo handleInfo, CbFsHardLinksEnumerationInfo hardLinksEnumerationInfo, stringRef LinkName, longRef ParentId, boolRef LinkNameFound );

Parameters

  • 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.

Description

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 Callback File System.

See also

OnCloseHardLinksEnumeration    

Discuss this help topic in CBFS Forum