If your gateway runs as a service of Windows NT Server, you must install it in the Windows NT service control manager (SCM). Making your gateway a service of Windows NT Server enables it to start up automatically when the computer is turned on and to run in its own security context. Users also gain the ability to control the gateway through the operating system, instead of requiring a custom user interface.
To register a gateway as a service of Windows NT Server
Connect to the SCM by calling the Win32 OpenSCManager function.
Create the service by calling the Win32 CreateService function and passing information such as the service name and type, and the ways the service should be switched to and started.
In the local Windows NT Registry, open the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services key. Do this by calling the Win32 RegOpenKeyEx function.
Under this key, create other necessary keys for the service, such as the Object key, the Parameters key, and the Diagnostics key. Registry keys are created by calling the Win32 RegCreateKeyEx function.
Write the configuration information that your application needs into these Registry keys.
For an example of this procedure, see the HrInstallService function in \SAMPLES\DbMsg\EXCHANGE\LIBSRC\EXCHINST.C. See Installing Event Logging for specifics on creating the Diagnostics key.