Device Driver Basics
By Stephen Bucaro
Most people understand that the "hardware" part of their computer is the real physical
parts, like the keyboard, mouse, modem, hard drive and so on. They understand that the
"software" is computer bits stored on the hard drive, CD-ROM, or other storage media.
But most people are a little hazy about exactly what a "driver" is.
In this article, I'm going to reveal in plain English what a driver is, why we need
drivers, and exactly where the drivers are hiding. To give you a basic understanding,
I'm going to go back, way back, to the early days of computers.
The Early Days
The year is 1981 and the world is in the midst of a severe resession. IBM's main frame
business has slowed and the company is losing money. Up until now they had been laughing
at the array of microcomputers on the market: Atari, Commodore, sinclair. Toys really,
mostly used to play computer games.
The problem was, these "toys" were selling like hot cakes. IBM had to get into that
market and get into it fast. They didn't have time to design and build a computer
complete enough to compete in the market, so they built an "open system". They used
commonly available electronic components and they published every design detail
(including the code), and they even provided plug-in slots so that others could
build components for their computer.
And people did provide components for the IBM PC. They provided video cards, memory
expansion cards, input-output port cards, game port cards, hard disk interface cards,
and much more. How were all these various devices able to interface with the PC's
operating system? That's where a "driver" comes in.
A hardware device is constructed with various electronic components using various
control signals, but the software interface to the operating system is standardized.
A device's interface to the operating system must follow the interface specification.
A driver is a piece of software that translates the hardware's control signals to
signals that the operating system expects, and translates signals from the operating
system to the hardware's control signals.
When the computer is started up, it would look in the "system" directory for files with
the extension ".drv" and load them into memory. Specific files like autoexec.bat,
config.sys, and win.ini were used to inform the operating system about drivers. Hardware
would be configured through these files, or through jumpers located on the device itself.
The driver specification evolved along with the PC. Today when a PC starts, it executes
the program ntdetect.com which queries the hardware components and builds the registery
key HKEY_LOCAL_MACHINE\HARDWARE\SYSTEM\CurrentControlSet. This key exists only in
memory and is created each time the computer boots. If all the drivers are loaded
successfully, a copy of the key is saved as ControlSet00X.
Under the registery key CurrentControlSet, the subkey Enum contains a
subkey for each harware device on the computer. Each device key contains fields for
Hardware ID, Driver ID, Device Parameters, and other configuration data. The 32-bit
drivers are files with the extension ".sys" and can be found in the folder C:/winnt/system32.