VirtualBox

Changeset 2960 in vbox for trunk


Ignore:
Timestamp:
May 31, 2007 11:26:17 AM (18 years ago)
Author:
vboxsync
Message:

Implement Windows host variant of determining domain name to pass in NAT DHCP. This required bumping the Windows API version.

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Makefile.kmk

    r2784 r2960  
    334334Storage/DrvHostDVD.cpp_SDKS.win = W2K3DDK
    335335Drivers_DEFS       = IN_IDE_R3
     336Drivers_DEFS.win.x86    += _WIN32_WINNT=0x0500
     337Drivers_DEFS.win.amd64  += _WIN32_WINNT=0x0510
    336338Drivers_INCS      := \
    337339        $(PATH_SUB_CURRENT) \
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r2959 r2960  
    1616                               const char **ppszDomain)
    1717{
     18    int rc = 0;
    1819    FIXED_INFO *FixedInfo=NULL;
    1920    ULONG    BufLen;
     
    2122    IP_ADDR_STRING *pIPAddr;
    2223    struct in_addr tmp_addr;
    23 
    24     *ppszDomain = NULL;
    25     /** @todo implement search list for Windows host. */
    2624
    2725    FixedInfo = (FIXED_INFO *)GlobalAlloc(GPTR, sizeof(FIXED_INFO));
     
    4240            FixedInfo = NULL;
    4341        }
    44         return -1;
     42        rc = -1;
     43        goto get_dns_prefix;
    4544    }
    4645
     
    6059        FixedInfo = NULL;
    6160    }
    62     return 0;
     61
     62get_dns_prefix:
     63    *ppszDomain = NULL;
     64    {
     65        OSVERSIONINFO ver;
     66        char szDnsDomain[256];
     67        DWORD dwSize = sizeof(szDnsDomain);
     68
     69        GetVersionEx(&ver);
     70        if (ver.dwMajorVersion >= 5)
     71        {
     72            /* GetComputerNameEx exists in Windows versions starting with 2000. */
     73            if (GetComputerNameEx(ComputerNameDnsDomain, szDnsDomain, &dwSize))
     74            {
     75                if (szDnsDomain[0])
     76                {
     77                    /* Just non-empty strings are valid. */
     78                    *ppszDomain = RTStrDup(szDnsDomain);
     79                    if (pData->fPassDomain)
     80                        LogRel(("NAT: passing domain name %s\n", szDnsDomain));
     81                    else
     82                        Log(("nat: ignoring domain %s\n", szDnsDomain));
     83                }
     84            }
     85            else
     86                Log(("nat: GetComputerNameEx failed (%d)\n", GetLastError()));
     87        }
     88    }
     89    return rc;
    6390}
    6491
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette