ChangeServiceConfig2 function
ChangeServiceConfig2 function
Changes the optional configuration parameters of a service.
Syntax
BOOL WINAPI ChangeServiceConfig2(
_In_ SC_HANDLE hService,
_In_ DWORD dwInfoLevel,
_In_opt_ LPVOID lpInfo
);
Parameters
- hService [in]
 - 
A handle to the service. This handle is returned by the OpenService or CreateService function and must have the SERVICE_CHANGE_CONFIG access right. For more information, see Service Security and Access Rights.
If the service controller handles the SC_ACTION_RESTART action, hService must have the SERVICE_START access right.
 - dwInfoLevel [in]
 - 
The configuration information to be changed. This parameter can be one of the following values.
Value Meaning - SERVICE_CONFIG_DELAYED_AUTO_START_INFO
 - 3
 
The lpInfo parameter is a pointer to a SERVICE_DELAYED_AUTO_START_INFO structure.
Windows Server 2003 and Windows XP: This value is not supported.
- SERVICE_CONFIG_DESCRIPTION
 - 1
 
The lpInfo parameter is a pointer to a SERVICE_DESCRIPTION structure.
- SERVICE_CONFIG_FAILURE_ACTIONS
 - 2
 
The lpInfo parameter is a pointer to a SERVICE_FAILURE_ACTIONS structure.
If the service controller handles the SC_ACTION_REBOOT action, the caller must have the SE_SHUTDOWN_NAMEprivilege. For more information, see Running with Special Privileges.
- SERVICE_CONFIG_FAILURE_ACTIONS_FLAG
 - 4
 
The lpInfo parameter is a pointer to a SERVICE_FAILURE_ACTIONS_FLAG structure.
Windows Server 2003 and Windows XP: This value is not supported.
- SERVICE_CONFIG_PREFERRED_NODE
 - 9
 
The lpInfo parameter is a pointer to a SERVICE_PREFERRED_NODE_INFO structure.
Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported.
- SERVICE_CONFIG_PRESHUTDOWN_INFO
 - 7
 
The lpInfo parameter is a pointer to a SERVICE_PRESHUTDOWN_INFO structure.
Windows Server 2003 and Windows XP: This value is not supported.
- SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO
 - 6
 
The lpInfo parameter is a pointer to a SERVICE_REQUIRED_PRIVILEGES_INFO structure.
Windows Server 2003 and Windows XP: This value is not supported.
- SERVICE_CONFIG_SERVICE_SID_INFO
 - 5
 
The lpInfo parameter is a pointer to a SERVICE_SID_INFO structure.
- SERVICE_CONFIG_TRIGGER_INFO
 - 8
 
The lpInfo parameter is a pointer to a SERVICE_TRIGGER_INFO structure. This value is not supported by the ANSI version of ChangeServiceConfig2.
Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported until Windows Server 2008 R2.
- SERVICE_CONFIG_LAUNCH_PROTECTED
 - 12
 
The lpInfo parameter is a pointer a SERVICE_LAUNCH_PROTECTED_INFO structure.
Note This value is supported starting with Windows 8.1. - lpInfo [in, optional]
 - 
A pointer to the new value to be set for the configuration information. The format of this data depends on the value of the dwInfoLevel parameter. If this value is NULL, the information remains unchanged.
 
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The ChangeServiceConfig2 function changes the optional configuration information for the specified service in the service control manager database. You can obtain the current optional configuration information by using the QueryServiceConfig2 function.
You cannot set the SERVICE_CONFIG_FAILURE_ACTIONS value for a service that shares the service control manager's process. This includes all services whose executable image is "Services.exe".
You can change and query additional configuration information using the ChangeServiceConfig and QueryServiceConfig functions, respectively.
If a service is configured to restart after it finishes with an error, the service control manager queues the restart action to occur after the specified time delay. A queued restart action cannot be canceled. If the service is manually restarted and then stopped before the queued restart action occurs, the service will restart unexpectedly when the time delay elapses. The service must be explicitly disabled to prevent it from restarting.
The SERVICE_CONFIG_LAUNCH_PROTECTED value can be used to launch the service as protected. In order to launch the service as protected, the service must be signed with a special certificate.
SERVICE_CONFIG_LAUNCH_PROTECTED example:
SERVICE_LAUNCH_PROTECTED_INFO Info;
SC_HANDLE hService; Info.dwLaunchProtected = SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT; hService = CreateService (...); if (ChangeServiceConfig2(hService,
SERVICE_CONFIG_LAUNCH_PROTECTED,
&Info) == FALSE)
{
Result = GetLastError();
}
Examples
For an example, see Changing a Service's Configuration.
Requirements
| 
 Minimum supported client  | 
 Windows XP [desktop apps only]  | 
|---|---|
| 
 Minimum supported server  | 
 Windows Server 2003 [desktop apps only]  | 
| 
 Header  | 
  | 
| 
 Library  | 
  | 
| 
 DLL  | 
  | 
| 
 Unicode and ANSI names  | 
 ChangeServiceConfig2W (Unicode) and ChangeServiceConfig2A (ANSI)  | 
See also
- ChangeServiceConfig
 - CreateService
 - OpenService
 - QueryServiceConfig
 - QueryServiceConfig2
 - QueryServiceDynamicInformation
 - Service Configuration
 - Service Functions
 - SERVICE_DELAYED_AUTO_START_INFO
 - SERVICE_DESCRIPTION
 - SERVICE_FAILURE_ACTIONS
 - SERVICE_FAILURE_ACTIONS_FLAG
 - SERVICE_PRESHUTDOWN_INFO
 - SERVICE_REQUIRED_PRIVILEGES_INFO
 - SERVICE_SID_INFO
 
ChangeServiceConfig2 function的更多相关文章
- Command Line-Version (SetACL.exe) – Syntax and Description
		
For a quick start, tell SetACL the following: Object name (-on): This is the path to the object SetA ...
 - Delphi 不使用自带模板创建服务
		
program Project1; uses Windows, WinSvc; const ServiceName: pchar = 'SnowWings Service'; DisplayName: ...
 - 【T1543.003】利用 ACL 隐藏恶意 Windows 服务
		
看到一篇文章讲述了通过设置 DACL 隐藏 Windows 服务信息,便做一下总结. 技术原理 系统中每个 Service 在 Windows 中属于都一种对象(Object),用户在访问对象时的权限 ...
 - 通过百度echarts实现数据图表展示功能
		
现在我们在工作中,在开发中都会或多或少的用到图表统计数据显示给用户.通过图表可以很直观的,直接的将数据呈现出来.这里我就介绍说一下利用百度开源的echarts图表技术实现的具体功能. 1.对于不太理解 ...
 - jsp中出现onclick函数提示Cannot return from outside a function or method
		
在使用Myeclipse10部署完项目后,原先不出错的项目,会有红色的叉叉,JSP页面会提示onclick函数错误 Cannot return from outside a function or m ...
 - JavaScript function函数种类
		
本篇主要介绍普通函数.匿名函数.闭包函数 目录 1. 普通函数:介绍普通函数的特性:同名覆盖.arguments对象.默认返回值等. 2. 匿名函数:介绍匿名函数的特性:变量匿名函数.无名称匿名函数. ...
 - 在ubuntu16.10 PHP测试连接MySQL中出现Call to undefined function: mysql_connect()
		
1.问题: 测试php7.0 链接mysql数据库的时候发生错误: Fatal error: Uncaught Error: Call to undefined function mysqli_con ...
 - jquery中的$(document).ready(function() {});
		
当文档载入时执行function函数里的代码, 这部分代码主要声明,页面加载后 "监听事件" 的方法.例如: $(document).ready( $("a") ...
 - Function.prototype.toString 的使用技巧
		
Function.prototype.toString这个原型方法可以帮助你获得函数的源代码, 比如: function hello ( msg ){ console.log("hello& ...
 
随机推荐
- 【转】ASP.NET MVC 数据验证及相关内容
			
原文地址:http://www.jb51.net/article/56713.htm 一.数据验证 数据验证的步骤在模型类中添加与验证相关的特性标记在客户端导入与验证相关的js文件和css文件使用与验 ...
 - Jquery的hover方法让鼠标经过li时背景变色
			
来源地址:http://itfish.net/article/29790.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Trans ...
 - PHP学习之[第03讲]PHP5.4 语法、常量、变量、数据类型详解
			
1.<?php echo "Hello World"; ?> 2.//注释1,#注释2,/* 注释3 */ 3.系统常量: __FILE__默认常量,是指PHP程序文件 ...
 - Android实现计时与倒计时(限时抢购)的几种方法
			
在购物网站的促销活动中一般都有倒计时限制购物时间或者折扣的时间,这些都是如何实现的呢? 在一个安卓客户端项目中恰好遇到了类似的问题,一开始使用的是Timer与 TimerTask, 虽然此方法通用,但 ...
 - 2008年NOI全国竞赛 假面舞会
			
/* 分三种情况 1 有环:找环长的gcd作为max gcd的超过2的最小因子作为min 2 树:所有最长链的和作为max 3为min (最长链≥3) 3 两条相交链:找出所有的这样的两条链的差 同1 ...
 - NOI2015 程序自动分析
			
/* 十分简单的题面 离散化一下 然后并茶几一下就OK了 跑的死慢 可能还有更优的方法吧 */ #include<iostream> #include<cstdio> #inc ...
 - UWP APP 开发日记
			
最近需要使用C#开发UWP应用,以前学习过C,这回就是快速看了一下C#的一些特别之处,然后就进入到了实战练习当中. 1.按照MSDN的教程自己搭建了一个简单的“Hello, world”应用.是使用C ...
 - jQuery自定义组件——输入框设置默认提示文字
			
if (window.jQuery || window.Zepto) { /** * 设置输入框提示信息 * @param options * @author rubekid */ var setIn ...
 - grep和正则表达式
			
正则表达式示例表字 符 意 义 示 例* 任意长度的字符串. a* 表示: 空字符串.aaaa.a…? 长度为0或者1的字符串. a? 表示: 空字符串和a.+ 长度为一个或者多个的字符串. a+表示 ...
 - 禁止Windows远程桌面拷贝文件
			
通过组策略,我们可以解决以上问题,开始菜单运行输入gpedit.msc,进入“计算机配置”项,按顺序进入“管理模板”.“windows组件”.“终端服务”.“客户端/服务器数据重定向”.在详细描述栏中 ...