Understanding Windows 7 Device Driver Objects and Associated Windows Driver Framework Objects
What Are Software Objects?
One of the fundamental ideas in software component engineering is the use of objects. But just what is an object? There doesn’t seem to be a universally accepted idea as to what an object is. The view that the computer scientist Grady Booch (1991) takes is that an object is defined primarily by three characteristics: its state, its behavior, and its identity. His book Object-Oriented Analysis and Design with Applications covers this approach to programming using OOP techniques. The fundamental unit of analysis, in most cognitive theories, is the information-process component. A component is an elementary information process that operates on the internal representation of objects or symbols. If we look at the way these components work, they may translate a sensory input into a conceptual representation, transform one conceptual representation into another, or translate a conceptual representation into a motor output.
The Object Oriented Programming (OOP) techniques for software have been around now for approximately a quarter of a century. But the phenomenon is not new. Ancient philosophers, such as Plato and Aristotle, as well as modern philosophers like Immanuel Kant, have been involved in explaining the meaning of existence in general and determining the essential characteristics of concepts and objects.
It was not until around 1990 when Bjarne Stroustrup published the book The Annotated C++ Reference Manual that OOP started getting into the main programming development stream. We have slowly come to realize just what properties our program should have to make it work in solving complex real-world problems. Having new languages like VB.NET or C# and their associated capabilities to create classes and objects was not enough. We realized that just using the abstract data type or classes was not enough. As part of this ongoing development, the methodology called object-oriented technology evolved into what is called the object model. The software engineering foundations whose elements are collectively called the object model encompass the principles of abstraction, modularity, encapsulation, hierarchy, typing, concurrency, and persistence. The object model defines the use of these elements in such a way that they form a synergistic association.
Windows Driver Foundation (WDF)
Even though we have been using the OOP Model for some two decades, it has only been relatively recently that this approach has filtered down into the world of writing hardware device drivers. The OOP Model is presented in the sense of what we call a Framework. Microsoft realized that there was a lot common code that could be captured in objects and collected in the Framework. They called this new OOP Model Framework for Device Driver development the Windows Driver Foundation.
It also has two major sub-frames for device driver development: the User Mode Driver Framework (UMDF), and the Kernel Mode Driver Framework (KMDF). This WDF and its sub-frames are the next generation of the driver model for the Windows family of operating systems. This new model can reduce driver development time, contribute to greater system stability, and improve driver serviceability.
WDF includes a suite of components (objects) that support the development, deployment, and maintenance of both KMDF and UMDF drivers.
WDF Object Model
Objects are a significant fundamental element of our device driver program development. In the WDF object model:
- Objects work as building blocks for the driver. A driver modifies these objects through well-defined interfaces. The objects themselves have well-defined life cycles.
- A set of events can affect each type of object. The framework defines default behavior for each event. To support device-specific behavior, the driver includes callback routines that override the defaults.
The model defines a set of objects that represent common driver constructs, such as devices, queues, I/O requests, and the driver itself. The objects have properties, methods, and events:
- Properties describe characteristics of the object. Each property is associated with methods that get and (if relevant) set the value of the property.
- Methods perform actions on the object.
- Events are conditions for which a driver might need to take action. WDF identifies possible events for each object and defines default actions for most of them. The driver includes code to handle only the events for which the default actions are inappropriate or inadequate for its device. When the event occurs, WDF invokes the related callback.