The SetupDiSetDeviceInterfaceDefault function sets a device interface as the default interface for a device interface class.
WINSETUPAPI BOOL SetupDiSetDeviceInterfaceDefault( HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Flags, PVOID Reserved );
A handle to the device information set that contains the device interface to set as the default for a device interface class.
A pointer to an SP_DEVICE_INTERFACE_DATA structure that specifies the device interface in DeviceInfoSet.
Not used, must be zero.
Reserved for future use, must be NULL.
The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.
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.
|Windows version||Available in Windows XP and later versions of Windows.|
|Header||setupapi.h (include Setupapi.h)|