SetupDiRemoveDevice

BOOLEAN
SetupDiRemoveDevice(
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData
);

SetupDiRemoveDevice is the default handler for the DIF_REMOVE installation request. It removes a device from the system.

Parameters

DeviceInfoSet

Supplies a handle to the device information set containing the device to be removed.

DeviceInfoData

Supplies a pointer to an SP_DEVINFO_DATA structure for which the device instance should be removed. This is an IN OUT parameter because the DevInst field of the structure can be updated with a new handle value upon return. If this is a global removal or the last hardware profile-specific removal, all traces of the device instance are deleted from the registry and the DeviceInfoSet handle is NULL.

Return Value

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

Comments

This function removes the device from the system. It deletes both of the device's registry keys and dynamically stops the device if its DevInst is active. If the device cannot be dynamically stopped, flags are set in the Install Parameter block of the device information set that eventually cause the user to be prompted to shut down the system. Device removal is either global to all hardware profiles or specific to one hardware profile as specified by the ClassInstallParams field of the structure.

See Also

SP_DEVINFO_DATA, SP_REMOVEDEVICE_PARAMS