CallbackFilter

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

CallbackFilter.CreateVirtualFile method

Filter:

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

CallbackFilter     See also    

Overview

Creates a virtual file.

Declaration

[Pascal]
    function CreateVirtualFile(FileName: TCBString; DesiredAccess: LongWord; ShareMode: LongWord; SecurityAttributes: PSecurityAttributes; CreationDisposition: LongWord; FlagsAndAttributes: LongWord; TemplateFile: THandle ): THandle;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    HANDLE CreateVirtualFile(LPWSTR FileName, DWORD DesiredAccess, DWORD ShareMode, LPSECURITY_ATTRIBUTES SecurityAttributes, DWORD CreationDisposition, DWORD FlagsAndAttributes, HANDLE TemplateFile );

[C++ (VCL)]
    HANDLE __fastcall CreateVirtualFile(WideString FileName, unsigned long DesiredAccess, unsigned long ShareMode, Winapi::Windows::PSecurityAttributes SecurityAttributes, unsigned long CreationDisposition, unsigned long FlagsAndAttributes, NativeUInt TemplateFile );

[C++ (.NET)]
    SafeFileHandle^ CreateVirtualFile(String^ FileName, UInt32 DesiredAccess, UInt32 ShareMode, IntPtr SecurityAttributes, UInt32 CreationDisposition, UInt32 FlagsAndAttributes, IntPtr TemplateFile );

[C#]
    SafeFileHandle CreateVirtualFile(string FileName, UInt32 DesiredAccess, UInt32 ShareMode, IntPtr SecurityAttributes, UInt32 CreationDisposition, UInt32 FlagsAndAttributes, IntPtr TemplateFile);

[VB.NET]
    Function CreateVirtualFile(ByVal FileName As String, ByVal DesiredAccess As UInt32, ByVal ShareMode As UInt32, ByVal SecurityAttributes As IntPtr, ByVal CreationDisposition As UInt32, ByVal FlagsAndAttributes As UInt32, ByVal TemplateFile As IntPtr ) As SafeFileHandle

Parameters

  • FileName - name of the file to be created
  • DesiredAccess - corresponds to the parameter with the same name in CreateFile() Windows API function
  • ShareMode - corresponds to the parameter with the same name in CreateFile() Windows API function
  • SecurityAttributes - corresponds to the parameter with the same name in CreateFile() Windows API function. Currently doesn't have any effect.
  • CreationDisposition - corresponds to the parameter with the same name in CreateFile() Windows API function
  • FlagsAndAttributes - corresponds to the parameter with the same name in CreateFile() Windows API function
  • TemplateFile - corresponds to the parameter with the same name in CreateFile() Windows API function. Can be IntPtr.Zero (which corresponds to NULL in native code)

Return values

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

Description

This method is a short way to create a virtual file and expose it to the OS. All parameters correspond to parameters of CreateFile() Windows API function.

See also

About virtual files    

Back to top