Expand Minimize

WdfDeviceRetrieveDeviceName method

[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

Device [in]

A handle to a framework device object.

String [in]

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 codeDescription
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

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, KmdfIrql, KmdfIrql2

See also

WdfDeviceQueryProperty
WdfDeviceInitAssignName
WdfStringCreate

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.