WdfDeviceInitSetRequestAttributes - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdevice.h

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

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdevice-wdfdeviceinitsetrequestattributes)

WdfDeviceInitSetRequestAttributes function

Description

[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.

Parameters

DeviceInit [in]

A caller-supplied pointer to a WDFDEVICE_INIT structure.

RequestAttributes [in]

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

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
                                  );

See also

EvtDriverDeviceAdd