Appendix C - Understanding Modem.inf

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

RAS now supports modems through the Universal Modem Driver (Unimodem) and continues to support modems described in this chapter for older legacy systems. To configure a previously installed unsupported modem to work with the Remote Access Service, add an entry for that modem in the Modem.inf file.

For more information on Unimodem, see the files Mdk.doc and Reg.doc at the following location: ftp://ftp.microsoft.com/developr/drg/modem/modemdev.exe.

Modemdev.exe is a self-extracting compressed file. Run it to obtain Mdk.doc and Reg.doc.

Note The files are Windows 95 documents that are also relevant to Windows NT except for the following areas:

  • Plug and Play (PnP) 

  • Voice INF structures 

  • VoiceView support 

  • Parallel port modems

The Modem.inf File

The Modem.inf file lists all modems supported by Remote Access, along with the command and response strings each modem needs for correct operation. When you select a modem during Remote Access installation, the Setup program associates the selected modem with the specified communication port. Remote Access connection utilities read Modem.inf to obtain the command strings for the modem associated with each communication port. You can find Modem.inf in the \systemroot\system32\ras directory.

The Modem.inf** **file consists of two main parts:

  • A global [Responses] section 

  • Individual sections for each supported modem, such as [Hayes V 9600] 

Each section contains the following four components. The first three must appear in the order given. Comment lines can appear anywhere.

Component

Quantity

Section header

Only one

Configuration parameters and substitution macros

Zero or more

Commands

One or more

Comment lines

Zero or more

Responses

A command-response set consists of one command followed by zero or more responses. Responses are strings expected from the device; they can contain macros. Responses take the following form:

keyword=value_string 

The Modem.inf file contains two types of responses:

Type of response

Location

Global

In the [Responses] section

Private

Immediately following the command line that is expected to produce the response, and before the next command line

A modem can match any response. If the modem returns only carrier bps, put the expected responses in the private modem section; if the modem returns connect bps or both carrier bps and connect bps, put the expected responses in the global section. To find out which bps string(s) your modem returns, see the modem documentation.

Global Responses

Responses used by most modems are in the global [Responses] section of Modem.inf. For example:

[Responses]
LOOP=<cr><lf>RING<cr><lf>
CONNECT_V42=<cr><lf>CONNECT <connectbps> RELIABLE EC=(LAPM) \ DC=(None)<cr><lf>
ERROR=<cr><lf>ERROR<cr><lf>

The only information contained by LOOP is that another response is coming. Remote Access then waits for that response before moving on. Any response keyword beginning with LOOP or LOOP_ acts this way.

Private Responses

Specific Modem.inf sections can contain private response strings. Remote Access checks for private responses first. If it doesn't find a response string to match the actual string returned by the modem, it continues checking in the global response section. There is one exception: If the first part of a string containing an <append> macro is matched in the private section, the global section will not be searched. Instead, Remote Access waits a few seconds for the rest of the string to arrive from the modem.

For information about adding an entry to Modem.inf, see "Adding a New Modem to Modem.inf," in this appendix.

The following example shows a section with private responses. Microsoft encourages you to use this method of inserting responses for any section you add.

COMMAND_LISTEN=ATS0=1<cr>
CONNECT=<cr><lf>CONNECT <carrierbps><cr><lf>
CONNECT_EC=<cr><lf>CONNECT <carrierbps>/MNP<cr><lf>
CONNECT_EC=<cr><lf>CONNECT <carrierbps>/MNP/COMPRESSED<cr><lf>
CONNECT_EC=<cr><lf>CONNECT <carrierbps>/MNP COMPRESSED<cr><lf>
CONNECT_EC=<cr><lf>CONNECT <carrierbps>/V42<cr><lf>
CONNECT_EC=<cr><lf>CONNECT <carrierbps>/V42BIS<cr><lf>

Syntax

Modem.inf file syntax consists of two components: section headers and configuration parameters.

Section Headers

A section header is a string of up to 32* *characters between square brackets, and it occupies the first line in each section. It identifies the specific device to which the section applies. In Modem.inf, the section header typically lists the modem make and model. For example, [Hayes V 9600].

Configuration Parameters

Remote Access works with the modem through configuration parameters, which take the following form:

parameter_name=value_string 

For example:

MAXCARRIERBPS=9600
CALLBACKTIME=8

Substitution Macros

