OnPostOpenFileC event/delegate/callback
Filter:
Pascal C++ (Lib) C++ (VCL) C++ (.NET) C# VB.NETOverview
This callback is called after the file/directory has been opened.
Declaration
[Pascal]
property OnPostOpenFileC : TCbFltPostOpenFileEventC;
TCbFltPostOpenFileEventC = procedure(Sender : TObject;
FileName: WideString;
DesiredAccess: DWORD;
FileAttributes: WORD;
ShareMode: WORD;
Options: DWORD;
CreateDisposition: WORD;
var UserContext: pointer) of object;
[C++ (Lib)]
typedef void (*CbFltPostOpenFileEventC)(CallbackFilter* Sender,
LPWSTR FileName,
DWORD DesiredAccess,
WORD FileAttributes,
WORD ShareMode,
DWORD Options,
WORD CreateDisposition,
PVOID* UserContext);
[C++ (VCL)]
typedef void __fastcall (__closure *TCbFltPostOpenFileEventC)(System::TObject* Sender,
WideSrting FileName,
unsigned long DesiredAccess,
unsigned short FileAttributes,
unsigned short ShareMode,
unsigned long Options,
unsigned short CreateDisposition,
void * UserContext);
[C++ (.NET)]
public delegate void CbFltPostOpenFileEventC(CallbackFilter^ Sender,
String^ FileName,
UInt32 DesiredAccess,
UInt16 FileAttributes,
UInt16 ShareMode,
UInt32 Options,
UInt16 CreateDisposition,
IntPtr% UserContext);
[C#]
delegate void CbFltPostOpenFileEventC(CallbackFilter Sender,
string FileName,
UInt32 DesiredAccess,
UInt16 FileAttributes,
UInt16 ShareMode,
UInt32 Options,
UInt16 CreateDisposition,
ref IntPtr UserContext);
[VB.NET]
Delegate Sub CbFltPostOpenFileEventC(ByVal Sender As CallbackFilter,
ByVal FileName As String,
ByVal DesiredAccess As UInt32,
ByVal FileAttributes As UInt16,
ByVal ShareMode As UInt16,
ByVal Options As UInt32,
ByVal CreateDisposition As UInt16,
ByRef UserContext As IntPtr)
Parameters
- Sender - reference to the class that called the delegate/event handler
- FileName - contains the name of the opened file
- DesiredAccess - requested mode of access to the opened file (dwDesiredAccess parameter of CreateFile() Windows API function)
- FileAttributes - contains the attributes of the opened file
- ShareMode -
- Options - requested FILE_FLAG_xxx options (dwFlagsAndAttributes parameter of CreateFile() Windows API function)
- CreateDisposition - requested creation disposition (dwCreationDisposition parameter of CreateFile() Windows API function)
- UserContext - the placeholder for the application-defined data
Description
This callback is called after the OS has opened a file or directory with given name and attributes.
To check, what has been opened (file or directory), check FileAttributes as follows (C++ / C# notation):
Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY == FILE_ATTRIBUTE_DIRECTORY;
DesiredAccess, FileAttributes, ShareMode, Options and CreateDisposition are passed as they were specified in the call to CreateFile() Windows API function. For more details check MSDN library shipped with your development tool and also available online.
The application can use UserContext to store the reference to some information, identifying the file or directory (such as file/directory handle or database record ID or reference to the stream class etc). The value, set in the event handler, is later passed to all operations, related to this file, together with file/directory name and attributes. Read more about contexts.
Read more about when excatly On*CreateFile* and On*OpenFile* callbacks are called.
Error handling
See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CallbackFilter.

