SetupDiGetDeviceInterfacePropertyKeys function (setupapi.h)

The SetupDiGetDeviceInterfacePropertyKeys function retrieves an array of device property keys that represent the device properties that are set for a device interface.

Syntax

WINSETUPAPI BOOL SetupDiGetDeviceInterfacePropertyKeys(
  [in]            HDEVINFO                  DeviceInfoSet,
  [in]            PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  [out, optional] DEVPROPKEY                *PropertyKeyArray,
  [in]            DWORD                     PropertyKeyCount,
  [out, optional] PDWORD                    RequiredPropertyKeyCount,
  [in]            DWORD                     Flags
);

Parameters

[in] DeviceInfoSet

A handle to a device information set. This device information set contains a device interface for which to retrieve an array of the device property keys that represent the device properties that are set for a device interface.

[in] DeviceInterfaceData

A pointer to an SP_DEVICE_INTERFACE_DATA structure that represents the device interface for which to retrieve the requested array of device property keys.

[out, optional] PropertyKeyArray

A pointer to a buffer that receives an array of DEVPROPKEY-typed values, where each value is a device property key for a device property that is set for the device interface. The pointer is optional and can be NULL. For more information, see the Remarks section later in this topic.

[in] PropertyKeyCount

The size, in DEVPROPKEY-typed elements, of the PropertyKeyArray buffer. If PropertyKeyArray is NULL, PropertyKeyCount must be set to zero.

[out, optional] RequiredPropertyKeyCount

A pointer to a DWORD-typed variable that receives the number of requested device property keys. The pointer is optional and can be set to NULL.

[in] Flags

This parameter must be set to zero.

Return value

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

The following table includes some of the more common error codes that this function might log.

Return code Description
ERROR_INVALID_FLAGS
The value of Flags is not zero.
ERROR_INVALID_HANDLE
The device information set that is specified by DevInfoSet is not valid.
ERROR_INVALID_DATA
An internal data value is not valid.
ERROR_INVALID_PARAMETER
A parameter is not valid. One possibility is that the device interface that is specified by DevInterfaceData is not valid.
ERROR_INVALID_USER_BUFFER
A user buffer is not valid. One possibility is that PropertyKeyArray is NULL, and PropertKeyCount is not zero. .
ERROR_NO_SUCH_DEVICE_INTERFACE
The device interface that is specified by DeviceInterfaceData does not exist.
ERROR_INSUFFICIENT_BUFFER
The PropertyKeyArray buffer is not large enough to hold all the requested property keys.
ERROR_NOT_ENOUGH_MEMORY
There was not enough system memory available to complete the operation.

Remarks

SetupDiGetDeviceInterfacePropertyKeys is part of the unified device property model.

If the PropertyKeyArray buffer is not large enough to hold all the requested property keys, SetupDiGetDeviceInterfacePropertyKeys does not retrieve any property keys and returns ERROR_INSUFFICIENT_BUFFER. If the caller supplied a RequiredPropertyKeyCount pointer, SetupDiGetDeviceInterfacePropertyKeys sets the value of *RequiredPropertyKeyCount to the required size, in DEVPROPKEY-typed values, of the PropertyKeyArray buffer.

To retrieve a device interface property, call SetupDiGetDeviceInterfaceProperty, and to set a device interface property, call SetupDiSetDeviceInterfaceProperty.

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later versions of Windows.
Target Platform DesktopFor universal, call CM_Get_Device_Interface_Property_Keys
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib
DLL Setupapi.dll

See also

SetupDiGetDeviceInterfaceProperty

SetupDiSetDeviceInterfaceProperty