Substitution macros are placeholders that are replaced in command strings. Macros follow these rules:

  • In the Modem.inf file, macros must come before the first command and, by convention, after the configuration parameters. 

  • Macro names must be enclosed in angle brackets (< >). 

For example:

<reset>=&F
<speaker_on>=M1
<speaker_off>=M0

There are two types of macros:

Macro Type

Form

Unary

<macro_name>=value_string

Binary

<macro_name_ON>=value_string

 

<macro_name_OFF>=value_string

The command AT<reset><cr> would be sent as AT&F<cr>. Binary macro placeholders are replaced according to instructions from the user. For example, if the user disables the speaker, the command AT<speaker><cr> is sent as ATM0<cr>. If the user enables the speaker, it is sent as ATM1<cr>.

Some responses can also use macros. Most macros in response strings behave as they do in commands. However, certain macros (such as <carrierbps> and <diagnostics>) capture information such as baud rate from the device response string.

Nested macros are not allowed. Two adjacent left angle brackets are interpreted as a less than sign, and two adjacent right angle brackets are interpreted as a greater than sign. This allows greater than and less than symbols to be used in a command string when required.

The macros in the following list are reserved words: You cannot define them in Modem.inf when creating a new macro. Reserved words are case insensitive.

  • carrierbps 

  • connectbps 

  • message 

  • phonenumber 

  • cr 

  • lf 

  • match 

  • ? 

  • append 

  • hXX 

  • ignore 

Caution These macros are defined internally and can be used in Modem.inf, just as phonenumber is used in the COMMAND_DIAL= string.

For additional reserved words, see "PAD.INF Format," in Chapter 9, "X.25 PAD Support."

Table C.1 lists macros defined in the file's Modem.inf. Always enclose these macros in angle brackets (< >).

Macro

Function

speaker

Turns the modem speaker on or off.

protocol

Turns the error correction protocol on or off.

compression

Turns modem compression on or off.

hwflowcontrol

Tells the modem whether to use hardware flow control between the COM port and modem.

cr

Inserts a carriage return.

lf

Inserts a line feed.

match

Reports a match if the string enclosed in quotation marks is found in the device response. For example, <match>"Smith" matches Jane Smith and John Smith III.

?

Inserts a wildcard character, for example, CO<?><?>2 matches COOL2 or COAT2, but not COOL3.

append

Causes information to be broken into two segments and received from the modem one segment at a time. The client expects delays between the segments and waits until all the information has arrived. See the sample Modem.inf file for an example.

hXX (XX are hexadecimal digits)

Allows any hexadecimal character to appear in a string including the zero byte, <h00>.

ignore

Ignores the rest of a response from the macro on. For example, <cr><lf>CONNECTV-<ignore> reads the following responses as the same: "crlfCONNECTV-1.1" and "crlfCONNECTV-2.3."

In Table C.1, the first four macros (speaker, protocol, compression, and hwflowcontrol) are binary macros. Define them, using the speaker example (first example in this section) as a model.

As values, use them as shown in the following example:

COMMAND_INIT=AT<speaker><cr> 

This command sends ATM1<cr> to the modem if the speaker is to be turned on and ATM0<cr> if the speaker is to be turned off. Through the Remote Access Phone Book, the user determines which macros are to be on or off. The Phone Book then reads the Modem.inf file to find out which value string to send to the modem. Note that value strings sometimes differ among modems.

The Remote Access Service uses the last five macros in the Table C.1 (match, ?, append, hXX, and ignore) in response strings to recognize responses from a modem or another device.

Commands

Commands are strings of characters sent to the modem. These strings can contain macros and take the following form:

command_keyword = value_string 

The set of command keywords (or types) is as follows:

  • COMMAND_INIT 

  • COMMAND_DIAL 

  • COMMAND_LISTEN 

The Modem.inf file initializes the modem, dials a phone number, and puts the modem into answer mode with the command types COMMAND_INIT, COMMAND_DIAL, and COMMAND_LISTEN. Commands of a given type are executed in the order found in the Modem.inf file. By convention, commands of the same type are grouped together, as shown in the following example from Modem.inf:

COMMAND_INIT=AT&F&C1&D2 V1 S0=0 S2=128 S7=55 W0 S95=44<cr>
COMMAND_INIT=AT<speaker><protocol><compression><hwflowcontrol><cr>
COMMAND_LISTEN=ATS0=1<cr>
COMMAND_DIAL=ATDT<phonenumber><cr>
Multiple Command Strings

