Author |
Message |
Cerium Server Help Squatter
Age:41 Gender: Joined: Mar 05 2005 Posts: 807 Location: I will stab you. Offline
|
Posted: Wed Mar 22, 2006 1:43 am Post subject: Writing a Windows Service |
|
|
|
|
Any of you guys know of a good tutorial that shows the steps to write a windows (nt) service? Ive tried using the project types from VS.net (2003) but theyre either incomplete, trying to hold my hand too much, or in a language Id rather not use/dont know (VB.net/C#). The (lack of) information on MSDN isnt helping much either.
Anyway, Im trying to find some info for writing a service from scratch, preferably in C++, but if it comes down to it I will learn/use whatever necessary to do so.
Thanks
-C _________________ There are 7 user(s) ignoring me right now. |
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Wed Mar 22, 2006 10:35 am Post subject: |
|
|
|
|
Service Programs. Not exactly a tutorial, but straight from the horse's mouth. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
|
Cerium Server Help Squatter
Age:41 Gender: Joined: Mar 05 2005 Posts: 807 Location: I will stab you. Offline
|
Posted: Wed Mar 22, 2006 2:03 pm Post subject: |
|
|
|
|
Yeah, I saw that, and its not very straight forward as to what goes where and whats required, etc, atleast, not from what my newbie ass could tell. Ive never written a service before so Id like something which is more step by step from creating the service, to running it and finally stopping. |
|
Back to top |
|
|
Mr Ekted Movie Geek
Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Wed Mar 22, 2006 2:30 pm Post subject: |
|
|
|
|
I've never done it before, but I thought there were utilities that could convert any EXE into a service, or load them dynamically as service. _________________ 4,691 irradiated haggis! |
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Wed Mar 22, 2006 11:08 pm Post subject: |
|
|
|
|
Well, what I got from skimming that guide is this:
A service has a main() function, like any other console app. In this main function, it calls StartServiceCtrlDispatcher(), which registers each service that the module holds. The system will then call the ServiceMain function for each service it's loading (in a separate thread). Each ServiceMain function should call RegisterServiceCtrlHandlerEx() to provide a function that processes control requests (like pause, stop, etc.), perform initialization, and call SetServiceStatus() with SERVICE_RUNNING.
And that's it. Now, like Ekted, I've never written a service before, so it may not quite work like that, but that's the impression I got from the docs. |
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
|
Back to top |
|
|
Cerium Server Help Squatter
Age:41 Gender: Joined: Mar 05 2005 Posts: 807 Location: I will stab you. Offline
|
Posted: Thu Mar 23, 2006 4:48 am Post subject: |
|
|
|
|
Yeah, Ive considered using that, since for what Im trying to do that would probably work slightly better anyway.
However, I know eventually it will be useful to know how to write a service, and Im getting sick and tired of these goddamn wizards that are trying to do everything for me. |
|
Back to top |
|
|
|