RegisterVirtualFileA

Document loading, Virtual files

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to RegisterVirtualFile and string arguments are interpreted using the current SetAnsiMode code page

Registers an in-memory virtual file under a name so every library entry point that opens input files by name serves it from memory

Documents, images, fonts, media and signature material can be fed from buffers without touching the file system, and the library file existence check reports the name as existing

The native Pascal unit also supports snapshot enumeration and collision-safe renaming without copying payload data

Syntax

Delphi

Function DLRegisterVirtualFileA(InstanceID: Integer; FileName: PAnsiChar; Data: PAnsiChar; DataLength: Integer): Integer;

DLL

int DLRegisterVirtualFileA(int InstanceID, const char* FileName, const char* Data, int DataLength);

Parameters

FileNameVirtual file name; matched case-insensitively, mirroring Windows file system behaviour
DataFile bytes as an AnsiString

Return values

1 on success, 0 when FileName is empty

Remarks

Registering an existing name replaces its data; file-writing entry points also store their output in memory when targeting a mem:// URI, a pre-registered virtual file name, or any file name while SetVirtualFileWriteMode(1) is active

See also

RegisterVirtualFileFromBytes, RegisterVirtualFileFromStream, GetVirtualFileToString, GetVirtualFileToBytes, GetVirtualFileToStream, SetVirtualFileWriteMode, DeleteVirtualFile, VirtualFileExists