From: Noel D. <noe...@te...> - 2003-09-05 12:49:28
|
I'm using pydns-2.3.0 on windows 2000. The function RegistryResolve() in win32dns.py uses a number of techniques to discover the name of DNS nameservers on various Windows platforms by querying certain registry keys. The techniques used will not discover any nameservers on Windows 2000 if the network interface is configured via DHCP. On Windows 2000, if the network interface is configured via DHCP then the nameserver can be found by querying the key DHCPNameServer. The following code can be used: try: # for win2000, dhcp enabled interface y= _winreg.OpenKey(x, r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces") for i in range(1000): try: n=_winreg.EnumKey(y,i) z=_winreg.OpenKey(y,n) try: nameserver,dummytype=_winreg.QueryValueEx(z,'DHCPNameServer') if nameserver and not (nameserver in nameservers): nameservers.extend(stringdisplay(nameserver)) except EnvironmentError: pass _winreg.CloseKey(z) except EnvironmentError: break _winreg.CloseKey(y) except EnvironmentError: pass This code is the code for whistler but with different registry keys. I suppose that this code could be rewritten to query the registry key "EnableDHCP" to see if the interface is configured by DHCP, then it could call the above code, otherwise it should default to the existing code. More information about Windows 2000 tcp/ip settings can be found on http://www.microsoft.com/technet/treeview/default.asp?url=/technet/itsolutions/network/deploy/depovg/tcpip2k.asp Regard, Noel. -- __________________________________________________________ Sign-up for your own personalized E-mail at Mail.com http://www.mail.com/?sr=signup CareerBuilder.com has over 400,000 jobs. Be smarter about your job search http://corp.mail.com/careers |