PeerGroupAddRecord function (p2p.h)

The PeerGroupAddRecord function adds a new record to the peer group, which is propagated to all participating peers.

Syntax

NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGroupAddRecord(
  [in]  HGROUP       hGroup,
  [in]  PPEER_RECORD pRecord,
  [out] GUID         *pRecordId
);

Parameters

[in] hGroup

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

[in] pRecord

Pointer to a PEER_RECORD structure that is added to the peer group specified in hGroup. This parameter is required.

The following members in PEER_RECORD must be populated.

  • dwSize
  • type
  • ftExpiration
ftExpiration must be expressed as peer time (see PeerGroupUniversalTimeToPeerTime).

The following members are ignored and overwritten if populated.

  • id
  • pwzCreatorId
  • pwzLastModifiedById
  • ftCreation
  • ftLastModified
  • securityData
The remaining fields are optional.

[out] pRecordId

Pointer to a GUID that identifies the record. This parameter is required.

Return value

Returns S_OK if the function 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 to perform the specified operation.
PEER_E_GROUP_NOT_READY
The peer group is not in a state where records can be added. For example, PeerGroupJoin is called, but synchronization with the peer group database has not completed.
PEER_E_INVALID_ATTRIBUTES
The XML string that contains the record attributes in the pwzAttributes member of the PEER_RECORD structure does not comply with the schema specification.
PEER_E_INVALID_GROUP
The handle to the peer group is invalid.
PEER_E_INVALID_PEER_NAME
The supplied peer name is invalid.
PEER_E_INVALID_RECORD
One or more fields in PEER_RECORD are invalid.
PEER_E_MAX_RECORD_SIZE_EXCEEDED
The record has exceeded the maximum size allowed by the peer group properties.
PEER_E_NOT_AUTHORIZED
The identity is not authorized to publish a record of that type.
 

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

Requirements

Requirement Value
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_RECORD

PeerGroupDeleteRecord

PeerGroupEnumRecords

PeerGroupUpdateRecord