Skip to content

Latest commit

 

History

History
263 lines (201 loc) · 8.36 KB

nf-setupapi-setupdisetclasspropertyw.md

File metadata and controls

263 lines (201 loc) · 8.36 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:setupapi.SetupDiSetClassPropertyW
SetupDiSetClassPropertyW function (setupapi.h)
The SetupDiSetClassProperty function sets a class property for a device setup class or a device interface class.
SetupDiSetClassProperty
SetupDiSetClassProperty function [Device and Driver Installation]
SetupDiSetClassPropertyA
SetupDiSetClassPropertyW
devinst.setupdisetclassproperty
di-rtns_c0346a11-5f87-4578-af46-5cb82e5b6101.xml
setupapi/SetupDiSetClassProperty
setupapi/SetupDiSetClassPropertyA
setupapi/SetupDiSetClassPropertyW
devinst\setupdisetclassproperty.htm
devinst
12402336-9894-4d0d-b176-c6907e0cdcd4
12/05/2018
SetupDiSetClassProperty, SetupDiSetClassProperty function [Device and Driver Installation], SetupDiSetClassPropertyA, SetupDiSetClassPropertyW, devinst.setupdisetclassproperty, di-rtns_c0346a11-5f87-4578-af46-5cb82e5b6101.xml, setupapi/SetupDiSetClassProperty, setupapi/SetupDiSetClassPropertyA, setupapi/SetupDiSetClassPropertyW
setupapi.h
Setupapi.h
DesktopFor universal, call CM_Set_Class_Property
Available in Windows Vista and later versions of Windows.
SetupDiSetClassPropertyW (Unicode) and SetupDiSetClassPropertyA (ANSI)
Setupapi.lib
Windows
19H1
SetupDiSetClassPropertyW
setupapi/SetupDiSetClassPropertyW
c++
APIRef
kbSyntax
LibDef
Setupapi.lib
Setupapi.dll
SetupDiSetClassProperty
SetupDiSetClassPropertyA
SetupDiSetClassPropertyW

SetupDiSetClassPropertyW function

-description

The SetupDiSetClassProperty function sets a class property for a device setup class or a device interface class.

-parameters

-param ClassGuid [in]

A pointer to a GUID that identifies the device setup class or device interface class for which to set a device property. For information about how to specify the class type, see the Flags parameter.

-param PropertyKey [in]

A pointer to a DEVPROPKEY structure that represents the device property key of the device class property to set.

-param PropertyType [in]

A DEVPROPTYPE-typed value that represents the property-data-type identifier for the device class property. For more information about the property-data-type identifier, see the Remarks section later in this topic.

-param PropertyBuffer [in, optional]

A pointer to a buffer that contains the property value of the device class. If either the property or the data is being deleted, this pointer must be set to NULL, and PropertyBufferSize must be set to zero. For more information about property data, see the Remarks section later in this topic.

-param PropertyBufferSize [in]

The size, in bytes, of the PropertyBuffer buffer. If PropertyBuffer is set to NULL, PropertyBufferSize must be set to zero.

-param Flags [in]

One of the following values, which specifies whether the class is a device setup class or a device interface class:

DICLASSPROP_INSTALLER

ClassGuid specifies a device setup class. This flag cannot be used with DICLASSPROP_INTERFACE.

DICLASSPROP_INTERFACE

ClassGuid specifies a device interface class. This flag cannot be used with DICLASSPROP_INSTALLER.

-returns

SetupDiSetClassProperty 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 invalid.
ERROR_INVALID_CLASS
The device setup class that is specified by ClassGuid is not valid. This error can occur only if the DICLASSPROP_INSTALLER flag is specified.
ERROR_INVALID_REFERENCE_STRING
The device interface reference string is not valid. This error can occur only if the DICLASSPROP_INTERFACE flag is specified.
ERROR_INVALID_REG_PROPERTY
The property key that is supplied by PropertyKey is not valid.
ERROR_INVALID_DATA
An unspecified internal data value was not valid. This error could be logged if the ClassGuid value is not a valid GUID or the property value is not consistent with the property type specified by PropertyType.
ERROR_INVALID_USER_BUFFER
A user buffer is not valid. One possibility is that PropertyBuffer is NULL, and PropertyBufferSize is not zero.
ERROR_NO_SUCH_INTERFACE_CLASS
The device interface class that is specified by ClassGuid does not exist. This error can occur only if the DICLASSPROP_INTERFACE flag is specified.
ERROR_INSUFFICIENT_BUFFER
An internal data buffer that was passed to a system call was too small.
ERROR_NOT_ENOUGH_MEMORY
There was not enough system memory available to complete the operation.
ERROR_NOT_FOUND
An unspecified item was not found. One possibility is that the property to be deleted does not exist.
ERROR_ACCESS_DENIED
The caller does not have Administrator privileges.

-remarks

SetupDiSetClassProperty is part of the unified device property model.

SetupAPI supports only a Unicode version of SetupDiSetClassProperty.

A caller of SetupDiSetClassProperty must be a member of the Administrators group to set a device interface property.

SetupDiSetClassProperty enforces requirements on the property-data-type identifier and the property value.

To obtain the device property keys that represent the device properties that are set for a device class on a local computer, call SetupDiGetClassPropertyKeys.

To retrieve a device class property on a local computer, call SetupDiGetClassProperty, and to retrieve a device class property on a remote computer, call SetupDiGetClassPropertyEx.

To set a device class property on a remote computer, call SetupDiSetClassPropertyEx.

-see-also

SetupDiGetClassProperty

SetupDiGetClassPropertyEx

SetupDiGetClassPropertyKeys

SetupDiSetClassPropertyEx