INF DDInstall.CoInstallers 部分

注意

从 Windows 11 版本 22H2 开始,使用此部分的驱动程序包不再有资格从硬件开发人员中心获得签名。

通用驱动程序包Windows 驱动程序 不能使用此部分。

此可选部分注册分发介质上提供的一个或多个特定于设备的共同安装程序,以补充现有设备类安装程序的操作。

[install-section-name.CoInstallers] |
[install-section-name.nt.CoInstallers] | 
[install-section-name.ntx86.CoInstallers] | 
[install-section-name.ntia64.CoInstallers] | (Windows XP and later versions of Windows)
[install-section-name.ntamd64.CoInstallers] | (Windows XP and later versions of Windows)
[install-section-name.ntarm.CoInstallers] | (Windows 8 and later versions of Windows)
[install-section-name.ntarm64.CoInstallers] (Windows 10 version 1709 and later versions of Windows)
  
AddReg=add-registry-section[,add-registry-section]... 
CopyFiles=@filename | file-list-section[,file-list-section]...
[Include=filename.inf[,filename2.inf]...]
[Needs=inf-section-name[,inf-section-name]...]
[DelFiles=file-list-section[,file-list-section]...]
[RenFiles=file-list-section[,file-list-section]...]
[DelReg=del-registry-section[,del-registry-section]...] 
[BitReg=bit-registry-section[,bit-registry-section]...]
[UpdateInis=update-ini-section[,update-ini-section]...]
[UpdateIniFields=update-inifields-section[,update-inifields-section]...]
[Ini2Reg=ini-to-registry-section[,ini-to-registry-section]...]
... 

AddReg=add-registry-section[,add-registry-section]...
引用一个或多个 INF 编写器定义的 add-registry-section,这些内容存储有关提供的辅助安装程序的注册表信息。

此类 add-registry 节中指定的 HKR 指定所要安装的设备的 “软件密钥” 注册表路径。 因此,对于特定于设备的辅助安装程序,它将 (或修改) 用户可访问的每设备/驱动程序“软件”键中的 CoInstallers32 值条目。

对于特定于类的辅助安装程序,它通过修改相应 的内容来注册新的共同安装程序 。CoDeviceInstallers\SetupClassGUID 子项。 必须在引用的 add-registry 节中显式指定相应注册表 SetupClassGUID 子项的路径。

有关详细信息,请参阅 INF AddReg 指令

CopyFiles=@filename | file-list-section*[,file-list-section]...
通常通过引用 INF 文件中其他位置的一个或多个 INF 编写器定义的 file-list-section将源共同安装程序文件传输到目标计算机上的目标。 此类文件列表部分指定要从源媒体复制到目标上的目标目录的辅助安装程序文件。

但是,安装共同安装程序的系统 INF 文件永远不会在 DDInstall 中使用此指令。CoInstallers 部分。

有关详细信息,请参阅 INF CopyFiles 指令

Include=filenameinf[,filename2.inf]...
指定一个或多个系统提供的 INF 文件,这些文件包含安装此设备或 设备安装程序类的辅助安装程序所需的部分。 具有此项的 INF 文件通常应指定 Needs

Needs=inf-section-name[,inf-section-name]...
指定安装此设备期间必须处理的特定部分。 通常,此类命名节为 DDInstall包含 ”条目中列出的系统提供的 INF 文件中的 CoInstallers 节。 但是,它可以是此类 DDInstall 中引用的任何部分。包含的 INF 的 CoInstallers 部分。

DelFiles=file-list-section[,file-list-section]...
引用指定要从目标中删除的文件的文件列表部分。 很少使用此指令。

有关详细信息,请参阅 INF DelFiles 指令

RenFiles=file-list-section[,file-list-section]...
引用文件列表部分,指定要在将共同安装程序源文件复制到目标之前重命名目标上的文件。 此指令也很少使用。

有关详细信息,请参阅 INF RenFiles 指令

