Appendix H - Structural Definition of .INF Files

Although the Microsoft® Internet Explorer Customization Wizard, Internet Explorer batch files, and third-party applications can customize Setup, you can also use setup information (.inf) files to develop a customized setup solution. This appendix describes the sections of an .inf file and provides a sample.

Related Information in the Resource Kit

  • For more information about how to use .inf files, see "Working with .inf Files." 

Sections of an .inf File

The following table describes the sections of a basic information (.inf) file. More complex .inf files can include additional sections. Section names in bold are reserved keywords. Section names in italic are arbitrary names created by the author of the .inf file.

Section

Description

[Version]

Provides basic version information for validating the .inf file.

[DefaultInstall]

Contains pointers to other sections specifying files to copy and delete, registry updates, .ini file updates, and so on. This section is executed by default.

[OtherInstall]

Uses the same format as the [DefaultInstall] section, but must explicitly be called. This section is useful for defining how you want a component to be uninstalled.

[CopyFiles]
[RenFiles]
[DelFiles]

Lists the files that you want to copy, rename, and delete.

[UpdateInis]
[UpdateIniFields]

Specifies updates to .ini files. Links are created in these sections.

[AddReg]
[DelReg]
[Ini2Reg]

Specifies registry additions and deletions.

[UpdateCfgSys]

Adds, updates, and renames commands in the Config.sys file.

[UpdateAutoBat]

Specifies commands that manipulate lines in the Autoexec.bat file.

[DestinationDirs]

Specifies the location on the hard disk where a section's files will be copied, deleted, or renamed (for example, Windows or Windows\System).

[SourceDisksNames]

Lists the source disks that contain the source files.

[SourceDisksFiles]

Lists the source files and the source disk for each listed source file.

[Strings]

Lists localizable strings.

[Optional Components]

Lists Install selections that are displayed when the user clicks the Add or Remove Programs icon in Control Panel, clicks the Windows Setup tab, and then clicks the Have Disk button. For situations in which this section is ignored, see the description for this section later in the appendix.


[Version] Section

[Version] 

Signature="$Chicago$" 

LayoutFile =filename.inf 

This section defines the standard header for all Microsoft® Windows® .inf files. If you do not use a signature of $Chicago$, Windows does not accept the .inf file as belonging to any of the classes of devices recognized by Windows.

The signature string recognition is not case-sensitive. For example, you can type either $Chicago$ or $CHICAGO$.

filename.inf 

The .inf file containing the layout information (source disks and files) required to install the component. This line is optional. If this information is not provided elsewhere, you must list the [SourceDisksNames] and [SourceDisksFiles] sections in this .inf file.

The following example shows a typical [Version] section:

[Version]
Signature="$CHICAGO$"

[DefaultInstall] and [OtherInstall] Sections

[install-section-name] 

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

RenFiles=file-list-section[,file-list-section]… 

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

UpdateInis=updateinis-section-name[,updateinis-section-name]… 

UpdateIniFields=updateinifields-section-name[,updateinifields-section-name]… 

AddReg=addreg-section-name[,addreg-section-name]… 

DelReg=delreg-section-name[,delreg-section-name]… 

Ini2Reg=ini2reg-section-name[,ini2reg-section-name]… 

UpdateCfgSys=updatecfgsys-section-name 

UpdateAutoBat=updateautobat-section-name 

The Install sections, [DefaultInstall] and [OtherInstall], identify the additional sections in the .inf file that contain installation information for the component. These sections use the same format.

Not all the entries shown in the preceding syntax are needed or required in the Install sections. If you use an entry, it must specify the name of a section in the .inf file. (The CopyFiles entry is an exception because you can use the @ symbol along with a file name to copy a single file without specifying a section name.) The section name must consist of printable characters.

You can use only one of each type of entry in an Install section. You can list more than one section name in an entry, but you must precede each additional name with a comma.

install-section-name 

The name of the Install section, which can be [DefaultInstall] or [OtherInstall] (a name that you specify).

If you name the Install section [DefaultInstall], it will execute when you right-click the .inf file and then click Install. This section will also execute when you select an .inf file as the setup option by using the Cabpack Wizard.

The following example shows a typical Install section. It contains Copyfiles and AddReg entries that identify the sections containing information about which files to install.

[MyApplication]
Copyfiles=MyAppWinFiles, MyAppSysFiles, @SRSutil.exe
AddReg=MyAppRegEntries

Note that if you rename the [MyApplication] section in this example to [DefaultInstall], the section is executed when you right-click the .inf file and then click Install.

The CopyFiles entry provides a special notation that allows a single file to be copied directly from the command line. You can copy an individual file by adding an @ symbol as a prefix to the file name. The destination for any file that you copy using this notation is the DefaultDestDir entry, as defined in "[DestinationDirs] Section" later in this appendix.

The following example shows how to copy individual files:

CopyFiles=FileSection1,@myfile.txt,@anotherfile.txt,LastSectionName
[CopyFiles] Section

[file-list-section] 

destination-file-name[, source-file-name][,temporary-file-name][,flag] 

[destination-file-name[,source-file-name][, temporary-file-name]][,flag] 

This section lists the names of files that you want to copy from a source disk to a destination directory. You must specify the source disk and destination directory associated with each file in other sections of the .inf file.

You can specify the copying of a single file in the CopyFiles entry of the Install section without creating a [CopyFiles] section. To do this, specify the file-list-section name in the CopyFiles entry of the Install section and use the @ symbol to force a single-file copy. For an example of the @ symbol in a CopyFiles entry, see the previous section. Copying a single file in this way imposes limitations, because you must use the same name for the source and destination file names, and you cannot use a temporary file.

file-list-section 

The section name, which must appear in the CopyFiles entry in an Install section of the .inf file.

destination-file-name 

The name of the destination file. If you do not provide a source file name, this name also specifies the source file.

source-file-name 

The name of the source file. If you use the same name for the source and destination files for the file-copy operation, you do not need to include source-file-name.

temporary-file-name 

The name of a temporary file for the file-copy operation. The installer copies the source file but gives it the temporary file name. The next time the operating system starts, it renames the temporary file to the destination file name. You might find this useful for copying files to a destination that is currently open or in use by Windows.

flag 

An optional flag used to perform special actions during the installation process. You can use multiple flags by adding the values together to create the combined flag. The following table identifies valid flags.

Value

Meaning

1

Warn if the user attempts to skip the file.

2

Setup-critical: Do not allow the user to skip the file.

4

Ignore version checking and always copy the file. This action will overwrite a newer file.

8

Force a rename operation. The setup program treats a file as if it were in use. This operation occurs only if the file already exists on the user's computer.

16

If the file already exists on the target computer, do not copy it.

32

Suppress the Version Conflict dialog box, and do not overwrite newer files.


The following example copies three files:

[CopyTheseFilesSec]
file11; copies file11
file21, file22, file23 ; copies file22, temporarily naming it file23
file31, file32 ; copies file32 to file31

In this example, you must define all of the source file names in a [SourceDisksFiles] section of the .inf file, and you must define the logical disk numbers that appear in that section in a [SourceDisksNames] section of the .inf file. For an alternate solution, you can use a Layout.inf file to supply this information.

[RenFiles] Section

[file-list-section] 

new-file-name, old-file-name 

.

.

This section lists the names of files that you want to rename.

file-list-section 

The section name, which must appear in the RenFiles entry in an Install section of the .inf file.

new-file-name 

The new name of the file.

old-file-name 

The old name of the file.

The following example renames file42 to file41, file52 to file51, and file62 to file61:

[RenameOldFilesSec]
file41, file42
file51, file52
file61, file62

In the previous example, you must define all the old file names (file42, file52, and file62) in a [SourceDisksFiles] section of the .inf file, and you must define the logical disk numbers that appear in that section in a [SourceDisksNames] section of the .inf file.

[DelFiles] Section

[file-list-section] 

file-name[,,,flag] 

. 

. 

This section lists the names of files that you want to delete.

file-list-section 

The section name, which must appear in the Delfiles entry in an Install section of the .inf file.

file-name 

The file that you want to delete.

flag 

An optional flag used to force Windows to delete the named file if it is in use during the installation process. To instruct Windows to initialize the file-deletion operation in Wininit.ini after the computer has restarted, set the flag value to 1. If a file marked with the flag=1 setting cannot be deleted because it is in use, the computer will restart after the device installation is completed.

If you do not use the flag=1 setting together with file-name and the file is in use when the  [DelFiles] section executes, it will not be deleted from the computer.

The following example deletes three files:

[DeleteOldFilesSec]
file1
file2
file3
[UpdateInis] Section

[updateinis-section-name] 

ini-file, ini-section, [old-ini-entry], [new-ini-entry], [flags] 

.

.

This section replaces, deletes, or adds complete entries in the specified .ini file.

updateinis-section-name 

The section name, which must appear in the UpdateInis entry in an Install section of the .inf file.

ini-file 

The name of the .ini file containing the entry to change. This name can be a string or a strings key. A strings key has the form %strkey%, where strkey is defined in the [Strings] section in the .inf file. In either case, you must use a valid file name.

The .ini file name should include the name of the directory containing the file, but you should specify the directory name as a logical directory identifier (LDID) rather than an actual name. The installer replaces an LDID with the actual name during installation.

An LDID has the form %ldid%, where ldid is one of the predefined identifiers or an identifier defined in the [DestinationDirs] section. Note that when the constants LDID_BOOT and LDID_BOOTHOST are replaced, the backslash is included in the path. For example, LDID_BOOT can be replaced with C:\. However, in your .inf file, you can either use the backslash character or not. For example, you can use either "%30%boot.ini" or "%30%\boot.ini" to reference Boot.ini in the root directory of the boot drive.

ini-section 

The name of the section containing the entry to change.

old-ini-entry 

An optional entry that usually has the form Key=Value.

new-ini-entry 

An optional entry that usually has the form Key=Value. Either the key or the value can specify replaceable strings. For example, you could use %String1% as either the key or the value specified in new-ini-entry, and define the string that replaces %String1% in the [Strings] section of the .inf file. You can use the asterisk (*) wildcard character when specifying the key and value, and it will be interpreted correctly.

flags 

Optional action flags that specify the conditions under which old-ini-entry is replaced with new-ini-entry. The following table identifies valid flags.

Value

Meaning

0

Default. If old-ini-entry is present in an .ini file entry, that entry is replaced with new-ini-entry. Note that only the keys of old-ini-entry and the .inf file entry must match; the value of each entry is ignored.
To add new-ini-entry to the .ini file unconditionally, set old-ini-entry to NULL. To delete old-ini-entry from the .ini file unconditionally, set new-ini-entry to NULL.

1

If both the key and the value of old-ini-entry exist in an .ini file entry, that entry is replaced with new-ini-entry. Note that both the key and the value for old-ini-entry and the .inf file entry must match so that the replacement can be made. This requirement is in contrast to using an action flag value of 0, where only the keys must match for the replacement to be made.

2

If the key in old-ini-entry does not exist in the .ini file, no operation is performed on the .ini file.
If the key in old-ini-entry exists in an .ini file entry and the key in new-ini-entry exists in an .ini file entry, the .ini file entry that matches the key in new-ini-entry is deleted. Also, the key of the .ini file entry that matches old-ini-entry is replaced with the key in new-ini-entry.
If the key in old-ini-entry exists in an .ini file entry and the key in new-ini-entry does not exist in an .ini file entry, an entry is added to the .ini file made up of the key in new-ini-entry and the old value.
Note that the match of old-ini-entry and an .ini file entry is based on the key alone, not the key and the value.

3

Same as a flag value of 2, except matching of old-ini-entry and an entry in the .inf file is based on both the key and the value, not just the key.


The following examples illustrate individual entries in an [UpdateInis] section of an .inf file:

%11%\sample.ini, Section1,, Value1=2 ; adds new entry
%11%\sample.ini, Section2, Value3=*, ; deletes old entry
%11%\sample.ini, Section4, Value5=1, Value5=4 ; replaces old entry

The following set of entries in an [UpdateInis] section of an .inf file work together to perform operations on the [Boot] section of System.ini.

system.ini, boot, "comm.drv=*vcoscomm.drv","~CommDrvTemp~=*", 3
system.ini, boot, "comm.drv=*r0dmdcom.drv","~CommDrvTemp~=*", 3
system.ini, boot,,"comm.drv=comm.drv"
system.ini, boot, "~CommDrvTemp~=*","comm.drv=*", 3

In the previous set of .inf file entries, the conditionality built into the flags is used to add the entry "comm.drv=comm.drv" to the [Boot] section, unless the entries "comm.drv=*vcoscomm.drv" or "comm.drv=*r0dmdcom.drv" exist in the [Boot] section. In that case, the existing entry is preserved, and the entry "comm.drv=comm.drv" is not added to the .ini file. In other words, after the four .inf file entries are executed, one "comm.drv=" entry will exist in the [Boot] section of the .ini file: "comm.drv=*vcoscomm.drv", "comm.drv=*r0dmdcom.drv", or "comm.drv=comm.drv."

[UpdateIniFields] Section

[updateinifields-section-name] 

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

. 

. 

This section replaces, adds, and deletes fields in a value of a specified .ini file entry. Unlike the [UpdateIniFile] section, the [UpdateIniFields] section replaces, adds, or deletes portions of a value in an .ini file entry rather than the whole value.

Any comments in the .ini file entry are removed, because they might no longer apply. When fields in this entry are processed, spaces, tabs, and commas are used as field delimiters. However, a space is used as the separator when the new field is appended to the entry.

updateinifields-section-name 

The section name, which must appear in the UpdateIniFields entry in an Install section of the .inf file.

ini-file 

The name of the .ini file containing the entry to change. For more information about specifying the .ini file name, see the previous section.

ini-section 

The name of the .ini file section containing the entry to change.

profile-name 

The name of the entry to change.

old-field 

The field value to delete.

new-field 

The field value to add, if it is not already there.

flags 

Optional flags that specify whether to treat old-field and new-field as if they had a wildcard character and to indicate what separator character to use when appending a new field to an.ini file entry. The following table identifies valid flags.

Value

Meaning

0

Default. When matching fields, treat the * character literally and not as a wildcard character. When adding a new field to an entry, use a blank space as a separator.

1

When matching fields, treat the * character as a wildcard character. When adding a new field to an entry, use a blank space as a separator.

2

When matching fields, treat the * character literally and not as a wildcard character. When adding a new field to an entry, use a comma as a separator.

3

When matching fields, treat the * character as a wildcard character. When adding a new field to an entry, use a comma as a separator.


[AddReg] Section

[addreg-section-name] 

reg-root-string, [subkey], [value-name], [flag], [value] 

[reg-root-string, [subkey], [value-name], [flag], [value]] 

.

.

This section adds subkeys or value names to the registry, optionally setting the value.

addreg-section-name 

The section name, which must appear in the AddReg entry in an Install section of the .inf file.

reg-root-string 

The registry root name, which can be one of the following values:

  • HKCR—Same as HKEY_CLASSES_ROOT 

  • HKCU—Same as HKEY_CURRENT_USER 

  • HKLM—Same as HKEY_LOCAL_MACHINE 

  • HKU—Same as HKEY_USERS 

  • HKR—Uses the value of the RelativeKeyRoot entry in the SetupInstallFromInfSection function (called by the setup program) as the registry root 

subkey 

An optional subkey to set. You can express this subkey, which uses the form key1\key2\key3..., as a replaceable string. For example, you could use %Subkey1% and define the string that replaces %Subkey1% in the [Strings] section of the .inf file.

value-name 

The optional value name for subkey. For a string type, if value-name is left empty, the value of the subkey specified in subkey is set to a NULL string. Note that you can express value-name as a replaceable string. For example, you could use %Valname1% and define the string that replaces %Valname1% in the [Strings] section of the .inf file.

flag 

The optional flag that specifies the type of value and whether the registry key is replaced if it already exists. The following table identifies valid flags.

Value

Meaning

0

Default. The value is an ANSI string. Replace the key if it exists.

1

The value is a hexadecimal number. Replace the key if it exists.

2

The value is an ANSI string. Do not replace the key if it exists.

3

The value is a hexadecimal number. Do not replace the key if it exists.


value 

An optional value to set. This value can be either an ANSI string or a number in hexadecimal notation and Intel format. You can use a backslash (\) character to extend any item containing a binary value beyond the 128-byte line maximum. You can also include a string key by using the form %strkey% and define strkey in the [Strings] section of the .inf file. To use a % character in the line, use %%.

At least two fields are required; however, one can be null (empty). Therefore, when you use this form, you must include at least one comma.

In the following example, the two entries add two value names to the registry. Note that %25% will be expanded to the computer's Windows directory.

[MyAppRegEntries]
HKLM,Software\MyApp,ProgramName,,"My Application"
HKLM,Software\MyApp,"Program Location",,"%25%\MyApp.exe"
[DelReg] Section

[delreg-section-name] 

reg-root-string, subkey, [value-name] 

[reg-root-string, subkey, [value-name]] 

.

.

This section deletes a subkey or value name from the registry. This section can contain any number of entries. Each entry deletes one subkey or value name from the registry.

delreg-section-name 

The section name, which must appear in the DelReg entry in an Install section of this .inf file.

reg-root-string 

The registry root name, which can be one of the following values:

  • HKCR—Same as HKEY_CLASSES_ROOT 

  • HKCU—Same as HKEY_CURRENT_USER 

  • HKLM—Same as HKEY_LOCAL_MACHINE 

  • HKU—Same as HKEY_USERS 

  • HKR—Uses the value of the RelativeKeyRoot entry in the SetupInstallFromInfSection function (called by the setup program) as the registry root 

subkey 

A subkey to delete. You can express the subkey, which uses the form key1\key2\key3..., as a replaceable string. For example, you could use %Subkey1% and define the string that replaces %Subkey1% in the [Strings] section of the .inf file.

value-name 

The optional value name for subkey. You can express value-name as a replaceable string. For example, you could use %Valname1% and define the string that replaces %Valname1% in the [Strings] section of the .inf file.

[Ini2Reg] Section

[ini2reg-section-name] 

ini-file, ini-section, [ini-key], reg-root-string, subkey[,flags] 

.

.

This section moves lines or sections from an .ini file to the registry, creating or replacing a registry entry under the specified key in the registry.

ini2reg-section-name 

The section name, which must appear in the Ini2Reg entry in an Install section of the .inf file.

ini-file 

The name of the .ini file containing the key to copy. For more information about specifying the .ini file name, see "[UpdateInis] Section" earlier in this appendix.

ini-section 

The name of the section in the .ini file containing the key to copy.

ini-key 

The name of the key in the .ini file to copy to the registry. If ini-key is empty, the entire section is transferred to the specified registry key.

reg-root-string 

The registry root name, which can be one of the following values:

  • HKCR—Same as HKEY_CLASSES_ROOT 

  • HKCU—Same as HKEY_CURRENT_USER 

  • HKLM—Same as HKEY_LOCAL_MACHINE 

  • HKU—Same as HKEY_USERS

  • HKR—Uses the value of the RelativeKeyRoot entry in the SetupInstallFromInfSection function (called by the setup program) as the registry root 

subkey 

The subkey that receives the value. This subkey uses the form key1\key2\key3... 

flags 

Flags that indicate whether to delete the key in the .ini file after transfer to the registry and whether to overwrite the value in the registry if the registry key already exists. The following table identifies the valid flags.

Value

Meaning

0

Default. After moving the information in the entry to the registry, do not delete the entry from the .ini file. If the registry subkey already exists, do not replace its current value.

1

After moving the information in the entry to the registry, delete the entry from the .ini file. If the registry subkey already exists, do not replace its current value.

2

After moving the information in the entry to the registry, do not delete the entry from the .ini file. If the registry subkey already exists, replace its current value with the value from the entry in the .ini file.

3

After moving the information in the entry to the registry, delete the .ini entry from the .ini file. If the registry subkey already exists, replace its current value with the value from the entry in the .ini file.


For example, the following code shows the [Windows] section in the Win.ini file:

[Windows]
CursorBlinkRate=15

If a CursorBlinkRate subkey does not exist under Control Panel\Desktop, the following entry in an [Ini2Reg] section creates the subkey, sets the value of the subkey to 15, and leaves the original line in Win.ini unchanged:

win.ini,Windows,CursorBlinkRate,HKCU,"Control Panel\Desktop"

If the subkey already exists, the .inf file entry sets the value of the subkey to 15 and leaves the original line in Win.ini unchanged.

[UpdateCfgSys] Section

[updatecfgsys-section-name] 

Buffers=legal-dos-buffer-value 

DelKey=key 

DevAddDev=driver-name,configkeyword[,flag][,param-string] 

DevDelete=device-driver-name 

DevRename=current-dev-name,new-dev-name 

Files=legal-dos-files-value 

PrefixPath=ldid[,ldid] 

RemKey=key 

Stacks=dos-stacks-values 

This section contains entries that add, delete, or rename commands in the Config.sys file.

Not all entries shown in the preceding syntax are needed or required. An update configuration section can contain as many DelKey, DevAddDev, DevDelete, DevRename, and RemKey entries as needed, but you can use the Buffers, Files, and Stacks entries only once in a section. When processing this section, the installer processes all DevRename entries first, all DevDelete entries second, and all DevAddDev entries last.

updatecfgsys-section-name 

The section name, which must appear in the UpdateConfigSys entry in an Install section of the .inf file.

Buffers Entry

Buffers=legal-dos-buffer-value 

This entry sets the number of file buffers. As it does with the Stacks entry, the installer compares the existing value with the proposed value and sets the file buffers to the larger of the two values.

legal-dos-buffer-value 

A legal MS-DOS buffer value.

DelKey Entry

DelKey =key 

This entry causes the command with the specified key to be remarked-out in the Config.sys file. For example, the following .inf file entry causes a Break=on command to be remarked-out in the Config.sys file:

DelKey=Break

The DelKey entry has the same effect as the RemKey entry. You can use multiple DelKey and/or RemKey entries in a section of the .inf file.

key 

The key of the command to be remarked-out in the Config.sys file.

DevAddDev Entry

DevAddDev =driver-name,configkeyword[,flag][,param-string] 

This entry adds a device or install command to the Config.sys file.

driver-name 

The name of the driver or executable file to add. The installer validates the file name extension, ensuring that it is .sys or .exe.

configkeyword 

The command name, which can be device or install.

flag 

An optional placement flag that specifies the location of the device or install command.

The following table identifies valid flags.

Value

Meaning

0

Default. The command is placed at the bottom of the file.

1

The command is placed at the top of the file.


param-string 

Optional command strings, which must be valid for the specified device driver or executable file.

DevDelete Entry

DevDelete =device-driver-name 

This entry deletes any line containing the specified file name from the Config.sys file.

device-driver-name 

The name of a file or device driver. The installer searches the Config.sys file for the name and deletes any line containing it. Because Microsoft® MS-DOS® does not permit implicit file name extensions in Config.sys, each device-driver-name must explicitly specify the file name extension.

In the following example, the DevDelete entry in an [UpdateCfgSys] section deletes lines 1 and 3 of the Config.sys file, but not line 2:

DevDelete=Filename.sys
;; lines in Config.sys
Device=Filename.sys;; line #1
Install=Filename.exe;; line #2
Device=Filename.sys /d:b800 /I:3 ;; line #3
DevRename Entry

DevRename=current-dev-name,new-dev-name 

This entry renames a device driver in the Config.sys file.

current-dev-name 

The name of the device driver or executable file to rename. The installer looks for the name on the right side of a device or install command in the Config.sys file.

new-dev-name 

The new name for a device driver or executable file.

Files Entry

Files =legal-dos-files-value 

This entry sets the maximum number of open files in the Config.sys file. As it does with the Stacks entry, the installer compares the existing value with the proposed value and sets the maximum number of open files to the larger of the two values.

legal-dos-files-value 

A legal MS-DOS files value.

PrefixPath Entry

PrefixPath =ldid[,ldid]... 

This entry appends the path associated with the given LDID to the path command.

ldid 

An identifier that can be any of the predefined LDID values or a new value defined in the .inf file. For definitions of all the predefined LDID values, see "[DestinationDirs] Section" later in this appendix.

RemKey Entry

RemKey =key 

This entry causes the command with the specified key to be remarked-out in the Config.sys file. For example, the following .inf file entry causes a Break=on command to be remarked-out in the Config.sys file:

RemKey=Break

The RemKey entry has the same effect as the DelKey entry. You can use multiple RemKey and/or DelKey entries in a section of the .inf file.

key 

The key of the command to be remarked-out in the Config.sys file.

Stacks Entry

Stacks=dos-stacks-values 

This entry sets the number and size of stacks in the Config.sys file. The installer compares the existing value with the proposed value and always sets Stacks to the larger of the two values. For example, if the Config.sys file contains Stacks=9,218 and the .inf file contains Stacks = 5,256, the installer sets the new value to Stacks=9,218.

dos-stacks-values 

Legal MS-DOS stacks values.

[UpdateAutoBat] Section

[updateautobat-section-name] 

CmdAdd=command-name[,command-parameters] 

CmdDelete=command-name 

PrefixPath=ldid[,ldid] 

RemOldPath=ldid[,ldid] 

TmpDir=ldid[,subdir] 

UnSet=env-var-name 

This section contains commands that manipulate lines in the Autoexec.bat file.

Not all entry types shown in the preceding syntax are needed or required. The section can contain as many CmdAdd, CmdDelete, and UnSet entries as needed, but you can use the PrefixPath, RemOldPath, and TmpDir entries only once in an .inf file.

The installer processes all CmdDelete entries before any CmdAdd entries.

