GetFileNameByFileId Event

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


virtual int FireGetFileNameByFileId(CBFSGetFileNameByFileIdEventParams *e);
typedef struct {
int64 FileId;
char *FilePath; int lenFilePath;
int ResultCode; int reserved; } CBFSGetFileNameByFileIdEventParams;
virtual INT FireGetFileNameByFileId(CBFSGetFileNameByFileIdEventParams *e);
typedef struct {
LONG64 FileId;
LPWSTR FilePath; INT lenFilePath;
INT ResultCode; INT reserved; } CBFSGetFileNameByFileIdEventParams;


This event fires anytime the class 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. 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. Note that the path must be copied to FilePath; set lenFilePath to the length of the copied string (measured in char/wchar_t, not including terminating nulls).

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

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) 2020 Callback Technologies, Inc. - All rights reserved.
CBFS Connect 2020 C++ Edition - Version 20.0 [Build 7545]