网站大量收购闲置独家精品文档,联系QQ:2885784924

Windows服务程序 四.doc

  1. 1、本文档共9页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Windows服务程序 四

Windows服务程序 四 Windows服务程序(四)2010-06-03 02:11 P.M. (三)对服务的深入讨论之下 现在我们还剩下一个函数可以在细节上讨论,那就是服务的CtrlHandler函 数。 当调用RegisterServiceCtrlHandler函数时,SCM得到并保存这个回调函数 的地址。一个SCP调一个告诉SCM如何去控制服务的Win32函数,现在已经有10个 预定义的控制请求: Control code Meaning SERVICE_CONTROL_STOP Requests the service to stop.The hService handle must have SERVICE_STOP access.SERVICE_CONTROL_PAUSE Requests the service to pause.The hService handle must have SERVICE_PAUSE_CONTINUE access.SERVICE_CONTROL_CONTINUE Requests the paused service to resume.The hService handle must have SERVICE_PAUSE_CONTINUE access.SERVICE_CONTROL_INTERROGATE Requests the service to update immediately its current status information to the service control manager.The hService handle must have SERVICE_INTERROGATE access.SERVICE_CONTROL_SHUTDOWN Requests the service to perform cleanup tasks,because the system is shutting down.For more information,see Remarks.SERVICE_CONTROL_PARAMCHANGE Windows 2000:Requests the service to reread its startup parameters.The hService handle must have SERVICE_PAUSE_CONTINUE access.SERVICE_CONTROL_NETBINDCHANGE Windows 2000:Requests the service to update its network binding.The hService ha ndle must have SERVICE_PAUSE_CONTINUE access.SERVICE_CONTROL_NETBINDREMOVE Windows 2000:Notifies anetwork service that acomponent for binding has been removed.The service should reread its binding information and unbind from the removed component.SERVICE_CONTROL_NETBINDENABLE Windows 2000:Notifies anetwork service that adisabled binding has been enabled.The service should reread its binding information and add the new binding.SERVICE_CONTROL_NETBINDDISABLE Windows 2000:Notifies anetwork service that one of its bindings has been disabled.The service should reread its binding information and remove the binding. 上表中标有Windows 2000字样的就是2000中新添加的控制代码。除了这些代 码之外,服务也可以接受用户定义的,范围在128-255之间的代码。 当CtrlHandler函数收到一个SERVICE_CONTROL_STOP、 SERVICE_CONTROL_PAUSE、SERVICE_CONTROL_CONTINUE控制代码的时候, SetServiceStatus必须被调用去确认这个代码,并指定你认为服务处理这个状态 变化所需要的时间。

文档评论(0)

2017meng + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档