Top  Previous  Next

int _stdcall


   IN  PACKAGE_HANDLE               hPkg,

   IN  LPWSTR                       SrcFileName,

   IN  LPWSTR                       DestFileName,

   IN  BOOL                         bVariablizeName,

   IN  ULONG                        FileFlags )

Same as VirtFsAdd, but allows controlling FileFlags of the added file.


hPkg [in]

Virtual application package handle, returned by PackageOpen.

SrcFileName [in]

Name of the physical file to be added to the package. In the form: "C:\SomeFile.ext".

DestFileName [in]

Name of the file as it will appear in the virtual package. In the form: "SomeDir\SomeFile.ext". If bVariablizeName is set to TRUE, the path will be variablized.

bVariablizeName [in]

If set to TRUE, DestFileName will be variablized. For example, "C:\Windows\SomeFile.ext" will be added as "%Windows%\SomeFile.ext".

FileFlags [in]

File flags of the newly-added file. Beware that if this is a file (as opposed to directory), you must specify VIRT_FILE_FLAGS_ISFILE. For possible FileFlags values, see VirtFsGetFileFlags.

Return Value

Returns APIRET_SUCCESS if successful, or APIRET_NOT_FOUND if the file was not found.


The package containing virtual files will be reconstructed during the next call to PackageSave. The source file must remain accessible at that time.


DestFileName should always contain a logical path, containing a drive name.

Good examples: "%Program Files%\MyApp\SomeFile.exe", "C_\MyApp\SomeFile.exe" (or, if bVariablizeName set to false: "C:\Program Files\MyApp\SomeFile.exe", "C:\MyApp\SomeFile.exe").

BAD example: "MyApp\SomeFile.exe".

Remember: the virtual application has to be able to find this file with a full, logical path containing a drive.