Changeset 53242 in vbox
- Timestamp:
- Nov 5, 2014 4:28:08 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96793
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r52769 r53242 328 328 socket \ 329 329 $(LIB_VMM) 330 331 VBoxSVC_LIBS.win += \ 332 $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/dnsapi.lib 330 333 331 334 VBoxSVC_INTERMEDIATES = \ -
trunk/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp
r53165 r53242 25 25 26 26 #include <Windows.h> 27 #include <windns.h> 27 28 28 29 #include <algorithm> … … 202 203 LONG lrc; 203 204 204 std::string strNameServer;205 205 std::string strDomain; 206 std::string strDhcpNameServer;207 206 std::string strDhcpDomain; 208 207 std::string strSearchList; /* NB: comma separated, no spaces */ … … 237 236 --cbKeyData; /* don't count trailing NUL if present */ 238 237 239 if (RTStrICmp("NameServer", keyName) == 0) 240 { 241 strNameServer.assign(keyData, cbKeyData); 242 Log2(("... NameServer=\"%s\"\n", strNameServer.c_str())); 243 } 244 else if (RTStrICmp("Domain", keyName) == 0) 238 if (RTStrICmp("Domain", keyName) == 0) 245 239 { 246 240 strDomain.assign(keyData, cbKeyData); 247 241 Log2(("... Domain=\"%s\"\n", strDomain.c_str())); 248 242 } 249 else if (RTStrICmp("DhcpNameServer", keyName) == 0)250 {251 strDhcpNameServer.assign(keyData, cbKeyData);252 Log2(("... DhcpNameServer=\"%s\"\n", strDhcpNameServer.c_str()));253 }254 243 else if (RTStrICmp("DhcpDomain", keyName) == 0) 255 244 { … … 266 255 HostDnsInformation info; 267 256 268 if (!strNameServer.empty()) 269 vappend(info.servers, strNameServer); 270 else if (!strDhcpNameServer.empty()) 271 vappend(info.servers, strDhcpNameServer); 257 /* 258 * When name servers are configured statically it seems that the 259 * value of Tcpip\Parameters\NameServer is NOT set, inly interface 260 * specific NameServer value is (which triggers notification for 261 * us to pick up the change). Fortunately, DnsApi seems to do the 262 * right thing there. 263 */ 264 DNS_STATUS status; 265 PIP4_ARRAY pIp4Array = NULL; 266 267 // NB: must be set on input it seems, despite docs' claim to the contrary. 268 DWORD cbBuffer = sizeof(&pIp4Array); 269 270 status = DnsQueryConfig(DnsConfigDnsServerList, 271 DNS_CONFIG_FLAG_ALLOC, NULL, NULL, 272 &pIp4Array, &cbBuffer); 273 274 if (status == NO_ERROR && pIp4Array != NULL) 275 { 276 for (DWORD i = 0; i < pIp4Array->AddrCount; ++i) 277 { 278 char szAddrStr[16] = ""; 279 RTStrPrintf(szAddrStr, sizeof(szAddrStr), "%RTnaipv4", pIp4Array->AddrArray[i]); 280 281 Log2((" server %d: %s\n", i+1, szAddrStr)); 282 info.servers.push_back(szAddrStr); 283 } 284 285 LocalFree(pIp4Array); 286 } 272 287 273 288 if (!strDomain.empty())
Note:
See TracChangeset
for help on using the changeset viewer.