OS读取硬件设备ID与inf文件中的ID做对比识别硬件.
拷贝驱动文件(.sys .dll .exe)到系统
添加注册表入口 + 注册服务
命令行安装为:
rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 %1
inf驱动安装日志:
C:\Windows\inf\setupapi.dev.log
inf驱动安装工具:
DPInst.exe
分号为注释,不区分大小写,’'为续行符
相同的节会被自动合并,从某一个install开始从上到下开始执行.
每一节由多个key=value形式构成,等号后多个value的用逗号分开
registry
HKLM\System\CurrentControlSet\Enum
:包含了系统上的设备信息HKLM\System\CurrentControlSet\Control
:包含了控制系统启动的信息以及一些设备配置HKLM\System\CurrentControlSet\Control\Class
:为了方便设备驱动安装而预先定义的一些设备类别IDHKR
[add-registry-section] HKLM\System\CurrentControlSet\Control\Network%ClassGuid%%DeviceGuid%\
[service-install-section] :HKLM\System\CurrentControlSet\Services[service_name..]
[event-log-install] :HKLM\System\CurrentControlSet\Services\Eventlog\
[DDInstall-section] :(软件子键)HKLM/System/CurrentControlSet/Control/Class/%ClassGuid%/%DeviceIndex%(设备序号:0000..)/
[DDInstall.HW-section] :(硬件子键)HKLM/System/CurrentControlSet/Enum/enumerator(设备类别)/deviceID/
[add-interface-section] :HKLM/System/CurrentControlSet/Control/DeviceClasses/%InterfaceClassGUID%/branch/path
%10% :%systemroot%
%11% :%systemroot%\system32
%12% :%systemroot%\system32\drivers
[Version]
; 该节必须,描述该驱动支持的OS+设备类型
; class :Display(显卡..),Media(声卡..),net(网卡),Image(摄像头),Modem,Printer,USB
; classguid :如果是标准类别就使用标准类别的guid,否则自己生成.e.g.:
Net: {4D36E972-E325-11CE-BECl-08002BE10318}
Signature = "$Windows NT" ;必须key,其他key可以没有
Class = NetTrans ;网络协议
ClassGUID = {4d36e975-e325-11ce-bfc1-08002be10318}
Provider = %Msft% ;在[string]中定义
LayoutFile = layout.inf
DriverVer = 10/01/2002,5.2.3790.1830
[Manufacturer]
* manufacture section
* %manufacture%=models-section-name(在后续节中再指定)
%Msft% = MSFT,NTamd64
[MSFT.NTamd64]
* Models section
* %device-desc%=install-section-name,hw-id[,compatible-id..]
* 此三者都在[string]中定义
%NwlnkIpx_Desc% = Install_Ipx, MS_NWIPX
%NwlnkNb_Desc% = Install_Nb, MS_NWNB
%NwlnkSpx_Desc% = Install_Spx, MS_NWSPX
[ControlFlags]
* 需要特别处理的节,除非有相应的硬件否则不启动
ExcludeFromSelect=MS_NWNB,MS_NWSPX
[Install_Ipx]
* Install/DDInstall section
* AddReg=add_registry_section[,add_registry_section]
Characteristics=0x80 ;必需项,支持用户接口
AddReg = Inst_Ndi_Ipx ;必需项
[Inst_Ndi_Ipx]
* root,subkey,value_name,flags,value[,value]
HKR, Ndi, ClsID,,"{c59938da-9b20-11d0-9ce3-00c04fc9bcc4}"
HKR, Ndi, Service,,"NwlnkIpx"
HKR, Ndi, CoServices,0x10000,"NwlnkIpx","NwlnkNb","NwlnkSpx"
HKR, Ndi, HelpText,,"@netcfgx.dll,-50013"
HKR, Ndi\Interfaces, UpperRange,,"ipx"
HKR, Ndi\Interfaces, LowerRange,,"ndis5,ndis4,ndiswanipx,ndis5_ipx"
[Install_Ipx.Services]
* service_name[,flags],service_install_section[,event_log_install_section][,event_log_type][,event_name]
AddService = NwlnkIpx,,NwlnkIpx_Service_Inst
[NwlnkIpx_Service_Inst]
; servicetype: 1(内核驱动),2(网络+文件系统驱动),0x10(SERVICE_WIN32_OWN_PROCESS),0x20(SERVICE_WIN32_SHARE_PROCESS)
; starttype: 0(service_boot_start),1(system),2(auto),3(demand),4(disabled)
; errorcontrol: 0(service_error_ignore),1(normal),2(server),3(critical),4(disabled)
DisplayName=%NwlnkIpx_Desc%
ServiceType=1 ;必需项
StartType=2 ;必需项
ErrorControl=1 ;必需项
ServiceBinary=%12%\nwlnkipx.sys ;必需项
LoadOrderGroup="PNP_TDI"
AddReg = AddReg_NwlnkIpx_Service_Inst
[AddReg_NwlnkIpx_Service_Inst]
HKLM,"System\CurrentControlSet\Control\ServiceProvider\Order","ExcludedProviders",0x2,""
HKLM,"System\CurrentControlSet\Control\ServiceProvider\Order","ProviderOrder",0x1000A,"NwlnkIpx"
HKR,"ServiceProvider","Class",0x10001,0x8
HKR,"ServiceProvider","Name",,%NwlnkIpx_Desc%
HKR,"ServiceProvider","ProviderPath",0x20000,"%SystemRoot%\System32\nwprovau.dll"
HKR,"Performance","Library",,"perfctrs.dll"
HKR,"Performance","Open",,"OpenIPXPerformanceData"
HKR,"Performance","Close",,"CloseIPXPerformanceData"
HKR,"Performance","Collect",,"CollectIPXPerformanceData";
HKLM,"System\CurrentControlSet\Services\EventLog\System\NwlnkIpx","EventMessageFile",0x20000,"%%SystemRoot%%\system32\netevent.dll"
HKLM,"System\CurrentControlSet\Services\EventLog\System\NwlnkIpx","TypesSupported",0x10001, 0x00000007
HKR,"Parameters","RipRoute",0x10001,0x0
Description=%NwlnkIpx_Desc%
[Install_Ipx.Winsock]
AddSock = Inst_Ipx_Winsock_Dependency
[Inst_Ipx_Winsock_Dependency]
TransportService=nwlnkipx
HelperDllName="%SystemRoot%\System32\wshisn.dll"
MaxSockAddrLength=0x10
MinSockAddrLength=0xe
LibraryPath="%SystemRoot%\System32\nwprovau.dll"
DisplayString=%NwlnkIpx_Desc%
SupportedNameSpace=1
Version=1
ProviderId="{e02daaf0-7e9f-11cf-ae5a-00aa00a7112b}"
[Install_Ipx.Remove]
DelReg = DelReg_Remove_Static_Ipx
[DelReg_Remove_Static_Ipx]
HKLM,"Software\Microsoft\Rpc\Protocols","ncacn_nb_ipx"
HKLM,"Software\Microsoft\Rpc\ClientProtocols","ncacn_nb_ipx"
HKLM,"Software\Wow6432Node\Microsoft\Rpc\ClientProtocols","ncacn_nb_ipx"
HKLM,"System\CurrentControlSet\Services\EventLog\System\NwlnkIpx"
[Install_Ipx.Remove.Services]
DelService=NwlnkIpx
[Install_Ipx.Remove.Winsock]
DelSock = Del_Ipx_Winsock_Dependency
[Del_Ipx_Winsock_Dependency]
TransportService=nwlnkipx
ProviderId="{e02daaf0-7e9f-11cf-ae5a-00aa00a7112b}"
[Strings]
Msft = "Microsoft"
NwlnkIpx_Desc = "NWLink IPX/SPX/NetBIOS Compatible Transport Protocol"
NwlnkNb_Desc = "NWLink NetBIOS"
NwlnkSpx_Desc = "NWLink SPX/SPXII Protocol"
NwlnkSpx_HelpText = ""