转至:https://docs.microsoft.com/zh-cn/windows-hardware/drivers/install/inf-ddinstall-services-section
官网是整个系列,更完整。
每个模型DDInstall。Services节包含一个或多个inf AddService 指令,这些指令引用 inf 文件中其他由 inf 编写器定义的部分。
[install-section-name.Services] |
[install-section-name.nt.Services] |
[install-section-name.ntx86.Services] |
[install-section-name.ntarm.Services] | (Windows 8 and later versions of Windows)
[install-section-name.ntarm64.Services] | (Windows 10 version 1709 and later versions of Windows)
[install-section-name.ntia64.Services] | (Windows XP and later versions of Windows)
[install-section-name.ntamd64.Services] (Windows XP and later versions of Windows)
AddService=ServiceName,[flags],service-install-section
[,event-log-install-section[,[EventLogType][,EventName]]]...]
[DelService=ServiceName[,[flags][,[EventLogType][,EventName]]]]...
[Include=filename.inf[,filename2.inf]...]
[Needs=inf-section-name[,inf-section-name]...]
可以提供DDInstall。 包含至少一个AddService指令的服务部分,用于控制加载特定驱动程序的服务的方式和时间、其他服务或驱动程序的依赖关系等。 还可以选择指定事件日志记录服务。
条目
AddService =ServiceName,[flags],service-[安装节,事件日志-安装节[,[EventLogType][,事件名称]]].。。]
此指令在 INF 文件中的其他位置引用了一个由 inf 编写器定义的服务安装部分,也可能是在此DDInstall部分所涵盖的设备的驱动程序的 inf 文件中的其他地方。 有关详细信息,请参阅INF AddService 指令。
DelService =ServiceName[,[flags[EventLogType**,],EventName,EventLogType],事件名称 ...]][][,[flags][,[EventLogType][,**EventName]]]...
此指令从目标计算机中删除以前安装的服务。 此指令很少使用。 有关详细信息,请参阅INF DelService 指令。
Include =filename.inf[,filename2]....inf
此可选条目指定一个或多个系统提供的其他 INF 文件,其中包含安装此设备所需的部分。 如果指定此项,则通常是需要输入。
有关其用法的包含项和限制的详细信息,请参阅指定设备文件的源位置和目标位置。
需求 =inf-名称[,inf-节名称].。。
此可选条目指定在安装此设备过程中必须处理的部分。 通常,部分是DDInstall。"包含项" 中列出的系统提供的 INF 文件中的 "服务" 部分。 但是,它可以是在 DDInstall 中引用的任何节DDInstall。服务部分。
不能嵌套需求条目。 有关其用法的需求条目和限制的详细信息,请参阅指定设备文件的源位置和目标位置。
备注
DDInstall。服务部分应该与相关的DDInstall部分具有相同的平台和操作系统修饰。 例如,ntx86节会有一个相应的安装节名称. ntx86。服务部分。
在 INF 文件的 "每制造商"型号部分下,必须在特定于设备/模型的条目中引用指定的DDInstall部分。 在正式语法语句中显示的安装节名称不区分大小写的扩展可以插入到此类DDInstall中 。 跨平台 INF 文件中的服务部分名称。
有关如何使用系统定义的 ntx86、 ntia64、 ntamd64、 ntarm和Ntarm64扩展的详细信息,请参阅为多个平台和操作系统创建 INF 文件。
示例
此示例显示了DDInstall。 作为INF DDInstall部分示例的 " Ser_Inst " 部分的 "服务" 部分。
[Ser_Inst.Services]
AddService=sermouse, 0x00000002, sermouse_Service_Inst,\
sermouse_EventLog_Inst
;
; flags value in preceding entry indicates function driver of device
;
AddService = mouclass,, mouclass_Service_Inst, mouclass_EventLog_Inst
; entries in the following xxx_Inst sections omitted here for brevity,
; but fully specified as the example for the AddService directive
;
[sermouse_Service_Inst]
; ...
[sermouse_EventLog_Inst]
; ...
[mouclass_Service_Inst]
; ...
[mouclass_EventLog_Inst]
; ...
此示例显示了安装部分的名称。NT.服务部分及其服务-安装节,适用于系统提供的 WDM 音频设备/驱动程序的 inf 文件中,如inf DDInstall部分所示。
[WDMPNPB003_Device.NT.Services]
AddService = wdmaud,0x00000000,wdmaud_Service_Inst
AddService = swmidi,0x00000000,swmidi_Service_Inst
AddService = sb16, 0x00000002,sndblst_Service_Inst
[wdmaud_Service_Inst]
DisplayName = %wdmaud.SvcDesc% ; friendly name (see Strings)
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\wdmaud.sys
[swmidi_Service_Inst]
DisplayName = %swmidi.SvcDesc%
ServiceType = 1
StartType = 1
ErrorControl = 1
ServiceBinary = %10%\system32\drivers\swmidi.sys
[sndblst_Service_Inst]
DisplayName = %sndblst.SvcDesc%
ServiceType = 1
StartType = 1
ErrorControl = 1
ServiceBinary = %10%\system32\drivers\mssb16.sys
[Strings] ; only immediately preceding %strkey% tokens shown here
%wdmaud.SvcDesc%="Microsoft WDM Virtual Wave Driver (WDM)"
%swmidi.SvcDesc%="Microsoft Software Synthesizer (WDM)"
%sndblst.SvcDesc%="WDM Sample Driver for SB16"
有关DDInstall的更多示例,请参阅INF DDInstall 部分。服务节,其中包含AddService指令引用的某些服务安装部分。 这包括一个用于 PnP 筛选器驱动程序。