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.
//Assumes registry keys exist TCHAR szDevKey[] = _T("Drivers\MyDriver"); ...
Get Professional Windows® Embedded Compact 7 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.