More P2P changes/additions

pull/164/head
dahall 2020-08-28 16:49:21 -06:00
parent 7ebd5aaf58
commit 005c158ecc
3 changed files with 41 additions and 9 deletions

View File

@ -1797,7 +1797,7 @@ namespace Vanara.PInvoke
// *phPeerEvent );
[DllImport(Lib_P2P, SetLastError = false, ExactSpelling = true)]
[PInvokeData("p2p.h", MSDNShortId = "NF:p2p.PeerCollabRegisterEvent")]
public static extern HRESULT PeerCollabRegisterEvent(HANDLE hEvent, uint cEventRegistration, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] PEER_COLLAB_EVENT_REGISTRATION[] pEventRegistrations, out SafeHPEEREVENT phPeerEvent);
public static extern HRESULT PeerCollabRegisterEvent(HANDLE hEvent, uint cEventRegistration, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] PEER_COLLAB_EVENT_REGISTRATION[] pEventRegistrations, out SafeCollabHPEEREVENT phPeerEvent);
/// <summary>The <c>PeerCollabSetEndpointName</c> function sets the name of the current endpoint used by the peer application.</summary>
/// <param name="pwzEndpointName">
@ -2374,22 +2374,22 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HPEEREVENT"/> that is disposed using <see cref="PeerCollabUnregisterEvent"/>.</summary>
public class SafeHPEEREVENT : SafeHANDLE
public class SafeCollabHPEEREVENT : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHPEEREVENT"/> class and assigns an existing handle.</summary>
/// <summary>Initializes a new instance of the <see cref="SafeCollabHPEEREVENT"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle">
/// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
/// </param>
public SafeHPEEREVENT(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
public SafeCollabHPEEREVENT(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
/// <summary>Initializes a new instance of the <see cref="SafeHPEEREVENT"/> class.</summary>
private SafeHPEEREVENT() : base() { }
/// <summary>Initializes a new instance of the <see cref="SafeCollabHPEEREVENT"/> class.</summary>
private SafeCollabHPEEREVENT() : base() { }
/// <summary>Performs an implicit conversion from <see cref="SafeHPEEREVENT"/> to <see cref="HPEEREVENT"/>.</summary>
/// <summary>Performs an implicit conversion from <see cref="SafeCollabHPEEREVENT"/> to <see cref="HPEEREVENT"/>.</summary>
/// <param name="h">The safe handle instance.</param>
/// <returns>The result of the conversion.</returns>
public static implicit operator HPEEREVENT(SafeHPEEREVENT h) => h.handle;
public static implicit operator HPEEREVENT(SafeCollabHPEEREVENT h) => h.handle;
/// <inheritdoc/>
protected override bool InternalReleaseHandle() => PeerCollabUnregisterEvent(handle).Succeeded;

View File

@ -2017,7 +2017,7 @@ namespace Vanara.PInvoke
[DllImport(Lib_P2P, SetLastError = false, ExactSpelling = true)]
[PInvokeData("p2p.h", MSDNShortId = "NF:p2p.PeerGroupRegisterEvent")]
public static extern HRESULT PeerGroupRegisterEvent(HGROUP hGroup, HANDLE hEvent, uint cEventRegistration,
[In, MarshalAs(UnmanagedType.LPArray)] PEER_GROUP_EVENT_REGISTRATION[] pEventRegistrations, out SafeHPEEREVENT phPeerEvent);
[In, MarshalAs(UnmanagedType.LPArray)] PEER_GROUP_EVENT_REGISTRATION[] pEventRegistrations, out SafeGroupHPEEREVENT phPeerEvent);
/// <summary>
/// The <c>PeerGroupSearchRecords</c> function searches the local peer group database for records that match the supplied criteria.
@ -2510,5 +2510,27 @@ namespace Vanara.PInvoke
/// <inheritdoc/>
public IntPtr DangerousGetHandle() => handle;
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HPEEREVENT"/> that is disposed using <see cref="PeerGroupUnregisterEvent"/>.</summary>
public class SafeGroupHPEEREVENT : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeGroupHPEEREVENT"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle">
/// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
/// </param>
public SafeGroupHPEEREVENT(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
/// <summary>Initializes a new instance of the <see cref="SafeGroupHPEEREVENT"/> class.</summary>
private SafeGroupHPEEREVENT() : base() { }
/// <summary>Performs an implicit conversion from <see cref="SafeGroupHPEEREVENT"/> to <see cref="HPEEREVENT"/>.</summary>
/// <param name="h">The safe handle instance.</param>
/// <returns>The result of the conversion.</returns>
public static implicit operator HPEEREVENT(SafeGroupHPEEREVENT h) => h.handle;
/// <inheritdoc/>
protected override bool InternalReleaseHandle() => PeerGroupUnregisterEvent(handle).Succeeded;
}
}
}

View File

@ -12,6 +12,16 @@ namespace Vanara.PInvoke
private const string Lib_P2P = "P2P.dll";
private const string Lib_P2PGraph = "p2pgraph.dll";
/// <summary/>
public static readonly Guid PEER_GROUP_ROLE_ADMIN = new Guid(0x04387127, 0xaa56, 0x450a, 0x8c, 0xe5, 0x4f, 0x56, 0x5c, 0x67, 0x90, 0xf4);
/// <summary/>
public static readonly Guid PEER_GROUP_ROLE_MEMBER = new Guid(0xf12dc4c7, 0x0857, 0x4ca0, 0x93, 0xfc, 0xb1, 0xbb, 0x19, 0xa3, 0xd8, 0xc2);
/// <summary/>
public static readonly Guid PEER_GROUP_ROLE_INVITING_MEMBER = new Guid(0x4370fd89, 0xdc18, 0x4cfb, 0x8d, 0xbf, 0x98, 0x53, 0xa8, 0xa9, 0xf9, 0x05);
/// <summary/>
public static readonly Guid PEER_COLLAB_OBJECTID_USER_PICTURE = new Guid(0xdd15f41f, 0xfc4e, 0x4922, 0xb0, 0x35, 0x4c, 0x06, 0xa7, 0x54, 0xd0, 0x1d);
/// <summary>The <c>PEER_APPLICATION_REGISTRATION_TYPE</c> enumeration defines the set of peer application registration flags.</summary>
/// <remarks>
/// <para>