Data Objects and Windows 2000

< BACK  NEXT >
[oR]

Object-oriented programming (OOP) is a proven software design technique to provide overall organization of code and high-level encapsulation of major design concepts. In this scheme, a data structure is grouped with the code that modifies it. Together, the code and its associated data are called objects. The data of the object remains opaque to the users of the object. Using code must invoke methods of the object to manipulate its state. The methods of an object form a strict interface for its use.

The overall goal of the object-orientation technique is to improve the reliability, robustness, and reusability of software by hiding implementation details from the users of an object.

Windows 2000 and OOP

Using a strict definition of OOP, the design of Windows 2000 isn't truly object-oriented. Rather, it can be thought of as object-based because it manages its internal data structures in an object-like way. In particular, Windows 2000 defines not only necessary data structures, but also groups of access functions that are allowed to manipulate those data structures. All other modules are expected to access functions to manipulate the contents of the structures.

In practice, not all elements of all data structures are completely opaque. In fact, since kernel-mode driver code is trusted code, there is no real way to enforce the object boundary. Additionally, the I/O Manager treats device drivers as trusted components of itself. A driver is required to read and write some offsets within some I/O Manager data structures directly.

Windows 2000 Objects and Win32 Objects

The Win32 API also defines kernel objects. These user-mode objects differ from internal OS objects in two important ways. First, in almost all cases, internal objects have no external name. This is because these objects aren't exported to user mode and, therefore, don't need to be managed by the Object Manager.

Second, user-mode code uses handles to reference the objects it creates or opens. Internal objects are referenced with a direct memory pointer. This pointer is routinely passed between I/O Manager and device driver. In some cases, the driver itself will allocate and initialize memory for the object.

< BACK  NEXT >


The Windows 2000 Device Driver Book(c) A Guide for Programmers
The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)
ISBN: 0130204315
EAN: 2147483647
Year: 2000
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net