Previous Next

INF Strings Section

[Strings] | [Strings.LanguageID] ...
 
strkey1= ["]some string["]
strkey2 = "     string-with-leading-or-trailing-whitespace      " |
               "very-long-multiline-string " |
               "string-with-semicolon" | "string-ending-in-backslash" |
               ""double-quoted-string-value""
...
 
 

An INF file must have at least one Strings section to define every %strkey% token specified elsewhere in that INF.

Entry Values

strkey1, strkey2, ...
Each string key in an INF file must specify a unique name consisting of letters, digits, and/or other explicitly visible characters. A % character within such a strkey token can be expressed as %%.
some string | "some string"
Specifies a string, optionally delimited with double quotation marks characters ("), that contains letters, digits, punctuation, and possibly even certain implicitly visible characters, in particular, internal space and/or tab characters. However, an unquoted string cannot contain an internal double quotation marks ("), semicolon (;), linefeed, return, or any invisible control characters, and it cannot have a backslash (\) as its final character.
"     string-with-leading-or-trailing-whitespace      " |
"very-long-multiline-string" |
"string-with-semicolon" | "string-ending-in-backslash" |
""double-quoted-string-value""
The value specified for a %strkey% token must be enclosed in double quotation marks, if it meets any of the following criteria:

To summarize, any string containing leading or trailing whitespace, that is so long it linewraps, that contains a semicolon or a final backslash character, or that is itself a quoted string, must be enclosed in a pair of double quotation marks characters ("). The system INF parser discards the outermost enclosing pair of double quotation marks characters delimiting such a string, along with any leading or trailing whitespace characters outside the double quotation marks string delimiters.

Comments

Because the system INF parser strips the outermost pair of enclosing double quotation marks from any "quoted string" defining a %strkey% token, many of the system INF files define all their %strkey% tokens as "quoted string"s to avoid the inadvertent loss of leading and trailing whitespaces during INF parsing, to ensure that particularly long string values that wrap across lines cannot be truncated, and to ensure that strings with ending backslashes cannot be concatenated to the next line in the INF file.

To create a single international INF file, an INF for NT-based installations can have a set of locale-specific Strings.LanguageID sections, as shown in the formal syntax statement. The LanguageID extension is a hexadecimal value defined as follows:

For example, a LanguageID value of 0407 represents a primary language ID of LANG_GERMAN (07) with a sublanguage ID of SUBLANG_GERMAN (01).

An INF file can contain only one [Strings] section, along with one [Strings.LanguageID] section for each LanguageID value. (Windows 9x/Me Setup does not support [Strings.LanguageID] sections.)

Depending on the current locale of a particular machine, the system setup functions process each such of these sections as follows:

  1. First, look for the .LanguageID values in the INF that match the current locale assigned to the machine. If an exact match is found, use that Strings.LanguageID INF section to translate %strkey% tokens for this installation.
  2. Otherwise, look next for a match to the LANG_XXX value with the value of SUBLANG_NEUTRAL as the SUBLANG_XXX. If such a match is found, use that INF section to translate %strkey% tokens.
  3. Otherwise, look next for a match to the LANG_XXX value and any valid SUBLANG_XXX for the same LANG_XXX family. If such a partial match is found, use that Strings.LanguageID INF section to translate %strkey% tokens.
  4. Otherwise, use the undecorated Strings section to translate %strkey% tokens for this installation.

By convention, and for convenience in creating a set of INF files for the international market, the Strings sections are the last within all system INF files. Using %strkey% tokens for all user-visible string values within an INF, and placing them in per-locale Strings sections, simplifies the translation of such strings. For additional information about locale-specific INF files, see Creating International INF Files.

Although the Strings sections are usually the last section in every INF file, any given %strkey% token defined in a Strings section can be used repeatedly elsewhere in the INF, in particular, wherever the translated value of that token is required. The system setup functions expand each %strkey% token to the specified string and then use that expanded value for further INF processing.

The use of %strkey% tokens within INF files is not restricted to user-visible string values. These tokens can be used in any manner convenient to the INF writer, as long as each token is defined within a Strings section. For example, when writing an INF file that requires the specification of several GUIDs, it might be convenient to create a %strkey% token for each GUID, using a meaningful name as a substitute for each such GUID value. Specifying a set of %strkey% = "{GUID}" values in the INF file's Strings section requires you to type each explicit GUID values only once, and it can help to provide more readable internal INF documentation than using explicit GUID values throughout the INF file.

All %strkey% tokens must be defined within the INF file in which they are referenced. Thus, for any INF file that has Include= and Needs= entries, an included INF must have its own Strings section to define all %strkey% tokens referenced in that INF.

The maximum length of any single string specified in an INF Strings section is 512 characters, including the terminating NULL. The maximum length of any concatenated string created from one or more %strkey% tokens is 4096 characters.

Examples

The following example shows a fragment of a Strings section from a system-supplied locale-specific dvd.inf for installations in English-speaking countries/regions.

[Strings]
Msft="Microsoft"
MfgToshiba="Toshiba"
Tosh404.DeviceDesc="Toshiba DVD decoder card"
; ... 

The following example illustrates string concatenation.

[OEM Windows System Component Verification]
OID = 1.3.6.1.4.1.311.10.3.7    ; WHQL OEM OID 
Notice = "%A% %B% %C% %D% %E%" 

[Strings]
A="This certificate is used to sign untested drivers that have not passed the Windows Hardware Quality Labs (WHQL) testing process."
B = "This certificate and drivers signed with this certificate are intended for use in test environments only, and are not intended for use in any other context."
C = "Vendors who distribute this certificate or drivers signed with this certificate outside a test environment may be in violation of their driver signing agreement."
D = "Vendors who have their drivers signed with this certificate do so at their own risk." 
E = "In particular, Microsoft assumes no liability for any damages that may result from the distribution of this certificate or drivers signed with this certificate outside the test environment described in a vendor's driver signing agreement."

See Also

DDInstall, DDInstall.CoInstallers, DDInstall.HW, DDInstall.Interfaces, DDInstall.Services, Manufacturer, InterfaceInstall32, Models, SourceDisksNames, Version