SetupDiSetDeviceInterfaceDefault function

The SetupDiSetDeviceInterfaceDefault function sets a device interface as the default interface for a device interface class.

Syntax

WINSETUPAPI BOOL SetupDiSetDeviceInterfaceDefault(
  HDEVINFO                  DeviceInfoSet,
  PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  DWORD                     Flags,
  PVOID                     Reserved
);

Parameters

DeviceInfoSet

A handle to the device information set that contains the device interface to set as the default for a device interface class.

DeviceInterfaceData

A pointer to an SP_DEVICE_INTERFACE_DATA structure that specifies the device interface in DeviceInfoSet.

Flags

Not used, must be zero.

Reserved

Reserved for future use, must be NULL.

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.

Remarks

A caller must have Administrator privileges to set the default interface for a device interface class. However, if the requested default interface is the same as the currently set default interface, the function returns TRUE regardless of whether the caller has Administrator privileges.

If the function successfully sets the specified device interface as the default for the device class, it updates the Flags member of the supplied SP_DEVICE_INTERFACE_DATA structure.

Call SetupDiGetClassDevs to obtain a DevInfoSet handle to a device information set that contains the device interface to set as the default for a device interface class. To obtain the DeviceInterfaceData pointer to the device interface element, call SetupDiEnumDeviceInterfaces to enumerate the interfaces in the device information set. To retrieve information about an enumerated interface, call SetupDiGetDeviceInterfaceDetail.

Requirements

   
Windows version Available in Windows XP and later versions of Windows.
Target Platform Desktop
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib
DLL Setupapi.dll

See Also

SetupDiEnumDeviceInterfaces

SetupDiGetClassDevs

SetupDiGetDeviceInterfaceDetail