.Inf file format description

xiaoxiao2021-03-06  46

The INF file must contain the following rules:

The section begins with the middle bracket ([]).

Version information will be included to indicate that you belong to Win95 or WinNT4 format.

Value is composed of an expression string that is replaced by% strkey%, and strkey must be defined in the Strings section. If the% occurs, use %% alternative.

Setup program uses the following sections:

[Version] must be included in the INF file, indicating the INF file format

[Version]

Signature = "signature-name"

Class = Class-Name

Classguid = Guid

Provider = INF-CREATOR

Layoutfile = filename.inf [, filename.inf] ...

Signature-name

The parameters can be valued $ Windows NT $, $ Chicago $, or $ Windows 95 $ (quotes enclose). If not the above strings, it is not recognized as an INF file.

Class-name

This parameter is used to install the device driver. See DDK Programmer's Guide for more information.

GUID

This parameter is used to install the device driver. See DDK Programmer's Guide for more information.

INF-CREATOR

The founder of INF is indicated. Typical case, this value is the founder of the INF file

FILENAME.INF

The INF file must contain SourceDisksFiles and SourceDiskSNames. Description files of these files are usually named layout.inf. If the file name is not specified, SourceDiskSNames and SourceDisksFiles must appear in the current INF file.

The following is a typical example:

[Version]

Signature = "$ Windows NT $"

Class = mouse

ClassGuid = {4D36E96F-E325-11CE-BFC1-08002BE10318}

Provider =% provider%

Layoutfile = layout.inf

[Strings]

Provider = "Corporation X"

[Install] This section specifies the included installation instruction section, each entry will become a section

[Install-Section-Name]

Logconfig = log-config-section-name [, log-config-section-name] ...

CopyFiles = file-list-section [, file-list-section] ...

RENFILES = file-list-section [, file-list-section] ...

DelFiles = file-list-section [, file-list-section] ...

Updateinis = update-ini-section [, update-ini-section] ...

Updateinifields = update-inifields-section [, update-inifields-section] ...

AddReg = add-registry-section [, add-registry-section] ...

Delreg = del-registry-section [, del-registry-section] ...

Ini2REG = INI-to-registry-section [, ini-to-registry-section] ...

The above entries are not all necessary. The name must be a visible character. Each entry contains one to more than one. All named after the first name must be guided. The entry specifies the sections that must appear in the INF file. CopyFiles can be exception (if there is no file being copied). If the driver is installed, just use the Logconfig entry. See DDK Programmer's Guide for details.

The CopyFiles entry can contain special characters @ to copy a single file directly. The file will be copied to the DefaultDestDir, and the DestinationDIRS section contains the description of DefaultDestDir. Such as examples:

[MyInstall]

CopyFiles = @ myfile.exe

This file will be copied to the default target directory.

In order to adapt to different platforms, different suffixs can be added after INSTALL. The name of DEFAULTINSTALL.NT can appear. INSTALL-Section-Name Optional suffix:

Extension Platform

.Win windows 95

.NT Windows NT (All Platforms)

.Ntx86 windows NT (x86 only)

.NTMIPS Windows NT (MIPS ONLY)

.Ntalpha windows NT (alpha only)

.Ntppc windows NT (PowerPC Only)

The following example shows how to appear two CopyFiles section:

[Ser_inst]

CopyFiles = Ser_copyFiles, Mouclass_copyFiles

[Ser_copyFiles]

Sermouse.sys

[mouclass_copyfiles]]

Mouclass.sys

[Add registry] describes how to add a registry project. The Add-Registry-Section section must now be in the AddREG entry in the Install section.

[add-registry-section]

Reg-root-string, [Subkey], [Value-name], [Flags], [Value]

[Reg-root-string, [Subkey], [Value-name], [Flags], [Value]]

Rename of Reg-root-string registry:

HKCR HKEY_CLASSES_ROOT.

HKCU HKEY_CURRENT_USER.

HKLM HKEY_LOCAL_MACHINE.

HKU HKEY_USERS.

HKR is associated with the value specified in SetupinstallFrominfSECTION.

Subkey

