IPortableDeviceManager::GetDeviceFriendlyName method (portabledeviceapi.h)
Retrieves the user-friendly name for the device.
HRESULT GetDeviceFriendlyName( LPCWSTR pszPnPDeviceID, WCHAR *pDeviceFriendlyName, DWORD *pcchDeviceFriendlyName );
Pointer to a null-terminated string that contains the device's Plug and Play ID. You can retrieve a list of Plug and Play names of all devices that are connected to the computer by calling GetDevices.
A caller-allocated buffer that is used to hold the user-friendly name for the device. To learn the required size for this parameter, first call this method with this parameter set to NULL and pcchDeviceFriendlyName set to 0; the method will succeed and set pcchDeviceFriendlyName to the required buffer size to hold the device-friendly name, including the termination character.
On input, the maximum number of characters that pDeviceFriendlyName can hold, not including the termination character. On output, the number of characters that is returned by pDeviceFriendlyName, not including the termination character.
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
||The supplied buffer is not large enough to hold the device description. (Refer to the value returned in pcchDeviceDescription for the required size.)|
||The device description could not be found.|
||The method succeeded.|
||At least one of the required arguments was a NULL pointer.|
A device is not required to support this method. If this method fails to retrieve a name, try requesting the WPD_OBJECT_NAME property of the device object (the object with the ID WPD_DEVICE_OBJECT_ID).