Service Programs

A service program contains executable code for one or more services. A service program created with the type SERVICE_WIN32_OWN_PROCESS contains the code for only one service. A service program created with the type SERVICE_WIN32_SHARE_PROCESS contains code for more than one service, enabling them to share code. An example of a service program that does this is the generic service host process, Svchost.exe, which hosts internal Windows services. Note that Svchost.exe is reserved for use by the operating system and should not be used by non-Windows services. Instead, developers should implement their own service hosting programs.

A service program can be configured to execute in the context of a user account from either the built-in (local), primary, or trusted domain. It can also be configured to run in a special service user account.

The following topics describe the interface requirements of the service control manager (SCM) that a service program must include:

These topics do not apply to driver services. For interface requirements of driver services, see the Windows Driver Kit (WDK).

A service runs as a background process that can affect system performance, responsiveness, energy efficiency, and security. For service optimization guidelines, see Developing Efficient Background Processes for Windows. The following topics describe additional programming considerations:

Note that if the service program functions as an RPC server, it should use dynamic endpoints and mutual authentication.