Attached Processes
Suppose a process has initialized BoxedApp by calling BoxedAppSDK_Init.
When initializing shared memory (using MMF - memory mapped files), BoxedApp creates a virtual registry and a virtual file system. Now, another process can also access the same virtual file system and virtual registry. In this case, these two processes share a virtual environment. Each process is attached to this environment. The process of initialization, when an "attachment" takes place, is called attaching to a virtual environment.
The primary way to attach a process to a virtual environment is to run it in the context of an already attached process.
This inheritance is controlled by BoxedApp SDK options: DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES and DEF_BOXEDAPPSDK_OPTION__EMULATE_OUT_OF_PROC_COM_SERVERS.
If the option DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES is set, all child processes inherit the link to the virtual environment. In other words, they use the same virtual file system and registry as the parent process.
The option DEF_BOXEDAPPSDK_OPTION__EMULATE_OUT_OF_PROC_COM_SERVERS is important when working with COM servers. If a COM object is implemented as a virtual EXE file, BoxedApp will run that virtual EXE to create the COM object.
If the COM object is implemented as an EXE file that does not exist in the virtual file system, by default the system will launch the real EXE. Even if the DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES option is enabled, the new process will not be attached to the virtual environment and therefore will not have access to virtual files. To attach such processes, enable DEF_BOXEDAPPSDK_OPTION__EMULATE_OUT_OF_PROC_COM_SERVERS.
To explicitly attach a process to a virtual environment, use BoxedAppSDK_AttachToProcess. To detach a process, use BoxedAppSDK_DetachFromProcess.