Moore's Mind

Saturday, October 15, 2005

PeerPnrpToDnsName and PeerDnsToPnrpName

In case anyone is interested, the C# DllImports are below...

[DllImport("pnrpnsp.dll", CharSet=CharSet.Unicode)]internal static extern int PeerPnrpToDnsName(string pwszPnrpNameStr, System.Text.StringBuilder pwszDnsNameStr, ref int pcchDnsName);

[DllImport("pnrpnsp.dll", CharSet=CharSet.Unicode)]
internal static extern int PeerDnsToPnrpName(string pwszDnsNameStr, System.Text.StringBuilder pwszPnrpNameStr, ref int pcchPnrpName);

Use the following code to call the first function...

int length = 255;
System.Text.StringBuilder DnsName = new System.Text.StringBuilder(length);
int err = PnrpNative.PeerPnrpToDnsName(PnrpName, DnsName, ref length);

In the first case, take any Peer Name, for example, 0.test (zero.test) previously registered to get the equivalent serverless DNS name. In this case, test-p.p0.pnrp.net is returned. Passing this into the second function returnes the original 0.test peer name. Use

netsh p2p pnrp cloud>show names

to see other peer name examples that may be registered on your computer. I'm still not sure what the benefit of getting the DNS name gives me.

What I'd like to know though is what parameters do you need to pass to PNRP lookup to get the equivalent of netsh p2p pnrp cloud> show names list of registered names? If anyone knows, please leave a comment.

2 Comments:

  • At 5:44 AM, Blogger Ad. said…

    Looks like these functions have been renamed for the Windows Vista October CTP. They are now called PeerHostNameToPeerName and PeerNameToPeerHostName.

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

    There is no APi for enumerating registered peernames. Sorry:(

     

Post a Comment

<< Home