Platform SDK: Exchange Server

Installing an Application as a Service

If your application runs as a service of Windows NT Server, it must be installed in the service control manager. Making your application a Windows NT Server application gives it the ability to start up automatically when the computer does and to run in its own security context. Users also gain the ability to control the application through the operating system instead of through a custom user interface.

To register an application as a service of Windows NT Server

  1. Connect to the service control manager by calling the Win32 OpenSCManager function.
  2. Create the service by calling the Win32 CreateService function and passing information such as the service name and type, as well as the ways the service should be accessed and started.
  3. In the local Windows NT Registry, open the HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\SERVICS key. Do this by calling the Win32 RegOpenKeyEx function.
  4. Under this key, create other necessary keys for the service, such as the object key and the parameters key. Registry keys are created by calling the Win32 RegCreateKeyEx function.
  5. Write the configuration information that your application needs into these Windows NT Registry keys.

For an example of this procedure, see the HrInstallService function in the EXCHINST.C file.