Expand Minimize

WdfDeviceSetDeviceState method

[Applies to KMDF and UMDF]

The WdfDeviceSetDeviceState method sets the device state for a specified device.

Syntax


VOID WdfDeviceSetDeviceState(
  [in]  WDFDEVICE Device,
  [in]  PWDF_DEVICE_STATE DeviceState
);

Parameters

Device [in]

A handle to a framework device object.

DeviceState [in]

A pointer to a driver-allocated WDF_DEVICE_STATE structure that contains the device's state information.

Return value

None.

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

Remarks

When a driver calls WdfDeviceSetDeviceState, the framework notifies the Plug and Play (PnP) manager that the device state has changed.

Examples

The following code example informs the PnP manager that a specified device is disabled.


WDF_DEVICE_STATE    deviceState;

WDF_DEVICE_STATE_INIT (&deviceState);
deviceState.Disabled = WdfTrue;
WdfDeviceSetDeviceState (
                         Device,
                         &deviceState
                         );

Requirements

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

DriverCreate, KmdfIrql, KmdfIrql2

See also

WDF_DEVICE_STATE_INIT

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft