OnCreateFileN event/delegate/notification
Filter:
Pascal C++ (Lib) C++ (VCL) C++ (.NET) C# VB.NETOverview
This notification callback is called after the OS has processed file or directory creation request.
Declaration
[Pascal]
property OnCreateFileN : TCbFltCreateFileEventN;
TCbFltCreateFileEventN = procedure(Sender : TObject;
FileName: WideString;
DesiredAccess: DWORD;
FileAttributes: WORD;
ShareMode: WORD;
Options: DWORD;
CreateDisposition: WORD) of object;
[C++ (Lib)]
typedef void (*CbFltCreateFileEventN)(CallbackFilter* Sender,
LPWSTR FileName,
DWORD DesiredAccess,
WORD FileAttributes,
WORD ShareMode,
DWORD Options,
WORD CreateDisposition);
[C++ (VCL)]
typedef void __fastcall (__closure *TCbFltCreateFileEventN)(System::TObject* Sender,
WideSrting FileName,
unsigned long DesiredAccess,
unsigned short FileAttributes,
unsigned short ShareMode,
unsigned long Options,
unsigned short CreateDisposition);
[C++ (.NET)]
public delegate void CbFltCreateFileEventN(CallbackFilter^ Sender,
String^ FileName,
UInt32 DesiredAccess,
UInt16 FileAttributes,
UInt16 ShareMode,
UInt32 Options,
UInt16 CreateDisposition);
[C#]
delegate void CbFltCreateFileEventN(CallbackFilter Sender,
string FileName,
Int32 DesiredAccess,
UInt16 FileAttributes,
UInt16 ShareMode,
UInt32 Options,
UInt16 CreateDisposition);
[VB.NET]
Delegate Sub CbFltCreateFileEventN(ByVal Sender As CallbackFilter,
ByVal FileName As String,
ByVal DesiredAccess As UInt32,
ByVal FileAttributes As UInt16,
ByVal ShareMode As UInt16,
ByVal Options As Int32,
ByVal CreateDisposition)
Parameters
- Sender - reference to the class that called the delegate/event handler
- FileName - contains the name of the file to create
- DesiredAccess - desired mode of access to the created file (dwDesiredAccess parameter of CreateFile() Windows API function)
- FileAttributes - the attributes to be set for the newly created 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)
Description
This notification callback is called after the OS has processed the request to create a file or directory with given name and attributes. When the callback is called, the file is already created and opened.
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.
To check, what was created (file or directory), check FileAttributes as follows (C++ / C# notation):
Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY == FILE_ATTRIBUTE_DIRECTORY;
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.

