[Applies to KMDF only]

A bus driver's EvtDeviceResourceRequirementsQuery event callback function creates a resource requirements list that represents the device's required hardware resources.



NTSTATUS EvtDeviceResourceRequirementsQuery(
  _In_ WDFDEVICE       Device,
  _In_ WDFIORESREQLIST IoResourceRequirementsList
{ ... }


Device [in]

A handle to a framework device object.

IoResourceRequirementsList [in]

A handle to a framework resource-requirements-list object that represents an empty resource requirements list.

Return value

If the driver did not encounter any errors, it must return STATUS_SUCCESS (whether or not it specifies any required hardware resource). If the driver encounters errors, it must return an NTSTATUS value that NT_SUCCESS evaluates as FALSE.

For more information about this callback function's return values, see Reporting Device Failures.


Framework-based bus drivers can provide an EvtDeviceResourceRequirementsQuery callback function. To register this callback function, bus drivers call WdfPdoInitSetEventCallbacks.

The framework calls the bus driver's EvtDeviceResourceRequirementsQuery callback function to obtain a resource requirements list for the device.

The driver must populate the supplied resource-requirements-list object with logical configurations of hardware resources that will allow the device to operate properly.

To create a resource requirements list, the driver calls framework resource-range-list object methods, which add resource descriptors to logical configurations, and framework resource-requirements-list object methods, which add logical configurations to the resource requirements list.

For more information about hardware resources and creating resource requirements lists, see Hardware Resources for Framework-Based Drivers.

If a driver is running on an operating system version that is earlier than Windows 7, a bus driver can use EvtDeviceResourceRequirementsQuery to set a device property on a child device prior to enumerating the child.

To set a device property on Windows 7 or later, a bus driver can provide a preprocess routine for IRP_MN_DEVICE_ENUMERATED.


To define an EvtDeviceResourceRequirementsQuery callback function, you must first provide a function declaration that identifies the type of callback function you’re defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it’s a requirement for writing drivers for the Windows operating system.

For example, to define an EvtDeviceResourceRequirementsQuery callback function that is named MyDeviceResourceRequirementsQuery, use the EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY type as shown in this code example:


Then, implement your callback function as follows:

 MyDeviceResourceRequirementsQuery (
    WDFDEVICE  Device,
    WDFIORESREQLIST  IoResourceRequirementsList

The EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY function type is defined in the Wdfpdo.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for KMDF Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.


Target platform


Minimum KMDF version



Wdfpdo.h (include Wdf.h)



See also




Send comments about this topic to Microsoft