PeerGraphUpdateRecord function (p2p.h)
The PeerGraphUpdateRecord function updates a record in the peer graph and then floods the record to each node in the peer graph.
Syntax
NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerGraphUpdateRecord(
[in] HGRAPH hGraph,
[in] PPEER_RECORD pRecord
);
Parameters
[in] hGraph
Handle to the peer graph.
[in] pRecord
Pointer to a PEER_RECORD structure that contains the new data for the record.
Return value
If the function call succeeds, the return value is S_OK. Otherwise, it returns one of the following values.
Return code | Description |
---|---|
|
One of the parameters is not valid. |
|
The peer graph has never been synchronized. Records cannot be updated until the graph has been synchronized. |
|
The handle to the peer graph is invalid. |
|
The peer graph must be initialized with a call to PeerGraphStartup before using this function. |
|
The specified record was not found. |
Remarks
The following members of the PEER_RECORD structure can be modified:
- pwzAttributes
- ftExpiration - the expiration can only be increased
- data
- pwzLastModified - filled in by default if no value is supplied
Examples
This code snippet shows how to update a record.
// dwFlags is updated to automatically refresh the record if it is about to expire.
record.dwFlags = PEER_RECORD_FLAG_AUTOREFRESH;
// The record data is updated with the string contained in pwzUserData.
record.data.cbData = (ULONG) wcslen(pwzUserData) * sizeof(WCHAR);
record.data.pbData = (PBYTE) pwzUserData;
HRESULT hr = PeerGraphUpdateRecord(hGraph, &record;);
if (FAILED(hr))
{
// Insert your code to handle the error here.
}
else
{
// Insert your application specific code here.
}
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 | P2PGraph.lib |
DLL | P2PGraph.dll |