Creating Callback Objects

Warning

UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2.

The archived UMDF 1 samples can be found in the Windows 11, version 22H2 - May 2022 Driver Samples Update.

For more info, see Getting Started with UMDF.

A UMDF driver can create callback objects, which consist of context data and interface methods. The framework accesses the driver's callback objects through the driver's callback interface methods.

The following figure shows how driver-implemented callback objects correspond to framework objects.

framework objects and vendor-supplied callback objects.

A UMDF driver can create several types of callback objects, including the following:

  • Driver callback object

    The framework uses the driver callback object to initialize the driver and notify the driver of the arrival of a new device.

  • Device callback object

    The driver uses the device callback object to store device context and to handle the cleanup and closing of file objects and Plug and Play (PnP) and power management (PM) events.

  • Queue callback object

    The driver uses the queue callback object to process I/O.

The following figure shows how a UMDF driver creates a device callback object.

call sequence for creating a umdf device callback object.

The following topics contain code examples that show how to create a callback object: