Bewerken

Delen via


WdfDeviceSetCharacteristics function (wdfdevice.h)

[Applies to KMDF only]

The WdfDeviceSetCharacteristics method sets device characteristics for a specified device.

Syntax

void WdfDeviceSetCharacteristics(
  [in] WDFDEVICE Device,
  [in] ULONG     DeviceCharacteristics
);

Parameters

[in] Device

A handle to a framework device object.

[in] DeviceCharacteristics

A value that consists of ORed system-defined constants that represent device characteristics. For more information, see the Characteristics member of the DEVICE_OBJECT structure.

Return value

None

Remarks

A bug check occurs if the driver supplies an invalid object handle.

You should set device characteristics by calling the WdfDeviceInitSetCharacteristics method in your EvtDriverDeviceAdd callback function before calling WdfDeviceCreate. If your driver cannot determine a device's characteristics until after the EvtDriverDeviceAdd callback function returns, the driver typically should call WdfDeviceSetCharacteristics in its EvtDevicePrepareHardware callback function.

Each call to WdfDeviceSetCharacteristics overwrites the settings of any previous call.

Examples

The following code example sets the FILE_REMOVABLE_MEDIA characteristic for a specified device.

WdfDeviceSetCharacteristics(
                            Device,
                            FILE_REMOVABLE_MEDIA
                            );

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 DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WdfDeviceGetCharacteristics

WdfDeviceInitSetCharacteristics