Building WDM Streaming Drivers
It is nearly impossible to write directly to the WDM Streaming interface. Large areas are not documented and Microsoft strongly recommends against this. Most uses of WDM Streaming use a class driver - minidriver model to split out common code.
The mini-driver (device-specific component) is loaded by Windows and immediately calls the class driver. The class driver (supplied by Microsoft) creates the device objects and manages all the formal interfaces, calling specific interfaces in the mini-driver via a function table as necessary to access the device. Unlike the ndis/scsi models, however, the mini-driver is free to call WDM services as necessary rather than being restricted to services offered by the class driver.
There are three choices of class driver:
- AVStream is a flexible, object-oriented class library that is recommended for video and audio/video devices. It is the best of the three models, creating small, simple and flexible minidrivers based on dispatch tables and typically written in C++. However, it was not released until 2001 (with Windows XP) and many drivers are still written to one of the original, less flexible models.
- The port class driver is designed for WDM Audio. Components are represented by COM interfaces. Normally a device-specific miniport object is combined with a system-supplied port object to make a combined filter. This model makes support for a range of audio devices very straightforward, including support for their volume and mixer properties. However, it cannot really be used for non-audio types.
- The stream class driver (stream.sys) is used by video capture devices, though it can also be used to develop audio devices (including combined video and audio capture devices). The minidriver registers callbacks with the class driver, and read, write and property requests are sent to these callbacks in the form of Stream Request Blocks (SRBs). The stream class driver supports only one filter type per driver binary (although it has support for loading child drivers). It does not support dynamic changes to the set of pins or formats, and provides very little help in some areas while being overprescriptive in other areas. The original implementation in Windows 98 Gold also had some serious limitations: for example, you could not connect two stream class filters directly together.
Device Driver Topics
- WDM Drivers
- Kernel Streaming
- KS Minidriver Models
- Windows NT Drivers
- Microsoft's WDM Streaming white paper
- Video Capture overview