Control over registry operations in Windows and .NET applications

OnSetFileSecurityC event/delegate/callback


Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET   

CallbackRegistry     See also    


This callback is called when the OS or the application needs to change the security attributes of the file.


    property OnSetFileSecurityC : TCbFltSetFileSecurityEventC;
    TCbFltSetFileSecurityEventC = procedure(Sender : TObject; FileName: TCBString; SecurityInformation: SECURITY_INFORMATION; SecurityDescriptor: PSECURITY_DESCRIPTOR; Length: DWORD; var ProcessRequest: boolean) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*CbFltSetFileSecurityEventC)(CallbackRegistry* Sender, LPWSTR FileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD Length, LPBOOL RequestAccepted);

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbFltSetFileSecurityEventC)(System::TObject* Sender, TCBString FileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD Length, bool &ProcessRequest);

[C++ (.NET)]
    public delegate void CbFltSetFileSecurityEventC(CallbackRegistry^ Sender, String^ FileName, UInt32 SecurityInformation, IntPtr SecurityDescriptor, UInt32 Length, bool% ProcessRequest);

    delegate void CbFltSetFileSecurityEventC(CallbackRegistry Sender, string FileName, uint SecurityInformation, IntPtr SecurityDescriptor, uint Length, ref bool ProcessRequest);

    Delegate Sub CbFltSetFileSecurityEventC(ByVal Sender As CallbackRegistry, ByVal FileName As String, ByVal uint SecurityInformation, ByVal IntPtr SecurityDescriptor, ByVal Length As UInt32, ByRef ProcessRequest As Boolean)


  • Sender - reference to the class that called the delegate/event handler
  • FileName - the name of the file
  • SecurityInformation - a bit field, which specifies, what security information should be taken from SecurityDescriptor and set for the file
  • SecurityDescriptor - the reference to a variable-length data block, which starts as a structure (SECURITY_DESCRIPTOR) described in Platform SDK
  • Length - the length of the data, referenced by SecurityDescriptor parameter
  • ProcessRequest (RequestAccepted) - specifies, whether the request must be passed further to the underlying filters and the file system


This callback is called when the OS or the application wants to change file security attributes. Use SecurityInformation parameter to find out, what exactly security information will be set. Detailed information about SECURITY_INFORMATION and SECURITY_DESCRIPTOR can be found in MSDN Library or Windows NT Platform SDK.
Read more about contexts.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CallbackRegistry.

See also


Back to top