IUPnPRegistrar::UnregisterDevice method (upnphost.h)

The UnregisterDevice method unregisters the device from the device host. A device is either temporarily or permanently unregistered.


HRESULT UnregisterDevice(
  [in] BSTR bstrDeviceIdentifier,
  [in] BOOL fPermanent


[in] bstrDeviceIdentifier

Specifies the device identifier of the device to unregister. The device identifier was returned from a previous call to RegisterDevice or RegisterRunningDevice.

[in] fPermanent

Specifies whether to permanently or temporarily unregister the device. Specify TRUE to unregister the device permanently from the device host. Specify FALSE to unregister it temporarily.

Return value

If the method succeeds, the return value is S_OK. Otherwise, the method returns one of the COM error codes defined in WinError.h.


This method removes a device from the device host. If fPermanent is TRUE, then the device is permanently unregistered. Otherwise, the device persists in the device host's mapping of the device identifier (returned from RegisterDevice or RegisterRunningDevice) to the UDN generated by the device host. If a device is unregistered temporarily, when the device is re-registered, use the previous UDN associated with the device.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header upnphost.h
DLL Upnphost.dll

See also