Home | CSF2 | CSF4 | Structure of .inf Files | Uninstallation From the Microsoft Documentation

Structural Definition of .inf Files

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

In This Appendix

Sections of an .inf File

Version Section
Install Sections (DefaultInstall and OtherInstall)
DestinationDirs Section
SourceDisksNames Section
SourceDisksFiles Section
Strings Section
Optional Components Section

Sample .inf File

See Also

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

Sections of an .inf File

A basic information (.inf) file contains the following sections (more complex .inf files may have additional sections). Section names in bold are reserved keywords. Section names in italic are arbitrary names created by the .inf author.
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 a component should be uninstalled.

[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).

[FileCopy/Delete/RenameSection(s)]

Lists files to be copied, deleted, or renamed.

[RegistryUpdateSection(s)]

Specifies registry additions or deletions.

[IniFileUpdateSection(s)]

Specifies updates to .ini files. Links are created in this section.

[SourceDisksNames]

Lists disks that contain the files.

[SourceDisksFiles]

Lists the specific disk that each file is on.

[Strings]

Lists localizable strings.

[Optional Components]

Lists Install selections that are displayed when the user clicks the Add/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.

For more information about .inf files, see the Windows 95 Resource Kit and the Windows 98 Resource Kit.

[Version]

Signature="$Chicago$"

LayoutFile=filename.inf

This section defines the standard header for all Microsoft Windows .inf files. Note that if the signature is not $Chicago$, Windows does not accept the .inf file as belonging to any of the classes of devices recognized by Windows.

Note that signature string recognition is not case sensitive, so, for example, you can use either $Chicago$ or $CHICAGO$.

filename.inf

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

The following example shows a typical [Version] section:

[Version]
Signature="$CHICAGO$"

The Install sections, [DefaultInstall] and [OtherInstall], use the same format. They can contain the following entries:

  • 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]
  • UpdateCfgSys=update-config-section
  • UpdateAutoBat=update-autoexec-section

The Install sections identify the additional sections in the .inf file that contain installation information for the component.

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

Only one of each type of entry can be used in any one Install section. More than one section name can be listed in an entry, but each additional name must be preceded by a comma.

install-section-name

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 select 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 Install section will execute when you right-click the .inf file and then select 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 prefixing the file name with an @ symbol. The destination for any file that you copy using this notation is the DefaultDestDir entry, as defined in the [DestinationDirs] section later in this appendix. The following example shows how to copy individual files:

CopyFiles=FileSection1,@myfile.txt,@anotherfile.txt,LastSectionName

Copy Files Sections (CopyFiles)

[CopyFiles-section-name]

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 to be copied from a source disk to a destination directory. The source disk and destination directory associated with each file are specified in other sections of the .inf file. The file-list-section name must appear in the CopyFiles item of an Install section.

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

destination-file-name

Name of the destination file. If no source file name is given, the name also specifies the source file.

source-file-name

Name of the source file. If the source and destination file names for the file copy operation are the same, the source file name is not required.

temporary-file-name

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. This is useful for copying files to a destination that is currently open or in use by Windows.

flag

Optional flag used to perform special actions during the installation process. Multiple flags can be used by adding the values to create the combined flag. The following valid flags can be used.
Value
Meaning
1

For CopyFiles: Warn if user tries to skip the file.

1

For DelFiles: If the file is in use, queue up a delayed delete operation in Wininit.ini. Otherwise, a file that is currently in use won't be deleted.

2

Setup-critical: Don't 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. The setup program treats a file as if it's in use. This happens only if the file already exists on the user's computer.

16

If the file already exists on the target computer, don't copy.

32

Suppress the version conflict dialog box, and don't 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

All of the source file names used in this example must be defined in a [SourceDisksFiles] section, and the logical disk numbers that appear in that section must have been defined in a [SourceDisksNames] section. For an alternate solution, you can use a Layout.inf file to supply this information.

Rename Files Sections (RenFiles)

[rename-files-section-name]

new-file-name, old-file-name

This section lists the names of files to be renamed. The name of the section must appear in a RenFiles entry in an Install section of the .inf file.

new-file-name

New name of the file.

old-file-name

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

All the old file names used in this example (file42, file52, and file62) must be defined in a [SourceDisksFiles] section, and the logical disk numbers that appear in that section must have been defined in a [SourceDisksNames] section.

Delete Files Sections (DelFiles)

[file-list-section]

