Expand Minimize

EvtDeviceResourcesQuery function

[Applies to KMDF only]

A bus driver's EvtDeviceResourcesQuery event callback function creates a resource list that represents a specified device's boot configuration.

Syntax


EVT_WDF_DEVICE_RESOURCES_QUERY EvtDeviceResourcesQuery;

NTSTATUS EvtDeviceResourcesQuery(
  _In_  WDFDEVICE Device,
  _In_  WDFCMRESLIST Resources
)
{ ... }

Parameters

Device [in]

A handle to a framework device object.

Resources [in]

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

Return value

If the driver did not encounter any errors, it must return STATUS_SUCCESS (whether or not it specifies boot configuration resources). 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.

Remarks

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

The framework calls the bus driver's EvtDeviceResourcesQuery callback function to obtain a resource list that specifies the boot configuration for the device.

The driver must populate the supplied resource list object with hardware resources that represent the boot requirements for the device. Drivers for PnP devices obtain this requirements information from the system BIOS.

To create a resource list, the driver calls framework resource-list object methods that add resources to the resource-list object that is represented by the Resources parameter.For more information about hardware resources and creating resource lists, see Hardware Resources for Framework-Based Drivers.

Examples

To define an EvtDeviceResourcesQuery 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 EvtDeviceResourcesQuery callback function that is named MyDeviceResourcesQuery, use the EVT_WDF_DEVICE_RESOURCES_QUERY type as shown in this code example:


EVT_WDF_DEVICE_RESOURCES_QUERY  MyDeviceResourcesQuery;

Then, implement your callback function as follows:


_Use_decl_annotations_
NTSTATUS
 MyDeviceResourcesQuery (
    WDFDEVICE  Device,
    WDFCMRESLIST  Resources
    )
  {...}

The EVT_WDF_DEVICE_RESOURCES_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_RESOURCES_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.

Requirements

Minimum KMDF version

1.0

Header

Wdfpdo.h (include Wdf.h)

IRQL

PASSIVE_LEVEL

See also

EvtDeviceResourceRequirementsQuery

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft