GetFileNameByFileId Event
Fires when the component needs to translate a file Id to a file or directory path.
Syntax
public event OnGetFileNameByFileIdHandler OnGetFileNameByFileId; public delegate void OnGetFileNameByFileIdHandler(object sender, CbfsGetFileNameByFileIdEventArgs e); public class CbfsGetFileNameByFileIdEventArgs : EventArgs { public long FileId { get; } public string FilePath { get; set; } public int ResultCode { get; set; } }
Public Event OnGetFileNameByFileId As OnGetFileNameByFileIdHandler Public Delegate Sub OnGetFileNameByFileIdHandler(sender As Object, e As CbfsGetFileNameByFileIdEventArgs) Public Class CbfsGetFileNameByFileIdEventArgs Inherits EventArgs Public ReadOnly Property FileId As Long Public Property FilePath As String Public Property ResultCode As Integer End Class
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.