Partager via


Stream Interface Drivers

A stream interface driver is any driver that exposes the stream interface functions, regardless of the type of device controlled by the driver.

The stream interface is appropriate for any I/O device that can be thought of logically as a data source or a data sink. That is, any peripheral that produces or consumes streams of data as its primary function is a good candidate to expose the stream interface. An example is a serial port device. An example of a device that does not produce or consume data in the traditional sense would be a display device, and indeed, the stream interface is not exposed for controlling display hardware.

The stream interface can use another underlying device driver to access the physical peripheral devices that the driver manages, or they can access the device directly if the device is mapped into memory. Audio device drivers for built-in audio hardware are an example of direct access.

The stream interface functions themselves are designed to closely match the semantics of the usual file system application programming interfaces (APIs) such as ReadFile, IOControl, and so on. As a side effect of this design, devices that are managed by the stream interface are exposed to applications through the file system; applications interact with the driver by opening special files in the file system.

This metaphor of treating devices as special files is common to many operating systems (OSs), including the desktop versions of the Microsoft® Windows® OS. For example, in the desktop versions of the Windows OS, printer devices have traditionally been represented by the LPTx: special file names, serial ports by the COMx: special file names, and so on.

Despite the generic characteristics of the stream interface, it can be implemented in different ways. For example, even though the stream interface is typically designed by independent hardware vendors (IHVs) for peripheral devices, original equipment manufacturers (OEMs) who customize platforms sometimes expose the stream interface for certain built-in devices.

In some less common cases, stream interface drivers can repackage existing resources, usually in ways that specific applications can more readily use. For example, this type of stream interface driver can control a serial global positioning system (GPS) receiver. In this example, an ISV might choose to write a special stream interface driver to work in conjunction with a GPS mapping application. Many GPS receivers connect to serial ports. A GPS mapping application could, therefore, open the special COMx: file corresponding to the serial port and directly interact with the GPS receiver. However, the GPS receiver might provide positioning data in an inconvenient format, or the application writer might want to keep the details of managing specific models of GPS receiver hidden. Therefore, a stream interface driver could be written to mediate between the application and the GPS receiver. The driver would interact with the GPS receiver through a special COMx: file as before, but could repackage the positioning data in a more convenient format for the application. The driver could expose its own services as a special GPSx: file, which the application would open in order to read positioning data.

See Also

Stream Interface Driver Architecture | I/O Control Codes | Stream Interface Driver Implementation

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.