/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <stdlib.h>
#include <windows.h>
#include <stdio.h>
#include <stddef.h>
#include <iprtrmib.h>
#include <time.h>
#include <assert.h>
#include <iphlpapi.h>
#include "jni_util.h"
/* JNI ids */
/*
* Utility routine to append s2 to s1 with a space delimiter.
* strappend(s1="abc", "def") => "abc def"
* strappend(s1="", "def") => "def
*/
return;
if (s1[0] != 0) /* needs space character */
len++;
return;
if (s1[0] != 0) {
}
}
/*
* Windows 2000/XP
*
* Use registry approach based on settings described in Appendix C
*
* DNS suffix list is obtained from SearchList registry setting. If
* this is not specified we compile suffix list based on the
* per-connection domain suffix.
*
* DNS name servers and domain settings are on a per-connection
* basic. We therefore enumerate the network adapters to get the
* names of each adapter and then query the corresponding registry
* settings to obtain NameServer/DhcpNameServer and Domain/DhcpDomain.
*/
int gotSearchList = 0;
/*
* First see if there is a global suffix list specified.
*/
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
0,
if (ret == ERROR_SUCCESS) {
if (ret == ERROR_SUCCESS) {
gotSearchList = 1;
}
}
}
/*
* Ask the IP Helper library to enumerate the adapters
*/
size = sizeof(IP_ADAPTER_INFO);
if (ret == ERROR_BUFFER_OVERFLOW) {
}
/*
* Iterate through the list of adapters as registry settings are
* keyed on the adapter name (GUID).
*/
if (ret == ERROR_SUCCESS) {
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s",
curr->AdapterName);
key,
0,
if (ret == ERROR_SUCCESS) {
/*
* Is DHCP enabled on this interface
*/
dwLen = sizeof(enableDhcp);
/*
* If we don't have the suffix list when get the Domain
* or DhcpDomain. If DHCP is enabled then Domain overides
* DhcpDomain
*/
if (!gotSearchList) {
result[0] = '\0';
enableDhcp) {
}
if (ret == ERROR_SUCCESS) {
}
}
/*
* Get DNS servers based on NameServer or DhcpNameServer
* registry setting. If NameServer is set then it overrides
* DhcpNameServer (even if DHCP is enabled).
*/
result[0] = '\0';
enableDhcp) {
}
if (ret == ERROR_SUCCESS) {
}
/*
* Finished with this registry key
*/
}
/*
* Onto the next adapeter
*/
}
}
/*
* Free the adpater structure
*/
if (adapterP) {
}
return STS_SL_FOUND & STS_NS_FOUND;
}
/*
* Initialize JNI field IDs.
*/
{
}
/*
* Class: sun_net_dns_ResolverConfgurationImpl
* Method: loadConfig0
* Signature: ()V
*/
{
searchlist[0] = '\0';
nameservers[0] = '\0';
/*
* Populate static fields in sun.net.DefaultResolverConfiguration
*/
}
/*
* Class: sun_net_dns_ResolverConfgurationImpl
* Method: notifyAddrChange0
* Signature: ()I
*/
{
HANDLE h;
if (rc == ERROR_IO_PENDING) {
if (rc != 0) {
return 0; /* address changed */
}
}
/* error */
return -1;
}