Networking FreeDOS - NDIS driver
installation
Overview
(Picture: Overview of the NDIS architecture)
Drivers based on the "Network Driver Interface Specification" (NDIS)
are the default in the Windows world. The most recent version is NDIS
6 which is used in Windows Vista. Windows 98 used NDIS 5, Windows 95
came with NDIS 3.1. In DOS you have to use the real-mode driver NDIS2.
Where to find them
It is most likely a NDIS driver exists for your network card. Look for
a directory called "NDIS2" in your cards installation files. If you
can't find a driver, take a look at this site (see: http://
drivesnapshot.de/en/makebootdisk.htm (*01)). The ending of the driver
name has to be *.DOS, so for instance the driver of the 3Com 3C574
PC-Card is called "EL3C574.DOS".
How they work
In the language of the NDIS architecture these drivers are called
"Media Access Control" (MAC) drivers.
The MAC driver is only one component of the NDIS architecture as you
can see in the figure above. According to the NDIS 2.1 documentation
(see: http://www.ndis.com/faq/ndis201.txt (*02)) NDIS seems to work
like that:
* Commands in FDCONFIG.SYS (FreeDOS) or CONFIG.SYS (other DOS) load
the Protocol Manager driver PROTMAN.DOS, the MAC driver and the
protocol driver. This can be done by lines for each of these drivers
or by starting the "Installable File System Helper" driver, which
is loaded by "DEVICEHIGH=IFSHLP.SYS" and starts the Protocol
Manager, the MAC and the protocol drivers according to
PROTOCOL.INI.
* The Protocol Manager reads the configuration from PROTOCOL.INI and
makes them available to the MAC driver and protocol driver which
load after it.
* The MAC driver and the protocol driver load and configure
themselves according to that information. They identify themselves
to the Protocol Manager.
* Before MAC driver and protocol driver can communicate, they have
to be bound together, so they can access each others "entry points"
(communication ports). This bind process is controlled by the
Protocol Manager based on information in PROTOCOL.INI.
* The binding sequence can be triggered by NET.EXE or NETBIND.COM
(which can be done in AUTOEXEC.BAT).
* The Protocol Manager (PROTMAN.DOS) then starts the memory resident
(Terminate and Stay Resident - TSR) program PROTMAN.EXE to execute
the bind command and to control the correct ordering of drivers.
* After binding has occurred, the MAC and the protocol driver communi-
cate directly to each other. The Protocol Manager is not involved
in this communication process any longer, so NETBIND.COM frees most
of the memory previously reserved by the Protocol Manager.
The configuration of NDIS under DOS has changed over time with different
versions of the package. Some hints about the differences can be found
here (see: http://www.yale.edu/pclt/WINWORLD/NDIS.HTM (*03)). In this
document, I am assuming that we use the NDIS files shipped with
MS client 3.0.
As this section is all about getting packet driver based TCP/IP appli-
cations up and running with DOS we will not go into details about
MS client here, this is already explained elsewhere.
Additional files needed
So how can we use the NDIS2 MAC driver that came with our network
interface card for TCP/IP networking? As we have learned from the
description above, we need some more files. These are:
* The Protocol Manager ("PROTMAN.DOS" and "PROTMAN.EXE")
* The bind utility ("NETBIND.COM")
These files are part of the MS client 3.0 which can be downloaded here:
ftp://ftp.microsoft.com/bussys/Clients/MSCLIENT/DSK3-1.EXE (*04)
ftp://ftp.microsoft.com/bussys/Clients/MSCLIENT/DSK3-2.EXE (*05)
The three files mentioned are part of "DSK3-1.EXE". Use the utility
"EXPAND.EXE" included on the first disk to uncompress these files.
* Copy DSK3-1.EXE to a directory like C:\MSCLIENT1. Avoid a long path
if you do this in Windows. 16-bit software won't execute, if the
path is too long.
* Run DSK3-1.EXE to unpack its content.
* Decompress PROTMAN.DO_ and PROTMAN.EX_.
expand -r protman.do_
expand -r protman.ex_
* NETBIND.COM is already uncompressed. Now you can take and use the
three files.
Read the LICENSE.TXT file before you start using the files. The software
is free for internal use. Neither the distribution nor a modification
is allowed.
The converter/shim
The last piece we need is the "Packet Driver to NDIS Converter". Get the
widely used "DIS_PKT9.DOS" (version 9, see: ftp://ftp.cc.umanitoba.ca/
software/pc_network/dis_pkt9.zip (*06)) or alternatively the slightly
newer (version 11) "DIS_PKT.DOS"(see: http://danlan.com/pdr_shim/odipkt/
odipkt.zip (*07)). There are no differences in usage and handling.
Both were written by Prof. Joe R. Doupnik (Utah State University) and
Dan Lanciani (Harvard University). The copyright holds the now historic
FTP Software, Inc., which luckily released this driver as public
domain, free for use, distribution, change and with sourcecode.
Configuration of NDIS drivers
As I already mentioned, this is just a minimal installation of the
MS client 3.0. The only purpose is to use packet-driver-based TCP/IP
applications. For this purpose:
Copy the four files
PROTMAN.DOS
PROTMAN.EXE
NETBIND.COM
DIS_PKT.DOS
into a directory, for instance C:\NET.
Copy also the MAC driver of your network interface card, for instance:
EL3C574.DOS
into this directory.
Now we have to create the configuration file needed for the NDIS
architecture: Create a file with the name PROTOCOL.INI inside the
C:\NET directory. For our minimal configuration it just needs the
following lines:
--- PROTOCOL.INI ---
[protman]
DriverName=PROTMAN$
[EL3C574]
DriverName=EL3C574$
[PKTDRV]
drivername=PKTDRV$
bindings=EL3C574
intvec=0x60
chainvec=0x68
Explanation of the parameters:
Like other *.ini files, PROTOCOL.INI is structured into section names
in square brackets and item names with values assigned to them.
[protman]
DriverName=PROTMAN$
The first section [protman] defines the Protocol Manager. Like
described above, the Protocol Manager is loaded as driver PROTMAN.DOS
which is called "PROTMAN$" here. Section and line are mandatory.
[EL3C574]
DriverName=EL3C574$
The section [EL3C574] defines the network interface card. By default
the section itself is named after the card - this is useful, if you
have more than one network card and use different sections for
different cards. So the section name is the first value to change
here. It would be a good idea to name it after your own network card.
But you may as well rename the section to "netcard", "NIC" or even
"baked_beans" - whatever you like, as long as you also change all the
other lines in PROTOCOL.INI that point to that section.
The next line of this section is "DriverName=EL3C574$". It defines the
driver for the network interface card. In our example this is
EL3C574.DOS, which is called "EL3C574$" here. Most certainly you will
use a different NIC than the one mentioned in the example. So you will
have to change this line. You find the correct name of the driver in
a text-file called "PROTOCOL.INI" that should be part of the NDIS
driver files supplied with your card.
It is also possible to add more lines to this section, so you can define
special settings for your network card. Consult the "PROTOCOL.INI"
supplied with your NDIS driver for more information. But in many cases
the line with the drivername should be enough.
[PKTDRV]
drivername=PKTDRV$
bindings=EL3C574
intvec=0x60
chainvec=0x68
The next section "[PKTDRV]" defines our Packet Driver to NDIS
Converter, which is "DIS_PKT.DOS" or "DIS_PKT9.DOS". Both are called
by the name "PKTDRV$".
It is important that the converter will bind to the driver of the
network card. This is done by the next line "bindings=EL3C574". Please
note that this name includes no "$" letter - it refers to the
name of the section that defines the driver, not to the driver itself.
So if you had called this section "[baked_beans]" as suggested above,
you'd have to write "bindings=baked_beans" here ;-).
The item "intvec" specifies the software interrupt vector used by the
packet driver interface. As already explained, this should be the
hexadecimal value 0x60 per default.
The "chainvec" item also defines an available software interrupt. Its
function is still a mystery to me. According to packet driver inventor
(see: http://groups.google.de/group/comp.protocols.tcp-ip.ibmpc/msg/
17b6041f7a3cde7c?dmode=source (*08)) FTP, adding a chain vector
interrupt may improve packet processing speed and reliability. Users
saw "a 10-fold increase in performance" (see: http://groups.google.de/
group/comp.protocols.nfs/msg/9b0c2e0d6aa47b32?dmode=source (*09)).
To avoid EMM386 errors, some recommend (see: http://groups.google.de/
group/bit.listserv.banyan-l/msg/aa961def5901f506?dmode=source (*10))
to set an interrupt that increases the vector by decimal 8. So if the
intvec is 0x60 (that is decimal 96), then the chainvec should be
decimal 104 (96+8) which is hexadecimal 0x68. This is also described
(see: http://groups.google.de/group/comp.protocols.tcp-ip.ibmpc/
msg/64f2b6060ff2b438?dmode=source (*11)) by one of the authors of
DIS_PKT.DOS, Dan Lanciani. Please write if you find out more.
These are all settings in PROTOCOL.INI needed for our purpose. A last
hint: If you consider changing some of these values at each boot, for
instance by choices presented by a DOS boot menu, you may find Horst
Schaeffer's freeware "Inifile" helpful (see: http://www.horstmuc.de/
wbat32.htm (*12)).
Installation
The last thing left to do now is to load the drivers at boot. So
change your system files to contain the following lines:
--- FDCONFIG.SYS (FreeDOS) ---
--- or CONFIG.SYS (MS DOS/other DOS) ---
DEVICEHIGH=C:\NET\PROTMAN.DOS /I:C:\NET
DEVICEHIGH=C:\NET\EL3C574.DOS
DEVICEHIGH=C:\NET\DIS_PKT.DOS
The "/I" parameter tells the Protocol Manager the location of
PROTOCOL.INI. This is not needed if both are in the same directory.
--- AUTOEXEC.BAT ---
C:\NET\NETBIND.COM
Note that NETBIND.COM can not be loaded high and should just be exe-
cuted from AUTOEXEC.BAT. If you try to load it like a driver, it will
abort with the message "run-time error R6009 - not enough space for
environment".
Reboot
That's all. Reboot the system and use a simple TCP/IP application
like ping to test if everything is working.
(Picture: Boot messages of NDIS)
(*01) OK
(*02) https://web.archive.org/web/20030327055531/http://
www.ndis.com/faq/
(*03) https://web.archive.org/web/20100901143311/http://www.yale.
edu/pclt/WINWORLD/NDIS.HTM
(*04) https://www.virtualbox.org/wiki/Sharing_files_with_DOS
and: https://archive.org/download/ftp.microsoft.com/ftp.microsoft.
com.zip/ftp.microsoft.com%2Fbussys%2FClients%2FMSCLIENT%2FDSK3-1.
EXE
(*05) https://www.virtualbox.org/wiki/Sharing_files_with_DOS
and: https://archive.org/download/ftp.microsoft.com/ftp.microsoft.
com.zip/ftp.microsoft.com%2Fbussys%2FClients%2FMSCLIENT%2FDSK3-2.
EXE
and: http://download.amd.com/techdownloads/wfw31.zip
and: https://archive.org/download/ftp.microsoft.com/ftp.microsoft.
com.zip/ftp.microsoft.com%2FSoftlib%2FMSLFILES%2FWG1049.EXE
and: https://archive.org/download/ftp.microsoft.com/ftp.microsoft.
com.zip/ftp.microsoft.com%2FSoftlib%2FMSLFILES%2FNETSHAR.EXE
and: https://jeffpar.github.io/kbarchive/kb/121/Q121086/
and: https://jeffpar.github.io/kbarchive/kb/128/Q128800/
(*06) OK
(*07) https://web.archive.org/web/20110722171549/http://
www.danlan.com/
(*08) https://groups.google.com/forum/#!topic/comp.os.ms-windows.
networking.tcp-ip/Ekxg5Y5pP0g
(*09) https://groups.google.com/forum/#!original/comp.protocols.
nfs/Xe1WnbPu0og/Mnukag0uDJsJ
(*10) https://groups.google.com/forum/#!original/bit.listserv.
banyan-l/v6HiU41jovQ/BvUBWe8dlqoJ
(*11) https://groups.google.com/forum/#!original/comp.protocols
.tcp-ip.ibmpc/-/OLTyDwa28mQJ
(*12) https://www.horstmuc.de/div.htm#inifile
------------------------------------------------------------------------------
Copyright (C) 2007 Ulrich Hansen, Mainz (Germany), modified 2010
and 2020 by W.Spiegl.
For more information see here.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation.
A copy of the license is included in the section entitled
"GNU Free Documentation License 1.2".