SetupDiGetHwProfileFriendlyNameExW function (setupapi.h)

The SetupDiGetHwProfileFriendlyNameEx function retrieves the friendly name associated with a hardware profile ID on a local or remote computer.


WINSETUPAPI BOOL SetupDiGetHwProfileFriendlyNameExW(
  [in]            DWORD  HwProfile,
  [out]           PWSTR  FriendlyName,
  [in]            DWORD  FriendlyNameSize,
  [out, optional] PDWORD RequiredSize,
  [in, optional]  PCWSTR MachineName,
                  PVOID  Reserved


[in] HwProfile

Supplies the hardware profile ID associated with the friendly name to retrieve. If this parameter is 0, the friendly name for the current hardware profile is retrieved.

[out] FriendlyName

A pointer to a character buffer to receive the friendly name.

[in] FriendlyNameSize

The size, in characters, of the FriendlyName buffer.

[out, optional] RequiredSize

A pointer to a variable to receive the number of characters required to store the friendly name (including a NULL terminator). This parameter is optional and can be NULL.

[in, optional] MachineName

A pointer to NULL-terminated string that contains the name of a remote computer on which the hardware profile ID resides. This parameter is optional and can be NULL. If MachineName is NULL, the hardware profile ID is on the local computer.


Must be NULL.

Return value

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved by making a call to GetLastError.



The setupapi.h header defines SetupDiGetHwProfileFriendlyNameEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Desktop
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib

See also