Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

WdfDeviceRetrieveDeviceName function (wdfdevice.h)

[Applies to KMDF only]

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

Syntax

NTSTATUS WdfDeviceRetrieveDeviceName(
 [in] WDFDEVICE Device,
 [in] WDFSTRING String
);

Parameters

[in] Device

A handle to a framework device object.

[in] 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:

Return code Description
STATUS_INVALID_PARAMETER
An invalid parameter was detected.
 

The method might return other NTSTATUS values.

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

Remarks

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.

Examples

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

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL PASSIVE_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WdfDeviceInitAssignName

WdfDeviceQueryProperty

WdfStringCreate


Feedback

Was this page helpful?

Additional resources