Optional, such as Key1 / Key2 / Key3 ....

Value-name

Optionally, mark the value name of Subkey. For string types, you can empty, labeled the default string value

Flag value type

Value meaning

FLG_ADDREG_BINVALUETYPE THE VALUE IS "RAW" data.flg_addreg_noclobber If you do not overwrite this value in the registry.

FLG_ADDREG_DELVAL Remove this button from the registry

FLG_ADDREG_APPEND Add a value to the existing value, only support the REG_MULTI_SZ value

FLG_ADDREG_TYPE_MASK MASK.

FLG_ADDREG_TYPE_SZ REG_SZ type

FLG_ADDREG_TYPE_MULTI_SZ REG_MULTI_SZ.

FLG_ADDREG_TYPE_EXPAND_SZ REG_EXPAND_SZ.

FLG_ADDREG_TYPE_BINARY REG_BINARY.

FLG_ADDREG_TYPE_DWORD REG_DWORD.

FLG_ADDREG_TYPE_NONE REG_NONE.

The Windows 95 installer will view the expansion data type as reg_sz or reg_binary.

Value

Optional. 16 invalidation or string

[CopyFiles] This section can have multiple, defined in the Install section.

[file-list-section]

Destination-file-name [, Source-file-name] [, Temporary-file-name] [, FLAG]

[destination-file-name [, source-file-name] [, Temporary-file-name] [, FLAG]

.

Destination-file-name

The target file name, if not given the source file name, then this name is also the source file name.

SOURCE-FILE-NAME

Source file name, if the target file name is not given, this name is also a target file name.

Temporary-file-name

Ignore, the Setup function automatically handles temporary files.

Flag

Optional, used to control the file how to copy it. You must configure the actual value

Copyflg_warn_if_skip (0x00000001)

If the user tries to skip the warning information after the error occurs after an error occurs

Copyflg_noskip (0x00000002)

Do not allow users to jump to copy this file

Copyflg_noversionCheck (0x00000004)

If the file exists in the target directory, ignore

Copyflg_force_file_in_use (0x00000008)

Replace the file used? When copying, the file is used

Copyflg_no_overwrite (0x00000010)

Not overlaid files in the target file

CopyFLG_NO_VERSION_DIALOG (0x00000020)

If the target file is saved and the new is not overwritten, no dialog box

Copyflg_replaceonly (0x00000040)

Replace the target file

[Delete Registry] describes how to add a registry project. The Del-Registry-Section section must now be in the DELREG entry in Install.

[DEL-registry-section]

Reg-root-string, [Subkey], [Value-name], [Flags], [Value]

[Reg-root-string, [Subkey], [Value-name], [Flags], [Value]]

Rename of Reg-root-string registry:

HKCR HKEY_CLASSES_ROOT.

HKCU HKEY_CURRENT_USER.HKLM HKEY_LOCAL_MACHINE.

HKU HKEY_USERS.

HKR is associated with the value specified in SetupinstallFrominfSECTION.

Subkey

Value-name

Optionally, mark the value name of Subkey. For string types, you can empty, labeled the default string value

[Delete Files] This section specifies the file that needs to be deleted, and the name of the name must appear in the Delfiles entry in Install.

[file-list-section]

File-name [,,, FLAG]

Flag

Optional.

DElflg_in_use (0x00000001)

When the file is being used, setupCommitFileQueue cancels, will be deleted when the queue is restarted during the system.

If this value is not used, the file being used is not deleted by the Delete Files specified.

DElflg_in_use1 (0x00010000)

High byte versions of DElflg_in_use. Setting DELFLG_IN_USE1 difference is the same available to the CopyFiles section and the Delete Files section, even if the copyflg_warn_if_skip flag is used.

This section indicates that entries in the INI file will correspond to the registry.

[Ini-to-registry-section]

Ini-file, ini-section, [ini-key], reg-root-string, Subkey [, Flags]

INI-File

INI file name.

INI-Section

Ini file section

INI-KEY

entry

Flags

Indicates whether the corresponding registry project is overwritten when the registry has a corresponding registry project.

Bit Value

0 0 Default, do not delete the INI file item, when INI is transferred to the registry

0 1 Delete items in the INI file, when INI is transferred to the registry

1 0 Default, when the registry exists, it is not overwritten

1 1 cover

[Rename Files] This type is listed in this type of files that will be changed. This section must appear in the Install section

[Rename-files-section-name]

NEW-file-name, old-file-name

NEW-file-name

New file name

Old-file-name

The original file name. This parameter must be defined in the SourceDisksfiles section.

[UPDATE INI FIELDS] This section is replaced, increasing, and deletes an entry for the specified INI file. This section must exist in the Install section.

[Update-inIfields-Section-Name]

INI-file, ini-section, profile-name, [old-field], [new-field], [Flags]

Parameter explanation

[UPDATE INI FILE] This section deletes, replaces or adds INI projects. The section must now be in the Updateinis entry in the INSTALL section.

Update-ini-section-name]

Ini-file, ini-section, [old-ini-entry], [new-ini-entry], [Flags]

INI-File

Contains the INI file that will change.

INI-Section

Section name

Old-ini-entry

Optional, usually in the form of key = value

New-ini-entry

Optional. It is usually from Key = Value. Key or Value can be an alternative string. Flags

Optional command flag.

Value meaning

0 is default. If the Old-Ini-Entry Key appears in the INI File entry, it will be replaced by new-ini-entry. The value will be ignored, as long as the key is matched. To add new entries to the INI file for unconditional, Old-Ini-Entry is NULL. To remove Old-Ini-Entry from the INI file, set new-ini-entry NULL.

1 If the key and value of the old-ini-entry already exist in the INI file, it will be replaced by New-Ini-Entry. KEY and VALUE of the Old-INI-Entry parameter must match

2 If the OLD-INI-ENTRY parameter does not appear in the INI file, it will not be replaced.

If the keY of Old-Ini-Entry is in the INI file and the NEW-INI-Entry's key is stored in the INI file, the key parameter of the new-ini-entry that matches in the INI file is deleted, and the key matching parameters of OLD-II-Entry Replace

3 Similar 2, however, the exception is that the OLD-INI-ENTRY parameter matches Key and Value, not limited to Key

You can use wildcard (*) to refer to part of Key and Value and all

The INI file name can be a string or a character key. That is,% strkey%, this strkey is defined in the [Strings] section, and must be a legal file name.

The INI file should contain a directory, which can be a direct directory or a specific directory marker.

You can have% DIRID% specified directory, Dirid specifies in the SetupSetDirectoryID section. When you use the directory marker, you should use the backslash number in a directory path. Example: You can use% 11% / card.ini to indicate that Card.ini is stored in the System32 directory.

The following is an example:

% 11% / Sample.ini, Section1, Value1 = 2; Add an entry

% 11% / Sample.ini, Section2, Value3 = *,; Delete old entry

% 11% / Sample.ini, Section4, Value5 = 1, Value5 = 4; replacing old entries

[Services] entry This section lists the list of services that add and delete.

[install-section-name.services]

Addservice = ServiceName, Flag, Service-Install-Section [, Event-Log-Install-Section]

DELSERVICE = ServiceName

ServiceName

Will install / delete service names

Flag

Specifies how to add services. This parameter is only used for the AddService key, with the value:

SPSVCINST_TAGTOFRONT (0x1)

See the preceding list of the service group

SPSVCINST_ASSOCSERVICE (0x2)

This added service is associated with services.

Service-install-section

Service installation festival

EVENT-log-install-section

Time Record the installation section.

The following is an example:

[Ser_INST.SERVICES]]

Addservice = Sermouse, 0x00000002, Sermouse_Service_Inst, Sermouse_EventLog_Inst; Port DriverAddService = mouclass, mouclass_service_inst, mouclass_eventlog_inst

Class Driver

[Service INSTALL] This section lists every service information to be installed

[Install-Section-Name_ServiceInstallSection]

DisplayName = [Name]

ServiceType = Type-Code

StartType = Start-Code

ErrorControl = Error-Control-Level

Servicebinary = path-to-service

