Expand Minimize

WdfDeviceCreateDeviceInterface method

[Applies to KMDF and UMDF]

The WdfDeviceCreateDeviceInterface method creates a device interface for a specified device.

Syntax


NTSTATUS WdfDeviceCreateDeviceInterface(
  [in]            WDFDEVICE Device,
  [in]            const GUID *InterfaceClassGUID,
  [in, optional]  PCUNICODE_STRING ReferenceString
);

Parameters

Device [in]

A handle to a framework device object.

InterfaceClassGUID [in]

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

ReferenceString [in, optional]

A pointer to a UNICODE_STRING structure that describes a reference string for the device interface. This parameter is optional and can be NULL. For more information, see the following Remarks section.

Return value

WdfDeviceCreateDeviceInterface returns STATUS_SUCCESS if the operation succeeds.

For a list of other return values that WdfDeviceCreateDeviceInterface can return, see Framework Object Creation Errors.

The method might return other NTSTATUS values.

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

Remarks

Drivers can use the ReferenceString parameter to differentiate different instances of a single interface. In other words, if a driver calls WdfDeviceCreateDeviceInterface twice for the same device interface class, the driver can specify a different ReferenceString parameter each time. When an instance of an interface is opened, the I/O manager passes the instance's reference string to the driver. The reference string is appended to the path component of the interface instance's name. The driver can then use the reference string to determine which instance of the device interface class is being opened.

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

Examples

The following example registers the COM port interface class for a device.


NTSTATUS  status;

status = WdfDeviceCreateDeviceInterface(
                                        Device,
                                        (LPGUID) &GUID_DEVINTERFACE_COMPORT,
                                        NULL
                                        );

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

PASSIVE_LEVEL

DDI compliance rules

DriverCreate, KmdfIrql, KmdfIrql2

See also

UNICODE_STRING
WdfDeviceSetDeviceInterfaceState

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft