PeerGroupEnumMembers function (p2p.h)

The PeerGroupEnumMembers function creates an enumeration of available peer group members and the associated membership information.


  [in]  HGROUP    hGroup,
  [in]  DWORD     dwFlags,
  [in]  PCWSTR    pwzIdentity,
  [out] HPEERENUM *phPeerEnum


[in] hGroup

Handle to the peer group whose members are enumerated. This handle is returned by the PeerGroupCreate, PeerGroupOpen, or PeerGroupJoin function. This parameter is required.

[in] dwFlags

Specifies the PEER_MEMBER_FLAGS flags that indicate which types of members to include in the enumeration. If this value is set to zero, all members of the peer group are included.

Value Meaning
Enumerate all members of the current peer group that are online.

[in] pwzIdentity

Unicode string that contains the identity of a specific peer whose information is retrieved and returned in a one-item enumeration. If this parameter is NULL, all members of the current peer group are retrieved. This parameter is required.

[out] phPeerEnum

Pointer to the enumeration that contains the returned list of peer group members. This handle is passed to
PeerGetNextItem to retrieve the items, with each item represented as a pointer to a PEER_MEMBER structure. When finished, PeerEndEnumeration is called to return the memory used by the enumeration. 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
One of the parameters is not valid.
There is not enough memory to perform the specified operation.
The handle to the peer group is invalid.

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


The local node is always the very first item in the enumeration if pwzIdentity is NULL, and dwFlags is set to indicate that the local node is a member of the explicit subset.

By default, every member publishes membership information to the peer group. If PEER_MEMBER_DATA_OPTIONAL is set on the PEER_MEMBER data for that peer, this information is only available when a peer performs an action within the group, for example, publishing a record, updating presence, or issuing a GMC.


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