[fpc-pascal] Resolving a local hostnames to an IP address

Ludo Brands ludo.brands at free.fr
Tue Apr 17 10:07:53 CEST 2012


> Bear in mind that files of that type are very much optional 
> on Windows, 
> a sop to those who demanded them in order to implement things 
> like innd 
> so they could claim it was as good as Unix. My experience is that the 
> nameserver addresses are available from the Windows registry if 
> configured statically, I suspect- but I've not checked and 
> aren't going 
> to- that that sort of thing will be copied into the registry if it 
> arrives using DHCP.
> 

The synapse library has in synamisc.pas function GetDNS: string; which
returns all DNS servers known on the system (windows or unix).  It uses on
windows the GetNetworkParams api function from IPHlpAPI.lib and, if not
succesfull, tries the windows registry.

Ludo




More information about the fpc-pascal mailing list