SetupDiRemoveDeviceInterface
TOC
Collapse the table of content
Expand the table of content

SetupDiRemoveDeviceInterface function

The SetupDiRemoveDeviceInterface function removes a registered device interface from the system.

Syntax


BOOL SetupDiRemoveDeviceInterface(
  _In_    HDEVINFO                  DeviceInfoSet,
  _Inout_ PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData
);

Parameters

DeviceInfoSet [in]

A pointer to the device information set that contains the device interface to remove. This handle is typically returned by SetupDiGetClassDevs.

DeviceInterfaceData [in, out]

A pointer to an SP_DEVICE_INTERFACE_DATA structure that specifies the device interface in DeviceInfoSet to remove. This pointer is typically returned by SetupDiEnumDeviceInterfaces.

After the interface is removed, this function sets the SPINT_REMOVED flag in DeviceInterfaceData.Flags. It also clears the SPINT_ACTIVE flag, but be aware that this flag should have already been cleared before this function was called.

Return value

SetupDiRemoveDeviceInterface returns TRUE if the function completed without error. If the function completed with an error, it returns FALSE and the error code for the failure can be retrieved by calling GetLastError.

Remarks

The caller of this function must be a member of the Administrators group.

SetupDiRemoveDeviceInterface removes the specified device interface from the system. This includes deleting the associated registry key.

Call SetupDiDeleteDeviceInterfaceData to delete the interface from a device information list.

A device interface must be disabled to be removed. If the interface is enabled, this function fails and GetLastError returns ERROR_DEVICE_INTERFACE_ACTIVE. Disable an interface by using whatever interface-specific mechanism is provided (for example, an IOCTL). If the caller has no way to disable an interface and the interface must be removed, the caller must stop the underlying device by using SetupDiChangeState. Stopping the device disables all the interfaces exposed by the device.

Requirements

Target platform

Desktop

Version

Available in Microsoft Windows 2000 and later versions of Windows.

Header

Setupapi.h (include Setupapi.h)

Library

Setupapi.lib

DLL

Setupapi.dll

See also

SetupDiChangeState
SetupDiCreateDeviceInterface
SetupDiDeleteDeviceInterfaceData
SetupDiEnumDeviceInterfaces
SetupDiGetClassDevs

 

 

Send comments about this topic to Microsoft

Show:
© 2016 Microsoft