限制用户停止一个窗口服务 [英] Restrict user to stop a windows service
本文介绍了限制用户停止一个窗口服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我参与编写Windows服务。在我开始写它,我想知道
- 什么是登录用户的角度来考虑,分具体怎么从停止服务限制其他用户?
- 什么是通用点我应该考虑在写服务?
- 如何,一旦用户尝试停止该服务显示一个警告警报?
请注意:我想用C编写服务
。感谢。
解决方案
- 普通用户将无法停止服务。它需要管理权限。
- 您不能做任何事情,包括编写到屏幕或读取键盘/鼠标。
- 您将需要编写的背景(隐藏窗口)坐镇,并通过一些进程间通信方式(RPC /插座等)的服务进行通信的应用程序。 这应用程序将从显示一个消息框或以其他方式与用户通信的服务接收的消息。
我想尝试写code(适用于服务与申请)在C#中,因为大多数的辛勤工作(与SCM注册,启动/停止等)已经为你做了
。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.
这篇关于限制用户停止一个窗口服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文