INF DDInstall.Services 部分

每个 per-Models DDInstall.Services 部分都包含一个或多个 INF AddService 指令,这些指令引用 INF 文件中其他 INF 编写器定义的部分。

[install-section-name.Services] |
[install-section-name.nt.Services] |
[install-section-name.ntx86.Services] |
[install-section-name.ntia64.Services] | (Windows XP and later versions of Windows)
[install-section-name.ntamd64.Services] | (Windows XP and later versions of Windows)
[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)
 
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]...] 

可以提供至少包含一个 AddService 指令的 DDInstall.Services 部分,用于控制如何以及何时加载特定驱动程序的服务,具体取决于其他服务或驱动程序等。 (可选)还可以指定事件日志记录服务。

条目

AddService=ServiceName, [flags],service-install-section[,event-log-install-section[,[EventLogType][,EventName]]]...

此指令引用 INF 编写器定义的 service-install-section,并且可能引用此 DDInstall 部分所涵盖设备的驱动程序的 INF 文件中其他位置的 event-log-install-section。 有关详细信息,请参阅 INF AddService 指令

DelService=ServiceName [,[flags][,[EventLogType][,EventName]]]...

此指令会从目标计算机中删除以前安装的服务。 很少用到此指令。 有关详细信息,请参阅 INF DelService 指令

Include=filename.inf [,filename2.inf]...

此可选条目指定一个或多个其他系统提供的 INF 文件,这些文件中包含安装此设备所需的部分。 如果指定了此条目,则为 Needs 条目。

Needs=inf-section-name [,inf-section-name]...

此可选条目指定在安装此设备的过程中必须处理的部分。 通常,该部分是系统提供的 INF 文件中的 DDInstall.Services 部分,该文件列在 Include 条目中。 但是,它可以是 DDInstall.Services 部分中引用的任何部分。

注解

DDInstall.Services 部分应具有与其相关的 DDInstall 部分相同的平台和操作系统修饰。 例如,install-section-name.ntx86 部分将具有对应的 install-section-name.ntx86.Services 部分。

必须在 INF 文件的每制造商 Models 部分下的设备/模型特定条目中引用指定的 DDInstall 部分。 可以将正式语法语句中显示的 install-section-name 的不区分大小写的扩展插入到跨平台 INF 文件中的此类 DDInstall.Services 部分名称中。

有关如何使用系统定义的 .nt.ntx86.ntia64.ntamd64.ntarm.ntarm64 扩展的详细信息,请参阅为多个平台和操作系统创建 INF 文件

示例

此示例显示 INF 文件中的 install-section-name.NT.Services 部分及其 service-install-section,例如用于将函数驱动程序和筛选器驱动程序添加到设备的驱动程序包。

[Example_DDInstall.Services]
AddService=ExampleFunctionDriver,0x00000002,function_ServiceInstallSection
AddService=ExampleUpperFilter,,filter_ServiceInstallSection

[function_ServiceInstallSection]
DisplayName    = %function_ServiceDesc%
ServiceType    = 1
StartType      = 3
ErrorControl   = 1
ServiceBinary  = %13%\ExampleFunctionDriver.sys

[filter_ServiceInstallSection]
DisplayName    = %filter_ServiceDesc%
ServiceType    = 1
StartType      = 3
ErrorControl   = 1
ServiceBinary  = %13%\ExampleUpperFilter.sys

[Strings] ; only immediately preceding %strkey% tokens shown here
%function_ServiceDesc%="Example function driver service"
%filter_ServiceDesc%="Example filter driver service"

有关 DDInstall.Services 部分的更多示例,这些部分包含 AddService 指令引用的一些 service-install-section,其中包括 PnP 筛选器驱动程序的一个部分,请参阅 INF DDInstall.HW 部分

另请参阅