BoxedAppSDK_CreateVirtualFileBasedOnBuffer
Description
The function creates a virtual file with its contents located in a specified memory buffer. The file reads data from this buffer and writes data back into it. This approach is useful when creating a virtual file of a fixed size, such as a read-only file or when the file data must remain entirely in memory.
The parameters of BoxedAppSDK_CreateVirtualFileBasedOnBuffer are similar to those of the WinAPI function CreateFile.
Syntax
HANDLE __stdcall BoxedAppSDK_CreateVirtualFileBasedOnBuffer(
LPCTSTR szPath,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile,
PVOID pData,
DWORD dwSize
);function BoxedAppSDK_CreateVirtualFileBasedOnBuffer(
lpFileName: PAnsiChar;
dwDesiredAccess, dwShareMode: Integer;
lpSecurityAttributes: PSecurityAttributes;
dwCreationDisposition, dwFlagsAndAttributes: DWORD;
hTemplateFile: THandle;
pData: Pointer;
dwSize: DWORD
): THandle; stdcall;
function BoxedAppSDK_CreateVirtualFileBasedOnBufferA(
lpFileName: PAnsiChar;
dwDesiredAccess, dwShareMode: Integer;
lpSecurityAttributes: PSecurityAttributes;
dwCreationDisposition, dwFlagsAndAttributes: DWORD;
hTemplateFile: THandle;
pData: Pointer;
dwSize: DWORD
): THandle; stdcall;
function BoxedAppSDK_CreateVirtualFileBasedOnBufferW(
lpFileName: PWideChar;
dwDesiredAccess, dwShareMode: Integer;
lpSecurityAttributes: PSecurityAttributes;
dwCreationDisposition, dwFlagsAndAttributes: DWORD;
hTemplateFile: THandle;
pData: Pointer;
dwSize: DWORD
): 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.
pData
Pointer to a memory buffer that will store the file’s contents.
All reads and writes to the virtual file are performed directly on this buffer.
dwSize
Specifies the size of the buffer, in bytes.