In-depth analysis of INF file

  

INF file full name Information File file, is used to describe data files such as devices or files under Winodws operating system
. The INF file is composed of standard ASCII code, and you can use any text editor to view and modify the contents. Generally, we always think that the INF file is the driver of the system device. In fact, this is a misunderstanding. Windows
The reason why the INF file is required when installing some hardware drivers is because the INF file provides the device. A comprehensive description of the hardware parameters and the corresponding driver files (DLL files). Just like we look at the manual installation computer
hardware, we are the Windows
system, the manual is the INF file. The INF file is very powerful and can perform almost all the functions of daily operations. You can think of it as a superb batch under the Windows
system. To be proficient in and understand and even write an INF file requires a considerable understanding of its internal structure. Let's take a closer look inside the INF file to see its true face! The composition of the INF file has three parts: Sections, Keys, and Values. The key section has [Version] version description information, mainly used for version control. [Strings] String information for constant definitions. [DestinationDirs] defines system path information. [SourceDisksNames] indicates the source disk information. [SourceDisksFiles] indicates the source disk file name. [DefaultInstall] starts the installation.

Other sections can be customized

*Rules 1: INF files are sectioned, each INF file has many sections, and section names are enclosed in square brackets. Some of these section names are well defined by the system, and some are user-defined. Each section name can be up to 255 characters (in Windows 2000/XP/2003 operating system) or 28 characters (in Windows 98 operating system). There is no order difference between sections and sections. In addition, if two identical section names appear in the same INF file, the system will automatically merge the entries under the two section names. * Rule 2: The content between the festivals is called an entry. Each section is composed of many entries. Each entry is in the form of a form such as “signature="$CHICAGO$"” consist of. If there are multiple values ​​after the equal sign of each entry, each value is separated by a “,” * Rule 3: The INF file is not case sensitive. * Rule 4: The content after the ";&" is a comment. *Rule 5: If an item has too much content and cannot be written completely on one line, use “\\” to write one line of content as multiple lines. After understanding the rules of the INF file, let us analyze the structure of the INF file.





;Specify the version and signature section [VERSION]; the system looks at the current version based on Signuture. If appropriate, execute it, otherwise it will not be executed. Of course, mandatory installation is possible; for WIN9XSignature="$CHICAGO$";WINNT+;Signature="$Windows NT$";Specify the installation file layout, the line is Optionally, if no layout information file is provided, the [SourceDisksNames] and [SourceDisksFiles] sections of the LayoutFile=filename.inf[SourceDisksNames] section [SourceDisksNames] section must contain the drive letter sequence code and disk description in the INF file. Symbol, coil label, and disc serial number. The syntax of the statement in the [SourceDisksNames] section is: disk-ordinal=“disk-description”,disk-label,disk-serial-number where disk-ordinal is mandatory and is the serial number of the drive letter, identifying a source disk with Uniqueness can generally be set to an integer that increments from 1, and 0 is not a valid drive letter sequence code. When there are multiple source disks, the drive letter sequence codes cannot be repeated. Disk-description is mandatory. It is a disk descriptor. The string or string macro enclosed in double quotes describes the content or purpose of the disk. The installation engine displays the string in a dialog box to prompt the user. Disk-label is the volume ID of the source disk. Disk-serial-number is not used but must be set to 0. [SourceDisksFiles] stanza The [SourceDisksFiles] stanza specifies the source file and drive letter sequence code, disk descriptor used during installation. The syntax of the [SourceDisksFiles] section statement is: file-name=disk-number[,subdir] [,file-size] where file-name is mandatory and is the name of the file on the source disk. Disk-number is the drive letter sequence code of the source disk containing the file specified by file-name. The drive letter sequence code must be listed in the [SourceDisksNames] section and greater than or equal to 1. Subdir is optional. Specify the subdirectory of the source disk where the file is located. If omitted, the source disk is the default installation path. File-size is optional and indicates the size of the file, in bytes. [DestinationDirs]; specifies the default operation directory of the CopyFiles, RenFiles, or DelFiles entry; syntax file-list-section=LDID, [Subdir]; LDID list is as follows:; 01; current directory; 04; backup directory; 10; windows directory; 11 ;system dir;12 ;iosubsys;13 ;command;14 ;control panel directory;15 ;printers directory;16 ;workgrou dir;17 ;inf dir;18 ;help dir;19 ;administration dir;20 ;fonts;21 ; Viewers;22;vmm32;23;color dir;25;shared dir;26 ;winboot;28 ;host winboot;30 ;root of boot drive;31 ;root of host drive of a virtual boot drive;32 ;old windows dir if Exists; the following example is installed into the window\\web directory; DefaultDestDir=10,"web"



;--------- Manufacturer And Models Sections ----------------------------------; Mfg0 is the device, MfgName is the manufacturer [Manufacturer]%MfgName %=Mfg0; Manufacurer Name A description of the device to be installed and the [Install] section for the device to be installed. ;[manufacturer-name] ;device-description=install-section-name,device-id[,compatible-device-id]... ;device-description is a description of the device to be installed. ;install-section-name is the [Install] section name for this device; the manufacturer-name section name must already be defined in the [Manufacturer] section. ;device-id is the hardware identifier for this device, and the different hardware for each vendor corresponds to a different device identifier. [Mfg0]; PCI hardware Ids use the form; PCI\\VEN_aaaa&DEV_bbbb&SUBSYS_cccccccc&REV_dd; changed to your own ID; DeviceDesc is the device name variable, defined in [String]; PCI\\VEN_9999&DEV_9999 is the device flag %DeviceDesc%=YouMark_DDI, PCI\\VEN_9999&DEV_9999

[YouMark_DDI]CopyFiles=YouMark_Files_DriverAddReg=YouMark_9X_AddReg[YouMark_9X_AddReg]HKR,,DevLoader,,*ntkernHKR,,NTMPDriver,,HelloWDM.sysHKR, "Parameters" , "BreakOnEntry", 0x00010001, 0

; --------- Files (common) -------------[YouMark_Files_Driver]HelloWDM.sys



;--------- Strings Section ---------------------- -----------------------------[Strings]MfgName=“Microsoft"DeviceDesc="MyDevice"


Copyright © Windows knowledge All Rights Reserved