Thinapp: Child process keeps SandBox locked

One of the best practices when packaging with ThinApp includes verifying no processes are left running that lock the Sandbox when you shuts down the application. You can simply verify this by trying to delete the package’s Sandbox. If it is locked and you cannot delete it, some process is still running.
To determine wich process locks the sandbox i use Process Explorer.

In my case the child process ‘svchost.exe’ kept the sandbox locked.
Because it was running outside of the thinapp the ‘OnLastProcessExit function’ is never called.

The solution to that problem can be found in the ThinApp  User’s Guide on page 83a.
In the package.ini you can specify exceptions to running child processes in the virtual environment.

The setting i used was:

[BuildOptions]
ChildProcessEnvironmentExceptions=svchost.exe
ChildProcessEnvironmentDefault=Virtual

Another process that can keep the SandBox locked is ‘ctfmon.exe’ (advanced text services)
You can simply disable this process by adding the following to the HKEY_CURRENT_USER.txt file:

isolation_writecopy HKEY_CURRENT_USER\Software\Microsoft\CTF
  Value=Disable Thread Input Manager
  REG_DWORD=#01#00#00#00

 

A. Reference: http://www.vmware.com/pdf/thinapp46_manual.pdf page 83