Setup Information File(INF) Definition
Overview
Creating Folders and Links in folders
Creating and Deleting Long File Names
Setting Attributes on Files and Folders
Copying files to the Program Files folder
Launching Applications via "Runonce" entries
Providing Uninstall for .INF scripts
Extensions and Sections only valid during Windows 95 Setup
Limitations of .INF files
Example INF File
Overview
A basic INF file will have the following
sections (more complex .INF files will have additional sections).
Bold section names are actual keywords. Italicized section names
are arbitrary names created by the .INF author:
| [Version]
| Basic version information for validating the .INF file
|
| [DefaultInstall]
| Installation section that is executed by default. Has pointers to other sections specifying files to copy & delete, registry updates, .ini file updates, etc.
|
| [OtherInstall]
| Uses same format as [DefaultInstall] section, but must be explicitly called. Useful for defining how a component should be uninstalled.
|
| [DestinationDirs]
| Specifies the location on the hard drive where a section's files will be copied, deleted or renamed (i.e. Windows dir, Windows\System dir, etc.)
|
| [FileCopy/Delete/RenameSection(s)]
| Lists files to be copied, deleted or renamed.
[RegistryUpdateSection(s)]
|
| [RegistryUpdateSection(s)]
| Specifies registry additions or deletions.
[IniFileUpdateSection(s)]
|
| [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 used above.
|
Return to Top of File
[Version]
Signature="$Chicago$"
LayoutFile=filename.inf
Defines the standard header for all
Windows 95 INF files. Note that if the signature is not $Chicago$
then Windows 95 will not accept the INF file as an INF file for
any of the classes of devices recognized by Windows 95.
Note the signature string recognition
is case-insensitive. So, for example, you can use either $Chicago$
or $CHICAGO$.
filename.inf
Names the INF file that contains the
layout information (source disks and files) required to install
this component. This line is optional. If not given, the SourceDisksNames
and SourceDisksFiles
sections must be given in this INF.
This example shows a typical Version
section:
[Version]
Signature="$CHICAGO$"
Return to Top of File
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
Identifies the additional sections in
the INF file that contain installation information for the component.
Not all the types of items shown in
the syntax above are needed or required in an Install
section. If an item type is used, it must specify the name
of a section in the INF file. (An exception to this is the CopyFiles
item, which may use the "@" character along with a filename
to copy a single file without specifying a section name.) The
section name must consist of printable characters.
Only one of each type of item can be
used in any one Install
section. More than one section name can be listed in an item,
but each additional name must be preceded with a comma.
install-section-name
Naming the install section [DefaultInstall]
will cause the install section to be executed when the "Install"
verb is selected when the .INF file is right-clicked. It is also
the section that is executed when selecting an .INF file as the
setup option using the Cabpack wizard.
This example shows a typical Install
section. It contains Copyfiles
and AddReg items
that identify the sections containing information about which
files to install.
[MyApplication]
Copyfiles=MyAppWinFiles, MyAppSysFiles, @SRSutil.exe
AddReg=MyAppRegEntries
Note that in the above example, by renaming
the [MyApplication] section to [DefaultInstall],
this Install section would be executed when the "Install"
verb is selected when right-clicking the .INF file.
The CopyFiles
item provides a special notation which will allow a single
file to be copied directly from the copy line. An individual file
can be copied by prefixing the file name with an @ symbol. The
destination for any file copied using this notation will be the
DefaultDestDir as defined in the DestinationDirs
section. The following example shows how to copy individual
files:
CopyFiles=FileSection1,@myfile.txt,@anotherfile.txt,LastSectionName
Return to Top of File
[CopyFiles-section-name]
destination-file-name[, source-file-name][,
temporary-file-name][,flag]
[destination-file-name[, source-file-name][,
temporary-file-name]][,flag]
.
.
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 item of the Install
section itself, without building a CopyFiles section. To
do this, use the special character "@" to force a single
file copy. An example of using the "@" character in
a CopyFiles-type item is in the Install section reference
topic. Copying a single file in this way is somewhat limited because
the source and destination filenames 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 filename is given, this is also the name of the source
file.
source-file-name
Name of the source file. If the source
and destination filenames for the file copy operation are the
same, this 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 which
is currently open or in use by Windows.
flag
Optional parameter 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:
| 1 | On CopyFiles: Warn if user tries to skip file.
|
| 1 | On DelFiles: If file is in use, queue up delayed delete in wininit.ini. Otherwise an in-use file will not be deleted.
|
| 2 | Setup Critical: don't allow user to skip file.
|
| 4 | Ignore version check and always copy file. This will overwrite a newer file.
|
| 8 | Force Rename (trick engine into thinking that file is in use). Only happens if file already exists on target.
|
| 16 | If file already exists on target, don't copy.
|
| 32 | Suppress version conflict dialog and don't overwrite newer files.
|
This example copies three files:
[CopyTheseFilesSec]
file11 ; copies file11
file21, file22, file23 ; copies file22, temporarily naming
it file23
file31, file32 ; copies file32 to file31
All the source filenames used in this
example must be defined in a SourceDisksFiles
section and the logical disk numbers that appear in the SourceDisksFiles
section must have been defined in a SourceDisksNames
section. As an alternative, you can use a LAYOUT.INF file to supply
this information.
Return to Top of File
[rename-files-section-name]
new-file-name, old-file-name
.
.
Lists the names of files to be renamed.
The name of the section must appear in a Renfiles item
in an Install section of
the INF file.
new-file-name
New name of the file.
old-file-name
Old name of the file.
This example renames the files file42
to file41, file52 to file51, and file62 to file61:
[RenameOldFilesSec]
file41, file42
file51, file52
file61, file62
All the old filenames used in this example
(file42, file52, and file62) must be defined in a SourceDisksFiles
section and the logical disk numbers that appear in the SourceDisksFiles
section must have been defined in a SourceDisksNames
section.
Return to Top of File
[file-list-section]
file-name[,,,flag]
.
.
A DelFiles section lists the
names of files to be deleted. The file-list-section name
must appear in the Delfiles item of an Install
section.
file-name
Identifies a file to be deleted.
flag
Optional parameter used to force Windows
95 to delete the file named in the item if it is in use during
the installation process. Set the flag parameter value
to 1 to cause Windows 95 to queue the file deletion operation
until the system has restarted. If a file marked with the flag=1
parameter setting cannot be deleted because it is in use, a system
restart will occur after the device installation is complete.
If you do not use the flag parameter
value equal to 1 along with a file-name parameter, then
if that file is in use when the DelFiles section is executed
that file will not be deleted from the system.
This example deletes three files:
[DeleteOldFilesSec]
file1
file2
file3
Return to Top of File
[update-ini-section-name]
ini-file, ini-section, [old-ini-entry],
[new-ini-entry], [flags]
.
.
Replaces, deletes, or adds complete
entries in the given INI file. The section name, update-ini-section-name,
must appear in the UpdateInis item in an 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
filename, see the comments below.
ini-section
Name of the section containing the entry
to change.
old-ini-entry
Optional. Usually in the form Key=Value.
new-ini-entry
Optional. Usually in the form Key=Value.
Either the key or value may specify replaceable strings. For example,
either the key or value specified in the new-ini-entry
parameter may be %String1%, where the string that replaces %String1%
is defined in the Strings
section of the INF file.
flags
Optional action flags. Can be one of
these values:
| 0 | Default. If old-ini-entry key is present in an INI file entry, that entry is replaced with new-ini-entry. Note that only the keys of the old-ini-entry parameter 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 the old-ini-entry parameter and the INF file entry must match on both 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 the old-ini-entry parameter does not exist in the INI file, then no operation is performed on the INI file.
If the key in the old-ini-entry parameter exists in an INI file entry and the key in the new-ini-entry parameter exists in an INI file entry, then the INI file entry that matches the key in the new-ini-entry parameter is deleted and the INI file entry that matches the old-ini-entry parameter is operated on in the following way: the key of the INI file entry is replaced with the key in the new-ini-entry parameter.
If the key in the old-ini-entry parameter exists in an INI file entry and the key in the new-ini-entry parameter does not exist in an INI file entry, then an entry is added to the INI file made up of the key in the new-ini-entry parameter and the old value.
Note that the match of the old-ini-entry parameter and an INI file entry is based on key alone, not key and value.
|
| 3 | Same as flag parameter value of 2 described above, except match of the old-ini-entry parameter and an entry in the INF file is based on matching both key and value, not just the key.
|
The wild card character (*) can be used
in specifying the key and value and they 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 filename.
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 may be replaced with C:\. However, in your INF file
you can either use the backslash character or not. For example,
either "%30%boot.ini" and "%30%\boot.ini"
can be used to reference BOOT.INI in the root of the boot drive.
The following examples illustrate individual
items in an Update INI File 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 items in an Update
INI File-type section of an INF file work together to operate
on the Boot section of SYSTEM.INI. The conditionality built into
the flags parameter of the INF file items 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 INF file entries
shown below are executed, there will be one "comm.drv="
entry in the Boot section of the INI file: "comm.drv=*vcoscomm.drv"
or "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
Return to Top of File
[update-inifields-section-name]
ini-file, ini-section, profile-name,
[old-field], [new-field],[flags]
.
.
Replaces, adds, and deletes fields in
the value of a given INI entry. Unlike the Update INI File section
type, 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 item in an 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
filename, see the topic that describes the Update INI File section
type.
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
Specifies whether to treat the old-field
and new-field parameters as if they have a wild card character
or not and/or what separator character to use when appending a
new field to an INI file entry. Can be any of these values:
| Value
| Meaning
|
| 0 | (Default) Treat "*" character literally when matching fields, and not as a wild card character. Use blank (" ") as a separator when adding a new field to an entry.
|
| 1 | Treat "*" character as a wild card character when matching fields. Use blank (" ") as a separator when adding a new field to an entry.
|
| 2 | Treat "*" character literally when matching fields, and not as a wild card character. Use comma (",") as a separator when adding a new field to an entry.
|
| 3 | Treat "*" character as a wild card character when matching fields. Use comma (",") as a separator when adding a new field to an entry.
|
Any comments in the INI file line are
removed as they might not be applicable after changes. When looking
for fields in the line in the INI file, 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.
Return to Top of File
[add-registry-section]
reg-root-string, [subkey], [value-name],
[flag], [value]
[reg-root-string, [subkey], [value-name],
[flag], [value]]
.
.
Adds subkeys or value names to the registry,
optionally setting the value. The add-registry-section
name must appear in an AddReg-type item in an Install
section.
reg-root-string
Registry root name. Can be one of these
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
Optional. Identifies the subkey to set.
Has the form key1\key2\key3.... This parameter 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. Identifies the value name
for the subkey. For string type, if the value-name
parameter is left empty, the value of the subkey specified in
the subkey parameter is set to a NULL string. Note that
the value-name parameter 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. Determines both the value
type and whether the registry key is replaced if it already exists.
| Value
| Meaning
|
| 0 | (Default) Value is an ANSI string. Replace key if it exists.
|
| 1 | Value is a hexadecimal number. Replace key if it exists.
|
| 2 | Value is an ANSI string. Do not replace key if it exists.
|
| 3 | Value is a hexadecimal number. Do not replace key if it exists.
|
value
Optional. Value to set. 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. The 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 thus at least one comma is required when using
this form.
The two items in the example AddReg-type
section below add two value names to the registry. Note that %25%
will be expanded to the machine's Windows directory.
[MyAppRegEntries]
HKLM,Software\MyApp,ProgramName,,"My Application"
HKLM,Software\MyApp,"Program Location",,"%25%\MyApp.exe"
Return to Top of File
[del-registry-section]
reg-root-string, subkey, [value-name]
[reg-root-string, subkey, [value-name]]
.
.
Deletes a subkey or value name from
the registry. The del-registry-section name must appear
in an DelReg item in an Install
section.
reg-root-string
Registry root name. Can be one of these
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
Identifies the subkey to delete. Has
the form key1\key2\key3... This parameter 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. Identifies the value name
for the subkey. Note that the value-name parameter
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-to-registry-section]
ini-file, ini-section, [ini-key],
reg-root-string, subkey[,flags]
.
.
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 item in an 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 filename,
see the comments in the Reference topic about the Update Ini File
Section.
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. Can be one of these
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
Identifies the subkey to receive the
value. Has the form key1\key2\key3...
flags
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. Can
be one of these 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, suppose the following entry
exists in the WIN.INI file:
[Windows]
CursorBlinkRate=15
If a CursorBlinkRate subkey does not
exist under the Control Panel\Desktop, then the following item
in an Ini File to Registry 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-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
Provides commands to add, delete, or
rename commands in the CONFIG.SYS file. The section name, update-config-section-name,
must appear in the UpdateConfigSys item in an Install
section of the INF file.
Not all item types shown in the syntax
above are needed or required. An Update Config.sys section may
contain as many DevRename, DevDelete, DevAddDev,
DelKey, and RemKey items as needed, but the Buffers,
Files, and Stacks items may only be used once in
a section. When processing an Update Config.sys section, the Installer
processes all DevRenames items first, all DevDelete
items second, and all DevAddDev items last. The syntax
and meaning of each of the types of items that can be used in
an Update Config.sys section are given later in this topic.
Buffers Item
Buffers=legal-dos-buffer-value
Sets the number of file buffers. As
it does with the Stacks item, 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
A legal MS-DOS buffers value.
DelKey Item
DelKey=key
Causes the CONFIG.SYS command with the
specified key to be remarked out in the CONFIG.SYS file. For example,
the INF file item
DelKey=Break
would cause a Break=on command to be
remarked out in the CONFIG.SYS file.
The DelKey item has the same
effect as the RemKey item. There can be multiple DelKey
and/or RemKey items in a section of the INF file.
key
The key of the CONFIG.SYS command to
be remarked out.
DevAddDev Item
DevAddDev=driver-name,configkeyword[,flag][,param-string]
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 filename extension, ensuring
that it is .SYS or .EXE.
configkeyword
Command name. 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 flag is not given, 0 is used by default.
param-string
Optional command parameters. Must be
valid for the given device driver or executable file.
DevDelete Item
DevDelete=device-driver-name
Deletes any line containing the specified
filename 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 MS-DOS does not permit implicit
filename extensions in CONFIG.SYS, each device-driver-name
must explicitly specify the filename extension.
This example DevDelete item in
an Update Config.sys section deletes lines 1 and 3 but not line
2 of the example CONFIG.SYS file:
DevDelete=Foo.sys
;; lines in CONFIG.SYS
Device=Foo.sys ;; line #1
Install=foo.exe ;; line #2
Device=Foo.sys /d:b800 /I:3 ;; line #3
DevRename Item
DevRename=current-dev-name,new-dev-name
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.
new-dev-name
New name for driver or executable file.
Files Item
Files=legal-dos-files-value
Sets the maximum number of open files
in the CONFIG.SYS file. As it does with the Stacks item,
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
A legal MS-DOS files value.
PrefixPath Item
PrefixPath=ldid[,ldid]...
Appends the path associated with the
given LDID to the path command.
ldid
Can be any of the predefined LDID values
or a new value defined in the INF. For a definition of all the
predefined LDID values, see the "Reference" topic about
the DestinationDirs
section.
RemKey Item
RemKey=key
Causes the CONFIG.SYS command with the
specified key to be remarked out in the CONFIG.SYS file. For example,
the INF file item
RemKey=Break
would cause a Break=on command to be
remarked out in the CONFIG.SYS file.
The RemKey item has the same
effect as the DelKey item. There can be multiple RemKey
and/or DelKey items in a section of the INF file.
key
The key of the CONFIG.SYS command to
be remarked out.
Stacks Item
Stacks=dos-stacks-values
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. For example, if CONFIG.SYS contains stacks=9,218
and an INF contains stacks=5,256, the installer sets to new value
to stacks=9,256.
legal-dos-stacks-value
A legal MS-DOS stacks value.
Return to Top of File
[update-autoexec-section]
CmdAdd=command-name[,command-parameters]
CmdDelete=command-name
PrefixPath=ldid[,ldid]
RemOldPath=ldid[,ldid]
TmpDir=ldid[,subdir]
UnSet=env-var-name
Provides commands to manipulate lines
in the AUTOEXEC.BAT file. The section name, update-autoexec-section-name,
must appear in the UpdateAutoBat item in an Install
section of the INF file.
Not all item types shown in the syntax
above are needed or required in an Update Autoexec.bat section.
The section can contain as many CmdAdd, CmdDelete
and UnSet
items as needed, but only one PrefixPath,
RemOldPath and TmpDir items can be used in an INF
file. The syntax and meaning of each of the item types is described
later in this topic.
The installer processes all CmdDelete
items before any CmdAdd items.
CmdAdd
Item
CmdAdd=command-name[,"command-parameters"]
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 filename is also defined in the SourceDisksFiles
and DestinationDirs
sections of the INF file, the installer adds the appropriate path
to the filename before writing it to the AUTOEXEC.BAT file.
command-parameters
A string enclosed in double quotation
marks or a replaceable string like %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 Item
CmdDelete=command-name
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 filename
extension of .EXE, .COM, and .BAT.
command-name
Name of an executable file without an
extension.
PrefixPath
Item
PrefixPath=ldid[,ldid]...
Appends the path associated with the
given LDID to the path command.
ldid
Can be any of the predefined LDID values
or a new value defined in the INF. For a definition of all the
predefined LDID values, see the "Reference" topic about
the DestinationDirs
section.
RemOldPath Item
RemOldPath=ldid[,ldid]
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
Can be any of the predefined LDID values
or a new value defined in the INF. For a definition of all the
predefined LDID values, see the "Reference" topic about
the DestinationDirs
section.
TmpDir Item
TmpDir=ldid[,subdir]
Creates a temporary directory within
the directory given by the LDID, if it does not already exist.
ldid
Can be any of the predefined LDID values
or a new value defined in the INF. For a definition of all the
predefined LDID values, see the "Reference" topic about
the DestinationDirs
section.
subdir
A path name. If ldid\subdir does not
already exist, it is created.
UnSet Item
UnSet=env-var-name
Removes any set command from
the AUTOEXEC.BAT file that includes the given environment variable
name.
env-var-name
Name of an environment variable.
Return to Top of File
[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
sections. Optionally, a default destination directory may be specified
for any CopyFiles, RenFiles,
or DelFiles sections in
the INF file that are not explicitly named in the DestinationDirs
section.
file-list-section
Name of a CopyFiles,
RenFiles, or DelFiles
section. This name must be referred to in a Copyfiles,
RenFiles, or DelFiles
item in an Install section.
ldid
A logical disk identifier (LDID). Can
be one of these values:
| 00 | Null LDID. This LDID can be used to create a new LDID
|
| 01 | Source Drive:\pathname
|
| 10 | Machine 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 | Guarenteed 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 item
provides a default destination for any CopyFiles
items that use the direct copy (@filename) notation or any CopyFiles,
RenFiles, or DelFiles
sections not specified in the DestinationDirs
section. If a DefaultDestDir is not used in a DestinationDirs
section, then the default directory is set to LDID_WIN.
This example sets the destination directory
for the MoveMiniPort section to WINDOWS\IOSUBSYS and sets the
default directory for other sections to be the BIN directory on
the boot drive:
[DestinationDirs]
MoveMiniPort=12 ; Destination for MoveMiniPort
Section is
; windows\iosubsys
DefaultDestDirs=30,bin ; Direct copies go to
Boot:\bin
Return to Top of File
[SourceDisksNames]
disk-ordinal="disk-description",disk-label,disk-serial-number
.
.
Identifies and names the disk(s) that
contain the source files for file copying and renaming operations.
disk-ordinal
A unique number that identifies a source
disk. If there is more than one source disk, each must have a
unique ordinal.
disk-description
A string or a 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. 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"
Return to Top of File
SourceDisksFiles
Section
[SourceDisksFiles]
filename=disk-number[,subdir]
[,file-size]
.
.
Names the source files
used during installation and identifies the source disks that
contain the files.
filename
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 parameter
that specifies the subdirectory on the source disk where the file
resides. If this parameter is not used, the source disk root directory
is the default.
file-size
Optional parameter
that specifies the size of the file, in Bytes.
This example SourceDisksFiles
section identifies a single source file, SRS01.386, on the disk
having ordinal 1:
[SourceDisksFiles]
SRS01.386 = 1
Return to Top of File
[Strings]
strings-key=value
.
.
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 files, a string key defined in this section may be
used anywhere in the INF file that the corresponding string would
be used. The Installer expands the string key to the given string
and uses it for further processing. Using a strings key requires
that it be enclosed in percent signs (%).
strings-key
A unique name consisting of letters
and digits.
value
A 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 at 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"
Return to Top of File
[Optional Components]
install-section-name
[install-section-name]
.
.
Lists Install
sections that are displayed when the user selects the .INF
file from the "Have Disk
" button in the Windows
Setup tab in the Add-Remove Programs control panel. The Install
sections show up as choices in the list of check-boxes.
Note that the Optional Comonents
section is ignored execting an .INF file by right-clicking on
the .INF file and selecting the "install" verb. When
executing an .INF file in this manner, the [DefaultInstall]
section is executed. The Optional Components section is also
ignored if the .INF file is being executed via the SETUPX.DLL
InstallHinfSection entry point. When executing an .INF via the
SETUPX entry point, the Install
section specified in parameter to 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 drive the UI in the "Have Disk" dialog:
OptionDesc=option-description
Tip=tip-description
InstallDefault=0
| 1 ; Whether to install this component by default. 1=Yes,
0=No.
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 option-description parameter
may 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 tip-description parameter has a 255 character
limit, and may 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. Valid values are:
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 Un-checked box
14 Printer
15 Net Card
16 Same as 0
17 Same as 0 w/ a sharing hand underneath
18 Unknown (question mark)
19 Atwork
20 Greyed Check box
21 Dial up networking
22 Direct cable connection
23 Briefcase
24 Exchange
25 Partial check
26 Accessories Group
27 Multimedia Group
28 Quick View
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
Parent
The list box displayed in the optional
components UI can can sub-levels. If the optional component is
a child, the Parent= keyword defines the Install
section that is the Parent.
Needs
If this component has dependencies on
other components, this 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) desribed in the Install
section(s) listed on the Needs= line.
Note that the Install
sections listed on the Needs= line must be in the same
.INF file. However, if dependent components from other .INF are
listed in the Needs= line, the .INF files must be specified
on the Include= line.
Include
The Include item enables you to specify
INF files that Setup 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
Needs item specifies the names of the sections you intend to run
in the included INF file(s).
The following example defines two optional
component install sections, and each install section uses the
additional entries to specify UI elements and dependencies:
[Optional Components]
InstallMyToys
InstallGames
[InstallMyToys]
OptionDesc=%Toys_DESC%
Tip=%Toys_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 montitor"
Return to Top of File
Creating a folder in the Programs Folder
or creating links in a folder is done by the shell after a component
is installed. It looks in the SETUP.INI file for a [progman.groups]
section and then parses it to create folders and links in those
folders.
If you are installing a component that
will require a folder or links in the Programs Folder, create
an UpdateInis section
that will create the proper entries in SETUP.INI. SETUP.INI follows
the following syntax to create folders and links. Note that folders
are relative to the Start Menu.
[progman.groups]
folder_1=Folder_1_Name
folder_2=Folder_2_Name
:
folder_n=Folder_n_Name
[folder_1]
Link-Name, .EXE-name, Icon-file-name,
Icon-index, profile
If the profile field is left
NULL, the link will always be added to the folder.
NOTE: If .EXE-name is NULL item
will be deleted from the group if it exists
there.
NOTE: If a Folder or Link has a space
in it's description,
you will need to use a double-quote
to get this to show up in setup.ini.
See examples below.
Example: Games
[Optional Components]
games
[games]
OptionDesc= %GAMES_DESC%
CopyFiles= wingames.files
UpdateInis= wingames.links
[wingames.files]
cards.dll
freecell.exe
freecell.hlp
mshearts.exe
mshearts.hlp
sol.exe
sol.hlp
winmine.exe
winmine.hlp
[wingames.links]
setup.ini, progman.groups,, "gamesfolder=%GAMES_DESC%"
;creates folder
setup.ini, gamesfolder,, """Solitaire
Game"",SOL.EXE,,," ;creates link
setup.ini, gamesfolder,, "Minesweeper,WINMINE.EXE,,,"
;creates link
setup.ini, gamesfolder,, ""Hearts Card
Game"",MSHEARTS.EXE,,,";creates link
setup.ini, gamesfolder,, "FreeCell,FREECELL.EXE,,,"
;creates link
Result: entry
will for "Games" will appear in the "Optional Components
Dialog" in Setup, and if selected, a "Games" folder
in the Programs Folder will be created with links to Solitaire,
Minesweeper, Hearts and FreeCell:
Return to Top of File
The setup engine in Windows 95 is a
16-bit .DLL (since Windows 95 Setup it must run under Windows
3.x). Because of this, the engine can only copy files with 8.3
filenames. In order to create and delete long file names, the setup engine
runs a 32-bit application when it exits that will rename and 8.3 short
filenames to long file names, and delete files with long file names. The 32-bit application gets its
instructions from predefined keys in the registry.
The root branch of the registry for
rename operations is the following:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RenameFiles
The root branch of the registry for
delete operations is the following:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\DeleteFiles
Each group of rename and delete operations are added
to a subkey under each branch. Each group of operations is limited
to renaming or deleting files in a single subdirectory. A minimum of two entries
must be made in each subkey to affect a rename or delete: first, the directory
path for the files to be renamed or deleted; second, the actual rename or delete operation.
The first key in each group of operations
is the directory entry. Each entry for a rename operation in the
related directory is an entry of the form "old_short_name"="new_long_name,[attrib_flag]".
The optional attrib_flag is used to set file attributes
during the rename operation. The flag is composed of the following values.
| 1 | READONLY |
| 2 | HIDDEN |
| 3 | SYSTEM |
To set multiple attributes on a file or folder,
the flags are added together, i.e. to set the
READONLY and HIDDEN attributes, attrib_flag would be 3
The following example is an
AddReg section that sets the SYSTEM and HIDDEN attributes
on the \Windows\System\Foo directory:
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Sys,,,%11%
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Sys,FOO,,"FOO,6"
Note: you should use all CAPS to ensure that the name stays a short file name.
Each entry for a delete operation in the
related directory is an entry of the form "arbitrary_key_name"="long_name_to_delete".
The following example is an AddReg
section that will cause the Oldname.txt to be renamed to New Long Name.txt
in the C:\Samples directory, and myreadme.txt to be renamed to
My Application Readme.txt in the Windows directory:
[MyAppShort2Long]
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Samples,,,C:\Samples
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Samples,oldname.txt,,"New
Long Name.txt"
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Win,,,%25%
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Win,myreadme.txt,,"My App Readme.txt"
The following example is an AddReg
section that will cause New Long Name.txt to be deleted from the
C:\Samples directory, and
My Application Readme.txt to be deleted from the Windows directory:
[MyAppDelLong]
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Samples,,,C:\Samples
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Samples,oldname.txt,,"New
Long Name.txt"
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Win,,,%25%
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Win,myreadme.txt,,"My App Readme.txt"
After these renames and deletes have been processed,
the entries are removed from the registry.
Note: during the rename operation, the
destination file is deleted before performing the rename. If the
same rename operation is queued twice, it could result in a loss
of the file. For example, suppose there is a bitmap that needs
to be renamed, from Picture.bmp to "Really Cool 3D Picture.bmp."
The second time such a rename operation is performed, "Really Cool 3D Picture.bmp"
already exists, so it is deleted before performing the rename
opreation. The exception to this rule is when the existing destination
filename is a directory.
Return to Top of File
To set the attributes on a file or folder, you use the same convention to create long file names,
using an optional flag.
See the Creating and Deleting Long File Names
Section for details.
Return to Top of File
Since all of the copies done by the
Windows 95 setup engine are done as 16-bit operations, only 8.3
short filenames can be used. To access the Program Files folder,
you will need to use the 8.3 equivalent, "24,PROGRA`1",
in the [DestinationDirs]
section (LDID 24 is the Root of drive containing the Windows directory)
.Similarly,
the short file name equivalent must be used to access any folders
with long file names that are below the Program Files Directory.
The example below copies three files
to the Program Files\Accessories folder, and creates links to
one of the files:
[WordPadInstall]
CopyFiles = WordPadCopyFiles
UpdateInis = WordPadInis
[DestinationDirs]
WordPadCopyFiles = 24,%PROGRAMF%\%ACCESSOR%
[WordPadCopyFiles]
mswd6_32.wpc
wordpad.exe
write32.wpc
[WordPadInis]
setup.ini, progman.groups,, "group4=%APPS_DESC%"
;creates Accessories folder (if not already there)
setup.ini, group4,, """%WORDPAD_LINK%"",
""%24%\%PROGRAMF%\%ACCESSOR%\WORDPAD.EXE"""
;creates link in Accessories folder
[Strings]
APPS_DESC = "Accessories"
WORDPAD_LINK = "WordPad"
; Directory names - note that that short versions
must match the truncated
; 8 char names for the long versions, or else
there will be problems.
PROGRAMF = "Progra~1" ; first 6 chars
of Program_Files, + "~1"
ACCESSOR = "Access~1" ; first 6 chars
of Accessories, + "~1"
Return to Top of File
- Directories cannot be deleted.
- Files cannot be moved to a different
(RenFiles only renames
a file in-place)
- Copies of a file cannot be made
(CopyFiles only copies
files from the source disk to the destination directory)
Return to Top of File