NetBios tables, and IP to MAC address translation

I'm trying to programatically get the information which is returned by running the call nbtstat.  Basically, I want to get a look at a computers Netbios Name Table.  Unfortunately, all I have is the computers IP address.

From what I can tell, you can use the NetBios() call to get the Name table of a computer, but you need to have the computer's MAC address to make the NetBios() call.   ( Actually, I'm not even sure that would work come to think of it. I'm on a different physical network than the computer I'm querying.)  At any rate, I can't find a way to translate between IP and MAC.  Win2k has SendArp() but I need something for general Win32.  And writing my own arp driver appears to require raw socket access which has the same problem.

Can anyone tell me how to get the name table nbtstat will display to you.  Am I on the right track?  If so, how can I get the right MAC Address?  Any tips appreciated.
nothingmanAsked:
Who is Participating?
 
NickRepinCommented:
0
 
nothingmanAuthor Commented:
Slight clarification.  nbtstat is not a call.  It's a program that ships with Windows.  You give it an IP and it gives you the Name table.  
0
 
nothingmanAuthor Commented:
Do you have a specific function in mind.  The only way I can see to do it based on the IP Helper API is with SendArp(), and that only works on Win2k.  
0
 
NickRepinCommented:
GetAdaptersInfo()
IP_ADAPTER_INFO.CurrentIpAddress   <-- IP
IP_ADAPTER_INFO.IpAddressList

IP_ADAPTER_INFO.Address   <---- MAC
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.