Expand Minimize

SetupDiUnremoveDevice function

The SetupDiUnremoveDevice function is the default handler for the DIF_UNREMOVE installation request.

Syntax


BOOL SetupDiUnremoveDevice(
  _In_    HDEVINFO         DeviceInfoSet,
  _Inout_ PSP_DEVINFO_DATA DeviceInfoData
);

Parameters

DeviceInfoSet [in]

A handle to a device information set for the local system that contains a device information element that represents a device to restore and to restart.

DeviceInfoData [in, out]

A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet. This is an IN-OUT parameter because DeviceInfoData.DevInst might be updated with a new handle value on return.

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.

Remarks

SetupDiUnremoveDevice restores a device to a hardware profile. This function starts the device, if possible, or it sets a flag in the device install parameters that eventually causes the user to be prompted to shut down the system.

Note  Only a class installer should call SetupDiUnremoveDevice and only in those situations where the class installer must perform device unremove operations after SetupDiUnremoveDevice completes the default device unremove operation. In such situations, the class installer must directly call SetupDiUnremoveDevice when the installer processes a DIF_UNREMOVE request. For more information about calling the default handler, see Calling Default DIF Code Handlers.

The device being restored must have class install parameters for DIF_UNREMOVE or the function fails and GetLastError returns ERROR_NO_CLASSINSTALL_PARAMS.

The DeviceInfoSet must only contain elements on the local computer.

The caller of SetupDiUnremoveDevice must be a member of the Administrators group.

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

DIF_UNREMOVE
SetupDiRemoveDevice
SP_DEVINFO_DATA

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft