CBFS Filter 2020 Delphi Edition

Questions / Feedback?

ReparseWithTag Event

Fires if an open operation returns STATUS_REPARSE so that the application can respond to the reparse point.

Syntax

type TReparseWithTagEvent = procedure (
  Sender: TObject;
  const FileName: String;
  ReparseTag: Integer;
  ReparseBuffer: Pointer;
  ReparseBufferLength: Integer;
  var ReissueIO: Boolean;
  var ResultCode: Integer
) of Object;

property OnReparseWithTag: TReparseWithTagEvent read FOnReparseWithTag write FOnReparseWithTag;

Remarks

This event fires if a STATUS_REPARSE result is returned when the OS attempts to open the file or directory specified by FileName, which indicates that there is a reparse point associated with said file or directory. More specifically, it fires immediately after the open operation returns such a result.

It is possible for applications to add reparse points to specific files/directories so that the filesystem will return STATUS_REPARSE when someone attempts to open them. Such applications can then use this event to perform some operation on the file/directory, assuming that the specified ReparseTag belongs to the application. Please refer to Microsoft's Reparse Point articles for more information.

Applications only need to handle this event if they've added a standard filter rule that includes the FS_CE_REPARSE_TAG flag.

The ReparseTag parameter reflects the reparse point's tag, which is the value the system uses to identify the format of the reparse point data. This value is also present in the ReparseBuffer data; the component extracts it and provides it separately for convenience.

The ReparseBuffer parameter points to a memory buffer that contains the full reparse point data. The ReparseBufferLength parameter reflects the length of ReparseBuffer. Please refer to the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The data itself is formatted as either a REPARSE_GUID_DATA_BUFFER structure or (for certain Microsoft-reserved tags) a REPARSE_DATA_BUFFER structure; please refer to Microsoft's documentation for more information.

If the part of the path contained in FileName constitutes a symbolic link or a junction point (both of which are handled by the filesystem), the structure in ReparseBuffer will contain the new path that is to replace a part of the original path. In such a case, the Reserved field of the REPARSE_DATA_BUFFER structure will contain the length in bytes in the original filename buffer that remains unchanged. This value, divided by 2, is the number of characters at the end of FileName which you must append to the new path, contained in ReparseBuffer.

ReissueIO can be set to True to instruct the OS to resend the original request again from the beginning. This may be necessary if the reparse tag is removed from the file or altered during this event.

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.

This event is fired synchronously; please refer to the Event Types topic for more information.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Filter 2020 Delphi Edition - Version 20.0 [Build 8047]