file-name[,,,flag]

This section lists the names of files to be deleted. The file-list-section name must appear in the Delfiles entry of an Install section.

file-name

File to be deleted.

flag

Optional flag used to force Windows to delete the file named in the item if it is in use during the installation process. To instruct Windows to queue the file deletion operation until 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 complete.

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

The following example deletes three files:

[DeleteOldFilesSec]
file1
file2
file3

Update .ini File Sections (UpdateInis)

[update-ini-section-name]

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

This section replaces, deletes, or adds complete entries in the given .ini file. The section name, update-ini-section-name, must appear in the UpdateInis entry in the Install section of the .inf file.

ini-file

Name of the .ini file containing the entry to change.

ini-section

Name of the section containing the entry to change.

old-ini-entry

Optional. Entry that usually has the form Key=Value.

new-ini-entry

Optional. Entry that usually has the form Key=Value. Either the key or value may specify replaceable strings. For example, either the key or value specified in new-ini-entry may be %String1%, where the string that replaces %String1% is defined in the [Strings] section of the .inf file.

flags

Optional action flag. It can be one of the following values:
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 key and value of old-ini-entry exist in an .ini file entry, that entry is replaced with new-ini-entry. Note that old-ini-entry and the .inf file entry must match for both the key and value for the replacement to be made. This 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 key alone, not key and value.

3

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

You can use the asterisk (*) wildcard character when specifying the key and value, and it will be interpreted correctly.

The ini-file 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, the name must be a valid file name.

The name should include the name of the directory containing the file, but the directory name should be given as a logical directory identifier (LDID) rather than an actual name. The installer replaces an LDID with an 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" and "%30%\boot.ini" to reference Boot.ini in the root of the boot drive.

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 operate on the [Boot] section of System.ini. The conditionality built into flags of the .inf file entries 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 which 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 following .inf file entries are executed, there will be one "comm.drv=" entry in the [Boot] section of the .ini file: "comm.drv=*vcoscomm.drv", "comm.drv=*r0dmdcom.drv", or "comm.drv=comm.drv."

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

Update .ini Fields Sections (UpdateIniFields)

[ update-inifields-section-name ]

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

This section replaces, adds, and deletes fields in the value of a given .ini entry. Unlike the [UpdateIniFile] section, this type of section replaces, adds, or deletes portions of a value in an .ini file entry rather than the whole value. The section name, update-inifields-section-name, must appear in the UpdateIniFields entry in the Install section of the .inf file.

ini-file

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

Name of the .ini file section containing the entry to change.

profile-name

Name of the entry to change.

old-field

Field value to delete.

new-field

Field value to add, if not already there.

flags

Flag specifying whether to treat old-field and new-field as if they have a wildcard character and to indicate what separator character to use when appending a new field to an .ini file entry. It can be any of these values:
Value
Meaning
0

Default. Treat the * character literally when matching fields and not as a wildcard character. Use a space as a separator when adding a new field to an entry.

1

Treat the * character as a wildcard character when matching fields. Use a space as a separator when adding a new field to an entry.

2

Treat the * character literally when matching fields and not as a wildcard character. Use a comma as a separator when adding a new field to an entry.

3

Treat the * character as a wildcard character when matching fields. Use a comma as a separator when adding a new field to an entry. Any comments in the .ini file line are removed, because they might not be applicable after changes. When fields in this line of the .ini file 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 line.

Add Registry Sections (AddReg)

[add-registry-section]

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. The add-registry-section name must appear in an AddReg entry in an Install section.

reg-root-string

Registry root name. It 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—Relative key used by the class installer. HKR is typically used by device drivers.

subkey

Optional. Subkey to set. This subkey, which has the form key1\key2\key3..., can be expressed as a replaceable string. For example, you could use %Subkey1%, where the string to replace %Subkey1% is defined in the [Strings] section of the .inf file.

value-name

Optional. Value name for the 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 value-name can be expressed as a replaceable string. For example, you could use %Valname1%, where the string to replace %Valname1% is defined in the [Strings] section of the .inf file.

flag

Optional. Flag that determines the value type and specifies whether the registry key is replaced if it already exists.
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

Optional. Value to set. This value can be either an ANSI string or a number in hexadecimal notation and Intel format. Any item containing a binary value can be extended beyond the 128-byte line maximum by using a backslash (\) character. A string key of the form %strkey% can also be given. Note that strkey must be defined 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, at least one comma is required when using this form.

