Bewerken

Delen via


WdfDeviceInitSetCharacteristics function (wdfdevice.h)

[Applies to KMDF only]

The WdfDeviceInitSetCharacteristics method sets device characteristics for a specified device.

Syntax

void WdfDeviceInitSetCharacteristics(
  [in] PWDFDEVICE_INIT DeviceInit,
  [in] ULONG           DeviceCharacteristics,
  [in] BOOLEAN         OrInValues
);

Parameters

[in] DeviceInit

A pointer to a WDFDEVICE_INIT structure.

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

[in] OrInValues

A Boolean value. If this value is TRUE, the DeviceCharacteristics value is ORed with existing device characteristics. If the value is FALSE, the DeviceCharacteristics value replaces existing device characteristics.

Return value

None

Remarks

To set device characteristics, call 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, call WdfDeviceSetCharacteristics.

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

The framework always sets the FILE_DEVICE_SECURE_OPEN characteristic, so your driver does not have to set this characteristic.

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

Examples

The following code example indicates that a device is a floppy disk.

WdfDeviceInitSetCharacteristics(
                                DeviceInit,
                                FILE_FLOPPY_DISKETTE,
                                FALSE
                                );

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

See also

WdfDeviceSetCharacteristics