CallbackFilter.CreateNonCbFile method


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

CallbackFilter     See also    


Creates a file by passing the request to the next filter.


    function CreateNonCbFile( FileName: CBString; DesiredAccess: LongWord; CreationDisposition: LongWord; FlagsAndAttributes: LongWord ): THandle;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    HANDLE CreateNonCbFile( LPWSTR FileName, DWORD DesiredAccess, DWORD CreationDisposition, DWORD FlagsAndAttributes );

[C++ (VCL)]
    HANDLE __fastcall CreateNonCbFile( WideString FileName, unsigned DesiredAccess, unsigned CreationDisposition, unsigned FlagsAndAttributes );

[C++ (.NET)]
    SafeFileHandle^ CreateNonCbFile( String^ FileName, unsigned long DesiredAccess, unsigned long CreationDisposition, unsigned long FlagsAndAttributes );

    SafeFileHandle CreateNonCbFile( string FileName, UInt32 DesiredAccess, UInt32 CreationDisposition, UInt32 FlagsAndAttributes );

    Function CreateNonCbFile( ByVal FileName As String, ByVal DesiredAccess As UInt32, ByVal CreationDisposition As UInt32, ByVal FlagsAndAttributes As UInt32) As SafeFileHandle


  • FileName - name of the file to be created or opened
  • DesiredAccess - desired mode of access to the created file (dwDesiredAccess parameter of CreateFile() Windows API function)
  • Options - FILE_FLAG_xxx options (dwFlagsAndAttributes parameter of CreateFile() Windows API function)
  • CreationDisposition - creation disposition (dwCreationDisposition parameter of CreateFile() Windows API function)

Return values

Handle of the file if the function succeeded or INVALID_HANDLE_VALUE (-1L or 0xFFFFFFFF) if the function failed.


Use this method to create or open the file on the disk in the way that callback/event handlers won't be called for this file and thus possible recursion and infinite loops will be avoided. Unlike OpenFile, this method should not be used from within a callback/event handler. The obtained handle can be used in any filesystem operation function.

Use CloseHandle() function in Windows API to close the obtained handle.

See also