【原创】驱动卸载之ControlService函数
BOOL WINAPI ControlService(
_In_ SC_HANDLE hService,
_In_ DWORD dwControl,
_Out_ LPSERVICE_STATUS lpServiceStatus
);
Control code | Meaning |
---|---|
|
Notifies a paused service that it should resume. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. (恢复服务,需要SERVICE_PAUSE_CONTINUE权限) |
|
Notifies a service that it should report its current status information to the service control manager. The hService handle must have the SERVICE_INTERROGATE access right. Note that this control is not generally useful as the SCM is aware of the current state of the service. (向SCM报告服务的当前状态信息,需要有SERVICE_INTERROGATE权限) |
|
Notifies a network service that there is a new component for binding. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead. (网络绑定相关,已废弃) |
|
Notifies a network service that one of its bindings has been disabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead. (网络绑定相关,已废弃) |
|
Notifies a network service that a disabled binding has been enabled. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead. (网络绑定相关,已废弃) |
|
Notifies a network service that a component for binding has been removed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. However, this control code has been deprecated; use Plug and Play functionality instead. (网络绑定相关,已废弃) |
|
Notifies a service that its startup parameters have changed. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. (服务启动参数已经改变,需要有SERVICE_PAUSE_CONTINUE权限) |
|
Notifies a service that it should pause. The hService handle must have the SERVICE_PAUSE_CONTINUE access right. (暂停服务,需要有SERVICE_PAUSE_CONTINUE权限) |
|
Notifies a service that it should stop. The hService handle must have the SERVICE_STOP access right. After sending the stop request to a service, you should not send other controls to the service. (停止服务,需要有SERVICE_STOP权限) |
Return code | Description |
---|---|
|
The handle does not have the required access right. |
|
The service cannot be stopped because other running services are dependent on it. |
|
The specified handle was not obtained using CreateService or OpenService, or the handle is no longer valid. |
|
The requested control code is undefined. |
|
The requested control code is not valid, or it is unacceptable to the service. |
|
The requested control code cannot be sent to the service because the state of the service is SERVICE_STOPPED, SERVICE_START_PENDING, or SERVICE_STOP_PENDING. |
|
The service has not been started. |
|
The process for the service was started, but it did not call StartServiceCtrlDispatcher, or the thread that called StartServiceCtrlDispatcher may be blocked in a control handler function. |
|
The system is shutting down. |
To stop and start a service requires a security descriptor that allows you to do so. The default security descriptor allows the LocalSystem account, and members of the Administrators and Power Users groups to stop and start services. To change the security descriptor of a service, see Modifying the DACL for a Service.
The QueryServiceStatusEx function returns a SERVICE_STATUS_PROCESS structure whose dwCurrentState and dwControlsAccepted members indicate the current state and controls accepted by a running service. All running services accept the SERVICE_CONTROL_INTERROGATE control code by default. Drivers do not accept control codes other than SERVICE_CONTROL_STOP and SERVICE_CONTROL_INTERROGATE. Each service specifies the other control codes that it accepts when it calls the SetServiceStatus function to report its status. A service should always accept these codes when it is running, no matter what it is doing.
The following table shows the action of the SCM in each of the possible service states.
Service state | Stop | Other controls |
---|---|---|
STOPPED | (c) | (c) |
STOP_PENDING | (b) | (b) |
START_PENDING | (a) | (b) |
RUNNING | (a) | (a) |
CONTINUE_PENDING | (a) | (a) |
PAUSE_PENDING | (a) | (a) |
PAUSED | (a) | (a) |
- (a)
-
If the service accepts this control code, send the request to the service; otherwise, ControlService returns zero and GetLastError returns ERROR_INVALID_SERVICE_CONTROL.
- (b)
-
The service is not in a state in which a control can be sent to it, so ControlService returns zero and GetLastError returns ERROR_SERVICE_CANNOT_ACCEPT_CTRL.
- (c)
-
The service is not active, so ControlService returns zero and GetLastError returns ERROR_SERVICE_NOT_ACTIVE.
本文链接:http://www.cnblogs.com/cposture/p/4717546.html
【原创】驱动卸载之ControlService函数的更多相关文章
- hook键盘驱动中的分发函数实现键盘输入数据的拦截
我自己在看<寒江独钓>这本书的时候,书中除了给出了利用过滤的方式来拦截键盘数据之外,也提到了另外一种方法,就是hook键盘分发函数,将它替换成我们自己的,然后再自己的分发函数中获取这个数据 ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数017·point点函数
<zw版·Halcon-delphi系列原创教程> Halcon分类函数017·point点函数 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“p ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数015,vector矢量
<zw版·Halcon-delphi系列原创教程> Halcon分类函数015,vector矢量 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“p ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数016,xld,xld轮廓
<zw版·Halcon-delphi系列原创教程> Halcon分类函数016,xld,xld轮廓 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“ ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数014,tuple,元组
<zw版·Halcon-delphi系列原创教程> Halcon分类函数014,tuple,元组 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“p ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数013,shape模型
<zw版·Halcon-delphi系列原创教程> Halcon分类函数013,shape模型 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“pr ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数012,polygon,多边形
<zw版·Halcon-delphi系列原创教程> Halcon分类函数012,polygon,多边形 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换 ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数011,ocr,字符识别
<zw版·Halcon-delphi系列原创教程> Halcon分类函数011,ocr,字符识别 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“p ...
- 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数010,obj,对象管理
<zw版·Halcon-delphi系列原创教程> Halcon分类函数010,obj,对象管理 为方便阅读,在不影响说明的前提下,笔者对函数进行了简化: :: 用符号“**”,替换:“p ...
随机推荐
- cp/tar/用c语言编写程序 实现cp命令的效果
1.cp (拷贝) 已存在文件路径 要拷贝的文件路径 实现cp命令的代码如下: #include <stdio.h> //因为要在命令中得到两个路径,所以要用到main函数的两个参数 i ...
- python set所用后列表不改变里面内容排序
my_list = [1,2,1,54,5,64,4681,4,676] my_list_two = list(set(my_list)) my_list_two.sort(key = my_list ...
- Eclipse下用NDK编译生成so文件
我们在安装环境的时候安装了NDK,可以在eclipse下直接生成so文件.NDK的压缩包里面自带了一些sample工程,NDK的文件直接解压到某个目录下即可. 第一次生成so文件的时候,我们先使用 ...
- java web 开发手册
W3School离线手册(2017.03) 提取密码: b2fo JavaScript高级程序设计第三版 提取密码: cscv CSS4.2.4 参 ...
- MFC编程汇总
1.visual2017专业版MFC编程环境搭建及第一个MFC程序的创建 2.通过MFC设计一个简单的计价程序 3.控件——静态空间.编辑框控件.命令按钮.复选框和单选控件 4.控件添加——静态控件. ...
- 初识Dubbo+Zookeeprt搭建SOA项目
由于工作中天天和Dubbo打交道,天天写对外服务,所以有必要自己动手搭建一个Dubbo+zookeeper项目来更更深层次的认识Dubbo 首先了解一下SOA: 英文名称(Service Orient ...
- Python之旅Day12 HTML与CSS
前端CSS与HTML部分 <a href="http://www.baidu.com" target="_Blank">百度</a>_B ...
- JS 实现版本号比较功能
js实现一个客户端版本号的统计,目前该功能可以实现版本号中数字版本的统计,例如2.2.3 <2.2.3.1, 1.2.3<2.0.0,原理就是从高版本号到次版本号依次比较 if (!Arr ...
- CSS中的px与物理像素、逻辑像素、1px边框问题
一直不太清楚CSS中的1px与逻辑像素.物理像素是个什么关系(作为一名前端感觉很惭愧 -_-!),今天终于花时间彻底弄清楚了,其实弄清楚之后就觉得事情很简单,但也只有在弄清楚之后,才会觉得简单(语出& ...
- 如何优化Spring Cloud微服务注册中心架构?
作者: 石杉的架构笔记 1.再回顾:什么是服务注册中心? 先回顾一下什么叫做服务注册中心? 顾名思义,假设你有一个分布式系统,里面包含了多个服务,部署在不同的机器上,然后这些不同机器上的服务之间要互相 ...