banner



What Is A Windows Service And How Does Its Lifecycle Differ From A "Standard" Exe?

5 Answers v

A windows service always runs once the computer starts up (as long as it's so configured). A standard EXE simply runs when a user is logged in, and volition stop if the user logs out.

Yous would use a windows service for things that ever need to run fifty-fifty if nobody is logged in.

You would use a standard EXE for programs that a user will run while logged in.

answered January 24, 2010 at 4:22

user avatar

one

  • Only how does it differ from using Task Scheduler to run a process (in an isolated session) and set the trigger to when the figurer starts? As well the service could be set to exist started only manually.

    Mar nine, 2019 at 12:fifteen

A Windows service has a special ServiceMain part and must respond to Service Control Director (SCM) commands properly in order to exist functional every bit a service. On the other hand, a regular executable has a chief or WinMain function and doesn't demand to respond to any particular control commands.

answered Jan 24, 2010 at 4:22

user avatar

3

  • Technically correct but I don't think it answers the question very well. (Run into Eric J's answer).

    Jan 24, 2010 at 5:11

  • Greg and Eric's answers piece of work, only I tin only marking i as correct :-(

    Jan 24, 2010 at five:20

  • I definitely think this is a much more right answer than the one called. The other 1 responds better to the question "What is a Windows service".

    Apr 7, 2013 at 4:03

If you're talking nigh implementing a background operation, here are the criteria I'd recommend to choose a service or a window-less .exe:

Cull an exe if:

  • You demand information technology to run on a per-user basis and only when a user is logged in
  • Y'all demand it to interact with the Windows desktop (notification icons, etc.)
  • Information technology needs all the privileges of the logged-in user (no more, no less)

Cull a service if:

  • It may need to run when no 1 is logged in
  • It doesn't generally need per-user information or privilege
  • It solely communicates with the network
  • It needs to expose new "securable" objects. Objects that take their ain Declarative Access Control Lists (DACL's) that limit access to sure accounts/groups.
  • It needs special permissions that may not be available to the logged-in user.

Services can easily be security holes, so prefer .exe'south to services. Sometimes you'll need both. A virus checker needs to be able to admission every file on the filesystem (which the current user may not be able to do), but it too needs to provide info to the user in the form of notification dialogs/pop-ups and a tool tray icon. Services can't interact with the user's GUI directly. They can use the standard Windows IPC (inter-process communication) services such as pipes and shared memory regions. Such tools usually have both a service and a per-user windowless .exe that communicates with the service using Windows pipes or shared memory regions.

Get "Programming Windows Security" by Keith Brown if yous want to swoop into these topics.

answered Jan 24, 2010 at iv:32

user avatar

3

  • Minor nit: the D in DACL stands for Discretionary.

    Jan 24, 2010 at iv:58

  • "It solely communicates with the network", This is incorrect, services tin can do many others things than network access.

    Jan 24, 2010 at 5:04

  • Not all Win32/64 services solely communicate with the network, only all daemons that need only communicate with the network are almost always best implemented equally services when programming on Win32/64. I intended the listing to describe scenarios where services make sense, not circumscribing every use example for Windows services.

    Jan 24, 2010 at 6:20

A service is (usually) is a standard exe with no UI. It tin can run fifty-fifty when there is no user logged into the machine, and it'south admission rights and view of the file system is no dependent on what user is logged in.

answered Jan 24, 2010 at 4:22

user avatar

5

  • Not 100% accurate. A service must meet some additional requirements beyond existence a standard exe with no UI.

    Jan 24, 2010 at 4:23

  • yes some requirements, and a different API that it has access to, but still a standard EXE.

    Jan 24, 2010 at 4:24

  • Doesn't SQL Server Agent Service take the traffic lite interface? Thats a service if I am non mistaken?

    Jan 24, 2010 at five:22

  • a UI for a service is usually a separate process that communicates with the service via a private aqueduct

    Jan 24, 2010 at six:56

  • One more thing worth mentioning is that a service does run every bit a specific user, much like an portable executable (exe) does. Past default almost services run as the local System user, but applications may choose to create their own user in an endeavour to command resources admission.

    Mar 1, 2019 at 20:21

From the perspective of the EXE Binary and from the perspective of the Compiler's C Library, a Windows service looks exactly like a standard Unix program or a Windows console program. i.e with chief() entry betoken. What makes a service different is how it is loaded / invoked by Microsoft Windows (from the registry, usually at kicking). A service can (and should) tell the SC.exe application [Service Control Director] via Windows API calls, that the service is started, stopped, suspended, etc.

answered Sep 28, 2011 at iii:07

user avatar

Not the respond y'all're looking for? Browse other questions tagged windows-services service or ask your own question.

What Is A Windows Service And How Does Its Lifecycle Differ From A "Standard" Exe?,

Source: https://stackoverflow.com/questions/2125924/how-does-a-windows-service-differ-from-a-standard-exe

Posted by: eliaswinve1935.blogspot.com

0 Response to "What Is A Windows Service And How Does Its Lifecycle Differ From A "Standard" Exe?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel