Windows Services

On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention. Windows services can be configured to start when the operating system is booted and run in the background as long as Windows is running, or they can be started manually when required. They are similar in concept to a Unix daemon. Many appear in the processes list in the Windows Task Manager, most often with a username of SYSTEM, LOCAL SERVICE or NETWORK SERVICE, though not all processes with the SYSTEM username are services. The remaining services run through svchost.exe as DLLs loaded into memory.

Windows Vista Session 0 Isolation:
Services have always run in session 0. Before Windows Vista, the first user to log on was also assigned to session 0. Now, session 0 is reserved exclusively for services and other applications not associated with an interactive user session. (The first user to log on is connected to session 1, the second user to log on is connected to session 2, and so on.) Session 0 does not support processes that interact with the user.

This change means that a service cannot post or send a message to an application and an application cannot send or post a message to a service. In addition, services cannot display a user interface item such as a dialog box directly. A service can use the WTSSendMessage function to display a dialog box in another session.

Links:

Design a Windows NT Service to Exploit Special Operating System Facilities - http://www.microsoft.com/msj/1097/winnt.aspx

How to debug Windows services - http://support.microsoft.com/kb/824344

How to debug a windows service and not die in the effort - http://www.codeproject.com/KB/system/HowtoDebugaWindowsService.aspx

How to: Debug Windows Service Applications - http://msdn.microsoft.com/en-us/library/7a50syb3(VS.80).aspx

Debugging Windows Services - http://www.ondotnet.com/pub/a/dotnet/2003/09/02/debuggingsvcs.html

Developing Windows Services - http://www.ondotnet.com/pub/a/dotnet/2003/08/18/winservices.html