CBFS Filter 2020 C++ Builder Edition

Questions / Feedback?

BeforeGetFileSecurity Event

Fires before a file or directory's security attributes are retrieved.

Syntax

typedef struct {
  String FileName;
  int SecurityInformation;
  void* SecurityDescriptor;
  int Length;
  int LengthNeeded;
  void* FileContext;
  void* HandleContext;
  bool ProcessRequest;
  int ResultCode;
} TcbfCBFilterBeforeGetFileSecurityEventParams;

typedef void __fastcall (__closure *TcbfCBFilterBeforeGetFileSecurityEvent)(System::TObject* Sender, TcbfCBFilterBeforeGetFileSecurityEventParams *e);

__property TcbfCBFilterBeforeGetFileSecurityEvent OnBeforeGetFileSecurity = { read=FOnBeforeGetFileSecurity, write=FOnBeforeGetFileSecurity };

Remarks

This event fires before security attributes are retrieved for the file or directory specified by FileName.

Note that this event will not fire every time a file or directory is accessed. To check file security upon each access to a file or directory, implement the file create and open events and perform the necessary checks there instead.

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

The SecurityInformation parameter indicates which pieces of security information are requested. Please refer to Microsoft's SECURITY_INFORMATION data type documentation for more information about possible values.

The SecurityDescriptor parameter points to a memory buffer that receives the requested security information. The buffer referenced by the SecurityDescriptor parameter may be modified by the event handler if the operation is completed without passing it further to other filters and the filesystem driver. The Length parameter reflects the capacity of the SecurityDescriptor buffer, in bytes.

If the capacity reflected by the Length parameter is not enough to accommodate the security information, set LengthNeeded to the number of bytes necessary to hold the data, and return the ERROR_INSUFFICIENT_BUFFER error code via ResultCode.

Please refer to the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The returned data will be formatted as a SECURITY_DESCRIPTOR structure in self-relative format; please refer to the Microsoft's documentation for more information.

The FileContext and HandleContext parameters are placeholders for application-defined data associated with the file and specific handle, respectively. Please refer to the Contexts topic for more information.

The ProcessRequest parameter controls whether the request is sent onwards for further processing by subsequent filter drivers and the filesystem; it is true by default.

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