VirtualBox

Changeset 18239 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Mar 25, 2009 7:49:45 AM (16 years ago)
Author:
vboxsync
Message:

NAT: better wide character handling in DNS suffix resolving

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r18226 r18239  
    1111# include <poll.h>
    1212#else
     13# include <Winnls.h>
    1314# define _WINSOCK2API_
    1415# include <IPHlpApi.h>
     
    332333    PIP_ADAPTER_DNS_SERVER_ADDRESS dns = NULL;
    333334    ULONG size = 0;
     335    int wlen = 0;
    334336    char *suffix;
    335337    struct dns_entry *da = NULL;
     
    395397            dns = dns->Next;
    396398        }
     399#if 1
    397400        buff_size = wcstombs(NULL, addr->DnsSuffix, 0);
    398401        if (buff_size == 0 || buff_size == (size_t)-1)
     
    400403        suffix = RTMemAllocZ(buff_size + 1);
    401404        wcstombs(suffix, addr->DnsSuffix, buff_size);
     405        suffix[buff_size] = '\0';
    402406        LogRel(("NAT: adding %s to DNS suffix list\n", suffix));
     407#else
     408        /*Probably more correct way but not working */
     409        buff_size = WideCharToMultiByte(CP_ACP, 0, addr->DnsSuffix, -1, NULL, 0, NULL, NULL);
     410        suffix = RTMemAllocZ(buff_size);
     411        WideCharToMultiByte(CP_ACP, 0, addr->DnsSuffix, -1, suffix, buff_size, NULL, NULL);
     412#endif
    403413        *ppszDomain = suffix;
    404414    next:
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