WdfDeviceSetDeviceInterfaceState function (wdfdevice.h)

[Applies to KMDF and UMDF]

The WdfDeviceSetDeviceInterfaceState method enables or disables a device interface for a specified device.

Note

The driver should only call this function after the device has started. To change interface state from device add, call WdfDeviceSetDeviceInterfaceStateEx instead.

Syntax

void WdfDeviceSetDeviceInterfaceState(
  [in]           WDFDEVICE        Device,
  [in]           const GUID       *InterfaceClassGUID,
  [in, optional] PCUNICODE_STRING ReferenceString,
  [in]           BOOLEAN          IsInterfaceEnabled
);

Parameters

[in] Device

A handle to a framework device object.

[in] InterfaceClassGUID

A pointer to a GUID that identifies the device interface class.

[in, optional] ReferenceString

A pointer to a UNICODE_STRING structure that describes a reference string for the device interface. This parameter is optional and can be NULL.

[in] IsInterfaceEnabled

A Boolean value that, if TRUE, enables the specified device interface instance or, if FALSE, disables it.

Return value

None

Remarks

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

For more information about device interfaces and the WdfDeviceSetDeviceInterfaceState method, see Using Device Interfaces.

Examples

The following code example disables a driver's COM port interface.

WdfDeviceSetDeviceInterfaceState (
                                  Device,
                                  (LPGUID) &GUID_DEVINTERFACE_COMPORT,
                                  NULL,
                                  FALSE
                                  );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL PASSIVE_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

UNICODE_STRING

WdfDeviceCreateDeviceInterface   WdfDeviceSetDeviceInterfaceStateEx