开发者

How to deny accessing to a service?

开发者 https://www.devze.com 2022-12-20 23:37 出处:网络
Some services can\'t start or stop with Service Management Console. ex) DcomLaunch, SamSs 开发者_开发问答

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

精彩评论

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