OnSetAllocationSizeC event/delegate/callback

Filter:

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

CBFSFilter     See also    

Overview

This callback is called when the OS or the application needs to set the allocation size of the file.

Declaration

[Pascal]
    property OnOnSetAllocationSizeC : TCBFSFltSetAllocationSizeEventC;
    TCBFSFltSetAllocationSizeEventC = procedure(Sender : TObject; FileName: TCBString; var AllocationSize: Int64; var UserContext: pointer; var HandleContext: pointer; var ProcessRequest: boolean) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*CBFSFltSetAllocationSizeEventC)(CBFSFilter* Sender, LPWSTR FileName, __int64* AllocationSize, PVOID* UserContext, PVOID* HandleContext, LPBOOL ProcessRequest);

[C++ (VCL)]
    typedef void __fastcall (__closure *TCBFSFltSetAllocationSizeEventC)(System::TObject* Sender, TCBString FileName, __int64 &AllocationSize, void* &UserContext, void* &HandleContext, bool &ProcessRequest);

[C++ (.NET)]
    public delegate void CBFSFltSetAllocationSizeEventC(CBFSFilter^ Sender, String^ FileName, Int64% AllocationSize, IntPtr% UserContext, IntPtr% HandleContext, bool% ProcessRequest);

[C#]
    delegate void CBFSFltSetAllocationSizeEventC(CBFSFilter Sender, string FileName, ref long AllocationSize, ref IntPtr UserContext, ref IntPtr HandleContext, ref bool ProcessRequest);

[VB.NET]
    Delegate Sub CBFSFltSetAllocationSizeEventC(ByVal Sender As CBFSFilter, ByVal FileName As String, ByRef AllocationSize As Long, ByRef UserContext As IntPtr, ByRef HandleContext As IntPtr, ByRef ProcessRequest As Boolean)

Parameters

  • Sender - reference to the class that called the delegate/event handler
  • FileName - name of the file
  • AllocationSize - the size of the space, allocated for the file. This size in most cases will be larger than the actual file size.
  • FileContext - the placeholder for the application-defined data, common to all concurrent file operations on the file
  • HandleContext - the placeholder for the application-defined data, local to each opened file handle
  • ProcessRequest - specifies, whether the request must be passed further to the underlying filters and the file system

Description

This callback is called when the OS or the application needs to set the allocation size of the file.
Read more about contexts.

AllocationSize is usually larger (and much larger) than the size of the file data. This happens because some file operations first reserve space for the file, then start writing actual data to this file. The application should track such situations and avoid re-allocating file space where possible to improve speed.

Error handling

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

See also

OnSetAllocationSizeN