DelReg=del-registry-section[,del-registry-section]...
引用一个或多个 INF-writer-define delete-registry-sections。 此类部分指定了有关以前安装应从注册表中删除的相同设备的辅助安装程序的过时注册表信息。 在此类 delete-registry 节中指定的 HKR 指定与 AddReg 条目所述的注册表子项相同的注册表子项。 此指令很少在 DDInstall 中使用。CoInstallers 部分。

有关详细信息,请参阅 INF DelReg 指令

BitReg=bit-registry-section[,bit-registry-section]...
此条目在此部分中有效,但几乎从未使用过。 此类位注册表节中指定的 HKR 指定与 AddReg 条目所述的注册表子项相同的注册表子项。

有关详细信息,请参阅 INF BitReg 指令

UpdateInis=update-ini-section[,update-ini-section]...
此条目在此部分中有效,但几乎从未使用过。

有关详细信息,请参阅 INF UpdateInis 指令

UpdateIniFields=update-inifields-section[,update-inifields-section]...
此条目在此部分中有效,但几乎从未使用过。

有关详细信息,请参阅 INF UpdateIniFields 指令

Ini2Reg=ini-to-registry-section[,ini-to-registry-section]...
此条目在此部分中有效,但几乎从未使用过。

有关详细信息,请参阅 INF Ini2Reg 指令

注解

指定的 DDInstall 节必须在 INF 文件的“按制造商 的型号 ”部分下的特定于设备/型号的条目中引用。

如果 INF 包含 DDInstall。Cointallers 部分,每个平台修饰和未修饰的 DDInstall 节都必须有一个。 例如,如果 INF 包含 [install-section-name.ntx86] 节和 [install-section-name] 部分,并且注册特定于设备的辅助安装程序,则 INF 必须同时包含 [install-section-name.ntx86。Cointallers] 部分和 [install-section-name.Cointallers] 部分。 有关如何使用系统定义的 .nt.ntx86.ntia64.ntamd64.ntarm.ntarm64 扩展的详细信息,请参阅 为多个平台和操作系统创建 INF 文件

DDInstall 中的每个指令。CoInstallers 节可以引用多个 INF 编写器定义的节名称。 但是,必须用逗号 (,) 分隔每个附加的命名节与下一节。

指令创建的每个节名称在 INF 文件中必须是唯一的,并且必须遵循定义节名称的一般规则。 有关这些规则的详细信息,请参阅 INF 文件的一般语法规则

共同安装程序是一个 Win32 DLL,通常将额外的配置信息写入注册表,或执行其他安装任务,这些任务需要动态生成的系统特定信息,这些信息在创建 INF 时不可用。 特定于设备的辅助安装程序是对操作系统设备安装程序或相应类安装程序(安装该设备时)的安装操作的补充。

有关如何编写和使用共同安装程序的详细信息,请参阅 编写共同安装程序

安装共同安装程序映像

必须将所有共同安装程序文件复制到 %SystemRoot%\system32 目录中。 与任何 INF CopyFiles 操作一样,目标通过 dirid11 或为 DefaultDestDir 条目提供此 dirid 值来显式控制 INF 文件的 DestinationDirs 节中的命名 file-list-section

注册 Device-Specific 辅助安装程序

注册一个或多个特定于设备的辅助安装程序需要向注册表添加 REG_MULTI_SZ类型的值条目。 使用以下常规形式指定 AddReg 指令引用的 add-registry-section

[DDInstall.CoInstallers_DeviceAddReg]
 
HKR,,CoInstallers32,0x00010000,"DevSpecificCoInstall.dll
   [,DevSpecificEntryPoint]"[,"DevSpecific2CoInstall.dll
      [,DevSpecific2EntryPoint]"...] 

HKR 条目在 INF 文件中以单行的形式列出,提供的每个特定于设备的共同安装程序 DLL 必须具有唯一的名称。 注册列出的共同安装程序后,系统的设备安装程序会在该设备安装过程的每个后续步骤中调用它们。

如果省略可选的 DevSpecificEntryPoint ,则默认的 CoDeviceInstall 例程名称将用作共同安装程序 DLL 的入口点。

有关详细信息,请参阅 注册 Device-Specific 辅助安装程序

注册 Device-Class 辅助安装程序

若要 (和 setup-class 子项添加值项,如果不存在) 一个或多个设备类辅助安装程序到注册表,则 AddReg 指令引用的 add-registry-section 具有以下常规形式:

[DDInstall.CoInstallers_ClassAddReg]
 
HKLM,System\CurrentControlSet\Control
    \CoDeviceInstallers,{SetupClassGUID},
       0x00010008,"DevClssCoInst.dll[,DevClssEntryPoint]" 
 ...

此类 add-registry 节中的每个条目在 INF 文件中以单行的形式列出,并且提供的每个类共同安装程序 DLL 必须具有唯一的名称。 如果提供的辅助安装程序应用于多个 设备安装类,则此 add-registry 节可以有多个条目,每个条目都具有相应的 SetupClassGUID 值。

此类补充设备类辅助安装程序不得替换现有类安装程序的任何已注册的辅助安装程序。 因此,类辅助安装程序必须具有唯一的名称,并且所提供的REG_MULTI_SZ类型值必须追加 (,如标志值中的 8 所指示,0x0010008) 特定于类的辅助安装程序条目(如果有)已存在于 {SetupClassGUID} 子项中。

注意

如果已注册同名的辅助安装程序, 则 SetupAPI 函数永远不会将重复的 DevClssCoInstall.dll 追加到值条目。

可通过右键单击安装或通过调用设备安装应用程序发出的 SetupInstallFromInfSection 来激活补充 设备类辅助安装程序的 INF。

示例

此示例显示 DDInstall。IrDA 串行网络适配器的 CoInstallers 部分。 系统为这些 IrDA 提供的 INF (串行) NIC 为系统 IrDA 类安装程序提供辅助安装程序。

; DDInstall section
[PNP.NT]
AddReg=ISIR.reg, Generic.reg, Serial.reg
PromptForPort=0     ; This is handled by IRCLASS.DLL
LowerFilters=SERIAL ; This is handled by IRCLASS.DLL
BusType=14
Characteristics=0x4 ; NCF_PHYSICAL 

; ... PNP.NT.Services section omitted here
[PNP.NT.CoInstallers]
AddReg = ISIR.CoInstallers.reg 
; ...

[IRSIR.reg]
HKR, Ndi, HelpText, 0, %IRSIR.Help%
HKR, Ndi, Service, 0, "IRSIR"
HKR, Ndi\Interfaces, DefUpper, 0, "ndisirda"
HKR, Ndi\Interfaces, DefLower, 0, "nolower"
HKR, Ndi\Interfaces, UpperRange, 0, "ndisirda"
HKR, Ndi\Interfaces, LowerRange, 0, "nolower"

[Generic.reg]
HKR,,InfraredTransceiverType,0,"0"

[Serial.reg]
HKR,,SerialBased,0, "0"

[ISIR.CoInstallers.reg]
HKR,,CoInstallers32,0x00010000,"IRCLASS.dll,IrSIRClassCoInstaller"

; ... Services and Event Log registry sections omitted here
[Strings]
; ...
IRSIR.Help = "An IrDA serial infrared device is a built-in COM port or 
external transceiver which transmits infrared pulses. This NDIS 
miniport driver installs as a network adapter and binds to the FastIR 
protocol."

前面的 PNP。Nt。CoInstallers 节仅引用特定于共同安装程序的 add-registry 节。

它没有 CopyFiles 指令,因为此系统提供的 INF 会安装一组 IrDA 网络设备。 与所有系统 INF 文件一样,此 INF 文件使用其版本部分中的 LayoutFile 条目将共同安装程序文件传输到目标。

任何 DDInstall IHV 或 OEM 提供的 INF 中的 CoInstallers 节需要 CopyFiles 指令以及 SourceDisksNamesSourceDisksFiles 节。

另请参阅

AddReg

BitReg

CopyFiles

DDInstall

DelFiles

DelReg

DestinationDirs

Ini2Reg

RenFiles

SourceDisksFiles

SourceDisksNames

UpdateIniFields

版本