Server Help

Non-Subspace Related Coding - Writing a Windows Service

Cerium - 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
Cyan~Fire - Wed Mar 22, 2006 10:35 am
Post subject:
Service Programs. Not exactly a tutorial, but straight from the horse's mouth.
Cerium - 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.
Mr Ekted - 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.
Cyan~Fire - 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.
D1st0rt - Thu Mar 23, 2006 1:39 am
Post subject:
This is what Ekted is referring to

http://forums.minegoboom.com/viewtopic.php?t=5463
Cerium - 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.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group