开发者

How to deny accessing to a service?

Some services can't start or stop with Service Management Console. ex) DcomLaunch, SamSs

开发者_开发问答

These services's stop button is disabled on Service Management Console. So, we can't stop the services.(Even if we have a Administrator account)

Is it possible? How can I do that?

Thanks in advance.


Your service ultimately calls SetServiceStatus to specify its status. Part of this is what controls it accepts. If you don't specify SERVICE_ACCEPT_STOP, the service cannot be shutdown. For managed code, you can set the CanStop property on ServiceBase.

Another possibility that allows a bit more finegrained control is to change the ACL on your service. MSDN has a sample article here. This is usually used if you want to allow non-admin users to be able to control when your service is running.

Please think very carefully if your service shouldn't be stopped - users should be in control of their machine and allowed to stop services at will.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