EldoS
 Table of Contents >  OnGetFileInfo event/delegate/callback
Navigation
Web site
Support
Table Of Contents

OnGetFileInfo 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 get information about the file or directory.

Declaration

[Pascal]
    property OnGetFileInfo : TCbFsGetFileInfoEvent;
    TCbFsGetFileInfoEvent = procedure( Sender : TObject; FileName: TCBString; var FileExists: Boolean; var CreationTime: TDateTime; var LastAccessTime: TDateTime; var LastWriteTime: TDateTime; var EndOfFile: Int64; var AllocationSize: Int64; var FileId: Int64; var FileAttributes: LongWord; var LongFileName: TCBString; var LongFileNameLength: Word ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void (__stdcall *CbFsGetFileInfoEvent)(void* Sender, wchar_t* FileName, bool * FileExists, FILETIME * CreationTime, FILETIME * LastAccessTime, FILETIME * LastWriteTime, long long * EndOfFile, long long * AllocationSize, long long * FileId, unsigned long * FileAttributes, wchar_t* LongFileName, ushort * LongFileNameLength );

[C++ (VCL)]
    typedef void (__closure *TCbFsGetFileInfoEvent)( System::TObject* Sender, WideString FileName, bool& FileExists, TDateTime & CreationTime, TDateTime & LastAccessTime, TDateTime & LastWriteTime, __int64 & EndOfFile, __int64 & AllocationSize, __int64 & FileId, unsigned long & FileAttributes, WideString & LongFileName, unsigned short & LongFileNameLength );

[C++ (.NET)]
    public __delegate void CbFsGetFileInfoEvent( CallbackFileSystem^ Sender, String^ FileName, bool% FileExists, DateTime% CreationTime, DateTime% LastAccessTime, DateTime% LastWriteTime, Int64% EndOfFile, Int64% AllocationSize, Int64% FileId, UInt32% FileAttributes, String^% LongFileName, UInt16% LongFileNameLength );

[C#]
    public void CbFsGetFileInfoEvent( CallbackFileSystem Sender, String FileName, ref bool FileExists, ref DateTime CreationTime, ref DateTime LastAccessTime, ref DateTime LastWriteTime, ref Int64 EndOfFile, ref Int64 AllocationSize, ref Int64 FileId, ref UInt32 FileAttributes, ref String LongFileName, ref UInt16 LongFileNameLength );

[VB.NET]
    Sub CbFsGetFileInfoEvent( ByVal Sender As CallbackFileSystem, ByVal FileName As String, ByRef FileExists As Boolean, ByRef CreationTime As DateTime, ByRef LastAccessTime As DateTime, ByRef LastWriteTime As DateTime, ByRef EndOfFile As Int64, ByRef AllocationSize As Int64, ByRef FileId As Int64, ByRef FileAttributes As UInt32, ByRef LongFileName As String, ByRef LongFileNameLength As UInt16 )

[Java]
    void ICbFsFileEvents.onGetFileInfo( CallbackFileSystem sender, String fileName, boolRef fileExists, dateRef creationTime, dateRef lastAccessTime, dateRef lastWriteTime, longRef endOfFile, longRef allocationSize, longRef fileId, longRef fileAttributes, stringRef LongFileName, intRef LongFileNameLength );

Parameters

  • Sender - reference to the class that called the delegate/event handler.
  • FileName - the name of the file or directory whose status is queried
  • FileExists - the event handler must set this parameter to true if the file exists and the information is provided and false otherwise
  • CreationTime - the event handler must place the time of the object creation to this parameter. The value can be empty (zero in VCL, DateTime.MinValue in .NET) if the parameter is not supported.
  • LastAccessTime - the event handler must place the time of last access to the object to this parameter. The value can be empty (zero in VCL, DateTime.MinValue in .NET) or equal if the parameter is not supported.
  • LastWriteTime - the event handler must place the time of last modification of the object to this parameter. The value can be empty (zero in VCL, DateTime.MinValue in .NET) if the parameter is not supported.
  • EndOfFile - the event handler must place the size of the file data in bytes to this parameter. The size is 0 for directories.
  • AllocationSize - the event handler must place the size of the space, allocated for the file to this parameter. The allocation size is in most cases a multiple of the allocation unit (cluster) size. The size is 0 for directories.
  • FileId - the event handler may place the unique ID of the file to this parameter. The parameter is optional.
  • FileAttributes - the event handler must place the file attributes to this parameter
  • LongFileName - if the application knows, that FileName contains short (8.3) name, this application can put the actual long name to LongFileName
  • LongFileNameLength - the length (in symbols) of the name, put by the application to LongFileName parameter

Description

The event is fired when the OS needs to get information about the file or directory. If the file exists, FileExists parameter must be set to true and all information (besides optional parameters, as specified above) must be set. If the file doesn't exist, then FileExists must be set to false. In this case no parameters are read back.

If you have enabled short file name support, your callback can receive a short file name in FileName parameter. If this happens, you should pass a corresponding long file name via LongFileName parameter. To speed-up operations (save one string length measurement) CBFS doesn't measure the length of the passed long file name (you will know it when putting it to LongFileName) so your code must put the length of the passed long file name into LongFileNameLength.

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

OnEnumerateDirectory    


Got questions or comments about this topic? Tell us about them.
Contact Us | Terms of Use | Trademarks | Privacy Statement
Copyright (c) 1998-2011, EldoS Corporation