windows驱动开发-inf文件(三)

持续讲解剩下inf节,剩下的几乎都是INF DDInstall 相关的部分,这部分其实非常多,不过我们只讲解最主要的部分,在inf文件说明的最后一篇文档中我们会说明原因。

INF-DefaultInstall

如果要生成 通用驱动程序包,则仅当具有体系结构修饰(例如 [DefaultInstall.NTAMD64])时,此部分才有效。在 INF 中使用 DefaultInstall 和 Manufacturer 部分将导致通用 INF 验证失败,并可能导致安装行为不一致。

如果用户在选择并按住 INF 文件名后选择“安装”菜单项,或者右键单击 (INF 文件名) ,则会访问 INF 文件的 DefaultInstall 部分。 在Windows 10版本 1903 及更高版本的 Windows 上,如果具有 DefaultInstall 的 INF 满足基元驱动程序的要求,则可以在许多驱动程序包 API 中使用:

[DefaultInstall] | 
[DefaultInstall.nt] | 
[DefaultInstall.ntx86] | 
[DefaultInstall.ntia64] | (Windows XP and later versions of Windows)
[DefaultInstall.ntamd64] | (Windows XP and later versions of Windows)
[DefaultInstall.ntarm] | (Windows 8 and later versions of Windows)
[DefaultInstall.ntarm64] (Windows 10 version 1709 and later versions of Windows)
 
[CopyFiles=@filename | file-list-section[,file-list-section] ...]
[CopyINF=filename1.inf[,filename2.inf]...]
[AddReg=add-registry-section[,add-registry-section]...]
[Include=filename1.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]...]
[ProfileItems=profile-items-section[,profile-items-section]...]
[UpdateInis=update-ini-section[,update-ini-section]...]
[UpdateIniFields=update-inifields-section[,update-inifields-section]...]
[Ini2Reg=ini-to-registry-section[,ini-to-registry-section]...]
[RegisterDlls=register-dll-section[,register-dll-section]...]
[UnregisterDlls=unregister-dll-section[,unregister-dll-section]...] ...
在通用 INF 中受支持
  • CopyFiles=@filename | file-list-section[,file-list-section] ...:此可选指令指定要从源介质复制到目标的一个命名文件,或者引用一个或多个 INF 编写器定义的部分,这些节指定要从源媒体传输到目标的文件。INF 的 DestinationDirs 节中的 DefaultDestDir 条目指定要复制的任何单个文件的目标。 SourceDisksNames 和 SourceDisksFiles 部分,或在此 INF 版本部分的 LayoutFile 条目中指定的其他 INF,提供驱动程序文件的分发媒体上的位置;
  • CopyINF=filename1.inf[,filename2.inf]...:(Windows XP 和更高版本的 Windows.) 此指令会导致将指定的 INF 文件复制到目标系统;
  • AddReg=add-registry-section[,add-registry-section]...:此指令引用一个或多个 INF 编写器定义的部分,这些节中的新子项(可能具有初始值条目)被指定写入注册表或在其中修改现有键的值条目;
  • Include=filename1.inf[,filename2.inf]...:此可选条目指定一个或多个系统提供的附加 INF 文件,其中包含安装此设备和/或驱动程序所需的部分。 如果指定了此项,则通常为 “需要 ”条目;
