MicroSoft的inf文件用来指示安装Windows驱动程序(*.sys) 。这是我在工作中生成的一个USB驱动程序的INF文件,注释做的比较全。
;****************************************************************************************************
;; Instrument100.inf
;; ********* PLEASE READ ***********
;; The wizard cannot create exact INF files for all buses and device types.
;; You may have to make changes to this file in order to get your device to
;; install. In particular, hardware IDs and logical configurations require
;; intervention.
;;
;; The Windows DDK documentation contains an excellent INF reference.
;--------- Version Section ---------------------------------------------------
[Version]
;Signature="$Windows 95$"
;表示Win9x及其以后平台
Signature="$CHICAGO$"
;驱动程序提供者,此信息会显示在设备属性的“常规”页
Provider=%ProviderName%
;驱动版本号,显示在驱动程序文件详细资料窗口
DriverVer=04/10/2006,1.00.000.17
;WHQL签发的数字证书
;CatalogFile=MyTest.cat
; If device fits one of the standard classes, use the name and GUID here,
; otherwise create your own device class and GUID as this example shows.
;指定设备所属的分类名称Class,分类名称可以是已知的(特定的ClassGUID);
;分类名称也可以新建,并指定唯一ClassGUID
;Class=NewDeviceClass
;ClassGUID={ff646f80-8def-11d2-9449-00105a075f6b}
Class=TimeGroupUsbDevice
ClassGUID={dd56b6f0-8e06-11d2-9449-00105a075f6c}
;--------- SourceDiskNames and SourceDiskFiles Section -----------------------
; These sections identify source disks and files for installation. They are
; shown here as an example, but commented out.
;[SourceDisksNames]
;1 = "Install Disk",Disk1,,
;[SourceDisksFiles]
Instrument100.sys = 1,,
;--------- ClassInstall/ClassInstall32 Section -------------------------------
; Not necessary if using a standard class
; 9X Style
[ClassInstall]
Addreg=Class_AddReg
; NT Style
[ClassInstall32]
Addreg=Class_AddReg
;设备所属分类在设备管理器中显示的名称和图标
[Class_AddReg]
HKR,,,,%DeviceClassName%
HKR,,Icon,,"-20"
;--------- DestinationDirs Section -------------------------------------------
[DestinationDirs]
TUD310_Files_Driver = 10,System32/Drivers
;--------- Manufacturer and Models Sections ----------------------------------
[Manufacturer]
%MfgName%=Mfg0
[Mfg0]
%DeviceDesc%=TUD310_DDI, USB/VID_0472&PID_1807
;---------- DDInstall Sections -----------------------------------------------
; --------- Windows 9X -----------------
; Experimentation has shown that DDInstall root names greater than 19 characters
; cause problems in Windows 98
[TUD310_DDI]
CopyFiles=TUD310_Files_Driver
AddReg=TUD310_9X_AddReg
[TUD310_9X_AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,Instrument100.sys
HKR, "Parameters", "BreakOnEntry", 0x00010001, 0
; --------- Windows NT -----------------
;添加service服务关键字于注册表
[TUD310_DDI.NT]
CopyFiles=TUD310_Files_Driver
AddReg=TUD310_NT_AddReg
[TUD310_DDI.NT.Services]
Addservice = Instrument100, 0x00000002, TUD310_AddService
[TUD310_AddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%/System32/Drivers/Instrument100.sys
[TUD310_NT_AddReg]
HKLM, "System/CurrentControlSet/Services/Instrument100/Parameters",/
"BreakOnEntry", 0x00010001, 0
; --------- Files (common) -------------
[TUD310_Files_Driver]
Instrument100.sys
;--------- Strings Section ---------------------------------------------------
[Strings]
;ProviderName="Your Company Name here"
;MfgName="Name of HW Manufacturer here"
;DeviceDesc="Description of Device here"
;SvcDesc="Description of Instrument100 NT service here"
;DeviceClassName="Description of Instrument100 Device class here"
ProviderName="MyCompany Corporation"
MfgName="制造商"
DeviceDesc="Instrument100 UsbDevice Driver"
SvcDesc="Instrument100 NT service for Win32 Applications"
DeviceClassName="MyCompany Usb Devices"