SetupDiGetClassPropertyKeys function (setupapi.h)
WINSETUPAPI BOOL SetupDiGetClassPropertyKeys( const GUID *ClassGuid, DEVPROPKEY *PropertyKeyArray, DWORD PropertyKeyCount, PDWORD RequiredPropertyKeyCount, DWORD Flags );
A pointer to a GUID that represents a device setup class or a device interface class. SetupDiGetClassPropertyKeys retrieves an array of the device property keys that represent device properties that are set for the specified class. For information about specifying the class type, see the Flags parameter.
A pointer to a buffer that receives an array of DEVPROPKEY-typed values, where each value is a device property key that represents a device property that is set for the device class. The pointer is optional and can be NULL. For more information, see the Remarks section later in this topic.
The size, in DEVPROPKEY-typed values, of the PropertyKeyArray buffer. If PropertyKeyArray is set to NULL, PropertyKeyCount must be set to zero.
A pointer to a DWORD-typed variable that receives the number of requested property keys. The parameter is optional and can be set to NULL.
One of the following values, which specifies whether to retrieve property keys for a device setup class or for a device interface class:
ClassGuid specifies a device setup class. This flag cannot be used with DICLASSPROP_INTERFACE.
ClassGuid specifies a device interface class. This flag cannot be used with DICLASSPROP_INSTALLER.
SetupDiGetClassPropertyKeys 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.
||The value of Flags is not valid.|
||If the DICLASSPROP_INSTALLER flag is specified, this error code indicates that the device setup class that is specified by ClassGuid does not exist.|
||The reference string for the device interface that is specified by ClassGuild is not valid. This error can be returned if the DICLASSPROP_INTERFACE flag is specified.|
||An unspecified data value is not valid. One possibility is that the ClassGuid value is not valid.|
||An unspecified parameter is not valid.|
||A user buffer is not valid. One possibility is that PropertyKeyArray is NULL, and PropertKeyCount is not zero.|
||If the DICLASSPROP_INTERFACE flag is specified, this error code indicates that the device interface class that is specified by ClassGuid does not exist.|
||The PropertyKeyArray buffer is not large enough to hold all the property keys, or an internal data buffer that was passed to a system call was too small.|
||There was not enough system memory available to complete the operation.|
||The caller does not have Administrator privileges.|
SetupDiGetClassPropertyKeys is part of the unified device property model.
A caller of SetupDiGetClassPropertyKeys must be a member of the Administrators group to retrieve device property keys for a device class.
If the PropertyKeyArray buffer is not large enough to hold all the requested property keys, SetupDiGetClassPropertyKeys does not retrieve any property keys and returns ERROR_INSUFFICIENT_BUFFER. If the caller supplied a RequiredPropertyKeyCount pointer, SetupDiGetClassPropertyKeys sets the value of *RequiredPropertyKeyCount to the required size, in DEVPROPKEY-typed values, of the PropertyKeyArray buffer.
To retrieve the property keys for a device setup class or device interface class on a remote computer, call SetupDiGetClassPropertyKeysEx.
|Minimum supported client||Available in Windows Vista and later versions of Windows.|
|Target Platform||DesktopFor universal, call CM_Get_Class_Property_Keys|
|Header||setupapi.h (include Setupapi.h)|