A.3.6.1  Common Shell and Install Section Commands

The following commands can be specified in either a shell section or an install section of a GUI INF file.

Set inserts a new variable-value string pair into the symbol table. The syntax of the command is:

set var = value

 

var

A name that can be used as a variable in the shell or install section in which it is set.

value

A string or a list. If the string contains whitespace or commas, it must be enclosed in double quotes, “x”. A list is enclosed in curly braces ({ }) with the list items separated by commas.

Set-xxx Commands

There are several Set-xxx commands that are used to manipulate string values. These include string substitution and string arithmetic commands. They are generally self-explanatory and the syntax is given below.

The Set-subst command is like the set command, except that set-subst replaces escape sequences in the value string with their byte equivalents before storing the variable and value in the symbol table. The following escape sequences are handled: (\n, \r, \t, and \###, where ### is an octal number).

The syntax of the command is:

set-subst var = value

 

The set-add, set-sub, set-mul, set-div, and set-or commands use atol to convert value1 and value2 into integer values and then perform the indicated operation. Using the ltoa function, the result is converted to a string and is assigned to var. For the set-or command, the values are treated as ULONG.

Examples:

set-add var = value1, value2      ; value1 + value2

set-sub var = value1, value2      ; value1 - value2

set-mul var = value1, value2      ; value1 * value2

set-div var = value1, value2      ; value1 / value2

set-or var = value1, value2       ; value1 | value2

 

The set-hextodec command converts value from a hexadecimal string to the equivalent decimal string. The set-dectohex command converts value from a decimal string to the equivalent hexadecimal string. Both do so before storing the variable and value in the symbol table.

Examples:

set-hextodec var = value

set-dectohex var = value

 

Cursor Manipulation Commands

The StartWait command displays the mouse hourglass cursor, and the EndWait command displays the mouse arrow cursor.

There are no arguments. The syntax is:

StartWait

EndWait

 

GetDriveInPath Command

GetDriveInPath sets the value of DriveVar to be the drive letter and colon extracted from the path string in DrivePath. For example, if DrivePath is c:\windows, the value assigned to DriveVar is c:. If DrivePath does not contain a drive, the value is an empty string.

The syntax of the command is:

GetDriveInPath DriveVar DrivePath

 

Debug_Output Command

Debug_Output writes the string SETUP:DebugMessage to the kernel debugger. The syntax of the command is:

Debug_Output DebugMessage

 

Debug output is controlled by the value of the variable, DEBUGOUTPUTCONTROL. If this variable is 1, debug messages are displayed; if it is 0, debug messages are suppressed. There are two ways to set or clear DEBUGOUTPUTCONTROL.

GUI-mode Setup is controlled by initial.inf which contains a [DebugVars] section. In this section, the var STF_DISPLAYDEBUGOUTPUT is initialized to 0 as follows:

[DebugVars]

STF_DISPLAYDEBUGCONTROL = 0

 

To display debug output, change the 0 to 1. This causes debug messages to be displayed because in the shell section of initial.inf , the value of STF_DISPLAYDEBUGCONTROL is assigned to DEBUGOUTPUTCONTROL as follows:

read-syms DebugVars

set !DebugOutputControl = $(!STF_DISPLAYDEBUGOUTPUT)

 

An acceptable and more direct method is to set DEBUGOUTPUTCONTROL directly. Setup.inf contains a statement which sets the value of DEBUGOUTPUTCONTROL.

set !G:DebugOutputControl = 0

 

Turn on debug output by modifying the statement:

set !G:DebugOutputControl = 1

 

This will cause debug output to be displayed.

In maintenance setup mode, this is the only available method since setup.inf controls maintenance mode setup (initial.inf is not used) and setup.inf does not have a [DebugVars] section.

The use of the G prefix sets the value of DEBUGOUTPUTCONTROL in the global symbol table in case setup.inf is not the top level .inf file.

For more information on using the debugger, refer to Chapter 4, Debugging Windows NT Drivers.

Split-String Command

The Split-String command has three arguments: SourceString, SeparatorsChars, and DestList. It creates a list by making a string a token using one or more delimiter characters. The items in the list include the tokens and the delimiter characters. For example, the following command line:

Split-String "\windows\system32\setup.exe" "\." DestinationList

 

sets DestinationList to the following list:

{"\","windows","\","system32","\","setup",".","exe"

 

QueryListSize Command

The QueryListSize command sets the ListSize variable to the number of items in a List variable.

The syntax of the command is:

QueryListSize ListSize List

 

AddfileToDeleteList Command

The AddfileToDeleteList command adds the name of a file to a list of files to be deleted at the next boot. The filename is stored in a file, and registry entries are set to cause a service to perform the deletion the next time the system boots.

The syntax of the command is:

AddFileToDeleteList FullPath

 

Sleep Command

The Sleep command suspends execution of the INF script for the interval specified by the parameter Millisecs. The maximum interval allowed is one minute, that is, 60000 milliseconds. This command blocks execution of the INF script, but, internally, the Setup program uses a loop to wait for the interval to elapse, while yielding periodically to handle messages. This enables the Setup program to be responsive to user interactions during the wait.

The syntax of the command is:

Sleep Millisecs

 

FlushInf Command

The FlushInf command determines whether the Setup program has parsed the INF file specified by InfFileName in advance. If so, the information is discarded. This is necessary for Setup to interpret more than one INF file with the same base filename.

The syntax of the command is:

FlushInf InfFileName