Hrrrrmm... OK, I fully expect to be labeled as 'brain-dead' for this one, but here goes....

Anyone know of an API call which can be used to locate a NetBIOS alias on my LAN? Returning either hostname or IP would be fine... I can't seem to find one anywhere....

GetHostByName seems the obvious choice, but not even close...

Getting an IP based on the MACHINE name (or vice-versa) is no problem, but an alias (logged-in username, etc...) is a different matter....

I've considered querying the WINS database, but it seems like there must be a more efficient way. NetMessageBufferSend can find the (username) NetBIOS alias with no problem.... I've considered running a sniffer to analyze the packets sent by this call....

My guess on how NetMessageBufferSend works:
(just a guess, this is without any real analysis)
It simply broadcasts to the network, and every machine running the Messenger service receives the broadcast and checks itself for the specified alias. If a machine has the specified alias, it replies to the machine which sent the message (in addition to displaying the pop-up on the 'receiving' machine).
If the 'sending' machine receives no response after a certain time-out period, the call returns an error which assumes the alias does not exist on the network.

Am I completely off-track, or am I overlooking something incredibly obvious, here?
Thanks for any help or insight anyone might have...
Posted on 2003-01-29 15:33:26 by Volponi