Callback to notify the driver of the object’s cleanup before deletion (references may still exist).
EvtDestroyCallback
Callback to notify the driver of the object’s imminent deletion (reference count will be 0).
ExecutionLevel
Describes the maximum IRQL at which the callbacks may be invoked by KMDF.
ParentObject
Identifies the parent of this object.
Size
Size of the object.
SynchronizationScope
Specifies whether callbacks should be synchronized with the parent, a queue or device, or nothing.
KMDF I/O Model
The KMDF I/O model follows the WDM mechanisms discussed earlier in the chapter. In fact, one can even think of the framework itself as a WDM driver, since it uses kernel APIs and WDM behavior to abstract KMDF and make it functional. Under KMDF, the framework driver sets its own WDM-style IRP dispatch routines and takes control over all IRPs sent to the driver. After being handled by one of three KMDF I/O handlers (which we’ll describe shortly), it then packages these requests in the appropriate KMDF objects, inserts them in the appropriate queues if required, and performs driver callback if the driver is interested in those events. Figure 8-31 describes the flow of I/O in the framework.
Based on the IRP processing discussed for WDM drivers earlier, KMDF performs one of the following three actions:
Sends the IRP to the I/O handler, which processes standard device operations
Sends the IRP to the PnP and power handler that processes these kinds of events and notifies other drivers if the state has changed
Sends the IRP to the WMI handler, which handles tracing and logging.
These components will then notify the driver of any events it registered for, potentially forward the request to another handler for further processing, and then complete the request based on an internal handler action or as the result of a driver call. If KMDF has finished processing the IRP but the request itself has still not been fully processed, KMDF will take one of the following actions:
For bus drivers and function drivers, complete the IRP with STATUS_INVALID_DEVICE_REQUEST
For filter drivers, forward the request to the next lower driver
I/O processing by KMDF is based on the mechanism of
The callbacks registered with the events associated with this queue.
The power management state for the queue. KMDF supports both power-managed and nonpower-managed queues. For the former, the I/O handler will handle waking up the device when required (and when possible), arm the idle timer when the device has no I/Os queued up, and call the driver’s I/O cancellation routines when the system is switching away from a working state.
The dispatch method for the queue. KMDF can deliver I/Os from a queue either in a sequential, parallel, or manual mode. Sequential I/Os are delivered one at a time (KMDF waits for the driver to complete the previous request), while parallel I/Os are delivered to the driver as soon as possible. In manual mode, the driver must manually retrieve I/Os from the queue.
Whether or not the queue can accept zero-length buffers, such as incoming requests that don’t actually contain any data.
Note
The dispatch method affects solely the number of requests that are allowed to be active inside a driver’s queue at one time. It does not determine whether the event callbacks themselves will be called concurrently or serially. That behavior is determined through the synchronization scope object attribute described earlier. Therefore, it is possible for a parallel queue to have concurrency disabled but still have multiple incoming requests.
Based on the mechanism of queues, the KMDF I/O handler can perform several possible tasks upon receiving either a create, close, cleanup, write, read, or device control (IOCTL) request: