注册特定于设备的辅助安装程序
注意
通用或移动驱动程序包不支持本部分所述的功能。 请参阅 使用通用 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
的文件列表节,以及一个 AddReg 指令,该指令指定名为 的 Xxx.OS-platform.CoInstallers_AddReg
add-registry 节。
add-registry 部分中的项在设备的驱动程序键中创建 CoInstallers32 值条目。 条目包含共同安装程序 DLL 和(可选)特定入口点。 如果省略入口点,则默认值为 CoDeviceInstall。 十六进制标志参数 (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
在安装设备的过程中,当处理 Cointallers INF 部分时,将注册特定于设备的共同安装程序。 然后,SetupAPI 会在安装过程的每个后续步骤中调用共同安装程序。 如果为设备注册了多个辅助安装程序,则 SetupAPI 会按照它们在注册表中的列出顺序调用它们。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