WdfDeviceInitSetRequestAttributes function (wdfdevice.h)

[Applies to KMDF and UMDF]

The WdfDeviceInitSetRequestAttributes method sets object attributes that will be used for all of the framework request objects that the framework delivers to the driver from the device's I/O queues.

Syntax

void WdfDeviceInitSetRequestAttributes(
  [in] PWDFDEVICE_INIT        DeviceInit,
  [in] PWDF_OBJECT_ATTRIBUTES RequestAttributes
);

Parameters

[in] DeviceInit

A caller-supplied pointer to a WDFDEVICE_INIT structure.

[in] RequestAttributes

A pointer to a caller-allocated WDF_OBJECT_ATTRIBUTES structure that contains attributes for the device's request objects.

Return value

None

Remarks

Your driver can call WdfDeviceInitSetRequestAttributes to specify the object context space that the framework will assign to the request objects that it creates for your driver. For more information about this context space, see Using Request Object Context.

The framework does not use the specified object attributes for request objects that it creates when a driver calls WdfRequestCreate or WdfRequestCreateFromIrp.

Your driver must call WdfDeviceInitSetRequestAttributes from within its EvtDriverDeviceAdd callback function, before it calls WdfDeviceCreate. For more information, see Creating a Framework Device Object.

Examples

The following code example initializes a WDF_OBJECT_ATTRIBUTES structure and calls WdfDeviceInitSetRequestAttributes.

typedef struct _REQUEST_CONTEXT {
  ULONG_PTR  Information;
} REQUEST_CONTEXT, *PREQUEST_CONTEXT;
WDF_OBJECT_ATTRIBUTES  attributes;

WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(
                                        &attributes,
                                        REQUEST_CONTEXT
                                        );
WdfDeviceInitSetRequestAttributes(
                                  DeviceInit,
                                  &attributes
                                  );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <= DISPATCH_LEVEL
DDI compliance rules ChildDeviceInitAPI(kmdf), ControlDeviceInitAPI(kmdf), DeviceInitAPI(kmdf), DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), PdoDeviceInitAPI(kmdf)

See also

EvtDriverDeviceAdd