Service Configuration Programs
程序员和系统管理员使用服务配置程序来增删改查服务。SCM需要得到SCManager的句柄或服务的句柄才可以对服务数据库进行操作。可以通过OpenSCManager获取服务数据库的句柄,或者用OpenService/CreateService得到服务的句柄。
服务的安装,删除和枚举
CreateService:安装新服务到SCM数据库中,同时指定服务的名称及其他信息。
DeleteService:删除服务。
GetServiceKeyName:获取服务名称。
EnumServicesStatusEx:枚举所有服务的状态。
EnumDependentServices:检举服务的依赖服务。
也可以使用命令行工具:
sc [ServerName] Command [ServiceName][option1][option2]...
-
ServerName
-
Optional server name. Use the form \\ServerName.
Command
-
One of the following commands:
- boot
- config
- create
- delete
- description
- EnumDepend
- failure
- failureflag
- GetDisplayName
- GetKeyName
- Lock
- qc
- qdescription
- qfailure
- qfailureflag
- qprivs
- qsidtype
- query
- queryex
- privs
- QueryLock
- sdset
- sdshow
- showsid
- sidtype
配置信息
配置信息决定服务如何启动。使用下面两个函数来修改和查询。 ChangeServiceConfig/QueryServiceConfig
本文深入探讨了服务配置程序的功能,包括服务的安装、删除、枚举及配置信息的管理。同时介绍了通过服务配置管理器(SCM)进行服务数据库操作的方法,并详细解释了使用命令行工具`sc`进行服务操作的命令语法。
2万+

被折叠的 条评论
为什么被折叠?



