GetFileNameByFileId Event

Fires when the component needs to translate a file Id to a file or directory path.

Syntax

// CBFSGetFileNameByFileIdEventArgs carries the CBFS GetFileNameByFileId event's parameters.
type CBFSGetFileNameByFileIdEventArgs struct {...}

func (args *CBFSGetFileNameByFileIdEventArgs) FileId() int64
func (args *CBFSGetFileNameByFileIdEventArgs) FilePath() string
func (args *CBFSGetFileNameByFileIdEventArgs) SetFilePath(value string)
func (args *CBFSGetFileNameByFileIdEventArgs) ResultCode() int32
func (args *CBFSGetFileNameByFileIdEventArgs) SetResultCode(value int32)

// CBFSGetFileNameByFileIdEvent defines the signature of the CBFS GetFileNameByFileId event's handler function.
type CBFSGetFileNameByFileIdEvent func(sender *CBFS, args *CBFSGetFileNameByFileIdEventArgs)

func (obj *CBFS) GetOnGetFileNameByFileIdHandler() CBFSGetFileNameByFileIdEvent
func (obj *CBFS) SetOnGetFileNameByFileIdHandler(handlerFunc CBFSGetFileNameByFileIdEvent)

Remarks

This event fires anytime the component needs a specified FileId translated to a file or directory path. This typically occurs when a process tries to open a file or directory by Id rather than by name (e.g., if FILE_OPEN_BY_FILE_ID is used when calling the Windows API's ZwCreateFile function); the OpenFile event fires after the path is obtained from this event.

This event must be handled if one of the UseDiskQuotas or UseHardLinks properties is enabled; otherwise it is optional, and applications need not implement it if the virtual filesystem doesn't support file Ids.
Note: NFS sharing makes use of File IDs.

To handle this event properly, applications must set FilePath to the absolute path of the file or directory associated with the specified FileId. The length of the path must not exceed the value of the MaxFilePathLength property.

The root directory (\) always uses the predefined Id 0x7FFFFFFFFFFFFFFF.

Please refer to the File IDs topic for more information.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Connect 2020 Go Edition - Version 20.0 [Build 8348]