Discuss this help topic in CBFS Forum

OnGetFileSecurity event/delegate/callback

Filter:

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

CallbackFileSystem     See also    

Overview

The event is fired when the OS wants to retrieve file security attributes.

Declaration

[Pascal]
    property OnGetFileSecurity : TCbFGetFileSecurityEvent;
    TCbFGetFileSecurityEvent = procedure( Sender : TObject; FileInfo: TCbFsFileInfo; HandleInfo: TCbFsHandleInfo; SecurityInformation: SECURITY_INFORMATION; SecurityDescriptor: PSECURITY_DESCRIPTOR; Length: DWORD; var LengthNeeded: DWORD ) of object;

[C++ (Lib)]
    void (__stdcall *CbFGetFileSecurityEvent)(void* Sender, CbFsFileInfo* FileInfo, CbFsHandleInfo* HandleInfo, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD Length, DWORD * LengthNeeded );

[C++ (VCL)]
    typedef void (__closure *TCbFGetFileSecurityEvent)( System::TObject* Sender, TCbFsFileInfo* FileInfo, TCbFsHandleInfo* HandleInfo, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD Length, DWORD * LengthNeeded );

[C++ (.NET)]
    public __delegate void CbFGetFileSecurityEvent( CallbackFileSystem^ Sender, CbFsFileInfo^ FileInfo, CbFsHandleInfo^ HandleInfo, UInt32 SecurityInformation, IntPtr SecurityDescriptor, UInt32 Length, UInt32% LengthNeeded );

[C#]
    public void CbFGetFileSecurityEvent( CallbackFileSystem Sender, CbFsFileInfo FileInfo, CbFsHandleInfo HandleInfo, UInt32 SecurityInformation, IntPtr SecurityDescriptor, UInt32 Length, ref UInt32 LengthNeeded );

[VB.NET]
    Sub CbFGetFileSecurityEvent( ByVal Sender As CallbackFileSystem, ByVal FileInfo As CbFsFileInfo, ByVal HandleInfo As CbFsHandleInfo, ByVal SecurityInformation As UInt32, ByVal SecurityDescriptor As IntPtr, ByVal Length As UInt32, ByRef LengthNeeded As UInt32 )

[Java]
    void ICbFsFileSecurityEvents.onGetFileSecurity( CallbackFileSystem sender, CbFsFileInfo fileInfo, CbFsHandleInfo handleInfo, int securityInformation, byteArrayRef securityDescriptor, int length, intRef lengthNeeded );

Parameters

  • Sender - reference to the class that called the delegate/event handler
  • FileInfo - contains the information about the file
  • HandleInfo - contains information about particular opened file or directory handle
  • SecurityInformation - a bit field, which specifies, what security information should be read for the file and placed to SecurityDescriptor
  • 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
  • LengthNeeded - the required minimum length of the memory placeholder, referenced by SecurityDescriptor

Description

This event is fired when the OS wants to obtain file security attributes. Use SecurityInformation parameter to find out, what exactly security information must be provided. Detailed information about SECURITY_INFORMATION and SECURITY_DESCRIPTOR can be found in MSDN Library or Windows NT Platform SDK. The returned security descriptor must be in the self-relative format, where all security information is stored in a contiguous block of memory. For details see MSDN for self-relative and absolute security descriptor formats.

The event is optional, i.e. you should not attach an event handler if you don't plan to handle the event and get/set file security.

NOTE: the system calls the callback twice. First it passes 0 in Length parameter and the application must provide the necessary length for the data in LengthNeeded parameter. Then the OS will call the callback for the second time, passing the actual buffer for the data.

Error handling

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

See also

OnSetFileSecurity event    

Discuss this help topic in CBFS Forum