The GUI INF script language supports variables, symbols for which a value string is stored in a symbol table maintained by the Setup program. An INF script uses the $(var) syntax to access the value of the variable named var. This causes the Setup program to perform a run-time textual substitution. Variable names are compared on a case-sensitive basis.
The syntax for assigning a value string to a variable depends on the type of section. In a shell or install section, use the set command to assign a value to a variable, as in:
set Status = STATUS_SUCCESSFUL
It is important to note that Setup treats names as self-defining. This means that the assignment statement above changes the variable status to contain the string “STATUS_SUCCESSFUL”. The following are completely equivalent:
set Status = STATUS_SUCCESSFUL
set Status = "STATUS_SUCCESSFUL"
set Temporary = STATUS_SUCCESSFUL
set Status = $(Temporary)
There are a number of other “set-...” commands (such as set-subst or set-add) you can use to set or modify the value string assigned to a variable. There are also built-in commands (such as GetRegValue) that perform an operation and then assign a return value to a specified variable.
These commands cannot be used in a detect section, where you would use the following syntax when assigning a value to a variable:
key = value [? LibHandle_or_Path FunctionName [Args]*]
For example:
[SampleDetectSection]
Company = "XYZ "
Product = "WidgetMaster"
Version = 1.0
Now = "no-time" ? $(!LIBHANDLE) GetSystemDate
A shell section uses the read-syms or detect commands to read the variables and values specified in a detect section. The shell section can then use the variables as if they had been specified with a set command. For example, the following lines read the variables from the detect section shown above, and then use the variables to assign a value string to a new variable:
read-syms SampleDetectSection
set ProductDescription = $(Company)$(Product)", Version "$(Version)
; the value string assigned to the ProductDescription key is
; "XYZ WidgetMaster, Version 1.0"
The optional component of the detect section syntax enables assigning a value string returned by a DLL function. This is done using the detect command, which searches a specified detect section for lines containing the ‘?’ operator. For these lines, the DLL function is called and the returned value string is assigned to the specified variable. The detect command does not assign values to variables in lines that do not contain the ‘?’ operator. Similarly, the read-syms command always uses the value string specified in value, and ignores the DLL function. Thus, using read-syms on the SampleDetectSection shown above would cause the string “no-time” to be stored as the Now key.