SetupDiSetDeviceInterfaceDefault function (setupapi.h)
The SetupDiSetDeviceInterfaceDefault function sets a device interface as the default interface for a device interface class.
Syntax
WINSETUPAPI BOOL SetupDiSetDeviceInterfaceDefault(
[in] HDEVINFO DeviceInfoSet,
[in, out] PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
[in] DWORD Flags,
PVOID Reserved
);
Parameters
[in] DeviceInfoSet
A handle to the device information set that contains the device interface to set as the default for a device interface class.
[in, out] DeviceInterfaceData
A pointer to an SP_DEVICE_INTERFACE_DATA structure that specifies the device interface in DeviceInfoSet.
[in] 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
Requirement | Value |
---|---|
Minimum supported client | Available in Windows XP and later versions of Windows. |
Target Platform | Desktop |
Header | setupapi.h (include Setupapi.h) |
Library | Setupapi.lib |
DLL | Setupapi.dll |