WdfDeviceInitSetDeviceType function (wdfdevice.h)

[Applies to KMDF only]

The WdfDeviceInitSetDeviceType method sets the device type for a specified device.

Syntax

void WdfDeviceInitSetDeviceType(
  [in] PWDFDEVICE_INIT DeviceInit,
  [in] DEVICE_TYPE     DeviceType
);

Parameters

[in] DeviceInit

A pointer to a WDFDEVICE_INIT structure.

[in] DeviceType

A FILE_DEVICE_XXXX value that identifies the device type. For more information about FILE_DEVICE_XXXX values, see Specifying Device Types.

Return value

None

Remarks

If a driver calls WdfDeviceInitSetDeviceType, it must do so before it calls WdfDeviceCreate.

For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

The device type that a driver specifies determines the default priority boost value that the framework uses when the driver completes an I/O request. For more information about priority boost values, see Specifying Priority Boosts When Completing I/O Requests.

If you are writing a UMDF driver, you must modify your driver's INF file or make registry changes to specify a device type. For more information about using the registry, see Setting Device Object Registry Properties During Installation.

Examples

The following code example indicates that a device is a serial device.

WdfDeviceInitSetDeviceType(
                           DeviceInit,
                           FILE_DEVICE_SERIAL_PORT
                           );

Requirements

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