在通用 INF 中不受支持
  • Delfiles=file-list-section[,file-list-section]...: 此指令引用一个或多个 INF 编写器定义的节,其中列出了要删除的目标上的文件;
  • Renfiles=file-list-section[,file-list-section]...: 此指令引用一个或多个 INF 编写器定义的部分,其中列出了在目标上重命名的文件,然后将与设备相关的源文件复制到目标计算机;
  • DelReg=del-registry-section[,del-registry-section]...: 此指令引用一个或多个 INF 编写器定义的部分,在这些节中指定了要在设备安装期间从注册表中删除的键和/或值项;
  • BitReg=bit-registry-section[,bit-registry-section]...: 此指令引用一个或多个 INF 编写器定义的部分,其中修改 了REG_BINARY 类型的现有注册表值条目;
  • ProfileItems=profile-items-section[,profile-items-section]...: 此指令引用一个或多个 INF 编写器定义的部分,这些节描述要添加到“开始”菜单或从“开始”菜单中删除的项;
  • UpdateInis=update-ini-section[,update-ini-section]...: 此很少使用的指令引用一个或多个 INF 编写器定义的节,指定源 INI 文件,在安装过程中,此类节中的特定节或行将读取到同名的目标 INI 文件中。 (可选)可以从同名的指定源 INI 文件对目标上的现有 INI 文件进行逐行修改,可以在 update-ini 节中指定;
  • UpdateIniFields=update-inifields-section[,update-inifields-section]...: 此很少使用的指令引用一个或多个 INF 编写器定义的部分,其中指定了特定于设备的 INI 文件的行中的修改;
  • Ini2Reg=ini-to-registry-section[,ini-to-registry-section]...: 此很少使用的指令引用一个或多个 INF 编写器定义的部分,其中,源媒体上提供的特定于设备的 INI 文件中的节或行将移动到注册表中;
  • RegisterDlls=register-dll-section[,register-dll-section]...: 此指令引用一个或多个 INF 部分,用于指定属于 OLE 控件且需要自注册的文件;
  • UnregisterDlls=unregister-dll-section[,unregister-dll-section]...: 此指令引用一个或多个 INF 部分,用于指定属于 OLE 控件且需要自注销 (自删除) 的文件;

注意: 

DefaultInstall 节不得用于设备安装。 仅将 DefaultInstall 节用于安装类筛选器驱动程序、文件系统筛选器和内核驱动程序服务,这些驱动程序与设备节点 (devnode) 。如果在 Windows 10 版本 1903 及更高版本的 Windows 上使用 DefaultInstall,建议 INF 文件满足基元驱动程序的要求。

如果要对 驱动程序包 进行数字签名,则具有 “Manufacturer ”部分的驱动程序包的 INF 文件不得包含 INF DefaultInstall 节。

INF DefaultInstall.Services

DefaultInstall.Services 部分包含一个或多个 AddService 指令,引用 INF 文件中其他 INF 编写器定义的部分。 本部分等效于 INF DDInstall.Service 节与 INF DefaultInstall 节相关联。

