Click here to Skip to main content
15,891,248 members
Articles / Hosted Services / Serverless

Peer Group - Identities

Rate me:
Please Sign up or sign in to vote.
4.80/5 (3 votes)
8 Feb 20068 min read 29.6K   286   16  
Understanding Peer Group Identities and Microsoft's Peer-to-Peer technology.
using System;
using System.Runtime.InteropServices;

namespace Peer.Identity
{
	[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
	internal struct PEER_NAME_PAIR
	{
		public int dwSize;
		public string pwzPeerName;
		public string pwzFriendlyName;
	};

	internal class PeerIdentityNative
	{
		[DllImport("p2p.dll")]
		internal static extern uint PeerFreeData(IntPtr pvData);

		[DllImport("p2p.dll")]
		internal static extern uint PeerGetItemCount(IntPtr hPeerEnum, out uint pCount);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerGetNextItem(IntPtr hPeerEnum, ref uint pCount, out IntPtr ppvItems);

		[DllImport("p2p.dll")]
		internal static extern uint PeerEndEnumeration(IntPtr hPeerEnum);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityCreate(IntPtr pwzClassifier, IntPtr pwzFriendlyName, IntPtr hCryptProv, out string ppwzIdentity);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityGetFriendlyName(string pwzIdentity, out string ppwzFriendlyName);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentitySetFriendlyName(string pwzIdentity, string pwzFriendlyName);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityGetCryptKey(string pwzIdentity, out IntPtr phCryptProv);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityDelete(string pwzIdentity);

		[DllImport("p2p.dll")]
		internal static extern uint PeerEnumIdentities(out IntPtr phPeerEnum);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerEnumGroups(string pwzIdentity, out IntPtr phPeerEnum);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerCreatePeerName(IntPtr pwzIdentity, IntPtr pwzClassifier, out string ppwzPeerName);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityGetXML(string pwzIdentity, out string ppwzIdentityXML);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityExport(string pwzIdentity, string pwzPassword, out string ppwzExportXML);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityImport(string pwzImportXML, string pwzPassword, out string ppwzIdentity);

		[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
		internal static extern uint PeerIdentityGetDefault(out string ppwzPeerName);
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Canada Canada
Adrian Moore is the Development Manager for the SCADA Vision system developed by ABB Inc in Calgary, Alberta.

He has been interested in compilers, parsers, real-time database systems and peer-to-peer solutions since the early 90's. In his spare time, he is currently working on a SQL parser for querying .NET DataSets (http://www.queryadataset.com).

Adrian is a Microsoft MVP for Windows Networking.

Comments and Discussions