updateautobat-section-name 

The section name, which must appear in the UpdateAutoBat entry in an Install section of the .inf file.

CmdAdd Entry

CmdAdd =command-name[,"command-parameters"] 

This entry adds the specified command and optional command parameters to the end of the Autoexec.bat file.

command-name 

The name of an executable file with or without an extension. If the file name is also defined in the [DestinationDirs] and [SourceDisksFiles] sections of the .inf file, the installer adds the appropriate path to the file name before writing it to the Autoexec.bat file.

command-parameters 

A string enclosed in double-quotation marks or a replaceable string. For example, you could use %String1% or %Myparam%, and define the string that replaces %String1% or %Myparam% in the [Strings] section of the .inf file. The installer appends the string to command-name before appending the line to the end of the Autoexec.bat file. The format of this line depends on the command-line requirements of the specified executable file.

CmdDelete Entry

CmdDelete =command-name 

This entry deletes any lines from the Autoexec.bat file that include the specified command-name. The installer searches for and deletes any occurrence of the given name that has an extension of.exe, .com, or .bat.

command-name 

The name of an executable file without an extension.

PrefixPath Entry

PrefixPath =ldid[,ldid]... 

This entry appends the path associated with the specified LDID to the path command.

ldid 

An identifier that can be any of the predefined LDID values or a new value defined in the .inf file. For definitions of all the predefined LDID values, see "[DestinationDirs] Section" later in this appendix.

RemOldPath Entry

RemOldPath =ldid[,ldid] 

This entry removes the path associated with the given LDID from the path command. For example, if the user installs the new version of Windows into C:\Newwin and has an old copy of Windows in C:\Windows, the following .inf file entry removes C:\Windows from the path environmental variable:

RemOldPath=10

ldid 

An identifier that can be any of the predefined LDID values or a new value defined in the .inf file. For definitions of all the predefined LDID values, see "[DestinationDirs] Section" later in this appendix.

TmpDir Entry

TmpDir =ldid[,subdir] 

This entry creates a temporary directory within the directory identified by the LDID, if it does not already exist.

ldid 

An identifier that can be any of the predefined LDID values or a new value defined in the .inf file. For definitions of all the predefined LDID values, see "[DestinationDirs] Section" later in this appendix.

subdir 

The path name. If the Ldid\Subdir directory does not already exist, it is created.

UnSet Entry

UnSet=env-var-name 

This entry removes any set command that includes the specified environment variable name from the Autoexec.bat file.

env-var-name 

The name of an environment variable.

[DestinationDirs] Section

[DestinationDirs] 

file-list-section=ldid[, subdir ] 

. 

. 

[DefaultDestDir =ldid[, subdir ]] 

The [DestinationDirs]  section defines the destination directories for the operations specified in file-list-section of CopyFiles, RenFiles, or DelFiles entries. Optionally, you can specify a default destination directory for any CopyFiles, RenFiles, or DelFiles entries in the .inf file that are not explicitly named in the [DestinationDirs] section.

file-list-section 

The name of a CopyFiles, RenFiles, or DelFiles entry. You must also include the Copyfiles, RenFiles, or DelFiles entry in an Install section of the .inf file.

Ldid 

The logical disk identifier. The following table identifies valid LDID values.

Value

Meaning

00

Null LDID—can be used to create a new LDID

01

Source Drive:\pathname

10

Computer directory (maps to the Windows directory for server-based setup)

11

System directory

12

IOSubsys directory

13

Command directory

17

Inf directory

18

Help directory

20

Fonts

21

Viewers

22

VMM32

23

Color directory

24

Root directory of the drive containing the Windows directory

25

Windows directory

26

Guaranteed boot device for Windows (Winboot)

28

Host Winboot

30

Root directory of the boot drive

31

Root directory for host drive of a virtual boot drive


subdir 

The name of the directory within the directory named by LDID as the destination directory.

The optional DefaultDestDir entry provides a default destination for any CopyFiles entries that use the direct copy (@file name) notation or any CopyFiles, RenFiles, or DelFiles entries not specified in the [DestinationDirs] section. If you do not include the optional DefaultDestDir entry in a [DestinationDirs] section, the default directory is set to LDID_WIN.

The following example sets the destination directory for the MoveMiniPort entry to Windows\Iosybsys and sets the default directory for other sections to the Bin folder on the boot drive:

[DestinationDirs]
MoveMiniPort=12 ; Destination for MoveMiniPort section is ; windows\iosubsys
DefaultDestDirs=30,bin ; Direct copies go to boot:\bin

[SourceDisksNames] Section

[SourceDisksNames] 

disk-ordinal="disk-description",disk-label,disk-serial-number 

. 

. 

This section identifies the source disk(s) that contain the source files for file copy and rename operations.

disk-ordinal 

The unique number that identifies a source disk. If more than one source disk exists, each disk must have a unique ordinal.

disk-description 

The string or strings key describing the contents or purpose of the source disk. The installer displays this string to the user to identify the disk. The description is enclosed in double quotation marks.

disk-label 

The volume label of the source disk that is set when the source disk is formatted.

disk-serial-number 

This unused value must be 0.

The following example identifies one source disk with the disk description specified as a strings key:

