OnEnumerateNamedStreams 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 check availability and enumerate the named streams of the file.


    property OnEnumerateNamedStreams : TCBEnumerateNamedStreamsEvent;
    TCBEnumerateNamedStreamsEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; HandleInfo: TCBHandleInfo; EnumerationInfo: TCBNamedStreamsEnumerationInfo; var StreamName: TCBString; var StreamSize: Int64; var StreamAllocationSize: Int64; var NamedStreamFound: Boolean ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void (__stdcall *CBEnumerateNamedStreamsEvent)(void* Sender, CBFileInfo* FileInfo, CBHandleInfo* HandleInfo, CBNamedStreamsEnumerationInfo* EnumerationInfo, LPWSTR StreamName, LPDWORD StreamNameLength, __int64 * StreamSize, __int64 * StreamAllocationSize, LPBOOL NamedStreamFound );

[C++ (VCL)]
    typedef void (__closure *TCBEnumerateNamedStreamsEvent)( System::TObject* Sender, TCBFileInfo* FileInfo, TCBHandleInfo* HandleInfo, TCBNamedStreamsEnumerationInfo* EnumerationInfo, TCBString & StreamName, __int64 & StreamSize, __int64 & StreamAllocationSize, bool & NamedStreamFound );

[C++ (.NET)]
    public __delegate void CBEnumerateNamedStreamsEvent( CBFSConnect^ Sender, CBFileInfo^ FileInfo, CBHandleInfo^ HandleInfo, CBNamedStreamsEnumerationInfo^ EnumerationInfo, String^% StreamName, Int32% StreamNameLength, Int64% StreamSize, Int64% StreamAllocationSize, bool% NamedStreamFound );

    public void CBEnumerateNamedStreamsEvent( CBFSConnect Sender, CBFileInfo FileInfo, CBHandleInfo HandleInfo, CBNamedStreamsEnumerationInfo EnumerationInfo, ref String StreamName, ref Int64 StreamSize, ref Int64 StreamAllocationSize, ref bool NamedStreamFound );

    Sub CBEnumerateNamedStreamsEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As TCBFileInfo, ByVal HandleInfo As CBHandleInfo, ByVal EnumerationInfo As CBNamedStreamsEnumerationInfo, ByRef StreamName As String, ByRef StreamSize As Int64, ByRef StreamAllocationSize As Int64, ByRef NamedStreamFound As Boolean )

    void ICbFsEnumerateEvents.onEnumerateNamedStreams( CBFSConnect sender, CBFileInfo directoryInfo, CBHandleInfo handleInfo, CBNamedStreamsEnumerationInfo enumerationInfo, stringRef streamName, longRef streamSize, longRef streamAllocationSize, boolRef namedStreamFound );


  • Sender - reference to the class that called the delegate/event handler.
  • FileInfo - information about the the file whose streams are being enumerated. This structure is common to all operations that occur at the same time in parallel.
  • HandleInfo - information about particular file handle which was opened for the purpose of stream enumeration
  • EnumerationInfo - information about current enumeration
  • StreamName - the event handler must set this parameter to the name of the found named stream.
    [C++ (Lib)] The buffer of size 32768 characters is passed by the caller. The event handler must put the stream name to this buffer.
  • StreamNameLength - the length of the returned name in bytes, not including the trailing NULL (in C++).
  • StreamSize - the event handler must place the size of the stream data in bytes to this parameter.
  • StreamAllocationSize - the event handler must place the size of the space, allocated for the stream to this parameter. The allocation size is in most cases a multiple of the allocation unit (cluster) size
  • NamedStreamFound - the event handler must set this parameter to true if the stream exists and the information is provided and false otherwise


This event is fired when the OS wants to enumerate secondary named streams of the file.
The application must report information about the entry in the file specified by FileInfo. If the entry is present, NamedStreamFound must be set to true and the information about the entry must be included. If the entry is not present, NamedStreamFound must be set to false.

If this is the first call to enumerate the streams, Context in EnumerationInfo can be used to store information, which speeds up subsequent enumeration calls. The application can use Context to store the reference to some information, identifying the search (such as stream or file 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 OnEnumerateNamedStreams event handler.
Read more about contexts.

The event is optional, i.e. you should not attach an event handler if you don't plan to work with alternate (named) streams. In this case CBFS API will tell the OS that the named streams are not supported by the file system.

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