Discuss this help topic in CBFS Forum

OnSetValidDataLength event/delegate/callback


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

CallbackFileSystem     See also    


The event is fired when the OS wants to set file valid data length.


    property OnSetValidDataLength : TCbFsSetValidDataLengthEvent;
    TCbFsSetValidDataLengthEvent = procedure( Sender : TObject; FileInfo: TCbFsFileInfo; ValidDataLength: Int64 ) of object;

[C++ (Lib)]
    void (__stdcall *CbFsSetValidDataLengthEvent)(void* Sender, CbFsFileInfo* FileInfo, __int64 ValidDataLength );

[C++ (VCL)]
    typedef void (__closure *TCbFsSetValidDataLengthEvent)( System::TObject* Sender, TCbFsFileInfo* FileInfo, __int64 ValidDataLength );

[C++ (.NET)]
    public __delegate void CbFsSetValidDataLengthEvent( CallbackFileSystem^ Sender, CbFsFileInfo^ FileInfo, Int64 ValidDataLength );

    public void CbFsSetValidDataLengthEvent( CallbackFileSystem Sender, CbFsFileInfo FileInfo, Int64 ValidDataLength );

    Sub CbFsSetValidDataLengthEvent( ByVal Sender As CallbackFileSystem, ByVal FileInfo As CbFsFileInfo, ByVal ValidDataLength As Int64 )

    void ICbFsVolumeEvents.onSetValidDataLength( CallbackFileSystem sender, CbFsFileInfo fileInfo, long validDataLength );


  • Sender - reference to the class that called the delegate/event handler
  • ValidDataLength - the length of file's valid data as passed to SetFileValidData() Win32 API function


This event is fired when some application uses SetFileValidData() Win32 API function to set valid data length for the file.

Change of valid data length is needed to quickly allocate large amount of space on the disk. When some application needs to allocate large file, it sets file pointer to the needed value using SetEndOfFile, then it can call SetFileValidData to tell the filesystem that the newly allocated space doesn't need filling with zeros (which will happen otherwise on NTFS).

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

GetHandleInfo method     OnSetAllocationSize event     OnSetEndOfFile event    

Discuss this help topic in CBFS Forum