WdfDeviceCreateDeviceInterface function

[Applies to KMDF and UMDF]

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


NTSTATUS WdfDeviceCreateDeviceInterface(
  WDFDEVICE        Device,
  CONST GUID       *InterfaceClassGUID,
  PCUNICODE_STRING ReferenceString



A handle to a framework device object.


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


A pointer to a UNICODE_STRING structure that describes a reference string for the device interface. The string must not contain any path separator characters ("/" or ""). 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.


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.


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

NTSTATUS  status;

status = WdfDeviceCreateDeviceInterface(
                                        (LPGUID) &GUID_DEVINTERFACE_COMPORT,


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)
DDI compliance rules DriverCreate, KmdfIrql, KmdfIrql2

See Also