SetupDiSetClassInstallParamsW function (setupapi.h)

The SetupDiSetClassInstallParams function sets or clears class install parameters for a device information set or a particular device information element.


WINSETUPAPI BOOL SetupDiSetClassInstallParamsW(
  [in]           HDEVINFO                DeviceInfoSet,
  [in, optional] PSP_DEVINFO_DATA        DeviceInfoData,
  [in, optional] PSP_CLASSINSTALL_HEADER ClassInstallParams,
  [in]           DWORD                   ClassInstallParamsSize


[in] DeviceInfoSet

A handle to the device information set for which to set class install parameters.

[in, optional] DeviceInfoData

A pointer to an SP_DEVINFO_DATA structure that represents the device for which to set class install parameters. This parameter is optional and can be NULL. If this parameter is specified, SetupDiSetClassInstallParams sets the class installation parameters for the specified device. If this parameter is NULL, SetupDiSetClassInstallParams sets the class install parameters that are associated with DeviceInfoSet.

[in, optional] ClassInstallParams

A pointer to a buffer that contains the new class install parameters to use. The SP_CLASSINSTALL_HEADER structure at the beginning of this buffer must have its cbSize field set to sizeof(SP_CLASSINSTALL_HEADER) and the InstallFunction field must be set to the DI_FUNCTION code that reflects the type of parameters contained in the rest of the buffer.

If ClassInstallParams is not specified, the current class install parameters, if any, are cleared for the specified device information set or element.

[in] ClassInstallParamsSize

The size, in bytes, of the ClassInstallParams buffer. If the buffer is not supplied (that is, the class install parameters are being cleared), ClassInstallParamsSize must be 0.

Return value

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


All parameters are validated before any changes are made. Therefore, a return value of FALSE indicates that no parameters were modified.

A side effect of setting class install parameters is that the DI_CLASSINSTALLPARAMS flag is set. If the caller wants to set the parameters, but disable their use, this flag must be cleared by a call to SetupDiSetDeviceInstallParams.

If the class install parameters are cleared, the DI_CLASSINSTALLPARAMS flag is reset.


The setupapi.h header defines SetupDiSetClassInstallParams 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
API set ext-ms-win-setupapi-classinstallers-l1-1-0 (introduced in Windows 8)

See also