[DefaultInstall.Services] |
[DefaultInstall.nt.Services] |
[DefaultInstall.ntx86.Services] |
[DefaultInstall.ntia64.Services] | (Windows XP and later versions of Windows)
[DefaultInstall.ntamd64.Services] | (Windows XP and later versions of Windows)
[DefaultInstall.ntarm.Services] | (Windows 8 and later versions of Windows)
[DefaultInstall.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=ServiceName,[flags],service-install-section[,event-log-install-section[,[EventLogType][,EventName]]]...: 对于此 DefaultInstall 节涵盖的驱动程序,此指令引用 INF 文件中其他位置的 INF 编写器定义的 service-install-section,并可能引用 event-log-install-section;
  • DelService=ServiceName[,[flags][,[EventLogType][,EventName]]]...: 此指令从目标计算机中删除以前安装的服务。 此指令很少使用;
  • Include=filename。inf[,filename2.inf]...: 此可选条目指定一个或多个系统提供的其他 INF 文件,其中包含安装此设备所需的部分。 如果指定了此项,则通常为 “需要 ”条目;
  • Needs=inf-section-name[,inf-section-name]...: 此可选条目指定在安装此设备期间必须处理的特定命名节。 通常,此类命名节为 DDInstall提供的 INF 文件中的“include ” 条目中列出的“service”部分。 但是,它可以是此类 DDInstall 中引用的任何“service”部分;
INF DDInstall

每个模型 DDInstall 节都包含一个可选的 DriverVer 指令,以及引用 INF 文件中其他命名节的一个或多个指令,此处显示了最常指定的 INF 指令 CopyFiles 和 AddReg。

这些指令引用的部分包含有关安装驱动程序文件和将任何特定于设备或特定于驱动程序的信息写入注册表的说明。

 

[install-section-name] | 
[install-section-name.nt] | 
[install-section-name.ntx86] | 
[install-section-name.ntia64] | (Windows XP and later versions of Windows)
[install-section-name.ntamd64] | (Windows XP and later versions of Windows)
[install-section-name.ntarm] | (Windows 8 and later versions of Windows)
[install-section-name.ntarm64] (Windows 10 version 1709 and later versions of Windows)

[DriverVer=mm/dd/yyyy[,x.y.v.z]]
[CopyFiles=@filename | file-list-section[,file-list-section] ...]
[CopyINF=filename1.inf[,filename2.inf]...] (Windows XP and later versions of Windows)
[AddReg=add-registry-section[,add-registry-section]...]
[AddProperty=add-property-section[,add-property-section]...] (Windows Vista and later versions of Windows)
[Include=filename1.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]...]
[DelProperty=del-property-section[,del-property-section]...] (Windows Vista and later versions of Windows)
[FeatureScore=featurescore]... (Windows Vista and later versions of Windows)
[BitReg=bit-registry-section[,bit-registry-section]...]
[LogConfig=log-config-section[,log-config-section]...]
[ProfileItems=profile-items-section[,profile-items-section]...] (Windows 2000 and later versions of Windows)
[UpdateInis=update-ini-section[,update-ini-section]...]
[UpdateIniFields=update-inifields-section[,update-inifields-section]...]
[Ini2Reg=ini-to-registry-section[,ini-to-registry-section]...]
[RegisterDlls=register-dll-section[,register-dll-section]...]
[UnregisterDlls=unregister-dll-section[,unregister-dll-section]...]
[ExcludeID=device-identification-string[,device-identification-string]...]... ((Windows XP and later versions of Windows)
[Reboot]
在通用 INF 中受支持
  • DriverVer=mm/dd/yyyy[,x.y.v.z]: 此可选条目指定 驱动程序包的版本信息;
  • CopyFiles=@filename | file-list-section[,file-list-section] ...: 此指令指定要从源媒体复制到目标的一个命名文件,或者引用一个或多个 INF 编写器定义的节,其中源媒体上的设备相关文件被指定为传输到目标。 CopyFiles 指令是可选的,但大多数 DDInstall 节中都存在。INF 的 DestinationDirs 节中的 DefaultDestDir 条目指定要复制的任何单个文件的目标。 SourceDisksNames 和 SourceDisksFiles 部分或在此 INF 的 Version 部分的 LayoutFile 条目中指定的其他 INF 提供驱动程序文件的分发媒体上的位置;
  • CopyINF=filename1.inf[,filename2.inf]...: (Windows XP 及更高版本) 此指令会导致将指定的 INF 文件复制到目标系统;
  • AddReg=add-registry-section[,add-registry-section]...: 此指令引用一个或多个 INF 编写器定义的节,这些节中的新子项(可能带有初始值条目)被指定写入注册表,或在其中修改现有键的值条目;
  • AddProperty=add-property-section[,add-property-section]...: (Windows Vista 及更高版本) 引用修改 为设备实例设置的设备属性 的一个或多个 INF 文件部分。 应仅使用 INF AddProperty 指令 来设置 Windows Vista 或更高版本的 Windows 操作系统中新增的设备实例属性;
  • Include=filename1.inf[,filename2.inf]...: 此可选条目指定一个或多个系统提供的其他 INF 文件,其中包含安装此设备和/或驱动程序所需的部分。 如果指定了此项,则通常也是 “需要 ”条目;
  • Needs=inf-section-name[,inf-section-name]...: 此可选条目指定系统提供的 INF 文件中必须在安装此设备期间处理的节。 通常,此类命名节是 DDInstall (或 DDInstall。xxx) Include 条目中列出的其中一个 INF 文件的节。 但是,它可以是此类 DDInstall 或 DDInstall 中引用的任何部分。包含的 INF 的 xxx 节;
  • FeatureScore=featurescore: (Windows Vista 及更高版本) 此指令为基于驱动程序支持的功能的驱动程序提供了额外的排名条件。 例如,可以为 设备设置类 定义功能分数,该类根据特定于类的条件区分驱动程序;
  • ExcludeID=device-identification-string[,device-identification-string]...: (Windows XP 及更高版本) 此指令指定一个或多个设备标识字符串, (硬件 ID 或 兼容 ID) 。 DDInstall 部分不会安装设备 ID 与列出的任何硬件 ID 或兼容 ID 相匹配的设备;
  • reboot: 此指令指示应在安装完成后提示调用方重新启动系统;
在通用 INF 中不受支持
  • Delfiles=file-list-section[,file-list-section]...: 此指令引用一个或多个 INF 编写器定义的部分,其中列出了要删除的目标上的文件;
  • Renfiles=file-list-section[,file-list-section]...: 此指令引用一个或多个 INF 编写器定义的部分,其中列出了在将设备相关的源文件复制到目标计算机之前,目标上要重命名的文件;
  • DelReg=del-registry-section[,del-registry-section]...: 此指令引用一个或多个 INF 编写器定义的部分,在这些节中指定要在设备安装期间从注册表中删除的键和/或值项。通常,当 INF 必须清除以前安装此设备的旧注册表项时,此指令用于处理升级;
  • DelProperty=del-property-section[,del-property-section]...: (Windows Vista 及更高版本) 引用删除 为设备实例设置的设备属性 的一个或多个 INF 文件部分。 应仅使用 INF DelProperty 指令 删除 Windows Vista 或更高版本的 Windows 中新增的设备实例属性;
  • BitReg=bit-registry-section[,bit-registry-section]...: 此指令引用一个或多个 INF 编写器定义的节,其中修改 了 REG_BINARY 类型的现有注册表项;
  • LogConfig=log-config-section[,log-config-section]...: 对于根枚举设备或手动安装的设备,此指令在 INF 中引用一个或多个 INF 编写器定义的节。 在这些命名部分中,此类“检测到”或手动安装设备的 INF 指定设备必须正常运行的总线相对硬件资源的一个或多个逻辑配置。 此类手动安装且不可配置软件的设备 INF 还应具有 DDInstall.FactDef 部分;LogConfig 指令永远不会用于安装即插即用 (PnP) 设备。 但是,可以使用 INF DDInstall.LogConfigOverride 部分 为 PnP 设备提供替代配置。此指令与所有更高级别的 (非设备) 驱动程序和组件无关;
  • ProfileItems=profile-items-section[,profile-items-section]...: (Microsoft Windows 2000 及更高版本的 Windows) 此很少使用的指令引用一个或多个 INF 编写器定义的部分,这些节描述了要添加到“开始”菜单或从“开始”菜单中删除的项目;
  • UpdateInis=update-ini-section[,update-ini-section]...: 此很少使用的指令引用一个或多个 INF 编写器定义的节,指定源 INI 文件,在该文件中,此类节中的特定节或行将在安装过程中读入同名的目标 INI 文件。 (可选)可以在 update-ini 节中指定对目标上同名的给定源 INI 文件中现有 INI 文件的逐行修改;
  • UpdateIniFields=update-inifields-section[,update-inifields-section]...: 此很少使用的指令引用一个或多个 INF 编写器定义的部分,其中指定了特定于设备的 INI 文件的行内的修改;
  • Ini2Reg=ini-to-registry-section[,ini-to-registry-section]...: 此很少使用的指令引用一个或多个 INF 编写器定义的节,其中,源媒体上提供的特定于设备的 INI 文件中的节或行将移动到注册表中;
  • RegisterDlls=register-dll-section[,register-dll-section]...: 此指令引用一个或多个 INF 部分,用于指定属于 OLE 控件且需要自注册的文件;
  • UnregisterDlls=unregister-dll-section[,unregister-dll-section]...: 此指令引用一个或多个 INF 部分,用于指定属于 OLE 控件且需要自注销 (自删除) 的文件; 
  • 10
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值