Object Hierarchy
KMDF objects are organized hierarchically. WDFDRIVER is the root object; all other objects are considered its children. For most object types, a driver can specify the parent when it creates the object. If the driver doesn't specify a parent at object creation, the framework sets the default parent to the WDFDRIVER object. Figure 1 shows the default KMDF object hierarchy.
Figure 1 Parent-child relationships among the KMDF objects.
For each object, Figure 1 shows which other object(s) must be in its parent chain. These objects aren't necessarily the immediate parent, but could be the grandparent, great-grandparent, and so forth. For example, Figure 1 shows the WDFDEVICE object as parent of the WDFQUEUE object. However, a WDFQUEUE object could be the child of a WDFIOTARGET object, which in turn is the child of a WDFDEVICE object. Thus, the WDFDEVICE object is in the parent chain for the WDFQUEUE object.
The object hierarchy affects the object's lifetime. The parent holds a reference count for each child object. When the parent object is deleted, the child objects are deleted and their callbacks are invoked in a defined order. Table 3 lists all the KMDF object types.
Table 3 KMDF Object Types
Object |
Type |
Description |
---|---|---|
Child list |
WDFCHILDLIST |
Represents a list of the child devices for a device. |
Collection |
WDFCOLLECTION |
Describes a list of similar objects, such as resources or the devices for which a filter driver filters requests. |
Device |
WDFDEVICE |
Represents an instance of a device. A driver typically has one WDFDEVICE object for each device that it controls. |
DMA common buffer |
WDFCOMMONBUFFER |
Represents a buffer that can be accessed by both the device and the driver to perform DMA. |
DMA enabler |
WDFDMAENABLER |
Enables a driver to use DMA. A driver that handles device I/O operations has one WDFDMAENABLER object for each DMA channel within the device. |
DMA transaction |
WDFDMATRANSACTION |
Represents a single DMA transaction. |
Deferred procedure call (DPC) |
WDFDPC |
Represents a deferred procedure call. |
Driver |
WDFDRIVER |
Represents the driver itself and maintains information about the driver, such as its entry points. Every driver has one WDFDRIVER object. |
File |
WDFFILEOBJECT |
Represents a file object through which external drivers or applications can access the device. |
Generic object |
WDFOBJECT |
Represents a generic object for use as the driver requires. |
I/O queue |
WDFQUEUE |
Represents an I/O queue. A driver can have any number of WDFIOQUEUE objects. |
I/O request |
WDFREQUEST |
Represents a request for device I/O. |
I/O target |
WDFIOTARGET |
Represents a device stack to which the driver is forwarding an I/O request. |
Interrupt |
WDFINTERRUPT |
Represents a device's interrupt object. Any driver that handles device interrupts has one WDFINTERRUPT object for each IRQ or message-signaled interrupt (MSI) that the device can trigger. |
Look-aside list |
WDFLOOKASIDE |
Represents a dynamically sized list of identical buffers that are allocated from the paged or non-paged pool. Both the WDFLOOKASIDE object and its component memory buffers can have attributes. |
Memory |
WDFMEMORY |
Represents memory that the driver uses, typically an input or output buffer that is associated with an I/O request. |
Registry key |
WDFKEY |
Represents a registry key. |
Resource list |
WDFCMRESLIST |
Represents the list of resources that have actually been assigned to the device. |
Resource range list |
WDFIORESLIST |
Represents a possible configuration for a device. |
Resource requirements list |
WDFIORESREQLIST |
Represents a set of I/O resource lists, which comprises all possible configurations for the device. Each element of the list is a WDFIORESLIST object. |
String |
WDFSTRING |
Represents a counted Unicode string. |
Synchronization: spin lock |
WDFSPINLOCK |
Represents a spin lock, which synchronizes access to data at DISPATCH_LEVEL. |
Synchronization: wait lock |
WDFWAITLOCK |
Represents a wait lock, which synchronizes access to data at PASSIVE_LEVEL. |
Timer |
WDFTIMER |
Represents a timer that fires either once or periodically and causes a callback routine run. |
USB device |
WDFUSBDEVICE |
Represents a USB device. |
USB interface |
WDFUSBINTERFACE |
Represents an interface on a USB device. |
USB pipe |
WDFUSBPIPE |
Represents a pipe in a USB interface. |
Windows Management Instrumentation (WMI) instance |
WDFWMIINSTANCE |
Represents an individual WMI data block that is associated with a particular provider. |
WMI provider |
WDFWMIPROVIDER |
Represents the schema for WMI data blocks that the driver provides. |
Work item |
WDFWORKITEM |
Represents a work item, which runs in a system thread at PASSIVE_LEVEL. |