put_ShareVirtualEnvironmentWithChildProcesses
Description
Specifies whether child processes of the packed executable should share the same virtual environment as the parent process. If this property is set to VARIANT_TRUE, any process created by the packed executable automatically inherits access to the same virtual file system and virtual registry.
Syntax
HRESULT put_ShareVirtualEnvironmentWithChildProcesses([in] VARIANT_BOOL bValue);Parameters
bValue
Type: VARIANT_BOOL
[in] Set to VARIANT_TRUE to make child processes share the same virtual environment as the parent process. Set to VARIANT_FALSE to make them run outside the virtual environment.
Return Value
Returns an HRESULT.
S_OKif the value was successfully applied.E_INVALIDARGif the argument is invalid.- Other standard COM error codes on failure.
Example
CComPtr<IBxProject> project;
if (SUCCEEDED(BxPackerApi_CreateProject(&project))) {
// Enable sharing of virtual environment between parent and child processes
project->put_ShareVirtualEnvironmentWithChildProcesses(VARIANT_TRUE);
project->put_InputPath(CComBSTR(L"C:\\Apps\\MyApp.exe"));
project->put_OutputPath(CComBSTR(L"C:\\Packed\\MyApp_Packed.exe"));
}Remarks
- When enabled, all child processes spawned by the packed executable automatically operate within the same virtual environment, including the same virtualized files and registry keys.
- This is particularly useful when the packed application launches helper executables or external tools that rely on the same set of virtual resources.
- When disabled, each child process runs in the normal system environment, outside the parent virtualization context.