First, you must understand the basic structure of an INF file: INF consists of segments. The functions of each segment are different. (This section is called "section" in most books ")
[Version] section: Mainly used to describe the version information.
[Strings] segment: String information, used for constant definition and display. If % XXXX % appears in other segments (that is, two percentage signs with a group of letters), the corresponding string will correspond to one of its strings in the strings segment.
[Sourcedisksnames] section: defines the disk where the installation source file is located. Generally, the value is 1, which indicates the first disk. This section is optional.
[Sourcediskfiles] section: Driver file list and installed location. This section must be combined with the [sourcedisksnames] section to know the specific location. For example, "atinbtxx. sys = 1", you must go to [destinationdirs] to view the location where "1" represents.
[Destinationdirs] section: It indicates where the above driver file is installed.
[Defainstall install] and [install] sections: here the installation section is used to operate the actual files, such as copying, deleting, and adding a registry, however, the names of installation segments are not necessarily the two. You can use the model segment to specify which one is the installation segment.
[Model]: This section is used to specify the name of the installation section. Which indicates the installation section. Format: % XXXX % = installation segment name, USB \ vid_04b4 & pid_8613. therefore, not only the installation section is specified, but the vid and PID of the Pilot installation are also set. When the PID and vid of the device are detected at the same time, the Device Manager considers that the device has found its own installation information file (INF file), and then starts to guide the installation. (The new general-purpose drive cyusb. inf file does not contain the model segment but targets device segments of multiple platforms, and Vid/PID information is also developed)
[Manufacturer] section: This section is used to specify the name of the device supplier, which is also a model section.
Related syntax of the INF file:
1. At last, we should understand the eight segments. Two segments are not directly displayed, that is, [model] and [install], which are all specified through other segments.
2. segment definition: I personally think that you only need to wrap your segment name in brackets in the INF file, such as [mysection] ...... this mysection can be considered as a segment.
3. The relationship between segments is parallel. If the two segments have the same name, they are connected to one segment. Case Insensitive
4. String tag, in the format of % xxxxxx %. This is a string tag, not a string. It only represents a string, which is defined in the srtings segment, of course, you can associate this string with a segment name.
Example: [manufacturer]
% Mfgname % = cypress
[Cypress]
......
[Strings]
Mfgname = "Cypress" // % mfgname % is a string tag, representing the string "Cypress ". This string is associated with the model segment name.
The following is the cyusb. inf file.
[Version] // version segment
Signature = "$ Chicago $" // signature must be generally this value
Class = USB // driver category, which indicates that this is a USB device
Classguid = {36fc9e60-c465-11cf-8056-444553540000} // The GUID value of the corresponding USB device. Guid values of different devices are different.
Provider = % provider % // provider of the INF file, % provider %Is a string tag. In the strings segment, you can see that it refers to the string "Cypress"
[Sourcedisksnames]
1 = % cyusb_install %, indicating that it is installed on disk 1
[Sourcedisksfiles] // source file to be installed, that is, the driver to be installed
Cyusbme. sys = 1 // 1 indicates which directory to install. The specific directory is in the [destinationdirs] description.
Cyusb. sys = 1
Cyusb. SPD = 1
[Manufacturer] // specifies the device supplier and the model segment.
% Mfgname % = cypress // cypress is the model segment
[Cypress] // This is the model segment, and lists the corresponding installation segments. Multiple device PIDs and vids can be listed. It is used to indicate the response to different firmware.
; Cypress fx2lp default ID
% Vid_04b4 & pid_8613.devicedesc % = cyusb, USB \ vid_04b4 & pid_8613 // cyusb is set as the installation segment
; Cypress fx1 default ID
% Vid_04b4 & pid_6473.devicedesc % = cyusb, USB \ vid_04b4 & pid_6473
; Cypress fx2lp example device. dvk firmware examples use this vid/PID
% Vid_04b4 & pid_1004.devicedesc % = cyusb, USB \ vid_04b4 & pid_1004
[Destinationdirs]
Cyusbme. Files. Ext = 10, system32 \ drivers // indicates that the content in cyusbme. Files. ext and cyusb. Files. Ext are specified in the direction, that is, the path on the right. No operation is performed here, but 10 indicates the Windows directory under drive C.
Cyusb. files. EXT = 10, system32 \ drivers // cyusbme. files. EXT, cyusb. files. EXT is two segments, which are defined later. We can see that these two segments represent the two driver files cyusbme. sys
[Cyusb] // This is the installation section and starts to install the file in the path shown in [destinationdirs]
Copyfiles = cyusbme. Files. Ext // copyfiles is a command, which is to install cyusbme. Files. Ext in the path specified by "cyusbme. Files. Ext" after "=", as shown in destinationdirs,
Addreg = cyusbme. addreg // Add a new child key to the Registry and perform the corresponding operations. The operations are placed in the cyusbme. addreg segment.
[Cyusb. HW]
Addreg = cyusb. addreg. guid // register under HW
[Cyusb. nt] // install and register on the NT (platform larger than Win98) Platform
Copyfiles = cyusb. Files. ext
Addreg = cyusb. addreg
[Cyusb. nt. HW]
Addreg = cyusb. addreg. guid
[Cyusb. nt. Services] // Add the service information of the Installation File
Addservice = cyusb, 0x00000002, cyusb. addservice //Addservice is an operation instruction format: addservice = Name of the installation segment for the service, 0x00000002 is a fixed value, and the name of the installation service information segment
[Cyusb. addservice] // Installation Service Information Section
Displayname = % cyusb. svcdesc %
Servicetype = 1; service_kernel_driver
Starttype = 3; service_demand_start // 2 indicates Automatic Installation
Errorcontrol = 1; service_error_normal
Servicebinary = % \ System32 \ drivers \ cyusb. sys // This indicates the path of the driver. You can see it in the Device Manager.
Loadordergroup = base // do not know why
[Cyusbme. addreg] // registry operation for different installation segments
Hkr, devloader, * ntkern
Hkr, ntmpdriver, cyusbme. sys
[Cyusb. addreg] // registry operation for different installation segments
Hkr, devloader, * ntkern
Hkr, ntmpdriver, cyusb. sys
[Cyusbme. Files. Ext] // driver file to be installed
Cyusbme. sys
[Cyusb. Files. Ext] // driver file to be installed
Cyusb. sys
[Cyusb. addreg. guid] // registry operation for different installation segments
; Hkr, driverguid, % cyusb. guid %
;---------------------------------------------------------------;
[Strings] // some displayed strings, which can be seen in the Device Manager
Provider = "Cypress"
Mfgname = "Cypress"
Cyusb_install = "Cypress generic USB driver installation disk"
Vid_04b4 & pid_8613.devicedesc = "Cypress EZ-USB fx2lp-EEPROM missing"
Vid_04b4 & pid_6473.devicedesc = "Cypress EZ-USB fx1-EEPROM missing"
Vid_04b4 & pid_1004.devicedesc = "Cypress EZ-USB example device"
Cyusb. svcdesc = "Cypress generic USB driver"
; Cyusb. guid = "{AE18AA60-7F6A-11d4-97DD-00010229B959 }"