O'Reilly logo

Professional Windows® Embedded Compact 7 by Thierry Joubert, David Jones, Samuel Phung

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

STREAM DRIVER API AND TEST APPLICATIONS

Test applications to load, unload, and perform IO with a stream driver are useful for debugging a driver, particularly when combined with breakpoints and debug messages. Stream drivers are loaded via the Device Manager, which results in a standard API for implementing loading, unloading, and IO with a stream. As introduced in the previous chapter, CEDriverWiz can generate custom test applications to test a stream driver. This following section looks at the source code for those samples as an example of using the Stream API.

The Stream Driver API

In Chapter 32, “Stream Interface Drivers,” and reprised again in Chapter 33, “Developing a Stream Interface Driver,” the stream application programming interface (API) functions were mapped to their corresponding stream driver functions (refer to Tables 32-2 and 32-5).

Loading the Stream Driver

If the driver has not been configured to be loaded at startup, then it can be dynamically loaded by an application. The following code snippet assumes that the registry settings required for the driver, HKLM\Drivers\MyDriver, are in the registry. The MyDriverLoadUserMode sample application implements the following code snippet after writing the required registry values.MyDriverLoadDynamic implements this code without first writing to the registry.

image
//Assumes registry keys exist TCHAR szDevKey[] = _T("Drivers\MyDriver"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required