[SourceDisksNames]
55 = %ID1%, Instd1, 0
[Strings]
ID1="My Application Installation Disk 1"

[SourceDisksFiles] Section

[SourceDisksFiles] 

file-name=disk-number[,subdir] [,file-size] 

. 

. 

This section specifies the source files used during installation and the source disks that contain the source files.

file-name 

The name of the file on the source disk.

disk-number 

The ordinal of the source disk that contains the file. You must define this ordinal in the [SourceDisksNames] section, and it must have a value greater than or equal to 1 (zero is not a valid value for disk-number).

subdir 

An optional subdirectory on the source disk where the file resides. If subdir is not specified, the root directory of the source disk is the default.

file-size 

An optional entry that specifies the size of the file, in bytes.

The following example shows a [SourceDisksFiles] section that identifies a single source file, SRS01.386, on the disk having ordinal 1:

[SourceDisksFiles]
SRS01.386 = 1

[Strings] Section

[Strings] 

strings-key=value 

. 

. 

This section defines one or more strings keys. A strings key is a name that represents a string of printable characters. Although the [Strings] section is generally the last section in the .inf file, a strings key defined in this section can be used anywhere in the .inf file that the corresponding string would be used. The installer expands the strings key to the specified string and uses it for further processing. You must enclose a strings key in percent signs (%).

The [Strings] section makes translation of strings for international markets easier by placing all strings that can be displayed in the user interface in a single section of the .inf file. Strings keys should be used whenever possible.

strings-key 

A unique name consisting of letters and digits.

value 

A string consisting of letters, digits, or other printable characters. If you use the corresponding strings key in an entry that requires double-quotation marks, you must also enclose value in double quotation marks.

The following example shows the [Strings] section for a sample .inf file:

[Strings]
String0="My Application"
String1="My Application Readme File"
String2="CX2590 SCSI Adapter"

[Optional Components] Section

[Optional Components] 

install-section-name 

[install-section-name] 

. 

. 

This section lists Install sections that are displayed when the user clicks Add or Remove Programs in Control Panel, clicks the Windows Setup tab, and then clicks the Have Disk button. The Install sections appear as check boxes in the list.

Note that the [Optional Components] section is ignored when you right-click an .inf file and then click Install to execute the file. When you use an .inf file in this way, the [DefaultInstall] section executes. The [Optional Components] section is also ignored if the .inf file is being executed through the InstallHinfSection entry-point function in Setupx.dll. When executing an .inf file by using this entry-point function, the Install section specified in the parameter of the entry point is executed.

The Install sections follow the same format as described in "[DefaultInstall] and [OtherInstall] Sections" earlier in this appendix. To create the interface in the Have Disk dialog box, you can include the following additional keys in an Install section:

OptionDesc= option-description 

Tip= tip-description 

InstallDefault=0 | 1

IconIndex=icon-index 

Parent=install-section-name 

Needs=install-section-name, [install-section-name] 

Include=inf-file, [inf-file] 

option-description 

The string value that displays as the component name in the list box. For example, you could use %String1% and define the string that replaces %String1% in the [Strings] section of the .inf file.

tip-description 

The string value that displays in the description box when the user selects the component in the list box. The value has a 255-character limit. For example, you could use %String1% and define the string that replaces %String1% in the [Strings] section of the .inf file.

icon-index 

The numeric value that determines the mini-icon that displays next to the component name. The following table identifies valid values for icon-index.

0 | 1 (InstallDefault)

A numerical value that identifies whether to install this component by default. A value of 0 equals No, and a value of 1 equals Yes.

Value

Icon

0

Machine (base and display)

1

Integrated circuit chip

2

Display

3

Network wires

4

Windows flag

5

Mouse

6

Keyboard (3 keys)

7

Phone

8

Speaker

9

Hard disks

10

Comm connector

11

Diamond (default value)

12

Checked box

13

Unchecked box

14

Printer

15

Net card

16

Same as 0

17

Same as 0 with a sharing hand underneath

18

Unknown (question mark)

19

At work

20

Dimmed check box

21

Dial-up networking

22

Direct cable connection

23

Briefcase

24

Exchange

25

Partial check

26

Accessories group

27

Multimedia group

28

QuickView

29

MSN®

30

Calculator

31

Defrag

32

Generic document

33

DriveSpace®

34

Solitaire

35

HyperTerminal

36

Object Packager

37

Paint

38

Screen saver

39

WordPad

40

Clipboard Viewer

41

Accessibility

42

Backup

43

Bitmap document

44

Character map

45

Mouse pointers

46

Net Watcher

47

Phone Dialer

48

System Monitor

49

Help book

50

Globe (international settings)

51

Audio compression

52

CD player

53

Windows Media™ Player

54

Sound scheme

55

Video clip

56

Video compression

57

Volume control

58

Musica sound scheme

59

Jungle sound scheme

60

Robotz sound scheme

61

Utopia sound scheme


install-section-name (Parent)

The list box displayed in the optional components interface can contain sublevels. If the optional component is a child, install-section-name for the Parent key defines the Install section that is the parent.

install-section-name (Needs)

If this component has dependencies on other components, install-section-name defines Install sections that this component requires. If the component is selected, the user will be warned that the component requires the component(s) described in the Install section(s) listed for the Needs key.