Because most modems accept strings of about 50 characters, the Remote Access Service supports multiple command strings. This allows you to break up long commands into strings the modem can accept.

For example, the first line could be rewritten as a multiple command string:

COMMAND_INIT=AT&F&C1&D2 V1 S0=0 S2=128 S7=55 W0 \ S95=44<speaker><protocol><compression><hwflowcontrol><cr>

COMMAND_INIT=AT&F&C1&D2 V1 S0=0 S2=128 S7=55 W0 S95=44<cr>
COMMAND_INIT=AT<speaker><protocol><compression><hwflowcontrol><cr>

Notice that each string

  • Is a command in its own right 

  • Begins with AT and ends with a carriage return (<cr>) 

  • Gets a response before going to the next string 

Comment Lines

Comment lines convey important information to those who maintain the .INF files. Comment lines begin with a semicolon (;), and can appear anywhere in the file. For example:

; Explanation of modem commands
; &F Reset modem to factory default settings 
; &C1 DCD tracks presence of modem carrier
; &D2 Hangup & disable autoanswer when DTR goes from ON TO OFF
Line Continuation

A backslash (\) indicates that commands or responses are continued on the next line. Line continuations can make files more legible. A double backslash (\\) denotes a backslash.

For example:

CONNECT_EC=\
<cr><lf>CARRIER <carrierbps><cr><lf><append>\
<cr><lf>PROTOCOL: V.42/LAPM<cr><lf>\
<cr><lf>COMPRESSION: NONE<cr><lf>\
<cr><lf>CONNECT <connectbps><cr><lf>

<protocol_on>=K0
<protocol_off>=K1

Assigning an Alias

If a modem's command strings are identical to those already listed for another modem, the name of the latter modem can be used as an alias for the former.

For example:

[QT Modem]
ALIAS=Codex 326X Fast

In this example, the QT modem uses command strings of a Codex 326X Fast modem.

An alias to an alias is not allowed. In other words, you cannot nest aliases. For example, to alias two modems to another modem, you must alias them directly:

[Modem 1]
;Modem 1's normal entries go here
[Modem 2]
ALIAS=Modem 1
[Modem 3]
ALIAS=Modem 1
;You cannot say ALIAS=Modem 2

Adding Modem Detection Information to Modem.inf

The command and response that enable Remote Access Setup to automatically detect modems are

  • DETECT_STRING 

  • DETECT_RESPONSE 

Insert the appropriate modem identification command after the DETECT_STRING parameter, followed by <cr>. Then insert the response expected from the modem after the DETECT_RESPONSE parameter. For example:

[DataRace RediModem V.32bis]; Command sent is ATI3<cr>, and the response is ; "PC Half-Card V.32bis/V.42bis/Fax". Actually, the modem; might return more than just the string in quotation marks,; but all that is needed to make a positive identification is; the information in quotation marks.
DETECT_STRING=ATI3<cr>DETECT_RESPONSE=PC Half-Card V.32bis/V.42bis/Fax

If several possible responses might be returned for a specific modem, then for each DETECT_STRING command, list all possible combinations of responses. For example, the following section enables Setup to detect the [Datatrek 2424AMH] modem. Setup sends the ATI9 command and expects any one of the four possible responses to be returned.

DETECT_STRING=ATI9<cr>DETECT_RESPONSE=C3DETECT_RESPONSE=C2DETECT_RESPONSE=3.DETECT_RESPONSE=2. 

If multiple commands are required to make a positive identification, list all the required commands and their corresponding responses. For example, the following section enables Setup to detect the [Intel 9600EX] modem. Setup expects specific responses for both the ATI0 and ATI3 commands in order to make a unique identification.

DETECT_STRING=ATI0<cr>DETECT_RESPONSE=969DETECT_STRING=ATI3<cr>DETECT_RESPONSE=U21 

Adding a New Modem to Modem.inf

If you use a modem that is not explicitly supported in Modem.inf, you can append a new section containing the command strings the modem requires. The name of the section should be the name of your modem and should be enclosed in brackets. For information about macros used in building a new section, see "Substitution Macros," in this appendix.

Note To minimize the risk of corrupting existing modem sections, be sure to add new sections to the end of the Modem.inf file.

