Object Hierarchy and Lifetime

Both UMDF and KMDF use reference counts in controlling object lifetime. Every object has a reference count, which ensures that the object persists as long as it is being used:

  • UMDF uses the standard COM interface. Drivers can use the AddRef and Release methods on the object to manage the object's reference count.

  • KMDF maintains its own reference counts. Drivers can use the WdfObjectReferenceXxx and WdfObjectDereferenceXxx methods.

In addition to a reference count, every framework object—except the driver object—is assigned a parent at creation. The driver object is the root object, and all other objects are its descendants. Device objects are always the children of the driver object, and queues are generally the children ...

Get Developing Drivers with the Windows® Driver Foundation now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.