I'm involved in writing a Windows Service. Before I start writing it, I'd like to know
- What are the points to be considered in terms of LOGIN USERS, specifically how to restrict other users from "stopping a service"?
- What are the generic points should I consider while writing a service?
- How can I display a warning alert once the user tries to stop the service?
Note: I am trying to write the service in C.
Thanks.
- Normal users wont be able to stop services. It requires administration privileges.
- You can't do anything that involves writing to the screen or reading the keyboard/mouse.
- You will need to write an application that sits in the background (hidden window) and communicates with the service via some interprocess communication method (RPC/sockets etc). This application will receive a message from the service that displays a message box or otherwise communicates with the user.
I would try to write the code (for both service & application) in C# as most of the hard work (registering with SCM, start/stop etc) has been done for you.