SetupDiGetHwProfileListEx function

The SetupDiGetHwProfileListEx function retrieves a list of all currently defined hardware profile IDs on a local or remote computer.


BOOL SetupDiGetHwProfileListEx(
  _Out_      PDWORD HwProfileList,
  _In_       DWORD  HwProfileListSize,
  _Out_      PDWORD RequiredSize,
  _Out_opt_  PDWORD CurrentlyActiveIndex,
  _In_opt_   PCTSTR MachineName,
  _Reserved_ PVOID  Reserved


HwProfileList [out]

A pointer to an array to receive the list of currently defined hardware profile IDs.

HwProfileListSize [in]

The number of DWORDs in the HwProfileList buffer.

RequiredSize [out]

A pointer to a variable of type DWORD that receives the number of hardware profiles that are currently defined. If the number is larger than HwProfileListSize, the list is truncated to fit the array size. The value returned in RequiredSize indicates the array size required to store the entire list of hardware profiles.

CurrentlyActiveIndex [out, optional]

A pointer to a variable that receives the index of the currently active hardware profile in the retrieved hardware profile list. This parameter is optional and can be NULL.

MachineName [in, optional]

A pointer to a NULL-terminated string that contains the name of a remote system for which to retrieve the list of hardware profile IDs. This parameter is optional and can be NULL. If this parameter is NULL, the list is retrieved for the local system.


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. If the required size is larger than HwProfileListSize, SetupDiGetHwProfileListEx returns FALSE and a call to GetLastError returns ERROR_INSUFFICIENT_BUFFER.


Target platform



Available in Microsoft Windows 2000 and later versions of Windows.


Setupapi.h (include Setupapi.h)



See also




Send comments about this topic to Microsoft