Virtual Services
Previous  Top  Next


Thinstall can be used to package up services in 2 different modes:

1. A Virtual Service

· Packaged together with a main supporting application  
· Runs on application start-up  
· Runs under the user account which ran the application  
· Can be started and stopped only by virtual applications in same sandbox (Visible to services control panel services manager only by running from virtual cmd.exe  
· Zero Installation or system changes required  

By default any application that installs a service will automatically use virtual services. When using Setup Capture to capture an application which installs virtual services, no changes are needed to your project to run virtual services.

Starting virtual services
Thinstall uses the registry values captured by Setup Capture to determine if it should automatically start a virtual service when it's host application is run.
If the Service Startup Type = Automatic, then Thinstall will start the service automatically before executing the host application.
If the Service Startup Type = Manual, then Thinstall will not start the service until a host application specifically starts the service using service API calls (OpenService/StartService). If you want to prevent virtual service from being automatically started when the first parent process is launched, you can use the AutoStartServices option.

Stopping virtual services
Virtual Services that are started during application startup will be automatically shutdown when the last non-service application exits. You can force virtual service to continue running until the user logs off using the AutoShutdownServices option.

running until the currently logged in user logs out unless the application explicitly tells the service to stop. See Stopping Services script for an example of how to explicitly stop virtual services when the main application exits. Note: This behavior may change in future version of Thinstall.

2. A real "Real" Windows Service

· Packaged as a separate Thinstalled EXE file which can be run directly  
· Runs on boot-up  
· Runs under the account specified by the service  
· Will be directly visible to the control panel services manager  
· Can be started and stopped by any application  
· Requires global system registry change  

Running Thinstalled EXE as "Real" Windows Services

For some applications, it may be desirable to run as a real windows service on system boot up rather than when an application is launched by a user.

To install a Thinstalled packaged EXE as a real service, the general procedure looks like this:

1. Remove virtual registy keys from your Thinstall project relating to services
2. Add real system registry keys for the associated service which point to your Thinstall packaged EXE


More specific instructions using Apache web server as an example:

1. After capture delete all services registry keys from HKEY_LOCAL_MACHINE.txt
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

2. On target machine where you want to run the service, write real registry keys where ImagePath points to your Thinstalled EXE, like this:

c:\path_to_thinstalled_apache\httpd.exe -k runservice

You can write the registry values using a .reg file or as part of an installation process.

3. You may need to reboot before the service will show up in the service control panel (Start->Run->services.msc). Once it shows up, you can test starting and stoping the service directly by using the control panel. Note: rebooting isn't required to use the service, it's just to have the service control panel refresh it's list of available services.

Below are the registry keys one would delete from HKEY_LOCAL_MACHINE.txt for the apache web server.

isolation_full HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache2.2
Value=Type  
REG_DWORD=#10#00#00#00  
Value=Start  
REG_DWORD=#02#00#00#00  
Value=ErrorControl  
REG_DWORD=#01#00#00#00  
Value=ImagePath  
REG_EXPAND_SZ~"%ProgramFilesDir%\Apache Software Foundation\Apache2.2\bin\httpd.exe" -k runservice#2300  
Value=DisplayName  
REG_SZ~Apache2.2#2300  
Value=DependOnService  
REG_MULTI_SZ~Tcpip#2300Afd#2300#2300  
Value=DependOnGroup  
REG_MULTI_SZ=#00  
Value=ObjectName  
REG_SZ~LocalSystem#2300  
Value=Description  
REG_SZ~Apache/2.2.3 (Win32)#2300  

isolation_full HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache2.2\Parameters
Value=ConfigArgs  
REG_MULTI_SZ~-f#2300%ProgramFilesDir%\Apache Software Foundation\Apache2.2\conf\httpd.conf#2300-d#2300%ProgramFilesDir%\Apache Software Foundation\Apache2.2\.#2300#2300  

isolation_full HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache2.2\Security
Value=Security  
REG_BINARY=#01#00#14#80#90#00#00#00#9c#00#00#00#14#00#00#00#30#00#00#00#02#00#1c#00#01#00#00#00#02#80#14#00#ff#01#0f#00#01#01#00#00#00#00#00#01#00#00#00#00#02#00#60#00#04#00#00#00#00#00#14#00#fd#01#02#00#01#01#00#00#00#00#00#05#12#00#00#00#00#00#18#00#ff#01#0f#00#01#02#00#00#00#00#00#05#20#00#00#00#20#02#00#00#00#00#14#00#8d#01#02#00#01#01#00#00#00#00#00#05#0b#00#00#00#00#00#18#00#fd#01#02#00#01#02#00#00#00#00#00#05#20#00#00#00#23#02#00#00#01#01#00#00#00#00#00#05#12#00#00#00#01#01#00#00#00#00#00#05#12#00#00#00  

isolation_full HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache2.2\Enum
Value=0  
REG_SZ~Root\LEGACY_APACHE2.2\0000#2300  
Value=Count  
REG_DWORD=#01#00#00#00  
Value=NextInstance  
REG_DWORD=#01#00#00#00