• Introduction
  • BoxedApp SDK
  • BoxedApp Packer
  • BoxedApp Packer API
Show / Hide Table of Contents
  • Introduction
  • Which Product to Choose
  • System Requirements
  • Basics
    • Virtual Environment
      • Virtual Environment
      • Attached Processes
      • How Attachment Works
      • Virtual Process
      • Shared Memory
    • Virtual File System
    • Virtual Registry
  • BoxedApp SDK
    • Introduction
    • Virtual Files
      • Creating Virtual Files
    • API
      • Functions
        • BoxedAppSDK_Init
        • BoxedAppSDK_EnableDebugLog
        • BoxedAppSDK_SetLogFile
        • BoxedAppSDK_WriteLog
        • BoxedAppSDK_EnableOption
        • BoxedAppSDK_IsOptionEnabled
        • BoxedAppSDK_RemoteProcess_EnableOption
        • BoxedAppSDK_RemoteProcess_IsOptionEnabled
        • BoxedAppSDK_CreateVirtualFile
        • BoxedAppSDK_CreateVirtualFileBasedOnIStream
        • BoxedAppSDK_CreateVirtualFileBasedOnBuffer
        • BoxedAppSDK_CreateVirtualDirectory
        • BoxedAppSDK_DeleteFileFromVirtualFileSystem
        • BoxedAppSDK_CreateVirtualRegKey
        • BoxedAppSDK_EnumVirtualRegKeys
        • BoxedAppSDK_RegisterCOMLibraryInVirtualRegistry
        • BoxedAppSDK_RegisterCOMServerInVirtualRegistry
        • BoxedAppSDK_AttachToProcess
        • BoxedAppSDK_DetachFromProcess
        • BoxedAppSDK_HookFunction
        • BoxedAppSDK_GetOriginalFunction
        • BoxedAppSDK_EnableHook
        • BoxedAppSDK_UnhookFunction
        • BoxedAppSDK_RemoteProcess_LoadLibrary
        • BoxedAppSDK_SharedMem_Alloc
        • BoxedAppSDK_SharedMem_Free
        • BoxedAppSDK_SharedMem_Lock
        • BoxedAppSDK_SharedMem_Unlock
        • BoxedAppSDK_SharedMem_CreateStreamOnSharedMem
      • Options
    • Use Cases
      • Using COM / ActiveX Object without Registering It in the Registry
      • Loading DLL from Memory
      • Starting Application Directly from Memory
      • Intercepting Functions
    • License
  • BoxedApp Packer
    • Introduction
    • Plugins
    • Virtual Files
    • Virtual Registry
    • Command Line Overriding
    • License
  • BoxedApp Packer API
    • Introduction
    • API
      • Functions
        • BxPackerApi_CreateProject
      • Interfaces
        • IBxProject
          • Methods
            • put_InputPath
            • get_InputPath
            • put_OutputPath
            • get_OutputPath
            • put_ShareVirtualEnvironmentWithChildProcesses
            • get_ShareVirtualEnvironmentWithChildProcesses
            • put_EnableDebugLog
            • get_EnableDebugLog
            • put_EnableVirtualRegistry
            • get_EnableVirtualRegistry
            • put_HideVirtualFileFromFileDialog
            • get_HideVirtualFileFromFileDialog
            • put_AllChangesAreVirtual
            • get_AllChangesAreVirtual
            • put_SetIcon
            • get_SetIcon
            • put_IconPath
            • get_IconPath
            • put_EnableSplashScreen
            • get_EnableSplashScreen
            • put_SplashScreenPath
            • get_SplashScreenPath
    • License

BoxedAppSDK_CreateVirtualFileBasedOnIStream

Description

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

BoxedAppSDK_CreateVirtualFile creates a file with the contents located in the shared memory. This is the easiest way to create a virtual file, which is sufficient for the majority of cases. However, sometimes you may need to have a virtual file with its data stored in other places: database, encrypted file or the Internet. For that purpose, BoxedApp SDK allows creating a virtual file, based on the implementation of the standard interface IStream: BoxedAppSDK_CreateVirtualFileBasedOnIStream.

Reading from such file takes the method IStream::Read(); writing to it calls IStream::Write().

Creating a new handle that points to such file requires IStream::Clone(), which returns IStream with its own current pointer.

To set and get the current position in that file, BoxedApp uses IStream::Seek().

To resize the file, it uses IStream::SetSize(). To get the size of the file, it can call the method IStream::Stat().

Syntax

C++


    HANDLE __stdcall BoxedAppSDK_CreateVirtualFileBasedOnIStream(
        LPCTSTR szPath,
        DWORD dwDesiredAccess,
        DWORD dwShareMode,
        LPSECURITY_ATTRIBUTES lpSecurityAttributes,
        DWORD dwCreationDisposition,
        DWORD dwFlagsAndAttributes,
        HANDLE hTemplateFile,
        LPSTREAM pStream);

Delphi


    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

The name, relative or full path of the virtual file to be created.

dwDesiredAccess

The requested access.

dwShareMode

The sharing mode.

lpSecurityAttributes

A pointer to a SECURITY_ATTRIBUTES structure that optionally specifies security descriptor, and whether the file handle can be inherited by child processes. It's ignored by BoxedApp currently.

dwCreationDisposition

An action to take on a virtual file that exists or doesn't exist.

dwFlagsAndAttributes

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

pStream

The virtual file will read and write data from this stream.

See Also

  • Virtual File System
Back to top BoxedApp SDK | BoxedApp Packer | BoxedApp Packer API | Download | Buy | Contact us | Copyright © Softanics | Generated by DocFX