PeerGroupCreatePasswordInvitation function (p2p.h)

The PeerGroupCreatePasswordInvitation function returns an XML string that can be used by the specified peer to join a group with a matching password.


  HGROUP hGroup,
  PWSTR  *ppwzInvitation



Handle to the peer group for which this invitation is issued. This handle is returned by the PeerGroupCreate, PeerGroupOpen, or PeerGroupJoin function. This parameter is required.


Pointer to a Unicode string that contains the invitation from the issuer. This invitation can be passed to PeerGroupPasswordJoin by the recipient in order to join the specified peer group. To return the details of the invitation as a PEER_INVITATION_INFO structure, pass this string to PeerGroupParseInvitation. To release this data, pass this pointer to PeerFreeData.

This function requires that the following fields are set on the PEER_GROUP_PROPERTIES structure passed to PeerGroupCreate.

  • pwzGroupPassword. This field must contain the password used to validate peers joining the peer group.
  • groupPasswordRole. This field must containing the GUID of the role (administrator or peer) for which the password is required.
  • dwAuthenticationSchemes. This field must have the PEER_GROUP_PASSWORD_AUTHENTICATION flag (0x00000001) set on it.

Return value

Returns S_OK if the operation succeeds; otherwise, the function returns one of the following values.

Return code Description
One of the parameters is not valid.
There is not enough memory to perform the specified operation.
The peer group is not in a state where records can be added. For example, PeerGroupJoin is called, but synchronization with the group database has not completed.
The GMC chain is longer than 24 administrators or members. For more information about GMC chains, please refer to the How Group Security Works documentation.
The data passed as pwzIdentityInfo is for a deleted identity and no longer valid.
The peer that called this method is not an administrator.
Access to the 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 is reset manually.

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


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