OnSetValidDataLength event/delegate/callback

Filter:

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

CBFSConnect     See also    

Overview

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

Declaration

[Pascal]
    property OnSetValidDataLength : TCBSetValidDataLengthEvent;
    TCBSetValidDataLengthEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; ValidDataLength: Int64 ) of object;

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

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

[C++ (.NET)]
    public __delegate void CBSetValidDataLengthEvent( CBFSConnect^ Sender, CBFileInfo^ FileInfo, Int64 ValidDataLength );

[C#]
    public void CBSetValidDataLengthEvent( CBFSConnect Sender, CBFileInfo FileInfo, Int64 ValidDataLength );

[VB.NET]
    Sub CBSetValidDataLengthEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As CBFileInfo, ByVal ValidDataLength As Int64 )

[Java]
    void ICbFsVolumeEvents.onSetValidDataLength( CBFSConnect sender, CBFileInfo fileInfo, long validDataLength );

Parameters

  • 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

Description

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 CBFS Connect.

See also

GetHandleInfo method     OnSetAllocationSize event     OnSetEndOfFile event