The two entries in the following example 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"

Delete Registry Sections (DelReg)

[del-registry-section]

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

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

This section deletes a subkey or value name from the registry. The del-registry-section name must appear in a DelReg entry in an Install section.

reg-root-string

Registry root name. It 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—Means relative from the key passed into GenInstallEx

subkey

Subkey to delete. The subkey, which has the form key1\key2\key3..., can be expressed as a replaceable string. For example, you could use %Subkey1%, where the string to replace %Subkey1% is defined in the [Strings] section of the .inf file.

value-name

Optional. Value name for the subkey. Note that value-name can be expressed as a replaceable string. For example, you could use %Valname1%, where the string to replace %Valname1% is defined in the [Strings] section of the .inf file.

This type of section can contain any number of items. Each item deletes one subkey or value name from the registry.

.ini File to Registry Sections (Ini2Reg)

[ ini-to-registry-section]

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 given key in the registry. The section name ini-to-registry-section must appear in an Ini2Reg entry in the Install section of the .inf file.

ini-file

Name of the .ini file containing the key to copy. For more information about specifying the .ini file name, see "Update .ini File Sections (UpdateInis)" earlier in this appendix.

ini-section

Name of the section in the .ini file containing the key to copy.

ini-key

Name of the key in the .ini file to copy to the registry. If ini-key is empty, the whole section is transferred to the specified registry key.

reg-root-string

Registry root name. This parameter 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—Relative key for use by the class installer. This key is typically used by device drivers.

subkey

Subkey to receive the value. This subkey has the form key1\key2\key3...

flags

Flag that indicates whether to delete the .ini key after transfer to the registry and whether to overwrite the value in the registry if the registry key already exists. The flag can be one of the following values:
Value
Meaning
0

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

1

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

2

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

3

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

For example, the following example 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 item 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 item sets the value of the subkey to 15 and leaves the original line in Win.ini unchanged.

Update Config.sys Sections (UpdateCfgSys)

[update-config-section]

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 provides entries to add, delete, or rename commands in the Config.sys file. The section name, update-config-section must appear in the UpdateConfigSys entry in an Install section of the .inf file.

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

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 always sets the file buffers to the larger of the two values.

legal-dos-buffers-value

Legal MS-DOS buffers value.

DelKey Entry

DelKey=key

This entry causes the Config.sys command with the specified key to be remarked out in the Config.sys file. For example, the following .inf file entry would cause 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. There can be multiple DelKey and/or RemKey entries in a section of the .inf file.

key

Key of the Config.sys command to be remarked out.

DevAddDev Entry

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

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

driver-name

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

configkeyword

Command name. It can be device or install.

flag

Optional placement flag. If 0, the command is placed at the bottom of the file. If 1, it is placed at the top. If a flag is not specified, 0 is used by default.

param-string

Optional command strings. These strings must be valid for the given 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

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 update configuration section deletes lines 1 and 3, but not line 2 of the example Config.sys file:

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

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

New name for 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 always sets the maximum number of open files to the larger of the two values.

legal-dos-files-value

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

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

RemKey Entry

RemKey=key

This entry causes the Config.sys command with the specified key to be remarked out in the Config.sys file. For example, the following .inf file entry would cause 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. There can be multiple RemKey and/or DelKey entries in a section of the .inf file.

key

Key of the Config.sys command to be remarked out.

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 the stacks to the larger of the two values.

dos-stacks-value

Legal MS-DOS stacks value.

Update Autoexec.bat Sections (UpdateAutoBat)

[update-autoexec-section]

CmdAdd=command-name[,command-parameters]

CmdDelete=command-name

PrefixPath=ldid[,ldid]

RemOldPath=ldid[,ldid]

TmpDir=ldid[,subdir]

UnSet=env-var-name

This section provides commands to manipulate lines in the Autoexec.bat file. The section name, update-autoexec-section must appear in the UpdateAutoBat entry in an Install section of the .inf file.

Not all entry types shown in the preceding syntax are needed or required in an Update Autoexec.bat section. The section can contain as many CmdAdd, CmdDelete, and UnSet entries as needed, but only one PrefixPath, RemOldPath, and TmpDir item can be used in an .inf file.

The installer processes all CmdDelete entries before any CmdAdd entries.

CmdAdd Entry

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

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

command-name

