PeerPnrpRegister function (p2p.h)

The PeerPnrpRegister function registers a peer with a PNRP cloud and returns a handle that can be used for registration updates.

Note  When called, this function will block until the PNRP service has been initiated.
 

Syntax

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerPnrpRegister(
  [in]           PCWSTR                       pcwzPeerName,
  [in, optional] PPEER_PNRP_REGISTRATION_INFO pRegistrationInfo,
  [out]          HREGISTRATION                *phRegistration
);

Parameters

[in] pcwzPeerName

Pointer to a zero-terminated Unicode string that contains the peer name to register with the PNRP service.

[in, optional] pRegistrationInfo

Pointer to a PEER_PNRP_REGISTRATION_INFO structure that contains the endpoint information for the registering peer node. If NULL, the API will register the peer with all known PNRP clouds, and any registered addresses are automatically selected by the infrastructure.

[out] phRegistration

Handle to the PNRP registration for the calling peer node. Use this handle to update the registration or to deregister with the PNRP service.

Return value

If the function call succeeds, the return value is S_OK. Otherwise, it returns one of the following values.

Return code Description
E_INVALIDARG
One of the parameters is not valid.
E_OUTOFMEMORY
There is not enough memory to perform the specified operation.
PEER_E_IDENTITY_NOT_FOUND
The local peer is using an identity that does not exist.
 

Additionally, this function can return WSA values. For a complete list of possible values, see PNRP NSP Error Codes.

Remarks

A handle must be registered in a process separate of the process it will be resolved in. If a handle is registered and resolved within the same process it will not be recognized.

A name cannot be registered with an endpoint more than once. When updates to a registered name are required, use PeerPnrpUpdateRegistration.

When pRegistrationInfo is NULL, or PEER_PNRP_AUTO_ADDRESSES is specified for cAddresses, the infrastructure will keep the addresses registered up to date as addresses change or cloud availability changes.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only],Windows XP with SP1 with the Advanced Networking Pack for Windows XP
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header p2p.h
Library P2P.lib
DLL P2P.dll

See also

PeerPnrpUnregister

PeerPnrpUpdateRegistration