from:
http://www.onegreen.net/Article_Print.asp?ArticleID=257
===============
增加一个服务:
Signature="$WINDOWS NT$"
AddService=inetsvr,,My_AddService_Name
DisplayName=Windows Internet Service
Description=提供对 Internet 信息服务管理的支持。
ServiceType=0x10
StartType=2
ErrorControl=0
ServiceBinary=%11%\inetsvr.exe
保存为inetsvr.inf,然后:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 c:\path\inetsvr.inf
这个例子增加一个名为inetsvr的服务(是不是很像系统自带的服务,呵呵)。
几点说明:
1,最后四项分别是
服务类型:0x10为独立进程服务,0x20为共享进程服务(比如svchost);
启动类型:0 系统引导时加载,1 OS初始化时加载,2 由SCM(服务控制管理器)自动启动,3 手动启动,4 禁用。
(注意,0和1只能用于驱动程序)
错误控制:0 忽略,1 继续并警告,2 切换到LastKnownGood的设置,3 蓝屏。
服务程序位置:%11%表示system32目录,%10%表示系统目录(WINNT或Windows),%12%为驱动目录system32\drivers。其他取值参见DDK。你也可以不用变量,直接使用全路径。
这四项是必须要有的。
2,除例子中的六个项目,还有LoadOrderGroup、Dependencies等。不常用所以不介绍了。
3,inetsvr后面有两个逗号,因为中间省略了一个不常用的参数flags。
删除一个服务:
Signature="$WINDOWS NT$"
DelService=inetsvr
from:
http://www.onegreen.net/Article_Print.asp?ArticleID=257
===============
Add a service:
Signature="$WINDOWS NT$"
AddService=inetsvr,,My_AddService_Name
DisplayName=Windows Internet Service
Description=Provides support for managing Internet information services.
ServiceType=0x10
StartType=2
ErrorControl=0
ServiceBinary=%11%\inetsvr.exe
Save as inetsvr.inf, then:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 c:\path\inetsvr.inf
This example adds a service named inetsvr (it's a lot like the system's own services, heh heh).
Some notes:
1. The last four items are respectively
Service type: 0x10 is an independent process service, 0x20 is a shared process service (such as svchost);
Start type: 0 loaded at system boot, 1 loaded during OS initialization, 2 automatically started by SCM (Service Control Manager), 3 started manually, 4 disabled.
(Note that 0 and 1 can only be used for drivers)
Error control: 0 ignore, 1 continue and warn, 2 switch to LastKnownGood settings, 3 blue screen.
Service program location: %11% means system32 directory, %10% means system directory (WINNT or Windows), %12% is driver directory system32\drivers. Other values refer to DDK. You can also use the full path directly without variables.
These four items are necessary.
2. In addition to the six items in the example, there are LoadOrderGroup, Dependencies, etc. They are not commonly used so not introduced.
3. There are two commas after inetsvr because an infrequently used parameter flags is omitted in the middle.
Delete a service:
Signature="$WINDOWS NT$"
DelService=inetsvr