CreateFileAsStream Method
Creates or opens a file as a stream by passing the request directly to the filesystem.
Syntax
public CBFSDirectStream CreateFileAsStream(string fileName, int desiredAccess, int creationDisposition, int flagsAndAttributes);
Public Function CreateFileAsStream(ByVal FileName As String, ByVal DesiredAccess As Integer, ByVal CreationDisposition As Integer, ByVal FlagsAndAttributes As Integer) As CBFSDirectStream
Remarks
This method should be used instead of the Windows API's CreateFile function to create or open the file specified by FileName when some other process has it open exclusively, or when the application doesn't have sufficient security rights/permissions to access it in a "standard" way.
If the file is created or opened successfully, this method returns a stream object that provides access to its data; otherwise, it returns null.
The FileName, DesiredAccess, CreationDisposition, and FlagsAndAttributes parameters correspond to the lpFileName, dwDesiredAccess, dwCreationDisposition, and dwFlagsAndAttributes parameters of the Windows API's CreateFile function (respectively). Please refer to Microsoft's documentation for more information on how to set these parameters appropriately.