注册特定于设备的辅助安装程序
注意
通用或移动驱动程序包不支持本部分中所述的功能。 请参阅 使用通用 INF 文件。
若要注册设备特定的共同安装程序,请在设备的 INF 文件中添加以下部分:
; :
; :
[DestinationDirs]
XxxCopyFilesSection = 11 \\DIRID_SYSTEM
\\ Xxx = driver or dev. prefix
; :
; :
[XxxInstall.OS-platform.CoInstallers] \\ OS-platform is optional
CopyFiles = XxxCopyFilesSection
AddReg = Xxx.OS-platform.CoInstallers_AddReg
[XxxCopyFilesSection]
XxxCoInstall.dll
[Xxx.OS-platform.CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"XxxCoInstall.dll, \
XxxCoInstallEntryPoint"
DestinationDirs 节中的 条目指定将 XxxCopyFilesSection 中列出的文件复制到系统目录。
Xxx 前缀应为驱动程序、设备或设备组的唯一标识符, (例如) cdrom_CopyFilesSection
。
上述示例中的下一部分 XxxInstall.OS-platform.CoInstallers
是 DDInstall。CoInstallers 部分。
本部分的名称可以具有可选的 OS/体系结构扩展 (例如,) cdrom_install.NTx86.CoInstallers
。
它包含一个 CopyFiles 指令,该指令指定名为 的文件列表节XxxCopyFilesSection
,以及一个指定名为 的 add-registry 节的AddReg 指令Xxx.OS-platform.CoInstallers_AddReg
。
add-registry 节中的 条目在设备的驱动程序密钥中创建 CoInstallers32值条目。 该条目包含共同安装程序 DLL 以及特定入口点(可选)。 如果省略入口点,则默认值为 CoDeviceInstall。 十六进制 flags 参数 (0x00010000) 指定这是 一个REG_MULTI_SZ 值条目。
若要为设备注册多个特定于设备的共同安装程序,请复制每个共同安装程序的文件,并包含注册表项中的多个字符串。 例如,若要注册两个共同安装程序,请创建如下所示的 INF 节:
; :
; :
[DestinationDirs]
XxxCopyFilesSection = 11 \\DIRID_SYSTEM
\\ Xxx = driver or dev. prefix
; :
; :
[XxxInstall.OS-platform.CoInstallers] \\ OS-platform is optional
CopyFiles = XxxCopyFilesSection
AddReg = Xxx.OS-platform.CoInstallers_AddReg
[XxxCopyFilesSection]
XxxCoInstall.dll \\ copy 1st coinst. file
YyyCoInstall.dll \\ copy 2nd coinst. file
[Xxx.OS-platform.CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000, \
"XxxCoInstall.dll, XxxCoInstallEntryPoint", \
"YyyCoInstall.dll, YyyCoInstallEntryPoint"
\\ add both to registry
设备特定的共同安装程序在安装设备的过程中注册,当处理了"Tallers INF"部分时。 然后,SetupAPI 在安装过程的每个后续步骤中调用共同安装程序。 如果为设备注册了多个共同安装程序,则 SetupAPI 将按它们在注册表中列出的顺序调用它们。