BoxedAppSDK_CreateVirtualFileBasedOnIStream

Description

The function creates a virtual file, the behavior of which is determined by the implementation of the standard COM interface IStream.
The arguments of BoxedAppSDK_CreateVirtualFileBasedOnIStream are similar to those of the WinAPI function CreateFile.

While BoxedAppSDK_CreateVirtualFile creates a file whose contents are stored in shared memory (sufficient for most scenarios), there are cases where you may want to store virtual file data elsewhere — for example, in a database, encrypted file, or even on the Internet.
To support these cases, BoxedApp SDK allows creating a virtual file based on an IStream implementation.

When reading or writing to such a file, BoxedApp calls the following methods:

  • IStream::Read() — to read file contents
  • IStream::Write() — to write data
  • IStream::Seek() — to change or retrieve the current position
  • IStream::SetSize() — to resize the virtual file
  • IStream::Stat() — to get file statistics
  • IStream::Clone() — to create a new handle to the same virtual file

Syntax

HANDLE __stdcall BoxedAppSDK_CreateVirtualFileBasedOnIStream(
  LPCTSTR szPath,
  DWORD dwDesiredAccess,
  DWORD dwShareMode,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  DWORD dwCreationDisposition,
  DWORD dwFlagsAndAttributes,
  HANDLE hTemplateFile,
  LPSTREAM pStream
);
function BoxedAppSDK_CreateVirtualFileBasedOnIStream(
  lpFileName: PAnsiChar;
  dwDesiredAccess, dwShareMode: Integer;
  lpSecurityAttributes: PSecurityAttributes;
  dwCreationDisposition, dwFlagsAndAttributes: DWORD;
  hTemplateFile: THandle;
  pStream: IStream
): THandle; stdcall;
 
function BoxedAppSDK_CreateVirtualFileBasedOnIStreamA(
  lpFileName: PAnsiChar;
  dwDesiredAccess, dwShareMode: Integer;
  lpSecurityAttributes: PSecurityAttributes;
  dwCreationDisposition, dwFlagsAndAttributes: DWORD;
  hTemplateFile: THandle;
  pStream: IStream
): THandle; stdcall;
 
function BoxedAppSDK_CreateVirtualFileBasedOnIStreamW(
  lpFileName: PWideChar;
  dwDesiredAccess, dwShareMode: Integer;
  lpSecurityAttributes: PSecurityAttributes;
  dwCreationDisposition, dwFlagsAndAttributes: DWORD;
  hTemplateFile: THandle;
  pStream: IStream
): THandle; stdcall;

Parameters

lpFileName
Specifies the name (relative or full path) of the virtual file to be created.

dwDesiredAccess
Specifies the type of access requested to the virtual file (read, write, etc.).

dwShareMode
Specifies the sharing mode of the virtual file.

lpSecurityAttributes
Pointer to a SECURITY_ATTRIBUTES structure that optionally specifies a security descriptor and determines whether the file handle can be inherited by child processes.
Currently ignored by BoxedApp.

dwCreationDisposition
Specifies the action to take if the virtual file already exists or does not exist.

dwFlagsAndAttributes
Combination of FILE_FLAG_* and FILE_ATTRIBUTE_* values. You can pass 0.

pStream
A pointer to an IStream implementation that defines how data is read, written, and managed for the virtual file.

See Also