Name of an executable file with, or without, an extension. If the file name is also defined in the [SourceDisksFiles] and [DestinationDirs] 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

String enclosed in double quotation marks or a replaceable string such as %String1% or %Myparam%, where the strings that replace %String1% and %Myparam% are defined in the [Strings] section of the .inf file. The installer appends the string to the command-name before appending the line to the end of the Autoexec.bat file. The format of this line is dependent on the command=line requirements of the given executable file.

CmdDelete Entry

CmdDelete=command-name

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

command-name

Name of an executable file without an extension.

PrefixPath Entry

PrefixPath=ldid[,ldid]...

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

ldid

Identifier that can be any of the predefined LDID values or a new value defined in the .inf file. For a definition of all the predefined LDID values, see the [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 item removes C:\Windows from the path environmental variable:

RemOldPath=10

ldid

Identifier that can be any of the predefined LDID values or a new value defined in the .inf file. For a definition of all the predefined LDID values, see the [DestinationDirs] section later in this appendix.

TmpDir Entry

TmpDir=ldid[,subdir]

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

ldid

Identifier that can be any of the predefined LDID values or a new value defined in the .inf file. For a definition of all the predefined LDID values, see the [DestinationDirs] section later in this appendix.

subdir

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 from the Autoexec.bat file that includes the given environment variable name.

env-var-name

Name of an environment variable.

[DestinationDirs]

file-list-section =ldid[, subdir ]

[DefaultDestDir=ldid[, subdir ]]

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

file-list-section

Name of a CopyFiles, RenFiles, or DelFiles entry. This name must be referred to in a Copyfiles, RenFiles, or DelFiles entry in an Install section.

Ldid

Logical disk identifier (LDID). This identifier can be one of the following 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 on a 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 of 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

Name of the directory within the directory named by LDID to be 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 a DefaultDestDir entry is not used 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 be 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]

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

Disk(s) that contain the source files for file copy and rename operations.

disk-ordinal

Unique number that identifies a source disk. If there is more than one source disk, each must have a unique ordinal.

disk-description

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

disk-label

Volume label of the source disk that is set when the source disk is formatted.

disk-serial-number

Unused. The value must be 0.

This example identifies one source disk. The disk description is given as a strings key:

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

[SourceDisksFiles]

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

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

File name

Name of the file on the source disk.

disk-number

Ordinal of the source disk that contains the file. This ordinal must be defined in the [SourceDisksNames] section, and must have a value greater than or equal to 1 (zero is not a valid disk-number parameter value).

subdir

Optional. Subdirectory on the source disk where the file resides. If subdir is not specified, the source disk root directory is the default.

file-size

Optional. 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]

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 given string and uses it for further processing. You must enclose a strings key in percent signs (%).

strings-key

Unique name consisting of letters and digits.

value

String consisting of letters, digits, or other printable characters. It should be enclosed in double quotation marks if the corresponding strings key is used in a type of item that requires double quotation marks.

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

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]

install-section-name

[install-section-name]

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

Note that the Optional Components section is ignored when you right-click an .inf file and then select 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 Setupx.dll InstallHinfSection entry-point function. When executing an .inf file by using the Setupx.dll 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 previously, and the following additional keys can be added to the Install section to create the interface in the Have Disk dialog box:

OptionDesc=option-description

Tip=tip-description

InstallDefault=0 | 1 ; Whether to install this component by default. 0=No, 1=Yes.

IconIndex=icon-index

Parent=install-section-name

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

Include=inf-file, [inf-file]

option-description

String value that is used as the component name in the list box. The value can be %String1%, where the string that replaces %String1% is defined in the Strings section of the .inf file.

tip-description

String value that is displayed in the description box when the component is selected in the list box. The value, which has a 255-character limit, can be %String1%, where the string that replaces %String1% is defined in the [Strings] section of the .inf file.

icon-index

Numeric value that determines the mini-icon that is displayed next to the component name. The following values are valid:
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

Grayed 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

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, the 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, the section name defines Install sections that are required by this component. 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 Needs, the .inf files must be specified for the Include key.

inf-file

The file name specifies .inf files that the setup program must also load into memory when it loads your .inf file, because these .inf files contain sections that must be run in addition to the Install sections in your .inf file. The section names for the Needs key specify the names of the sections you intend to run in the included .inf file(s).

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/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/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"


 

Last updated January 12, 2000
2000 Microsoft Corporation. All rights reserved. Terms of use.


Back