Instant control over file and folder operations in Windows and .NET applications

OnSetFileSecurityN event/delegate/callback


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

CallbackFilter     See also    


This callback is called after the OS or the application changed the security attributes of the file.


    property OnSetFileSecurityN : TCbFltSetFileSecurityEventN;
    TCbFltSetFileSecurityEventN = procedure(Sender : TObject; FileName: TCBString; SecurityInformation: SECURITY_INFORMATION; SecurityDescriptor: PSECURITY_DESCRIPTOR; Length: DWORD; Status : DWORD) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*CbFltSetFileSecurityEventN)(CallbackFilter* Sender, LPWSTR FileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD Length, LONG Status);

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

[C++ (.NET)]
    public delegate void CbFltSetFileSecurityEventN(CallbackFilter^ Sender, String^ FileName, UInt32 SecurityInformation, IntPtr SecurityDescriptor, UInt32 Length, Int32 Status);

    delegate void CbFltSetFileSecurityEventN(CallbackFilter Sender, string FileName, uint SecurityInformation, IntPtr SecurityDescriptor, uint Length, Int32 Status);

    Delegate Sub CbFltSetFileSecurityEventN(ByVal Sender As CallbackFilter, ByVal FileName As String, ByVal uint SecurityInformation, ByVal IntPtr SecurityDescriptor, ByVal Length As UInt32, ByVal Status As Int32)


  • 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
  • Status - status code of the completed operation


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

See also


Back to top