IUPnPReregistrar::ReregisterDevice method (upnphost.h)

The ReregisterDevice method re-registers a device with the device host. The device information is stored by the device host. Then, the device host returns a device identifier and publishes and announces the device on the network.

Syntax

HRESULT ReregisterDevice(
  [in] BSTR bstrDeviceIdentifier,
  [in] BSTR bstrXMLDesc,
  [in] BSTR bstrProgIDDeviceControlClass,
  [in] BSTR bstrInitString,
  [in] BSTR bstrContainerId,
  [in] BSTR bstrResourcePath,
  [in] long nLifeTime
);

Parameters

[in] bstrDeviceIdentifier

Specifies the device identifier of the device. Use the identifier returned by IUPnPRegistrar::RegisterDevice.

[in] bstrXMLDesc

Specifies the XML device description template of the device to register.

[in] bstrProgIDDeviceControlClass

Specifies the ProgID of a device control object that implements the IUPnPDeviceControl interface. This interface must be an in-process COM server (CLSCTX_INPROC_SERVER) and must be accessible to LocalService.

[in] bstrInitString

Identifies the initialization string specific to the device. This string is later passed to IUPnPDeviceControl::Initialize.

[in] bstrContainerId

Specifies a string that identifies the process group in which the device belongs. All devices with the same container ID are contained in the same process.

[in] bstrResourcePath

Specifies the location of the resource directory of the device. This resource directory contains the icon files and service descriptions that are specified in the device description template bstrXMLDesc. The resource directory may also contain the presentation files. However, this is optional.

[in] nLifeTime

Specifies the lifetime of the device announcement, in seconds. After the timeout expires, the announcements are refreshed. If you specify zero, the default value of 1800 (30 minutes) is used. The minimum allowable value is 900 (15 minutes); if you specify anything less than 900, an error is returned.

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, or one of the following UPnP-specific error codes.

Return code Description
UPNP_E_DEVICE_NOTREGISTERED
The device has not been registered. Use RegisterRunningDevice to register an unregistered device.
UPNP_E_DEVICE_RUNNING
The device is currently running. Use ReregisterRunningDevice to reregister a device while it is running.
UPNP_E_DUPLICATE_NOT_ALLOWED
A duplicate element exists.
UPNP_E_DUPLICATE_SERVICE_ID
A duplicate service ID for a service within the same parent device exists.
UPNP_E_INVALID_DESCRIPTION
The device description is not valid.
UPNP_E_INVALID_ICON
An error is present in the icon element of the device description.
UPNP_E_INVALID_SERVICE
An error is present in a service element in the device description.
UPNP_E_REQUIRED_ELEMENT_ERROR
A required element is missing.

Remarks

Use the identifier returned in pbstrDeviceIdentifier when invoking IUPnPRegistrar::UnregisterDevice.

Common errors that can occur when invoking this function include:

Requirements

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

See also

IUPnPRegistrar

IUPnPReregistrar