Loadordergroup = [loading-order-group-name]

Dependencies = depend-on-group-name [[, depend-on-service-name] ...]

StartName = [driver-object-name]

Name

Optional, friendly service name

TYPE-CODE

Drive type. For any parameters approved by the TheCreateService function.

START-CODE

When to start the driver. Can be:

Service_boot_start (0x0)

Started by the operating system Loader. Use this value only for the operating system basic service.

Service_system_start (0x1)

Operating system initialization is started.

Service_AUTO_START (0x2)

SCM starts during system startup

Service_Demand_start (0x3)

SCM starts as needed

Service_disabled (0x4)

This service cannot be started

Error-Control-Level

Specify the error control level.

Critical (0x3)

If the driver load fails, the startup failed. If the start is not in the last correct (LastkNowng.) Control set, switch to LastknownGood. If you start trying to use for LastkNowngood, run a fault check routine

Severe (0x2)

If startup is not used for LastknownGood, switch to LastknownGood. If you start trying LastknownGood, you will continue to start when an error occurs.

NORMAL (0x1)

If the initialization fails, the start will continue, but the warning message is displayed.

Ignore (0x0)

If the initialization fails, start will continue, no warning information

Path

Binary path

Load-Order-Group-Name

Optional. Indicates the order in the service group in the service: Pointer, Port, Primary Disk, And So Forth.

depend-on-group-name

Optional, service-dependent service group, service is only started after the last service of the group is started

Depend-on-service-name

Optional. Dependent service.

Driver-Object-name

Optional. If the type belongs to the Kernel Driver or File System Driver, this name is used for the name of the I / O manager loading

example:

[mouclass_service_inst]

DisplayName =% mouclass.svcdesc%

ServiceType = 1; service_kernel_driver

StartType = 1; service_system_starterrorControl = 1; service_error_normal

Servicebinary =% 12% / mouclass.sys

Loadordergroup = Pointer Class

[DestinationDIR] This section is used to specify the target directory in the Copy file, Rename File.

[DestinationDIRS]

File-list-section = drid [, subdir]

.

[DefaultDestDir = Drid [Subdir]]

FILE-LIST-Section

Copy Files, Rename Files, or Delete Files section name. Drid

Directory Target (DRID). The installer replaces a Dirid during installation and uses the actual directory.

Dirid% DIRID% is a predefined directory

Dirid can be the following value:

-01, 0xffff

01 SourceDrive: / path.

10 Windows Directory.

11 System Directory. (% WINDIR% / System on Windows 95,% WINDIR% / System32 on Windows NT)

12 Drivers Directory. (% WINDIR% / System32 / Drivers On Windows NT)

17 INF file directory

18 Help Directory

FONTS DIRECTORY.

21 viewer catalog

24 application directory

25 Shared Directory Shared Directory.

30 Start the root of the drive Root Directory of the boot drive.

50% WINDIR% / System

51 Spool Directory SPOOL DIRECTORY.

52 spool drivers.

53 User PROFILE directory

54 NTLDR or Osloader.exe

Subdir

Sub-directory name

Options DefaultDestDir provides the default target directory. If DEFAULTDESTDIR is not used for DestinationDirs section, the default directory is set to Drid_System.

[SOURCEDISKSFILES] This section specifies the files on the source installation disk

In order to allow multiple operating systems to distribute source files, you can construct a SourceDisksFiles section for a specific platform, on the MIPS platform, all installation features will first look for the SourceDisksFiles.Mips section. If the installation function does not find the SourceDisksFiles.Mips section, or a particular line cannot be found there, the installation function will use the SourceDisksfiles section. This behavior directly or indirectly affects the installation function to handle SourceDisksFiles section as part of its process. Sizeless prefix is:

alpha

MIPS

PPC

x86

[SOURCEDISKSFILES]]

FileName = Disk-number [, subdir] [, size]

Filename

File name on the source

Disk-Number

The second few source disks contain this file. Greater than or equal to 1, and defined in the SourceDisksNames section

Subdir

Optional parameters. In the subdirectory on the source disk, the default is the reply of the source disk

Size

Optional parameters, compressed size of files