Note that the Install sections listed for the Needs key must be in the same .inf file. However, if dependent components from other .inf files are listed for the Needs key, the .inf files must be specified for the Include key.

inf-file (Include)

Additional .inf files that the setup program must also load into memory when it loads your .inf file. These .inf files contain sections that must be run in addition to the Install sections in your.inf file. The Needs key specifies the names of the sections you intend to run in the additional.inf file(s).

The following example shows two [Optional Components] sections, with each section specifying additional entries for interface elements and dependencies:

[Optional Components]
InstallMyToys
InstallOtherApps

[InstallMyToys]
OptionDesc=%Toys_DESC%
Tip=%Tomytoysys_TIP%
IconIndex=35 ;Phone mini-icon for dialogs
Parent=MailApps
Needs=MSMAIL, MAPI, MicrosoftNetwork
Include=mos.inf, msmail.inf
CopyFiles=MyToysFiles
UpdateInis=MyToysLinks
AddReg=MyToysRegItems

[InstallOtherApps]
OptionDesc=%Other_DESC%
Tip=%Other_TIP%
IconIndex=4 ;Windows mini-icon for dialogs
CopyFiles=OtherFiles
UpdateInis=OtherLinks
AddReg=OtherRegItems

[Strings]
Toys_DESC="Mail Utilities"
Toys_TIP="Additional utilities for sending and organizing mail"
Other_DESC="Other Helpful Utilities"
Other_TIP="Calculator, disk checker, and performance monitor"

Sample .inf File

The following example shows an .inf file that performs a number of different actions:

; - Copies files to the Windows, System, Inf, and Help folders.
; - Makes a number of registry entries (including entries that 
; will rename the copied files to long file names).
; - Creates a link on the Help menu.
; - Has an uninstall section that registers the uninstall 
; action in the Add or Remove Programs dialog box in Control Panel.
; - Uses replaceable strings to make localization easy.
[Version]
Signature=$CHICAGO$
[DestinationDirs]
SampleCopy = 24,%PROGRAMF%\Sample
SampleDel = 24,%PROGRAMF%\Sample
SampleWinCopy = 25
SampleSysCopy = 11
SampleINFCopy = 17
sampleHLPCopy = 18
[DefaultInstall]
CopyFiles = SampleCopy, SampleWinCopy, SampleSysCopy, SampleINFCopy, SampleHLPCopy
AddReg = SampleRegisterApp, SampleRegUninstall, SampleRenameFiles
UpdateInis = SampleAddLinks 
[RemoveSample]
DelFiles = SampleWinCopy, SampleSysCopy, SampleINFCopy, SampleHLPCopy
DelReg = SampleUnRegisterApp, SampleRegUninstall
AddReg = SampleRemoveLFNs
UpdateInis = SampleRemoveLinks
[SampleCopy]
sample.bmp
[SampleWinCopy]
sample.exe
[SampleSysCopy]
sample.dll
[SampleINFCopy]
sample.inf
[SampleHLPCopy]
sample.hlp
[SampleRegisterApp]
;Makes an arbitrary registry entry (for private use of Sample.exe):
HKLM,Software\Sample,Installed,,"1"
[SampleUnRegisterApp]
;Deletes the registry entry (note that this deletes the entire key):
HKLM,Software\Sample
[SampleRegUninstall]
;Adds entry to the Add or Remove Programs dialog box in Control Panel 
;to uninstall the program:
HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sample,
"DisplayName",,"Sample Application"
HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sample,
"UninstallString",,"RunDll setupx.dll,InstallHinfSection RemoveSample 
4 sample.inf"
[SampleRenameFiles]
;Renames 8.3 file names to long file names:
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Sample,,,"%24%\
%PROGRAMF%\Sample"
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Sample,
sample.bmp,,"Sample Bitmap.bmp"
[SampleRemoveLFNs]
;Deletes files with long file names during uninstall:
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Sample,,,"%24%\
%PROGRAMF%\Sample"
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Sample,
sample.bmp,,"Sample Bitmap.bmp"
[SampleAddLinks]
;Adds shortcut to Sample.exe on the Start menu:
setup.ini, progman.groups,, "Sample=%SampleFolder%" ;creates folder
setup.ini, Sample,, """%SampleDesc%"", %25%\SAMPLE.EXE" ;creates link
[SampleRemoveLinks]
;Removes shortcut to Sample.exe on the Start menu during uninstall:
setup.ini, progman.groups,, "Sample=%SampleFolder%" ;creates folder
setup.ini, Sample,, """%SampleDesc%""" ;deletes link
[SourceDisksNames]
99 = %DiskName%,Sample,0
[SourceDisksFiles]
sample.exe = 1,,13456
sample.dll = 1,,20987
sample.bmp = 1,,64098
sample.hlp = 1,,55441
sample.inf = 1,,5687
[Strings]
PROGRAMF = "PROGRA~1"
SampleFolder = "Samples"
SampleDesc = "Sample Application"
DiskName = "Sample Application Installation Disk"

Additional Resources

These resources contain additional information and tools related to this chapter.

Related Information Outside the Resource Kit

  • Microsoft® Windows® 98 Resource Kit 

  • Microsoft® Windows® 2000 Server Resource Kit 

  • Microsoft® Windows®XP Professional Resource Kit 


Page view tracker