Windows Driver Kit: Kernel-Mode Driver Framework
WdfDeviceRetrieveDeviceName

The WdfDeviceRetrieveDeviceName method returns the device name for a specified device.

NTSTATUS
  WdfDeviceRetrieveDeviceName(
    IN WDFDEVICE  Device,
    IN WDFSTRING  String
    )

Parameters

Device
A handle to a framework device object.
String
A handle to a framework string object that receives the device name.

Return Value

If the operation succeeds, WdfDeviceRetrieveDeviceName returns STATUS_SUCCESS. Additional return values include:

STATUS_INVALID_PARAMETER, if an invalid parameter was detected.

The method might return other NTSTATUS values.

Comments

The WdfDeviceRetrieveDeviceName method returns the device name that the driver specified in a previous call to WdfDeviceInitAssignName.

To obtain the device name string from the string object, the driver can call WdfStringGetUnicodeString.

Example

The following code example creates a string object and then retrieves a specified device's name.

NTSTATUS status;
WDFSTRING string;

status = WdfStringCreate(
                         NULL,
                         WDF_NO_OBJECT_ATTRIBUTES,
                         &string
                         );
if (NT_SUCCESS(status)) {
    status = WdfDeviceRetrieveDeviceName(
                                         Device,
                                         string
                                         );
    if (!NT_SUCCESS(status)) {
        return status;
    }
}

Requirements

Versions: The WdfDeviceRetrieveDeviceName method is available in version 1.0 and later versions of KMDF.

IRQL: PASSIVE_LEVEL

Headers: Declared in wdfdevice.h. Include wdf.h.

Library: See Framework Library Versions.

See Also

WdfDeviceQueryProperty, WdfDeviceInitAssignName, WdfStringCreate


Send feedback on this topic
Built on November 19, 2009
Page view tracker