|
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.
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.