【原创】驱动卸载之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 ...
随机推荐
- JS模块化工具require.js教程(二):基本知识
前一篇:JS模块化工具我们以非常简单的方式引入了requirejs,这一篇将讲述一下requirejs中的一些基本知识,包括API使用方式等 基本API require会定义三个变量:define,r ...
- npm: 权限阻止修复
在使用 npm install 时,总提示: Error: EACCES: permission denied 今天通过这个命令设置了权限解决了问题: sudo chown -R $(whoami) ...
- Servlet创建完美教程
简介:Servlet其实是Server Let的缩写,是服务器端应用程序. java中有一个applet是客户端应用程序,与servlet对应.applet已经过时.Servlet作用:能在B/S架 ...
- Sqlalchemy python经典第三方orm
Ⅰ. 安装 pip install sqlalchemy Ⅱ. 起步链接 import time import threading import sqlalchemy from sqlalchemy ...
- Codeforces831D Office Keys
D. Office Keys time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- repo跟svn的区别
Git与SVN区别 Git和SVN正好相反,git提倡开发时拉分支,各干各的,相互独立,发版本时打标签:而svn呢,平时大家都在主干上干活,发版本时拉个分支,所以呢,svn经常会提交冲突,经常要合并代 ...
- 自兴人工智能 python特点了解
计算机语言从语言执行分类来看,大概可分为编译型语言(如Java.c++)和解释型语言(如python.javascript) 1.编译型语言 java c++ 编写源代码.java ---> ...
- querySelectorAll选择器的js实现
自从标准浏览器增加了querySelector这个类JQ的方法后,选择一个元素变成了一件so easy的事情.但是某些浏览器还是不支持.使用jq库又有点太大,其实可以自己动手实现这个选择器,具体代码如 ...
- day_11函数的形参与实参
昨天讲了函数的定义和简单分类 1:什么是函数:具体特定功能的代码快 --特定功能代码作为一个整体,并给该整体命名,就是函数. 函数的优点: 1:减少代码的冗余 2:结构清晰,可读性强 3:具有复用性, ...
- unigui ShowModal、MessageDlg
procedure Calback(Sender: TComponent; AResult: Integer);procedure TForm.Calback(Sender: TComponent; ...