Fires before a file or directory's security attributes are retrieved.
type TBeforeGetFileSecurityEvent = procedure ( Sender: TObject; const FileName: String; SecurityInformation: Integer; SecurityDescriptor: Pointer; Length: Integer; var LengthNeeded: Integer; var FileContext: Pointer; var HandleContext: Pointer; var ProcessRequest: Boolean; var ResultCode: Integer ) of Object;
property OnBeforeGetFileSecurity: TBeforeGetFileSecurityEvent read FOnBeforeGetFileSecurity write FOnBeforeGetFileSecurity;
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.
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 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.