Standard Windows device drivers are implemented as dynamic-link libraries. Following are the standard Windows device drivers:
Device driver | Purpose |
COMM.DRV | Serial communication |
DISPLAY.DRV | Video display |
KEYBOARD.DRV | Keyboard input |
MOUSE.DRV | Mouse input |
SOUND.DRV | Sound output |
SYSTEM.DRV | Timer |
The SYSTEM.INI file identifies the drivers that are to be installed when Windows starts.
A device driver for a nonstandard device also must be implemented by using custom dynamic-link libraries. Different applications can then access the device, and the device driver provides the necessary synchronization to prevent conflicts between the applications.
Because interrupts can occur at any time, not just during the execution of the application that is using the device, device interrupt-handling code must be in a fixed code segment.
Interrupt-handling code in a device driver should not call client applications directly. In addition, such a device driver must not call application code using the SendMessage function, because there is no mechanism to synchronize such calls with an application's normal message processing. Such calls can lead to race conditions, data corruption, and indeterminate results.
Instead, interrupt-handling code must wait to be polled by the client applications, in much the same way that the communication driver must be polled by its client applications. Alternatively, a device driver can use the PostMessage function to place a message in the application's message queue.