Moore's Mind

Wednesday, September 28, 2005

Problems Enumerating EndPoints

I'm trying to put together a demo application that uses all the capabilities of the new PeerCollab Managed Wrapper. However, enumerating endpoints for a given contact is giving me problems.

When I call PeerCollabEnumEndpoints passing in what appears to be valid PEER_CONTACT info, I get an E_INVALIDARG result. At first, I was trying to pass in contact info for a PEER_NEAR_ME. Figuring, maybe the contact needs to be added to my list of contacts, I did this, but the same error occurs.

The defintion of PEER_CONTACT works for all the other API calls, so I don't think its the problem.

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct PEER_CONTACT
[MarshalAs(UnmanagedType.LPWStr)] public String pwzPeerName;
[MarshalAs(UnmanagedType.LPWStr)] public String pwzFriendlyName;
public int fWatch;
public int WatcherPermissions;

The API is the following:

HRESULT WINAPI PeerCollabEnumEndpoints(
IN const PCPEER_CONTACT pcContact,
OUT HPEERENUM * phPeerEnum);

My DllImport definition is:

[DllImport("p2p.dll", PreserveSig=true)]
internal static extern uint PeerCollabEnumEndpoints(ref PEER_CONTACT pcContact, ref IntPtr phPeerEnum);

Yet, when I pass the same PEER_CONTACT info to PeerCollabDeleteContact, there is not error.

I'm trying to enumerate the list of endpoints in order to send an invitation.

Any help is appreciated.


  • At 7:29 AM, Blogger Silver Fox said…

    Hey, you have a great blog here! I'm definitely going to bookmark you!

    I'm willing to pay you $10 - $50 hr to work at home. Hey, there's no investment. All you need to do is visit my website and sign-up for free.

    Come and check it out if you get time :-)

  • At 9:49 PM, Blogger Tripp Parks said…

    change public int fWatch to public bool fWatch
    set it to true and call update contact, then try enumerating endpoints

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    internal struct PEER_CONTACT
    public string pwzPeerName;
    public String pwzFriendlyName;
    public bool fWatch;
    public bool WatcherPermissions;

  • At 4:02 PM, Blogger Ad. said…

    I followed Tripp's suggestion. When signed in to Internet, setting Watch to true, calling PeerCollabUpdateContact before calling PeerCollabEnumEndpoints prevents the exception. However, no endpoints are returned.

  • At 11:35 PM, Blogger Tripp Parks said…

    try adding the contact that you are enumerating from and setting watcher permission to true on the side you are trying to enumerate

  • At 8:15 AM, Blogger Ad. said…

    I used netsh to set watch = true and watchPerm = Allow on both contacts. Still no luck getting any endpoints at either side.

  • At 10:50 AM, Blogger Ad. said…

    I've posted a managed c++ test application and question on the Windows Vista formum...


Post a Comment

<< Home