INF file format

Source: Internet
Author: User
Tags old windows

INF file format

INF, short for device information file, is a file format launched by Microsoft for hardware device manufacturers by publishing their drivers, the inf file contains hardware device information or scripts to control hardware operations.

INF Functions

1. Copy, delete, or rename a file.
2. add or delete a project in the registry.
3. Modify important system settings files (such as autoexec. bat, config. sys, And. INI)

INF rules

INF is a plain text file, which is segmented. This is similar to the INI file. Each section is expanded, each node name can contain a maximum of 255 characters (in Windows 2000/XP/2003 operating systems) or 28 characters (in Windows 98 operating systems ). The content between a section is called an entry. Each section is composed of multiple entries. Each entry is separated by a, for example, a = "B ". If there are multiple values after an equal sign for each entry, separate each value with a comma. INF is not case sensitive. The line comment statement command is ";", similar to 'in VB '. If a row cannot be written, use "/" to wrap the line.

INF running

. The inf file is a script file interpreted and executed by the setupapi of windows. It runs in a simple and linear way. there is no branch statement in the running process of the INF file, that is, there is no conditional statement. Once executed, it is run along a fixed route. It is run in units of a node. It starts from a [install] section and runs the entries in this section from top to bottom. If this entry is a section, execute the entries in the subsection one by one, so that they are recursively executed. To run the program on the window, right-click the file and click Install.

INF syntax structure

; Specify version and signature Section
[Version]
The system checks whether the current version is applicable according to signuure. If it is applicable, the system executes the command. Otherwise, the command is not executed. Of course, the Force installation is acceptable.
; For Win9x
Signature = "$ Chicago $"
; Winnt +
; Signature = "$ Windows NT $"
; Specifies the Installation File layout. This row is optional. If no layout information file is provided, the INF file must contain the [sourcedisksnames] and [sourcedisksfiles] sections.
Layoutfile = filename. inf
[Sourcedisksnames]
The [sourcedisksnames] section lists the drive letter sequence code, disk descriptor, disk volume number, and disk serial number of the source file.
The syntax of the statements in [sourcedisksnames] is:
Disk-ordinal = "disk-description", disk-label, disk-serial-Number
Here, disk-ordinal is a required sequence code, which identifies a source disk and has uniqueness. It can be set to an integer that increases from 1, 0 is not a valid drive letter sequence code. When multiple source disks exist, the serial number of the drive letter cannot be repeated.
Disk-description is a required disk descriptor. It is a string or string macro enclosed in double quotation marks to describe the content or purpose of the disk. The installation engine displays the string in the 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]
[Sourcedisksfiles] specifies the source file, drive letter sequence, and disk descriptor used during installation. The statement syntax in [sourcedisksfiles] is:
File-name = disk-number [, subdir] [, file-size]
The file-name parameter is required and is the name of the file on the source disk.
Disk-number is the drive letter sequence code that contains the source disk of the file-name specified file. The drive letter sequence code must be listed in [sourcedisksnames] and must be greater than or equal to 1.
Subdir is optional. It specifies the subdirectory of the source disk where the file is located. If it is omitted, the source disk is the default installation path.
File-size is optional, indicating the file size, in bytes.

[Destinationdirs]
; Specifies the default operation directory for copyfiles, renfiles, or delfiles entries
; Syntax file-list-Section = ldid, [subdir]
The 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 shows how to install it in the window/web directory.
; Defaultdestdir = 10, "Web"
The [install] section provides an overview of the INF file installation process, which recognizes other detailed actions in the file that contain the installation Information Section, is a real entry for Windows to build and install functions to identify the installation process and content
[Install]
The [install] section contains two types: [defainstall install] and [otherinstall ].
; [Defainstall install] The section name defaultinstall is explicitly specified in the Registry as described in the preceding table.
This section is also the first entry for the system to obtain the installation information in the INF file. When you right-click the INF file and select "Install", this section is executed.
; The [otherinstall] and [defainstall install] sections follow the same syntax, but must be explicitly called and are often used to define anti-installation actions.

; Default installation Section
[Defainstall install]
; Indicates the subsection for adding the registry. The custom node name is followed by the equal sign. For example, see [add ].
Addreg = add

; Indicates the subnode of the Registry to be deleted. The custom node name is after the equal sign.
Delreg = del

Specifies the file subsection to be copied for installation. The copyfiles command can replace the file being accessed by the system. These functions cannot be implemented through normal del and copy commands.
Copyfiles = cfile

Specifies the file subsections to be deleted for reverse installation. Multiple sections are separated by commas. If the file to be deleted is locked, the file will be placed in the system deletion queue and queued
When the system restarts, the file is automatically deleted.
Delfiles = delete a file segment
; [Delete a file segment]
; File Name List
; Example:
;A.exe
B. sys
; Rename the file segment
; Renfiles = rename a file segment
; [Rename a file segment]
; Syntax:
; [File-list-section]
; New-file-name, old-file-name
; File1, file2; modify the file name file1 to file2

; Update the content subsection of the INI file segment
Updateinis = Update INI file segment
; [Update INI file segment]
; Ini-file, ini-section, [old-ini-entry], [New-ini-entry], [flags]
Ini-file contains the. ini file name of the entry to be modified.
The ini-section contains the name of the node for which you want to change the entry.
; (Optional) old-ini-entry. The common format is key = value.
; New-ini-entry (optional)
; Key = value. Flags are optional operation tags
; Example
; % 01%/wincmd. ini, configuration, "installdir = % 01%"
; % 01%/wincmd. ini, configuration, "mainmenu = % 01%/Language/tcextmenu. MNU"
; Update INI file value content
Updateinifield =
; INI file updates the Registry
Ini2reg = AA. ini
; Update config. sys content
Updatecfgsys = Update autoexec. Bat segment
[Update autoexec. Bat segment]
; Update autoexec. Bat content
Updateautobat = update the autoexec. Bat segment
[Update autoexec. Bat segment]

Define the resource section, such as the resource file. When calling % REG_SZ %, it indicates 0x00000000.
[Strings]
REG_SZ = 0x00000000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
; Customize the Section for adding registry entries
[Add]
Note the format: hkey (Root Key abbreviation), subkey (subkey), valuename (key value name), type (key value type), value (key value)
; Hkcu-> HKEY_CURRENT_USER
; Hkcr-> hkey_classes_root
; HKLM-> HKEY_LOCAL_MACHINE
; HKU-> HKEY_USERS
; HKU-> HKEY_USERS
; HKCC-> hkey_current_config
; Hkdd-> hkey_dyn_data
; Unban Registry Editor
Hkcu, software/Microsoft/Windows/CurrentVersion/policies/system, disableregistrytools
; Disable Internet Options of IE
Hkcu, software/policies/Microsoft/Internet Explorer/restrictions, nobrowseroptions, 1, 0
; Specific options in Internet Options of IE
Hkcu, software/policies/Microsoft/Internet Explorer/restrictions, nobrowseroptions, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, settings
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, homepage, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, generaltab
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, cache, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, history, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, colors
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, fonts
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, ages
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, accessibility, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, securitytab, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, secchangesettings, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, secaddsites
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, contenttab, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, ratings, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, certificates, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, certifpers
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, certifsite
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, certifpub
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, formsuggest, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, formsuggest passwords, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, wallet
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, profiles
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, connectionstab, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, connection wizard
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, connwiz admin lock, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, connection settings
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, proxy
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, AutoConfig
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, programstab
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, resetwebsettings
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, check_if_default, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, advancedtab, 1, 0
Hkcu, software/policies/Microsoft/Internet Explorer/control panel, advanced, 1, 0
; Unban download (available for separate use)
Hkcu, software/Microsoft/Windows/CurrentVersion/Internet Settings/zones/3, 1803, 1, 0
Automatically modify ie title bar text, home page, search page, etc.
Hkcu, software/Microsoft/Internet Explorer/Main, window title, 0, "Internet Explorer"
Hkcu, software/Microsoft/Internet Explorer/Main, start page, 0, "http://www.ii8888.com"
Hkcu, software/Microsoft/Internet Explorer/Main, search page, 0, "http://www.ii8888.com"
Hkcu, software/Microsoft/Internet Explorer/Main, default_page_url, 0, "http://www.ii8888.com"
HKLM, software/Microsoft/Internet Explorer/Main, default_search_url, 0, "http://www.ii8888.com"
HKLM, software/Microsoft/Internet Explorer/Main, search page, 0, "http://www.ii8888.com"
HKLM, software/Microsoft/Internet Explorer/Main, start page, 0, "http://www.ii8888.com"
HKLM, software/Microsoft/Internet Explorer/Main, default_page_url, 0, "http://www.ii8888.com"
HKLM, software/Microsoft/Internet Explorer/Main, default_page_url, 0, "http://www.ii8888.com"

[Dfile]
This section defines the list of files to be deleted. The 1 mark after filename indicates that if the file cannot be deleted currently, it will be deleted after the system restarts.
; Format: filename, 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.