PeerGroupJoin function (p2p.h)

The PeerGroupJoin function prepares a peer with an invitation to join an existing peer group prior to calling PeerGroupConnect or PeerGroupConnectByAddress.

Syntax

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGroupJoin(
  [in]  PCWSTR pwzIdentity,
  [in]  PCWSTR pwzInvitation,
  [in]  PCWSTR pwzCloud,
  [out] HGROUP *phGroup
);

Parameters

[in] pwzIdentity

Pointer to a Unicode string that contains the identity opening the specified peer group. If this parameter is NULL, the implementation uses the identity obtained from PeerIdentityGetDefault.

[in] pwzInvitation

Pointer to a Unicode string that contains the XML invitation granted by another peer. An invitation is created when the inviting peer calls PeerGroupCreateInvitation or PeerGroupIssueCredentials. Specific details regarding this invitation can be obtained as a PEER_INVITATION_INFO structure by calling PeerGroupParseInvitation. This parameter is required.

[in] pwzCloud

Pointer to a Unicode string that contains the name of the PNRP cloud where a group is located. The default value is NULL, which indicates that the cloud specified in the invitation must be used.

[out] phGroup

Pointer to the handle of the peer group. To start communication with a group, call PeerGroupConnect. This parameter is required.

Return value

Returns S_OK if the operation succeeds. Otherwise, the function 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 available to complete the operation.
PEER_E_CLOUD_NAME_AMBIGUOUS
The cloud cannot be uniquely discovered, for example, more than one cloud matches the provided name.
PEER_E_INVALID_PEER_NAME
The peer identity specified in pwzIdentity is invalid.
PEER_E_INVALID_TIME_PERIOD
The validity period specified in the invitation is invalid. Either the specified period has expired or the invitation is not yet valid (i.e. the specified ValidityStart date\time has not yet been reached). One possible reason for the return of this error is that the system clock is incorrectly set on the machine joining the group, or on the machine that issued the invitation.
PEER_E_INVITATION_NOT_TRUSTED
The invitation is not trusted. This may be due to invitation alteration, errors, or expiration.
PEER_E_NO_CLOUD
The cloud cannot be located.
PEER_E_UNSUPPORTED_VERSION
The invitation is not supported by the current version of the Peer Infrastructure.
PEER_E_NO_KEY_ACCESS
Access to the peer identity or peer group keys is denied. Typically, this is caused by an incorrect access control list (ACL) for the folder that contains the user or computer keys. This can happen when the ACL has been reset manually.
 

Cryptography-specific errors can be returned from the Microsoft RSA Base Provider. These errors are prefixed with CRYPT_* and defined in Winerror.h.

Requirements

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

See also

PEER_INVITATION_INFO

PeerGroupConnect

PeerGroupConnectByAddress

PeerGroupCreateInvitation

PeerGroupOpen

PeerGroupParseInvitation