on_enumerate_hard_links Event
Fires when the OS needs to enumerate a file's hard links.
Syntax
class CBFSEnumerateHardLinksEventParams(object): @property def file_name() -> str: ... @property def link_found() -> bool: ... @link_found.setter def link_found(value) -> None: ... @property def link_name() -> str: ... @link_name.setter def link_name(value) -> None: ... @property def parent_id() -> int: ... @parent_id.setter def parent_id(value) -> None: ... @property def handle_info() -> int: ... @property def file_context() -> int: ... @file_context.setter def file_context(value) -> None: ... @property def handle_context() -> int: ... @handle_context.setter def handle_context(value) -> None: ... @property def enumeration_context() -> int: ... @enumeration_context.setter def enumeration_context(value) -> None: ... @property def result_code() -> int: ... @result_code.setter def result_code(value) -> None: ... # In class CBFS: @property def on_enumerate_hard_links() -> Callable[[CBFSEnumerateHardLinksEventParams], None]: ... @on_enumerate_hard_links.setter def on_enumerate_hard_links(event_hook: Callable[[CBFSEnumerateHardLinksEventParams], None]) -> None: ...
Remarks
This event fires when the OS needs to enumerate the hard links of the file specified by FileName (which will have been opened via on_open_file).
This event only needs to be handled if the use_hard_links property is enabled. To handle this event properly, applications must return information about each of the file's hard links. Note that a file's "primary" name (i.e., the one contained in FileName) is itself one of the hard links that must be reported; please refer to the Hard Links topic for more information.
For each hard link, set LinkFound to True and supply the hard link's information using the following parameters:
- LinkName: Set to the name of the hard link (not including its path).
- The length of the returned name must not exceed the value of the max_file_name_length property.
- ParentId: Set to the unique Id of the directory the hard link resides in (this Id should not change over time). Always use 0x7FFFFFFFFFFFFFFF if the hard link resides in the root directory (\).
If there are no more hard links present, set LinkFound to False and leave the above parameters unchanged. When the OS is finished with the hard links enumeration, the on_close_hard_links_enumeration event will fire.
The HandleInfo parameter carries a handle to an object with information about the file handle. While within the event handler, it can be used to call any of the following methods: get_handle_creator_process_id, get_handle_creator_process_name, get_handle_creator_thread_id, or get_handle_creator_token.
The FileContext, HandleContext, and EnumerationContext parameters are placeholders for application-defined data associated with the file, specific handle, and enumeration; respectively. Please refer to the Contexts 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.