[SOURCEDISKSFILES]]

SRS01.X86 = 1; Source file SRS01.x86 exists in the root directory of the installation disk 1

[SourceDiskSNames] Indicates the disk name of the source file

In order to allow multiple operating system to distribute source files, you can construct a SourceDiskSNames section for specific platforms. On the MIPS platform, all installation features will first look for the SourceDiskSnames.Mips section. If the installation function does not find the SourceDiskSNames.Mips section, or a particular line cannot be found there, the installation function will use the SourceDiskSNames section. This behavior directly or indirectly affects the installation function to process the SourceDiskSNames section as part of its process.

Sizeless prefix is:

alpha

MIPS

PPC

x86

[SourceDiskSnames [.PLATFORM]]]

Disk-Ordinal = "Disk-description" [, [Disk-Label], [Unused, PATH]

.

Platform

Indicates the platform indicator of the source file application.

Disk-Ordinal

Disk serial number

Disk-description

"" The contained string is used to mark the disk.

Disk-label

Disk volume

unused

Reserved

Path

Optional parameters, the absolute path of the source file, if not, the root directory

In the following example, all platforms of Write.exe are the same, and existing on the / commit directory of the source disk 1. Disk 1 exists in the / common directory of all files. The cmd.exe file is specific to the platform, and the disk 2 indicates the installation function for a specific directory for each platform. The Halnecmp.dll file is specific to the MIPS platform.

[SOURCEDISKSNAMES]]

1 = "Windows NT CD-ROM", INSTD1, / COMMON

[SourceDisksnames.alpha]

2 = "Windows NT CD-ROM", INSTD1,, / ALPHA

[SourceDisksnames.Mips]

2 = "Windows NT CD-ROM", INSTD1,, / MIPS

[SourceDisksnames.x86]

2 = "Windows NT CD-ROM", INSTD1,, / X86

[SourceDisksNames.ppc]

2 = "Windows NT CD-ROM", INSTD1,, / PPC [SourceDisksFiles]

Write.exe = 1

cmd.exe = 2

[SourceDisksfiles.Mips]

HALNECMP.DLL = 2

[EVENTLOG INSTALL] Add event message files to the registry, or use this section to remove event message files.

[install-section-name_eventloginstallsection]

AddReg = add-registry-section

DELREG = DEL-Registry-Section

Add-registry-section

Del-registry-section

Event message section name

AddReg indicates which section will be an enrolled registry key

DELREG instructs deletion event item

The following is a typical EVENTLOG installation festival:

[sermouse_eventlog_inst]

AddReg = Sermouse_EventLog_AddReg

[Sermouse_EventLog_AddReg]

HKR, EventMessageFile, 0x00020000, "%% SystemRoot %% / System32 / IOLOGMSG.DLL /; %% SystemRoot %% / System32 / Drivers / Sermouse.sys"

HKR, TYPESSUPPORTED, 0X00010001, 7

[Strings] This section defines 1 or more string keywords. A string key expands a print-print string

String festivals for specific languages

[Strings [.langID]]]]

Strings-key = value

Langid

Optional indicates the language marker to which the String section belongs. For example, u.s. english is 0409 and Standard French is 040c.

Strings-key

The only name consisting of characters and numbers

Value

Expand string content

example:

[Strings]

String0 = "Corporation X"

String1 = "Corporation X"

String2 = "CS2590 SCSI Adapter"

Example of a specific language:

[Strings.0409]

American English Strings

S1 = "Hello"

[Strings.0009]

British English strings

Note That 0009 is buy instead of 0809 to make this the default

For English Languages ​​Other Than U.S.ENGLISH.

S1 = "Greetings"

[Strings]

French Strings

NOT SPECIFYING A LANGID MAKES THIS THE DEFAULT

S1 = "bonjour"

Comment

Although this section is usually in the last section of the INF file, the defined string KEY can be used for any location of the INF file. The installer will expand the string

If you use%, please use %%.

Windows 95: Do not include the Strings section, do not support multi-language.

转载请注明原文地址:https://www.9cbs.com/read-63180.html

New Post(0)