概述
我们知道Windows设备驱动的安装都需要inf文件,inf文件中定义了驱动的服务,定义了驱动的硬件子键,服务子键和类子键。使操作系统可以方便的了解你的驱动的属性,特性等等。
Windows系统从98到2000,到XP,Vista,Win7,以及Win8,容量越来越大。在很大的程度上,是由于驱动的原因。因为支持的设备越来越多,所以驱动越来越多。我们先来看硬件子键,一般它在注册表的位置为HKEY_LOCATION_MACHINESYSTEMControlSet001Enum下面如下图:它知名硬件的HID,VID,DID这些信息,总而言之,跟硬件和硬件厂商相关的信息。
这是我自己电脑上所截的图,我们再来看ACPI 中的DSDT截图:
我们再看服务子健,它在注册表中的位置为HKEY_LOCATION_MACHINESYSTEMControlSet001Services,它主要是跟驱动相关的,指明驱动的路径,以及驱动名字。
类子健在注册表中的位置为HKEY_LOCATION_MACHINESYSTEMControlSet001ControlClass,它主要是知名INF文件。 我们看到DSDT跟INF貌似没有任何关系。其实不然,我们可以看到DSDT中的HID,在上面的注册表的硬件子键中有,由于我们的桌面系统,Windows是基于PNP的,很多设备都是PNP的,比如USB,PCI,SATA等,但是不属于PNP的,比如总线设备等,怎么安装了,这个就要借助DSDT了,所以这部分驱动MSFT自己提供了,而且把HID固定下来了,也就是PNP0800这些,这些代码MSFT的一个驱动。所以OEM厂商需要在ACPI中,声明这些总线设备,也就是填充正确的HID。而后面需要安装驱动,比如某种USB设备,或者PCIE设备了,MSFT又将这些设备分了好多类。如下:
这个就是我们的类子键,需要声明是哪中设备,当然不是是哪家做的,什么功能,所以当然我们需要DEVICE ID和VENDOR ID,有时候还有PRODUCT ID,当然还有些驱动的属性也需要。在注册表中有了设备ID和供应商ID后,如果是USB设备,当USB设备接入时,PNP管理器接收到USB总线驱动程序发送过来的,设备接入通知,以及ID信息后,就在USB类中需要相应的ID的驱动程序,创建设备堆栈,设备对象,使设备工作。如果是标准的功能设备,MSFT有驱动了,这样只需要MSFT在其inf文件里添加这个设备ID信息使其支持。当然,这个是要收费的,呵呵。贴出一个1394控制器设备驱动的inf文件:
; 1394.INF -- This file contains descriptions of all the 1394
; Host controllers supported in Windows NT and Memphis
;
;*** Created 07/09/97 (Creation Date)
[Version]
;Signature="$WINDOWS NT$" ; JSG - What to do???
Signature="$CHICAGO$"
Class=1394
ClassGuid={6BDD1FC1-810F-11D0-BEC7-08002BE2092F}
Provider=%MSFT%
LayoutFile=layout.inf
DriverVer=07/01/2001,5.1.2535.0
; =================== Class Sections ===========================
[ClassInstall32]
Addreg=1394ClassReg
[ClassInstall]
Addreg=1394ClassReg
[1394ClassReg]
HKR,,,0,%1394ClassName%
HKR,,Icon,,-21
[ControlFlags]
; All PnP devices should be excluded from manual AddDevice Applet list
ExcludeFromSelect=*
; =================== Table of content =========================
[DestinationDirs]
DefaultDestDir=12
1394_CopyFiles=12
OHCI_CopyFiles=12
ndis1394_CopyFiles=12
[Manufacturer]
%NECMfg%=NEC
%TIOHCIMfg%=TIOHCI
%NSCMfg%=NSC
%SONYMfg%=SONY
%GENERICMfg%=GENERIC
%VIAMfg%=VIA
%FUJITSUMfg%=FUJITSU
; =================== OHCI CONTROLLERS ========================
[GENERIC]
%PCICC_0C0010.DeviceDesc%=GENERIC_Install,PCICC_0C0010
[GENERIC_Install]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[GENERIC_Install.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[GENERIC_Install.NT.Services]
AddService=ohci1394, 2, GENERIC_ServiceInstallSection
[GENERIC_ServiceInstallSection]
DisplayName=%PCICC_0C0010.DeviceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%ohci1394.sys
; =================== NEC ========================
[NEC]
%PCIVEN_1033&DEV_0063.DeviceDesc%=NEC_Install,PCIVEN_1033&DEV_0063
%PCIVEN_1033&CC_0C0010.DeviceDesc%=NEC_Install,PCIVEN_1033&CC_0C0010
[NEC_Install]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[NEC_Install.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[NEC_Install.NT.Services]
AddService=ohci1394, 2, NEC_ServiceInstallSection
[NEC_ServiceInstallSection]
DisplayName=%PCIVEN_1033&DEV_0063.DeviceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%ohci1394.sys
; =================== VIA ========================
[VIA]
%PCIVEN_1106&DEV_3044.DeviceDesc%=VIA_Install,PCIVEN_1106&DEV_3044
%PCIVEN_1106&CC_0C0010.DeviceDesc%=VIA_Install,PCIVEN_1106&CC_0C0010
[VIA_Install]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[VIA_Install.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[VIA_Install.NT.Services]
AddService=ohci1394, 2, VIA_ServiceInstallSection
[VIA_ServiceInstallSection]
DisplayName=%PCIVEN_1106&DEV_3044.DeviceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%ohci1394.sys
; =================== National Semi ========================
[NSC]
%PCIVEN_100B&DEV_000F.DeviceDesc%=NSC_Install,PCIVEN_100B&DEV_000F
%PCIVEN_100B&CC_0C0010.DeviceDesc%=NSC_Install,PCIVEN_100B&CC_0C0010
[NSC_Install]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[NSC_Install.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[NSC_Install.NT.Services]
AddService=ohci1394, 2, NSC_ServiceInstallSection
[NSC_ServiceInstallSection]
DisplayName=%PCIVEN_100B&DEV_000F.DeviceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%ohci1394.sys
; =================== TI OHCI ========================
[TIOHCI]
%PCIVEN_104C&DEV_8009.DeviceDesc%=TIOHCI_Install,PCIVEN_104C&DEV_8009
%PCIVEN_104C&DEV_8019.DeviceDesc%=TIOHCI_Install,PCIVEN_104C&DEV_8019
%PCIVEN_104C&CC_0C0010.DeviceDesc%=TIOHCI_Install,PCIVEN_104C&CC_0C0010
%PCIVEN_104C&DEV_8009&SUBSYS_8032104D.DeviceDesc%=TIOHCI_Install,PCIVEN_104C&DEV_8009&SUBSYS_8032104D
[TIOHCI_Install]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[TIOHCI_Install.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[TIOHCI_Install.NT.Services]
AddService=ohci1394, 2, TIOHCI_ServiceInstallSection
[TIOHCI_ServiceInstallSection]
DisplayName=%PCIVEN_104C&DEV_8009.DeviceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%ohci1394.sys
; =================== SONY ========================
[SONY]
%PCIVEN_104D&DEV_8039.DeviceDesc%=SONY_Install,PCIVEN_104D&DEV_8039
%PCIVEN_104D&DEV_8039&REV_03.DeviceDesc%=SONY_Install2,PCIVEN_104D&DEV_8039&REV_03
[SONY_Install]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[SONY_Install2]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[SONY_Install.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[SONY_Install2.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[SONY_Install.NT.HW]
AddReg=SONY_WA_AddReg
[SONY_WA_AddReg]
HKR,,"DiagnosticMode",0x00010003,2
[SONY_Install.NT.Services]
AddService=ohci1394, 2, SONY_ServiceInstallSection
[SONY_Install2.NT.Services]
AddService=ohci1394, 2, SONY_ServiceInstallSection
[SONY_ServiceInstallSection]
DisplayName=%PCIVEN_104D&DEV_8039.DeviceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%ohci1394.sys
; =================== FUJITSU ========================
[FUJITSU]
%PCIVEN_10CF&CC_0C0010.DeviceDesc%=FUJITSU_Install,PCIVEN_10CF&CC_0C0010
[FUJITSU_Install]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles
[FUJITSU_Install.NT]
CopyFiles=OHCI_CopyFiles, 1394_CopyFiles, ndis1394_CopyFiles
AddReg=Nic1394AddReg
[FUJITSU_Install.NT.Services]
AddService=ohci1394, 2, FUJITSU_ServiceInstallSection
[FUJITSU_ServiceInstallSection]
DisplayName=%PCIVEN_10CF&CC_0C0010.DeviceDesc%
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%ohci1394.sys
; =================== Generic ==================================
[Nic1394AddReg]
HKR,"Virtual Device List"NIC1394"LOCAL HOST EUI64",,,
[1394_CopyFiles]
1394bus.sys
[OHCI_CopyFiles]
ohci1394.sys
[ndis1394_CopyFiles]
enum1394.sys
nic1394.sys
arp1394.sys
[ControlFlags]
最后
以上就是温婉皮皮虾为你收集整理的Windows驱动中的inf文件的全部内容,希望文章能够帮你解决Windows驱动中的inf文件所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复