'Extract DNS info from a registry key.'

def _config_win32_fromkey(self, key):

    try:
        (servers, rtype) = _winreg.QueryValueEx(key, 'NameServer')
    except WindowsError:
        servers = None
    if servers:
        self._config_win32_nameservers(servers)
        try:
            (dom, rtype) = _winreg.QueryValueEx(key, 'Domain')
            if dom:
                self._config_win32_domain(dom)
        except WindowsError:
            pass
    else:
        try:
            (servers, rtype) = _winreg.QueryValueEx(key, 'DhcpNameServer')
        except WindowsError:
            servers = None
        if servers:
            self._config_win32_nameservers(servers)
            try:
                (dom, rtype) = _winreg.QueryValueEx(key, 'DhcpDomain')
                if dom:
                    self._config_win32_domain(dom)
            except WindowsError:
                pass
    try:
        (search, rtype) = _winreg.QueryValueEx(key, 'SearchList')
    except WindowsError:
        search = None
    if search:
        self._config_win32_search(search)
