Discuss this help topic in SecureBlackbox Forum


TElSFTPServer     See also     

Filter: C#  VB.NET  Pascal  C++  PHP  Java  

This event is fired when your software has to open file.


    event TElSFTPServerOpenFileEvent OnOpenFile;
    delegate void TElSFTPServerOpenFileEvent(Object Sender, string Path, TSBSftpFileOpenModes Modes, TSBSftpFileOpenAccess Access, uint DesiredAccess, TElSftpFileAttributes Attributes, ref Object Data, ref int ErrorCode, ref string Comment);

    Event OnOpenFile As TElSFTPServerOpenFileEvent
    Delegate Sub TElSFTPServerOpenFileEvent(ByVal Sender As Object, ByVal Path As String, ByVal Modes As TSBSftpFileOpenModes, ByVal Access As TSBSftpFileOpenAccess, ByVal DesiredAccess As UInt32, ByVal Attributes As TElSftpFileAttributes, ByRef Data As Object, ByRef ErrorCode As Integer, ByRef Comment As String)

    property OnOpenFile: TSBSFTPServerOpenFileEvent;
    TSBSFTPServerOpenFileEvent = procedure(Sender : TObject; const Path : string; Modes: TSBSftpFileOpenModes; Access : TSBSftpFileOpenAccess; DesiredAccess : Cardinal; Attributes : TElSftpFileAttributes; var Data : pointer; var ErrorCode : integer; var Comment : string) of object;
    TSBSftpFileOpenModes = set of TSBSftpFileOpenMode;
    TSBSftpFileOpenAccess = set of TSBSftpFileOpenAccessItem;

    void get_OnOpenFile(TElSFTPServerOpenFileEvent &pMethodOutResult, void * &pDataOutResult);
    void set_OnOpenFile(TElSFTPServerOpenFileEvent pMethodValue, void * pDataValue);
    typedef void (SB_CALLBACK *TElSFTPServerOpenFileEvent)(void * _ObjectData, TObjectHandle Sender, const char * pcPath, int32_t szPath, TSBSftpFileOpenModesRaw Modes, TSBSftpFileOpenAccessRaw Access, uint32_t DesiredAccess, TElSftpFileAttributesHandle Attributes, void * (* Data), int32_t &ErrorCode, char * pcComment, int32_t &szComment);

    TElSFTPServerOpenFileEvent|callable|NULL get_OnOpenFile()
    void set_OnOpenFile(TElSFTPServerOpenFileEvent|callable|NULL $Value)
    callable TElSFTPServerOpenFileEvent(TObject $Sender, string $Path, integer $Modes, integer $Access, integer $DesiredAccess, TElSftpFileAttributes $Attributes, TSBPointer $Data, integer &$ErrorCode, string &$Comment)

    TElSFTPServerOpenFileEvent getOnOpenFile();
    void setOnOpenFile(TElSFTPServerOpenFileEvent Value);
    TElSFTPServerOpenFileEvent.Callback OnOpenFile = new TElSFTPServerOpenFileEvent.Callback() {
        public void TElSFTPServerOpenFileEventCallback(TObject Sender, String Path, int Modes, int Access, int DesiredAccess, TElSftpFileAttributes Attributes, TSBObject Data, TSBInteger ErrorCode, TSBString Comment) {


  • Path - specifies the path to a file to open
  • Modes - specifies the file opening mode
  • Access - specifies if file must be blocked for reading, writing or deleting while opened.
  • DesiredAccess - specifies desired file access mode
  • Attributes - specifies the initial attributes for the file
  • Data - user data that will be associated with the file to be opened
  • ErrorCode - the error code, see values below
  • Comment - server comment
  • pcPath - specifies the path to a file to open
  • szPath - the length of pcPath.
  • pcComment - server comment
  • szComment - the length of pcComment.

TSBSftpFileOpenMode values:

TSBSftpFileOpenModesRaw values

TSBSftpFileOpenAccess values:

TSBSftpFileOpenAccessRaw values

DesiredAccess values:

Error codes values:


    This event is fired when the file has to be opened.

    Note, the Access parameter has meaning only for SFTPv5 and will be ignored for earlier versions.
The application can return the error code in ErrorCode parameter and textual comment in Comment parameter.

See also:     OnReadFile     OnRenameFile     OnRemove     OnWriteFile    

Discuss this help topic in SecureBlackbox Forum