To edit Modem.inf for a new modem 

  1. Back up your existing Modem.inf file. 

  2. Copy an existing section to the end of Modem.inf and rename the section header of the copy to the name of your modem. For information about section headers, see "Section Headers," in this appendix. 

  3. Change MAXCONNECTBPS and MAXCARRIERBPS to the values of the new modem, and set values for CALLBACKTIME and DEFAULTOFF. For example: 

    MAXCARRIERBPS=9600
    

MAXCONNECTBPS=19200 CALLBACKTIME=10 DEFAULTOFF=speaker compression</pre>

<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="header">
<th><p>Configuration parameter</p></th>
<th><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><p><strong>MAXCARRIERBPS</strong> </p></td>
<td><p>The maximum speed at which the client's modem and the Remote Access server's modem exchange data (bps rate on the telephone line). This speed is always equal to or less than <strong>MAXCONNECTBPS</strong>. </p></td>
</tr>
<tr class="even">
<td><p><strong>MAXCONNECTBPS</strong> </p></td>
<td><p>The maximum speed at which a modem talks to the computer (DTE to DCE bps transfer rate). Set this value to the maximum serial port bps that the modem can support. </p></td>
</tr>
<tr class="odd">
<td><p><strong>CALLBACKTIME</strong> </p></td>
<td><p>The time in seconds that the server waits before calling the client back. This delay allows the client's modem to reset itself. Start with 10 seconds, and increase this number if there are problems. </p></td>
</tr>
<tr class="even">
<td><p><strong>DEFAULTOFF</strong> </p></td>
<td><p>A list of all the on/off macros that you want set to off by default, until turned on by Rasphone.exe. </p></td>
</tr>
</tbody>
</table>
  1. Change the command strings for hwflowcontrol, protocol (error control), compression, and speaker. Check your modem's documentation for the correct values. 

    For example: 

    <hwflowcontrol_off>=&K0
    

<hwflowcontrol_on>=&K3 <protocol_off>=&Q0 S36=1 <protocol_on>=&Q5 S36=5 S46=138 <compression_off>=*DC0 <compression_on>=*DC1 <speaker_on>=M1 <speaker_off>=M0

**Note** If you don't find values for these commands in your modem's documentation, contact the modem manufacturer. If a modem does not support these features, omit these macros from Modem.inf. (If you omit a macro definition in step 4, be sure to also omit the same macro in the COMMAND\_INIT string in step 5.)
  1. And finally, change the commands in the following example. Again, check your modem's documentation for the correct values. 

    COMMAND_INIT=AT&F&C1&D2 v1 s0=0 s2=128 s7=55 w1<cr>
    

COMMAND_INIT=AT<hwflowcontrol><protocol><compression><speaker><cr> COMMAND_LISTEN=ATS0=1<cr> COMMAND_DIAL=ATDT<phonenumber><cr>

Command

Description

COMMAND_INIT

Initializes the modem

COMMAND_LISTEN

Sets the modem to autoanswer mode. Check your modem's documentation for the value that makes the modem answer after the first ring. Insert this value for Remote Access servers and clients configured for callback.

COMMAND_DIAL

Dials the phone number and connects. Do not enter an actual phone number here. Enter <phonenumber>, as shown in the example.

The following table lists the modes to which you should initialize your modem. The codes in the left column show examples of each mode. Codes like these form the COMMAND_INIT string. For the codes used by your modem, consult the modem's documentation.

Code

Meaning

&F

Restores factory settings

&C1

Causes data carrier detect (DCD) to track the presence of a data carrier

&D2

Hangs up and disables autoanswer when the data terminal ready (DTR) signal goes from on to off (high to low)

V1

Allows verbose (English words) return codes

L1

Lowers the speaker volume

Q0

Lets the modem return result codes

E1

Enables character echo in the command state

S0

Answers on a certain ring number: S0=0 for COMMAND_INIT, S0=1 for COMMAND_LISTEN

S2=128

Disables the escape character

S7=55

Sets the carrier waiting time (to about 55 seconds)

W1

Enables negotiation progress messages

S95=44

Allows carrier, protocol, and compression messages

By being meticulous when you create a new modem section, you can reduce the need for debugging later. Microsoft also recommends that you document your work: Doing so allows others to quickly understand the entries and helps you remember your programming rationale. Be sure to type a semicolon (;) at the beginning of each comment line.

Important If you edit Modem.inf and your new modem does not work, restore the original version of the file and use one of the modems listed in the Hardware Compatibility List.

Cc751485.spacer(en-us,TechNet.10).gif