Only in m:\bind: WINNTPORT
Only in m:\bind: bind-4.9.3-BETA26.tar.gz
Only in m:\bind: bind-4.9.3-BETA27.tar.gz
Only in m:\bind: bind-4.9.3-BETA29.tar.gz
Only in m:\bind: bind-4.9.3-BETA30.tar.gz
Only in m:\bind: bind-4.9.3-BETA31.tar.gz
Only in m:\bind: bind-4.9.3-BETA32.tar.gz
Only in m:\bind: buildallnt.bat
diff --recurs m:\bindb32/compat/include/sys/cdefs.h m:\bind/compat/include/sys/cdefs.h
100,109c100,111
< #ifndef __GNUC__
< #define	__const				/* delete pseudo-ANSI C keywords */
< #define	__inline
< #define	__signed
< #define	__volatile
< /*
<  * In non-ANSI C environments, new programs will want ANSI-only C keywords
<  * deleted from the program and old programs will want them left alone.
<  * When using a compiler other than gcc, programs using the ANSI C keywords
<  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
---
> #ifndef WINNT
> #ifndef __GNUC__
> #define	__const				/* delete pseudo-ANSI C keywords */
> #define	__inline
> #define	__signed
> #define	__volatile
> #endif
> /*
>  * In non-ANSI C environments, new programs will want ANSI-only C keywords
>  * deleted from the program and old programs will want them left alone.
>  * When using a compiler other than gcc, programs using the ANSI C keywords
>  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
113c115
< #ifndef	NO_ANSI_KEYWORDS
---
> #ifndef NO_ANSI_KEYWORDS
118c120
< #endif
---
> #endif /* WINNT */
Only in m:\bind/compat/lib: MSG00001.bin
Only in m:\bind/compat/lib: WinRel
diff --recurs m:\bindb32/compat/lib/ftruncate.c m:\bind/compat/lib/ftruncate.c
44,53c44,56
< 
< 	/* maybe shorten... */
< 	if (wantsize < cursize) {
< 		struct flock fl;
< 
< 		fl.l_whence = 0;
< 		fl.l_len = 0;
< 		fl.l_start = wantsize;
< 		fl.l_type = F_WRLCK;
< 		return (fcntl(fd, F_FREESP, &fl));
---
> 	/* maybe shorten... */
> 	if (wantsize < cursize) {
> #ifndef WINNT
> 		struct flock fl;
> 
> 		fl.l_whence = 0;
> 		fl.l_len = 0;
> 		fl.l_start = wantsize;
> 		fl.l_type = F_WRLCK;
> 		return (fcntl(fd, F_FREESP, &fl));
> #else
> 		return (lseek(fd, wantsize, 0) && SetEndOfFile((HANDLE)fd));
> #endif
diff --recurs m:\bindb32/compat/lib/gettimeofday.c m:\bind/compat/lib/gettimeofday.c
15,21c15,22
< 	time_t clock, time __P((time_t *));
< 
< 	if (time(&clock) == (time_t) -1)
< 		return (-1);
< 	if (tvp) {
< 		tvp->tv_sec = clock;
< 		tvp->tv_usec = 0;
---
> #ifndef WINNT
> 	time_t clock, time __P((time_t *));
> 
> 	if (time(&clock) == (time_t) -1)
> 		return (-1);
> 	if (tvp) {
> 		tvp->tv_sec = clock;
> 		tvp->tv_usec = 0;
23,24c24,25
< 	if (tzp) {
< 		tzp->tz_minuteswest = 0;
---
> 	if (tzp) {
> 		tzp->tz_minuteswest = 0;
26a28,33
> #else
> 	struct _timeb timebuffer;
> 	_ftime(&timebuffer);
> 	tvp->tv_sec = (long) timebuffer.time;
> 	tvp->tv_usec = (long) (1000 * (timebuffer.millitm));
> #endif
Only in m:\bind/compat/lib: lib44bsd.mak
Only in m:\bind/compat/lib: lib44bsd.mdp
Only in m:\bind/compat/lib: lib44bsd.ncb
Only in m:\bind/compat/lib: lib44bsd.vcp
Only in m:\bind/compat/lib: log.c
Only in m:\bind/compat/lib: log.h
Only in m:\bind/compat/lib: makemc.bat
Only in m:\bind/compat/lib: messages.aps
Only in m:\bind/compat/lib: messages.h
Only in m:\bind/compat/lib: messages.mc
Only in m:\bind/compat/lib: messages.rc
diff --recurs m:\bindb32/compat/lib/mktemp.c m:\bind/compat/lib/mktemp.c
101,104c101,106
< 	extern int errno;
< 	register char *start, *trv;
< 	struct stat sbuf;
< 	u_int pid;
---
> #ifndef WINNT
> 	extern int errno;
> #endif
> 	register char *start, *trv;
> 	struct stat sbuf;
> 	u_int pid;
106,110c108,112
< 	pid = getpid();
< 	for (trv = path; *trv; ++trv);		/* extra X's get set to 0's */
< 	while (*--trv == 'X') {
< 		*trv = (pid % 10) + '0';
< 		pid /= 10;
---
> 	pid = getpid();
> 	for (trv = path; *trv; ++trv);		/* extra X's get set to 0's */
> 	while (*--trv == 'X') {
> 		*trv = (pid % 10) + '0';
> 		pid /= 10;
124a127
> #ifndef WINNT
125a129,131
> #else
> 				WSASetLastError(ENOTDIR);
> #endif
Only in m:\bind/compat/lib: ntmisc.c
diff --recurs m:\bindb32/compat/lib/strcasecmp.c m:\bind/compat/lib/strcasecmp.c
61,65c61,67
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/cdefs.h>
< #if (!defined(BSD)) || (BSD < 199306)
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/cdefs.h>
> #endif
> #if (!defined(BSD)) || (BSD < 199306)
> #include "../../conf/portability.h"
67,68c69,70
< #include <string.h>
< #endif
---
> #include <string.h>
> #endif
70c72
< #ifndef NEED_STRCASECMP
---
> #ifndef NEED_STRCASECMP
116c118
< 	const char  *s1, *s2;
---
> 	const char *s1, *s2;
diff --recurs m:\bindb32/compat/lib/strerror.c m:\bind/compat/lib/strerror.c
61c61,63
< #include <sys/param.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
diff --recurs m:\bindb32/compat/lib/strpbrk.c m:\bind/compat/lib/strpbrk.c
61c61,63
< #include <sys/param.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
diff --recurs m:\bindb32/compat/lib/strtoul.c m:\bind/compat/lib/strtoul.c
64c64,66
< #include <sys/param.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
diff --recurs m:\bindb32/compat/lib/writev.c m:\bind/compat/lib/writev.c
9c9,10
<  */
---
>  *  WindowsNT
>  */
11c12
< #if defined(_CRAY)
---
> #if defined(_CRAY)
15,16c16,17
< #include <sys/stat.h>
< #include <sys/socket.h>
---
> #include <sys/stat.h>
> #include <sys/socket.h>
82a84,127
> }
> #endif
> 
> #ifdef WINNT
> #define OWN_WRITEV
> #define TIMEOUT_SEC 120
> #include <stdarg.h>
> #include "../../conf/portability.h"
> 
> 
> /*
>  * writev --
>  * simplistic writev implementation for WindowsNT using the WriteFile WIN32API.
>  */	
> int
> writev(fd, iov, iovcnt)
> 	int fd;
> 	struct iovec *iov;
> 	int iovcnt;
> {
> 	int i;
> 	char *base;
> 	DWORD BytesWritten, TotalBytesWritten = 0, len, dwWait;
> 	extern HANDLE hReadWriteEvent;
> 	OVERLAPPED overlap;
> 	BOOL ret; 
> 
> 	for (i=0; i<iovcnt; i++) {
> 		base = iov[i].iov_base;
> 		len = (DWORD)iov[i].iov_len;
> 		overlap.Offset = overlap.OffsetHigh = (DWORD)0;
> 		overlap.hEvent = hReadWriteEvent;
> 		ret = WriteFile((HANDLE)fd, (char *)base, len,
> 		              (LPDWORD)&BytesWritten, (LPOVERLAPPED)&overlap);
> 		if ((ret == FALSE) && (errno != ERROR_IO_PENDING)) {
> 				return (-1);
> 		}
> 		dwWait = WaitForSingleObject((HANDLE)hReadWriteEvent, (DWORD)TIMEOUT_SEC * 1000);
> 		if ((dwWait == WAIT_FAILED) || (dwWait == WAIT_TIMEOUT)){
> 			return (-1);
> 		}
> 		TotalBytesWritten += BytesWritten;
> 	}
> 	return((int)TotalBytesWritten);
diff --recurs m:\bindb32/conf/master/root.cache m:\bind/conf/master/root.cache
15,16c15,16
< ;       last update:    Nov 8, 1995
< ;       related version of root zone:   1995110800
---
> ;       last update:    Sep 1, 1995
> ;       related version of root zone:   1995090100
diff --recurs m:\bindb32/conf/options.h m:\bind/conf/options.h
118c118,120
< #define RENICE  	/* named-xfer should run at normal priority */
---
> #ifndef WINNT
> #define RENICE  	/* named-xfer should run at normal priority */
> #endif
diff --recurs m:\bindb32/conf/portability.h m:\bind/conf/portability.h
67,71c67,104
< #include <sys/param.h>
< #ifndef TIME_H_INCLUDED
< # include <sys/time.h>
< # define TIME_H_INCLUDED
< #endif
---
> #ifndef WINNT
> #include <sys/param.h>
> #ifndef TIME_H_INCLUDED
> # include <sys/time.h>
> # define TIME_H_INCLUDED
> #endif
> #endif /* WINNT */
> 
> #ifdef WINNT
> #ifndef _PORTABILITY_H
> #define _PORTABILITY_H
> #include <stdio.h>
> #ifdef BUFSIZ
> #undef BUFSIZ
> #endif
> #define BUFSIZ 1024  /* GMS - added since Unix used 1K and NT 512B */
> #include <string.h>
> #include <process.h>
> #include <sys/timeb.h>
> #include <time.h>
> #include <io.h>
> #include <stdlib.h>
> #define FD_SETSIZE 512
> #include <winsock.h>
> #include <windows.h>
> 
> #define NOWAIT
> #define HAVE_SETVBUF
> #define NEED_GETTIMEOFDAY
> #define USE_MEMCPY
> #undef IP_OPTIONS
> #define PATH_MAX MAX_PATH
> #define ETIMEDOUT WSAETIMEDOUT
> #define ECONNRESET WSAECONNRESET
> #define ECONNREFUSED WSAECONNREFUSED
> #define EADDRINUSE WSAEADDRINUSE
> #define PORT_WOULDBLK WSAEWOULDBLOCK
> #define _TIMEZONE timezoneBSD
73,74c106,156
< #ifdef ISC
< # ifndef _POSIX_SOURCE
---
> struct timezoneBSD {
> 	int tz_minuteswest;
> 	int tz_dsttime;
> };
> struct iovec {
> 	char *  iov_base;
> 	int 	iov_len;
> };
> typedef char *	caddr_t;
> typedef long pid_t;
> #define sleep(t) Sleep(t*1000)
> #define errno WSAGetLastError()
> /* #define close(s) closesocket(s) */
> #define chdir(path) SetCurrentDirectory(path)
> #define dup2(s1, s2) DuplicateHandle(GetCurrentProcess(), (HANDLE)(s1), \
> 					GetCurrentProcess(), (LPHANDLE)&(s2), \
> 					0, FALSE, DUPLICATE_SAME_ACCESS);
> #define strcasecmp(x, y) stricmp(x, y)
> #define strncasecmp(x, y, z) strnicmp(x, y, z)
> 
> void  	service_main(DWORD, LPTSTR *);
> void  	service_ctrl(DWORD);
> void    worker_thread(void *);
> void syslog(int, char *, ...);
> void expand_paths(void);
> int writev(int, struct iovec *, int);
> int mkstemp(char *);
> 
> #define MAXALIASES 35
> #define LOG_EMERG       0       /* system is unusable */
> #define LOG_ALERT       1       /* action must be taken immediately */
> #define LOG_CRIT        2       /* critical conditions */
> #define LOG_ERR         3       /* error conditions */
> #define LOG_WARNING     4       /* warning conditions */
> #define LOG_NOTICE      5       /* normal but signification condition */
> #define LOG_INFO        6       /* informational */
> #define LOG_DEBUG       7       /* debug-level messages */
> /* control codes that the service will accept */
> #define SERVICE_CONTROL_DUMPDB  128
> #define SERVICE_CONTROL_RELOAD  129
> #define SERVICE_CONTROL_STATS   130
> #define SERVICE_CONTROL_TRACE   131
> #define SERVICE_CONTROL_NOTRACE 132
> #define SERVICE_CONTROL_QRYLOG  133
> #define SERVICE_CONTROL_CHKPT   134
> #define SERVICE_CONTROL_EXIT    135
> #endif /* _PORTABILITY_H */
> #endif /* WINNT */
> 
> #ifdef ISC
> # ifndef _POSIX_SOURCE
189c271
< # if !defined(NeXT)
---
> # if !defined(NeXT)	&& !defined(WINNT)
252c334
< # ifndef NeXT
---
> # if !defined(NeXT) && !defined(WINNT)
256a339
> #ifndef WINNT
257a341
> #endif
259c343
< # if !defined(DMALLOC) && !defined(NeXT)
---
> # if !defined(DMALLOC) && !defined(NeXT) && !defined(WINNT)
305c389
< #if !defined(__STDC__) && !defined(const)
---
> #if !defined(__STDC__) && !defined(const) && !defined(WINNT)
315a400
> 	!defined(WINNT) && \
328c413
< # if defined(USE_POSIX) || \
---
> # if defined(USE_POSIX) || defined(WINNT) ||\
330c415
< 	  && !defined(M_UNIX))
---
>  	  && !defined(M_UNIX))
352c437
< 	&& !defined(M_UNIX)
---
> 	&& !defined(M_UNIX)	&& !defined(WINNT)
369c454
< # if !defined(__ultrix) && !defined(apollo)
---
> # if !defined(__ultrix) && !defined(apollo) && !defined(WINNT)
418a504
> #if !defined(WINNT)
421a508
> #endif
431c518
< #if !defined(USE_POSIX)
---
> #if !defined(USE_POSIX) && !defined(WINNT)
446a534
> #ifndef WINNT
458a547
> #endif
491c580
< 	(defined(__ultrix) || defined(__osf__) || defined(NeXT))
---
> 	(defined(__ultrix) || defined(__osf__) || defined(NeXT) || defined(WINNT))
550c639
< #if !defined(HAVE_FCHMOD)
---
> #if !defined(HAVE_FCHMOD) && !defined(WINNT)
566a656,661
> #endif
> 
> #ifdef WINNT /* l kahn new definitions needed for vc++4.0 */
> #define fstat _fstat
> #define stat _stat
> #define fileno _fileno
Only in m:\bind/contrib/nutshell: ch09.check_del.c~
diff --recurs m:\bindb32/contrib/old/nstest.c m:\bind/contrib/old/nstest.c
68,75c68,82
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< #include <stdio.h>
< #include <resolv.h>
< #include "../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> #include <stdio.h>
> #include <resolv.h>
> #include "../../conf/portability.h"
> 
> #ifdef WINNT
> void usage();
> HANDLE hReadWriteEvent;
> #endif
77c84
< char *progname;
---
> char *progname;
97d103
< 	_res.options |= RES_DEBUG|RES_RECURSE;
98a105
> 	_res.options |= RES_DEBUG|RES_RECURSE;
131c138,139
< 	_res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
---
> //	_res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
> 	_res.nsaddr.sin_addr.s_addr = inet_addr("132.233.186.51");
318a327
> 					_res.options |= RES_DEBUG|RES_RECURSE;
420a430
> void
Only in m:\bind/contrib: winnt-dist
Only in m:\bind: creadme.bat
Only in m:\bind: diffs.ksh
Only in m:\bind: diffsb31tont_context.txt
Only in m:\bind: diffsb31tont_nocontext.txt
Only in m:\bind: diffsbindb31_b32_context.txt
Only in m:\bind: diffsbindb31_b32_nocontext.txt
Only in m:\bind/doc/info: Linux-ELF
Only in m:\bind/doc/info: Linux-again
Only in m:\bind/doc/info: Linux-and-more
Only in m:\bind/doc/info: Linux-more
Only in m:\bind/doc/info: Linux-still-more
Only in m:\bind/doc/info: sunshlib.3
Only in m:\bind/doc/misc: notify.txt
Only in m:\bind: eventlib.zip
diff --recurs m:\bindb32/include/arpa/inet.h m:\bind/include/arpa/inet.h
66,75c66,82
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
< #else
< # include <sys/types.h>
< #endif
< #include <sys/cdefs.h>
< 
< __BEGIN_DECLS
< unsigned long	 inet_addr __P((const char *));
---
> #ifndef WINNT
> #include <sys/param.h>
> #if (!defined(BSD)) || (BSD < 199306)
> # include <sys/bitypes.h>
> #else
> # include <sys/types.h>
> #endif
> #else
> #define FD_SETSIZE 512
> #include <winsock.h>
> #endif /* WINNT */
> #include <sys/cdefs.h>
> 
> __BEGIN_DECLS
> #ifndef WINNT
> unsigned long	 inet_addr __P((const char *));
> #endif
80a88
> #ifndef WINNT
81a90
> #endif
diff --recurs m:\bindb32/include/arpa/nameser.h m:\bind/include/arpa/nameser.h
64,66c64,68
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
> #if (!defined(BSD)) || (BSD < 199306)
> # include <sys/bitypes.h>
68c70
< # include <sys/types.h>
---
> # include <sys/types.h>
70c72
< #include <sys/cdefs.h>
---
> #include <sys/cdefs.h>
72,73c74,75
< #ifdef _AUX_SOURCE
< #include <sys/types.h>			/* ech for A/UX */
---
> #ifdef _AUX_SOURCE
> #include <sys/types.h>			/* ech for A/UX */
128a131
> #if !(defined(WINNT) && defined(NOERROR))
129a133
> #endif
330,331c334,335
< 	*t_cp++ = t_s >> 8; \
< 	*t_cp   = t_s; \
---
> 	*t_cp++ = (char) (t_s >> 8); \
> 	*t_cp   = (char) t_s; \
diff --recurs m:\bindb32/include/netdb.h m:\bind/include/netdb.h
64,73c64,76
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
< #endif
< #include <sys/cdefs.h>
< 
< #define	_PATH_HEQUIV	"/etc/hosts.equiv"
< #define	_PATH_HOSTS	"/etc/hosts"
< #define	_PATH_NETWORKS	"/etc/networks"
< #define	_PATH_PROTOCOLS	"/etc/protocols"
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif /* WINNT */
> #if (!defined(BSD)) || (BSD < 199306)
> # include <sys/bitypes.h>
> #endif
> #include <sys/cdefs.h>
> 
> #ifndef WINNT
> #define	_PATH_HEQUIV	"/etc/hosts.equiv"
> #define	_PATH_HOSTS	"/etc/hosts"
> #define	_PATH_NETWORKS	"/etc/networks"
> #define	_PATH_PROTOCOLS	"/etc/protocols"
76a80,85
> #else /* WINNT */
> #define	_PATH_HOSTS	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\HOSTS"
> #define	_PATH_NETWORKS	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\NETWORKS"
> #define	_PATH_PROTOCOL	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\PROTOCOL"
> #define	_PATH_SERVICES	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\SERVICES"
> #endif /* WINNT */
77a87
> #ifndef WINNT
114a125
> #endif /* WINNT */
122a134
> #ifndef WINNT
127a140
> #endif /* WINNT */
133a147
> #ifndef WINNT
138c152
< struct netent	*getnetbyaddr __P((long, int)); /* u_long? */
---
> struct netent	*getnetbyaddr __P((u_long, int)); /* u_long? */
139a154
> #endif
140a156
> #ifndef WINNT
142a159
> #endif
143a161
> #ifndef WINNT
145a164
> #endif
diff --recurs m:\bindb32/include/resolv.h m:\bind/include/resolv.h
64,68c64,65
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
< #else
< # include <sys/types.h>
---
> #ifndef WINNT
> #include <sys/param.h>
70,71c67,77
< #include <sys/cdefs.h>
< #include <stdio.h>
---
> #if (!defined(BSD)) || (BSD < 199306)
> # include <sys/bitypes.h>
> #else
> # include <sys/types.h>
> #endif
> #include <sys/cdefs.h>
> #include <stdio.h>
> #ifdef WINNT
> #define FD_SETSIZE 512
> #include <winsock.h>
> #endif
89a96
> #ifndef WINNT
90a98,101
> #else
> #define _PATH_RESCONF		 "%windir%\\RESOLV.CONF"
> #define _ALT_PATH_RESCONF	 "%windir%\\RESOLV.INI"
> #endif /* WINNT */
240c251
< u_int	 inet_nsap_addr __P((const char *, u_char *, int maxlen));
---
> u_int	 inet_nsap_addr __P((const char *, u_char *, u_int maxlen));
Only in m:\bind: mkdist.bat
Only in m:\bind: mksrc.bat
Only in m:\bind: mktxt.bat
Only in m:\bind/named: TAGS
diff --recurs m:\bindb32/named/Version.c m:\bind/named/Version.c
11c11,16
< char Version[] = "named %VERSION% %WHEN%\n\t%WHOANDWHERE%";
---
> #ifndef WINNT
> char Version[] = "named %VERSION% %WHEN%\n\t%WHOANDWHERE%";
> #else
> char Version[] = "named 4.9.3-BETA32-Monday-25-Dec\n\tGregSchueman-LarryKahn-VirajBais";
> #endif
> 
Only in m:\bind/named: WinRel
diff --recurs m:\bindb32/named/db_defs.h m:\bind/named/db_defs.h
79c79,83
< 	u_int32_t	d_ttl;		/* time to live */
---
> #ifndef WINNT
> 	u_int32_t	d_ttl;		/* time to live */
> #else
> 	int32_t	        d_ttl;		/* time to live */
> #endif
diff --recurs m:\bindb32/named/db_dump.c m:\bind/named/db_dump.c
61,70c61,74
< #include <sys/param.h>
< #include <sys/stat.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <netdb.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <resolv.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/stat.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <netdb.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <resolv.h>
> #include <errno.h>
416c420
< 				&& (int32_t)(dp->d_ttl - tt.tv_sec)
---
> 				&& (int)(dp->d_ttl - tt.tv_sec)
423c427
< 			    dp->d_ttl != zones[dp->d_zone].z_minimum)
---
> 			    (u_int32_t)dp->d_ttl != zones[dp->d_zone].z_minimum)
576c580
< 					n = -2;		/* XXX - hack */
---
> 					n = (u_int32_t) -2;		/* XXX - hack */
diff --recurs m:\bindb32/named/db_glue.c m:\bind/named/db_glue.c
62,71c62,75
< #include <sys/uio.h>
< #include <sys/param.h>
< #include <sys/stat.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <ctype.h>
< #include <netdb.h>
---
> #ifndef WINNT
> #include <sys/uio.h>
> #include <sys/param.h>
> #include <sys/stat.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <ctype.h>
> #include <netdb.h>
124a129
> #ifndef WINNT
126a132,137
> #else
>   	/* under Windows, abort() does not call raise(SIGABRT)
>   	 * or flush stream buffers
>   	 */
>   	 exit(3);
>   #endif
142,144c153,155
< 		if (!slp)
< 			panic(errno, "malloc(servent)");
< 		slp->name = savestr(sp->s_name);
---
>  		if (!slp)
>   			panic(errno, "malloc(servent)");
>  		slp->name  = savestr(sp->s_name);
146,148c157,159
< 		slp->port = ntohs((u_int16_t)sp->s_port);  /* host byt order */
< 		slp->next = servicelist;
< 		slp->prev = NULL;
---
> 		slp->port = ntohs((u_int16_t)sp->s_port); /* host byte order */
> 		slp->next  = servicelist;
> 		slp->prev  = NULL;
370a382
> #ifndef WINNT
371a384,387
> #else
> 		WSASetLastError(0);
> #endif
> #ifndef WINNT
372a389,391
> #else
> 		s = closesocket(fd);
> #endif
374a394
> #ifndef WINNT
375a396,398
> #else
> 	if (s < 0 && errno != WSAEBADF)
> #endif
1181a1205
> #ifndef WINNT
1224a1249
> #endif /* WINNT */
diff --recurs m:\bindb32/named/db_load.c m:\bind/named/db_load.c
65,74c65,78
< #include <sys/param.h>
< #include <sys/stat.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <ctype.h>
< #include <netdb.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <sys/stat.h>
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <ctype.h>
> #include <netdb.h>
> #include <resolv.h>
211c215
< 		dprintf(1, (ddt, "db_load: error opening file %s\n",
---
> 		dprintf(1, (ddt, "db_load: error opening file %s \n",
297c301
< 				    if (n > (INT_MAX - (*cp - '0')) / 10) {
---
> 				    if (n > (((u_int32_t)INT_MAX - (u_int32_t)(*cp - '0')) / (u_int32_t)10)) {
310c314
< 				    if (n > max_cache_ttl)
---
> 				    if (n > (u_int32_t)max_cache_ttl)
528a533
> #ifndef WINNT
529a535,537
> #else
> 				if ((u_int32_t)zp->z_expire < zp->z_refresh ) {
> #endif
668c676
< 				    *cp++ = 255;
---
> 				    *cp++ = (char)255;
diff --recurs m:\bindb32/named/db_lookup.c m:\bind/named/db_lookup.c
65,68c65,70
< #include <syslog.h>
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <syslog.h>
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
diff --recurs m:\bindb32/named/db_reload.c m:\bind/named/db_reload.c
61,66c61,70
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <stdio.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
diff --recurs m:\bindb32/named/db_save.c m:\bind/named/db_save.c
65,69c65,73
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
diff --recurs m:\bindb32/named/db_secure.c m:\bind/named/db_secure.c
9,14c9,19
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <syslog.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #ifndef WINNT
> #include <syslog.h>
> #include <errno.h>
> 
> #endif
diff --recurs m:\bindb32/named/db_update.c m:\bind/named/db_update.c
62,66c62,67
< #include <syslog.h>
< 
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <syslog.h>
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
Only in m:\bind/named: ipaddr.mak
Only in m:\bind/named: ipaddr.vcp
diff --recurs m:\bindb32/named/named-xfer.c m:\bind/named/named-xfer.c
76,84c76,84
< #include <sys/param.h>
< #include <sys/file.h>
< #include <sys/stat.h>
< #include <sys/socket.h>
< 
< #include <netinet/in.h>
< #if defined(__osf__)
< # include <sys/mbuf.h>
< # include <net/route.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/file.h>
> #include <sys/stat.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #if defined(__osf__)
> # include <sys/mbuf.h>
> # include <net/route.h>
90a91,95
> 
> #else
> #include <sys/stat.h>
> #include <limits.h>
> #endif /* WINNT */
94d98
< 
97a102
> #ifndef WINNT
98a104
> #endif
100c106
< # include <math.h>
---
> #include <math.h>
112a119,124
> #ifdef WINNT
> #define exit(x) ExitProcess(x);
> HANDLE hReadWriteEvent = NULL;
> char pathtmpxfer[MAX_PATH], pathtmpdir[MAX_PATH];
> #endif
> 
114a127
> #ifndef WINNT
116a130,132
> #else
> static char	*ddtfile = pathtmpxfer,
> #endif
133a150
> #ifndef WINNT
134a152
> #endif
148c166,169
< 	int dbfd, ddtd, result, c, fd, closed = 0;
---
> 	int dbfd, ddtd, result, c, closed = 0;
> #ifndef WINNT
> 	int fd;
> #endif
158a180,191
> #ifdef WINNT
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
> 
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		exit(XFER_FAIL); 
> 	}
> 
> #endif
> 
165a199
> #ifndef WINNT
168a203
> #endif
174a210,218
> #ifdef WINNT
> 	(void) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
> 	if (!GetTempPath(MAX_PATH, pathtmpdir))
> 		syslog(LOG_ERR, "GetTempPath() failed: %m");
> 	else {
> 		strcpy(pathtmpxfer, pathtmpdir);
> 		strcat(pathtmpxfer, _PATH_TMPXFER);
> 	}
> #endif
175a220
> #ifndef WINNT
180a226
> #endif /* WINNT */
327a374
> #ifndef WINNT
347a395
> #endif /* WINNT */
353,354c401,402
< 	buildservicelist();
< 	buildprotolist();
---
> 	  buildservicelist();
> 	  buildprotolist();
381c429
< 			hp = gethostbyname(tm);
---
> 		   hp = gethostbyname(tm);
385c433,434
< 				       tm, zp->z_origin);
---
> 				       tm, zp->z_origin); 
> 
388c437
< 			bcopy(hp->h_addr,
---
>                   bcopy(hp->h_addr,
391a441
> 
413a464
> #ifndef WINNT
414a466,469
> #else
> 		/* C run time rename function under NT does not overwrite */
> 		if(!MoveFileEx(tmpname, dbfile, MOVEFILE_REPLACE_EXISTING)) {
> #endif
478c533,534
< int	minimum_ttl = 0, got_soa = 0;
---
> u_int32_t	minimum_ttl = 0;
> int	got_soa = 0;
501a558
> #ifndef WINNT
507c564,566
< 	int qdcount, ancount, aucount, class, type;
---
> #endif
> 	u_short qdcount, ancount, aucount;
> 	int class, type;
509a569,574
> #ifdef WINNT
> /* lgk moved startup to beginning.. */
> 
> 	hReadWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
> #endif /* WINNT */
> 
524a590,591
> 
> #ifndef WINNT
538a606
> #endif /* WINNT */
560a629
> 
569c638
< 		}	
---
> 		}
592a662
> #ifndef WINNT
597a668
> #endif /* WINNT */
645,647c716,718
< 		qdcount = ntohs(hp->qdcount);
< 		ancount = ntohs(hp->ancount);
< 		aucount = ntohs(hp->nscount);
---
> 		qdcount = ntohs( (u_short) hp->qdcount);
> 		ancount = ntohs( (u_short) hp->ancount);
> 		aucount = ntohs( (u_short) hp->nscount);
793a865
> #ifndef WINNT
800a873
> #endif /* WINNT */
861,862c934,935
< 				ancount = ntohs(hp->ancount);
< 				for (cnt = 0 ; cnt < ancount ; cnt++) {
---
> 				ancount = ntohs( (u_short) hp->ancount);
> 				for (cnt = 0 ; cnt < (u_int) ancount ; cnt++) {
869,870c942,943
< 					ancount = ntohs(hp->nscount);
< 					for (cnt = 0 ; cnt < ancount ; cnt++) {
---
> 					ancount = ntohs( (u_short) hp->nscount);
> 					for (cnt = 0 ; cnt < (u_int) ancount ; cnt++) {
875,876c948,949
< 				ancount = ntohs(hp->arcount);
< 				for (cnt = 0 ; cnt < ancount ; cnt ++) {
---
> 				ancount = ntohs( (u_short) hp->arcount);
> 				for (cnt = 0 ; cnt < (u_int) ancount ; cnt ++) {
975a1049
> #ifndef WINNT
976a1051,1054
> #else
> 					if (fseek(dbfp, 0L, SEEK_SET) || 
> 						!SetEndOfFile((HANDLE)fileno(dbfp))) {
> #endif
995a1074
> #ifndef WINNT
1001a1081
> #endif /* WINNT */
1020a1101
> #ifndef WINNT
1025a1107
> #endif /* WINNT */
1049d1130
< 	struct itimerval ival, zeroival;
1053a1135,1136
> #ifndef WINNT
> 	struct itimerval ival, zeroival;
1057a1141,1145
> #else
> 	int ret;
> 	struct timeval tvout;
> 	fd_set fdset;	
> #endif
1058a1147
> #ifndef WINNT
1063a1153
> 		
1094a1185,1217
> #else /* WINNT */
> 		/* our socket is kept nonblocking due to timeout considerations
> 		 * there are two ways to ensure that a recv on the nonblocking
> 		 * socket will not return prematurely:
> 		 * 1) use select() to wait (with timeout) for the socket to be ready
> 		 * 2) use the ReadFile() win32 API to do asynchronous I/O using
> 		 *    signalled events (as has been done in writev() implementation
> 		 * The first is being used here because it will work for Unix
> 		 * systems also, and some day the setitimer() alarms may be 
> 		 * replaced by select() to create a single scheme for both
> 		 * Unix and NT
> 		 */
> 		 tvout.tv_sec = timeout;
> 		 tvout.tv_usec = 0;
> 		 FD_ZERO(&fdset);
> 		 FD_SET(fd, &fdset);
> 		 ret = select(fd+1, &fdset, (fd_set *)0, (fd_set *)0, &tvout);
> 		 if (ret != SOCKET_ERROR && ret > 0) {
> 		 	n = recv(fd, buf, len, 0);
> 			if (n == SOCKET_ERROR)
> 				if (WSAGetLastError() == WSAEWOULDBLOCK)
> 					continue;
> 				else {
> 					syslog(LOG_INFO, "recv(len=%d): %m", len);
> 					return (-1);
> 				}
> 		 } else {
> 		 	if (ret == 0)
> 				WSASetLastError(WSAETIMEDOUT);
> 			syslog(LOG_INFO, "select error: %m");
> 			return (-1);
> 		}
> #endif /* WINNT */
1097a1221
> #ifndef WINNT
1101a1226
> #endif
Only in m:\bind/named: named.mak
Only in m:\bind/named: named.mdp
Only in m:\bind/named: named.ncb
Only in m:\bind/named: named.vcp
Only in m:\bind/named: ndc.c
Only in m:\bind/named: ndc.mak
Only in m:\bind/named: ndc.mdp
Only in m:\bind/named: ndc.ncb
Only in m:\bind/named: ndc.vcp
diff --recurs m:\bindb32/named/ns_defs.h m:\bind/named/ns_defs.h
125,134c125,139
< 	u_int32_t	z_expire;	/* expiration time for cached info */
< 	u_int32_t	z_minimum;	/* minimum TTL value */
< 	u_int32_t	z_serial;	/* changes if zone modified */
< 	char		*z_source;	/* source location of data */
< 	time_t		z_ftime;	/* modification time of source file */
< 	struct in_addr	z_xaddr;	/* override server for next xfer */
< 	struct in_addr	z_addr[NSMAX];	/* list of master servers for zone */
< 	u_char		z_addrcnt;	/* number of entries in z_addr[] */
< 	u_char		z_type;		/* type of zone; see below */
< 	u_int16_t	z_flags;	/* state bits; see below */
---
> #ifndef WINNT
> 	u_int32_t	z_expire;	/* expiration time for cached info */
> #else
> 	int32_t	z_expire;	/* expiration time for cached info */
> #endif
> 	u_int32_t	z_minimum;	/* minimum TTL value Changes */
> 	u_int32_t	z_serial;	/* changes if zone modified */
> 	char		*z_source;	/* source location of data */
> 	time_t		z_ftime;	/* modification time of source file */
> 	struct in_addr	z_xaddr;	/* override server for next xfer */
> 	struct in_addr	z_addr[NSMAX];	/* list of master servers for zone */
> 	u_char		z_addrcnt;	/* number of entries in z_addr[] */
> 	u_char		z_type;		/* type of zone; see below */
> 	u_int16_t	z_flags;	/* state bits; see below */
> #ifndef WINNT
135a141,143
> #else
> 	HANDLE		z_xferpid;	/* handle for thread doing xfer */
> #endif
185a194,196
> #ifdef WINNT
> #define XFER_KILLED 	4
> #endif
186a198
> #ifndef WINNT
187a200
> #endif
260a274
> #ifndef WINNT
261a276,278
> #else
> 	SOCKET	s_rfd;
> #endif
275a293
> #ifndef WINNT
276a295,297
> #else
> 	u_int		dq_dfd;		/* datagram file descriptor */
> #endif
diff --recurs m:\bindb32/named/ns_forw.c m:\bind/named/ns_forw.c
61,65c61,67
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
67,70c69,77
< #include <syslog.h>
< #include <resolv.h>
< #include <stdio.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <syslog.h>
> #else
> #include <stdlib.h>
> #include <search.h>
> #endif
> #include <resolv.h>
> #include <stdio.h>
> #include <errno.h>
73a81,84
> #ifdef WINNT
> int qcomp(const void *, const void *);
> #endif
> 
353c364
< 	register int n;
---
> 	register unsigned int n;
558a570
> #ifndef WINNT
560a573,575
> #else
> 		qsort((char *)qp->q_addr, n, sizeof(struct qserv), qcomp);
> #endif
diff --recurs m:\bindb32/named/ns_func.h m:\bind/named/ns_func.h
108,111c108,115
< extern void		holdsigchld __P((void));
< extern void		releasesigchld __P((void));
< extern SIG_FN		reapchild __P(());
< extern void		endxfer __P((void));
---
> #ifndef WINNT
> extern void		holdsigchld __P((void));
> extern void		releasesigchld __P((void));
> extern SIG_FN		reapchild __P(());
> extern void		endxfer __P((void));
> #else
> extern	void		endxfer __P((DWORD));
> #endif
diff --recurs m:\bindb32/named/ns_glob.h m:\bind/named/ns_glob.h
89,90c89,93
< DECL	int			vs		INIT(-1);
< 
---
> #ifndef WINNT
> DECL	int			vs		INIT(-1);
> #else
> DECL	int			vs		INIT(INVALID_SOCKET);
> #endif
diff --recurs m:\bindb32/named/ns_init.c m:\bind/named/ns_init.c
61,70c61,74
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/stat.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <syslog.h>
< #include <resolv.h>
< #include <stdio.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <sys/stat.h>
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <resolv.h>
> #include <stdio.h>
> #include <errno.h>
103,106c107,110
< {
< 	u_long refresh = (zp->z_refresh > 0) ? zp->z_refresh : INIT_REFRESH;
< 	time_t half = (refresh + 1) / 2;
< 
---
>    {
>   	u_long refresh = (zp->z_refresh > 0) ? zp->z_refresh : INIT_REFRESH;
>   	time_t half = (refresh + 1) / 2;
>  
236a241,243
> #ifdef WINNT
> 	extern char *pathtmpdir;
> #endif
260a268
> #ifndef WINNT
261a270,272
> #else
> 			if (chdir(buf) != TRUE) {
> #endif
576a588
> #ifndef WINNT
577a590,592
> #else
> 				sprintf(buf, "%sNsTmp%ld.%d", pathtmpdir,
> #endif
diff --recurs m:\bindb32/named/ns_main.c m:\bind/named/ns_main.c
73,78c73,80
< #include <sys/param.h>
< #include <sys/file.h>
< #include <sys/stat.h>
< #if !defined(SYSV) && defined(XXX)
< #include <sys/wait.h>
< #endif /* !SYSV */
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/file.h>
> #endif
> #include <sys/stat.h>
> #if !defined(SYSV) && defined(XXX)
> #include <sys/wait.h>
> #endif /* !SYSV */
80,82c82,84
< # define _SOCKADDR_LEN		/* XXX - should be in portability.h but that
< 				 * would need to be included before socket.h
< 				 */
---
> # define _SOCKADDR_LEN		/* XXX - should be in portability.h but that
> 				 * would need to be included before socket.h
> 				 */
83a86
> #ifndef WINNT
86a90
> #endif
94a99
> #ifndef WINNT
95a101,103
> #else
> #include "ntif.h" /* hacked version for nt only */
> #endif
99a108
> #ifndef WINNT
100a110
> #endif
114a125,129
> #ifdef WINNT
> #include <process.h> 
> #include "../compat/lib/log.h"
> #endif
> 
126a142,167
> #ifdef WINNT
> 	/* handles for various threads, process, and objects */
> 	HANDLE hReadWriteEvent = NULL, hServDoneEvent = NULL, hWorkerThread = NULL;
> 	/* variables used to inform the Service Control Manager of our current state */
> 	SERVICE_STATUS ServiceStatus;
> 	SERVICE_STATUS_HANDLE   hServiceStatus;
> 	OVERLAPPED overlap; 
> 	int was_stopped = 0;
> 	char *pathboot, *pathxfer, *pathdebug,
> 	 	 *pathdumpfile, *pathpidfile, *pathstats,
> 	 	 *pathxfertrace, *pathxferddt, *pathtmpdir;
>     CRITICAL_SECTION protected_zp;
>     CRITICAL_SECTION maint_section;
>     /* critical section used to synchronize the named xfers */
> #define exit(x) { if (hServDoneEvent != NULL) \
> 						SetEvent(hServDoneEvent);\
> 				  ExitThread(x); \
> 				}
> char szMsgPath[255];
> #ifdef NOWAIT
> 	char loopbuf[] = "";
> 	struct sockaddr_in loopback;
> #endif
> #endif /* WINNT */
> 
> 
135a177
> #ifndef WINNT
149a192
> #endif /* WINNT */
165,166c208,213
< 	register int n, udpcnt;
< 	register char *arg;
---
>   	register int n;
> 	register char *arg;	
> 	const int on = 1;
> 
> #ifndef WINNT
>     register int udpcnt;
171d217
< 	const int on = 1;
181c227
< #endif
---
> #endif 
186c232,235
< 	struct timeval t, *tp;
---
> 	struct timeval *tp;
> #endif /* WINNT */
> 
> 	struct timeval t;
198a248,272
> #ifdef WINNT
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
> 
> 	/* initialize the winsock dll version needed */
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		return;
> 	}
> 
>     /* initialize the critical section */
>    InitializeCriticalSection(&protected_zp);
>    InitializeCriticalSection(&maint_section);
> 	/* initialize all pathnames */
> 	expand_paths();
> 
>        /* lgk add startup code here */
>          /* Set the Event-ID message-file name. */
>           GetCurrentDirectory(sizeof(szMsgPath), szMsgPath);
>           strcat(szMsgPath, "\\named.exe");
>           addSourceToRegistry("DNS", szMsgPath);
> 
> #endif /* WINNT */
> 
307a382
> #ifndef WINNT
312a388
> #endif /* WINNT */
345a422
> #ifndef WINNT
346a424,426
> #else
> 		if ((vs = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
> #endif
388a469
> #ifndef WINNT
400a482
> #endif /* WINNT */
425a508
> #ifndef WINNT
449a533
> #endif /* WINNT */
458a543
> #ifndef WINNT
536a622,781
> 
> #else /* WINNT */
> #ifdef DEBUG
> 	if (!debug)
> #endif
> 	{
> 		SERVICE_TABLE_ENTRY dispatchTable[] = {
>         	{ TEXT("DomainNameService"), (LPSERVICE_MAIN_FUNCTION)service_main },
>         	{ NULL, NULL }
>     	};
> 
> 	/* daemonize */
>     	if (!StartServiceCtrlDispatcher(dispatchTable)) {
> 			if (!was_stopped) {
> 				syslog(LOG_ERR, "StartServiceCtrlDispatcher: %m");
> 				ExitProcess(2);
> 			} else {
> 				syslog(LOG_INFO, "StartServiceCtrlDispatcher: service stopped");
> 				ExitProcess(0);
> 			}
> 		}
> 	}
> #ifdef DEBUG
> 	else
> 	   service_main(argc, argv);
> #endif /* DEBUG */
> } /* end main */
> 
> /*
>  * If this runs as a service under NT, the main thread will block at StartServiceCtrlDispatcher()
>  * and another thread will be started by the Service Control Dispatcher which will begin execution 
>  * at the routine specified in that call (viz. service_main) 
>  */
> void
> service_main(argc, argv)
> 	DWORD argc;
> 	LPTSTR *argv;
> {
> 	DWORD dwWait;
> 
> #ifdef DEBUG
> 	if(!debug) {
> #endif /* DEBUG */
> 
> #ifdef NOWAIT
> 	loopback.sin_family = AF_INET;
> 	loopback.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> 	loopback.sin_port = local_ns_port;
> #endif
>     	/* register our service control handler */
> 		if (!(hServiceStatus = RegisterServiceCtrlHandler( TEXT("DomainNameService"),
>                         			(LPHANDLER_FUNCTION)service_ctrl))) {
> 			syslog(LOG_ERR, "RegisterServiceCtrlHandler() failed: %m");
> 			return;
> 		}
> 
> 		/* report pending status to Service Control Manager */
> 		ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
> 		ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
> 		ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
> 		ServiceStatus.dwWin32ExitCode = NO_ERROR;
>     	        ServiceStatus.dwServiceSpecificExitCode = 0;
> 		ServiceStatus.dwCheckPoint = 1;
> 		ServiceStatus.dwWaitHint = 5000;
> 		if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) {
> 			syslog(LOG_ERR, "SetServiceStatus(): %m");
>         	ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 			SetServiceStatus(hServiceStatus, &ServiceStatus);
> 			return;
>     	}
> 
> 		/* create an event object that the control handler function
> 	 	* will signal when it receives the "stop" control code */
> 		if (!(hServDoneEvent = CreateEvent(
>         				NULL,    /* no security attributes */
>         				FALSE,   /* auto-reset event */
>         				FALSE,   /* not-signalled */
>         				NULL))){ /* no name */
> 				syslog(LOG_ERR, "CreateEvent() failed: %m");
>         		ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 				SetServiceStatus(hServiceStatus, &ServiceStatus);
> 				return;
>     	}
> 
> 	/* 
> 	 * the service_main() thread will have to wait for start/stop/pause/continue requests
> 	 * from the services icon in the Control Panel or from any WIN32 application
>      * start a new thread to perform all the work of the NTP service 
>      */
>         if (!(hWorkerThread = (HANDLE)_beginthread(
>                     worker_thread,
>                     0,       /* stack size			*/
>                     NULL))){    /* argument to thread	*/
> 			syslog(LOG_ERR, "_beginthread: %m");
> 			if (hServDoneEvent != NULL)
> 				CloseHandle(hServDoneEvent);
>         	ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 			SetServiceStatus(hServiceStatus, &ServiceStatus);
> 			return;
> 		}
> 
>     	/* report to the service control manager that the service is running */
> 		ServiceStatus.dwCurrentState = SERVICE_RUNNING;
> 		ServiceStatus.dwWin32ExitCode = NO_ERROR;
> 		if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) {
> 			syslog(LOG_ERR, "SetServiceStatus(): %m");
> 			if (hServDoneEvent != NULL)
> 				CloseHandle(hServDoneEvent);
>         	ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 			SetServiceStatus(hServiceStatus, &ServiceStatus);
> 			return;
> 		}
> 
>     	/* wait indefinitely until hServDoneEvent is signaled */
>     	dwWait = WaitForSingleObject(hServDoneEvent,INFINITE);
> 		if (hServDoneEvent != NULL)
> 			CloseHandle(hServDoneEvent);
> 		if (hWorkerThread != NULL)
> 			CloseHandle(hWorkerThread);
>     	ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 		SetServiceStatus(hServiceStatus, &ServiceStatus);
> 		return;
> 	}
> #ifdef DEBUG
> 	else 
> 	    worker_thread(NULL);
> #endif /* DEBUG */
> } /* end service_main() */
> 
> 
> /*
>  * worker_thread - perform all remaining functions after initialization and and becoming a service
>  */
> void
> worker_thread(notUsed)
> 	void *notUsed;
> {
> #ifdef WANT_PIDFILE
> 	FILE *fp;
> #endif
> 	register int n, udpcnt;
> 	register struct qstream *sp;
> 	register struct qdatagram *dqp;
> 	struct qstream *nextsp;
> 	int nfds;
> 	const int on = 1;
> 	int size;
> 	SOCKET rfd;
> 	time_t lasttime, maxctime;
> 	u_char buf[BUFSIZ];
> 	struct timeval t, *tp;
> 	fd_set tmpmask;
> 	struct qstream *candidate = QSTREAM_NULL;
> 
> 	hReadWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
> 	overlap.Offset = overlap.OffsetHigh = (DWORD)0;
> 	overlap.hEvent = hReadWriteEvent;
> 
> #endif /* WINNT */
> 
593a839,840
> // this should never be called from nt as the needendxfer is only set
> // vai a call to reapchild in ns_maint.c through a signal
594a842
> #ifndef WINNT
597a846,849
> #else
>                 needendxfer = 0;
> 		syslog(LOG_ERR, "Needendxfer was Set under Windows NT... Shouldn't happen!");
> #endif
598a851,852
> 
> #ifndef WINNT 
599a854
> #endif
640a896
> #ifndef WINNT
641a898,900
> #else
> 		if (n < 0 && errno != WSAEINTR) {
> #endif
668a928,935
> #if defined(WINNT) && defined(NOWAIT)
> 				if ((n ==1) && !strcmp(buf, "")) {
> 				/* dummy packet intended to terminate select
> 				 * because a control code has been received or
> 				 * needmaint flag has been set by the timer thread */
> 					break;
> 				}
> #endif
699a967
> #ifndef WINNT
700a969,971
> #else
> 			if (rfd == INVALID_SOCKET && WSAGetLastError() == WSAEINTR)
> #endif
701a973
> #ifndef WINNT
702a975,977
> #else
> 			if (rfd == INVALID_SOCKET && WSAGetLastError() == WSAEMFILE && streamq) {
> #endif
721a997
> #ifndef WINNT
722a999,1001
> #else
> 			if (rfd == INVALID_SOCKET) {
> #endif
725a1005
> #ifndef WINNT 
735a1016,1022
> #else
> 			if(ioctlsocket(rfd, FIONBIO, (u_long *)&on) == SOCKET_ERROR) {
> 				syslog(LOG_INFO, "ioctlsocket(rfd, NONBLOCK): %m");
> 				(void) my_close(rfd);
> 				continue;
> 			}
> #endif
814a1102
> #ifndef WINNT
815a1104,1107
> #else
>  			           (n = recv(sp->s_rfd, sp->s_bufp, size, 0)) >0
> 
> #endif
858a1151
> #ifndef WINNT
862a1156,1161
> #else
> 				  (n = recv(sp->s_rfd,
> 					sp->s_bufp,
> 					sp->s_size, 0)
> 			       ) > 0
> #endif
887a1187
> #ifndef WINNT
888a1189,1191
> #else
> 			if ((n == SOCKET_ERROR) && (errno == PORT_WOULDBLK))
> #endif
930a1234
> #ifndef WINNT /* nt dos not have this functionality so call our new fx */
934a1239,1247
> #else
>         if (get_winnt_interfaces(&ifc) < 0)
> 
>          {
> 	   syslog(LOG_ERR, "get interface configuration: %m - exiting");
> 	   exit(1);
> 	}
> #endif
> 
944a1258
> #ifndef WINNT
945a1260,1263
> #else
>              
> 	     cp += sizeof (ifr->ifr_name) + my_size(ifr->ifr_addr) + sizeof(ifr->ifr_mask)) {
> #endif
947c1265
< 		ifr = (struct ifreq *)cp;
---
> 		 ifr = (struct ifreq *)cp;
958c1276
< #if !defined(BSD) || (BSD < 199103)
---
> #if (!defined(BSD) || (BSD < 199103)) && !defined(WINNT)
965c1283
< 			    inet_ntoa(((struct sockaddr_in *)
---
> 			    inet_ntoa(((struct sockaddr_in *)   
966a1285
> 
1022a1342
> #ifndef WINNT				
1033a1354,1359
> #else /* nt masks are supported */
>                    ntp->mask = inet_addr(ifreq.ifr_mask);
> #endif
> 
> #ifndef WINNT /* no interface flags on NT */
> 
1037a1364,1365
> #endif
> 
1053,1062d1380
< 		} else if ((ifreq.ifr_flags & IFF_POINTOPOINT)) {
< 			if (ioctl(vs, SIOCGIFDSTADDR, (char *)&ifreq) < 0) {
< 				syslog(LOG_NOTICE, "get dst addr: %m");
< 				continue;
< 			}
< 			ntp->mask = 0xffffffff;
< 			ntp->addr = ((struct sockaddr_in *)
< 				     &ifreq.ifr_addr)->sin_addr.s_addr;
< 		} else {
< 			ntp->addr = ntp->mask & ntp->my_addr.s_addr;
1063a1382,1400
> #ifndef WINNT /* no interface flags on NT */
>                      else if ((ifreq.ifr_flags & IFF_POINTOPOINT))
>                             {
> 			      if (ioctl(vs, SIOCGIFDSTADDR, (char *)&ifreq) < 0)
>                                 {
> 			    	   syslog(LOG_NOTICE, "get dst addr: %m");
> 				    continue;
> 			        }
> 			      ntp->mask = 0xffffffff;
> 		  	      ntp->addr = ((struct sockaddr_in *)
> 			   	          &ifreq.ifr_addr)->sin_addr.s_addr;
> 			    } else
>                             {
> 			     ntp->addr = ntp->mask & ntp->my_addr.s_addr;
> 			    }
> #else
> 			     ntp->addr = ntp->mask & ntp->my_addr.s_addr;
> 
> #endif
1124a1462,1468
> 	/* don't know how to get interface information on multihomed NT
> 	 * machines. I'm told that gethostbyname(gethostname()) should
> 	 * return all IP addresses of the local machine (except 127.0.0.1)
> 	 * but there still remains the question of netmasks and flags etc
> 	 * This whole issue needs to be addressed more thoroughly.
> 	 * Implications of this???
> 	 */
1191a1536
> #ifndef WINNT
1198a1544,1548
> #else
> 	if(ioctlsocket(dqp->dq_dfd, FIONBIO, (u_long *)&on) == SOCKET_ERROR) {
> 		syslog(LOG_NOTICE, "ioctlsocket(dqp->dq_dfd, nonblocking): %m");
> 	}
> #endif
1217a1568
> #ifndef WINNT
1296a1648
> #endif /* WINNT */
1299c1651
< ** Turn on or off debuging by open or closeing the debug file
---
> ** Turn on or off debuging by open or closing the debug file
1311a1664
> #ifndef WINNT
1312a1666
> #endif
1324a1679
> #ifndef WINNT
1330a1686
> #endif /* WINNT */
1337a1694
> #ifndef WINNT
1441a1799,1800
> #endif /* WINNT */
> 
1544c1903
< 		FD_CLR(this->dq_dfd, &mask);
---
>  		FD_CLR(this->dq_dfd, &mask);
1665a2025,2408
> 
> 
> #ifdef WINNT
> /* service_ctrl - control handler for NTP service
>  * signals the service_main routine of start/stop requests
>  * from the control panel or other applications making
>  * win32API calls
>  */
> void
> service_ctrl(dwCtrlCode)
> 	DWORD dwCtrlCode;
> {
>     DWORD  dwState = SERVICE_RUNNING;
> 	int len;
> 
>     /* Handle the requested control code */
>     switch(dwCtrlCode) {
> 
>         case SERVICE_CONTROL_PAUSE:
> 		/* see no reason to support this */
> 		break;
> 
>         case SERVICE_CONTROL_CONTINUE:
>  		/* see no reason to support this */
>   		break;
> 
>         case SERVICE_CONTROL_STOP:
>             dwState = SERVICE_STOP_PENDING;
>             /* Report the status, specifying the checkpoint and waithint,
>              *  before setting the termination event.
>              */
> 			ServiceStatus.dwCurrentState = dwState;
> 			ServiceStatus.dwWin32ExitCode = NO_ERROR;
> 			ServiceStatus.dwWaitHint = 1000;
> 			if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) {
> 				syslog(LOG_ERR, "SetServiceStatus(): %m");
> 			}
> 			was_stopped = 1;
>             SetEvent(hServDoneEvent);
>             return;
> 
>         case SERVICE_CONTROL_INTERROGATE:
>             	/* Update the service status */
> 			break;
> 
>         case SERVICE_CONTROL_DUMPDB:
>             needToDoadump = 1;
> 			break;
> 
>         case SERVICE_CONTROL_RELOAD:
> 			needreload = 1;
> 			break;
> 
>         case SERVICE_CONTROL_STATS:
> 			needStatsDump = 1;
> 			break;
> 
>         case SERVICE_CONTROL_TRACE:
> 			debug++;
> 			if (debug == 1)
> 				setdebug(1);
> 			fprintf(ddt, "Debug turned ON, Level %d\n", debug);
> 			break;
> 
>         case SERVICE_CONTROL_NOTRACE:
> 			setdebug(0);
> 			break;
> 
>         case SERVICE_CONTROL_QRYLOG:
> 			qrylog = !qrylog;
> 			syslog(LOG_NOTICE, "querylog %s\n", qrylog ? "on":"off");
> 			break;
> 
>         case SERVICE_CONTROL_CHKPT:
> 			needToChkpt = 1;
> 			break;
> 
>         case SERVICE_CONTROL_EXIT:
>  #ifdef XSTATS
>         	               needToExit = 1;
>  #endif
>         	               was_stopped = 1;	
>                        	break;
> 
>         default:
>         	/* invalid control code */
> 			syslog(LOG_ERR, "invalid control code: %d", dwCtrlCode);
>             break;
> 
>     }
> 
> #ifdef NOWAIT
> 	if((len = sendto(datagramq->dq_dfd, loopbuf, 1, 0, (struct sockaddr *)&loopback,
> 	          sizeof(struct sockaddr_in))) == SOCKET_ERROR)
> 		syslog(LOG_ERR, "failed to send the control code immediately: %m");
>  
> #endif
> 
> 	ServiceStatus.dwCurrentState = dwState;
> 	ServiceStatus.dwWin32ExitCode = NO_ERROR;
> 	if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) {
> 		syslog(LOG_ERR, "SetServiceStatus(): %m");
> 	}
> }
> 
> 
> /* Expand environmental variables in file pathnames */
> /* XXX - Would it be better to store/retrieve pathnames from the registry? */
> void
> expand_paths(void)
> {
>   FILE *fp;
> 
>         /* change name back to named.boot but for backwards compat. this fails go back to the
>            alternate name named.ini... unfort. since bootfile is passed a few layers down it
>            would be a pain to changeall these calls in the stock bind so attempt to open the
>            file here and decide which name to use */
>            
> 	pathtmpdir = (char *)malloc(MAX_PATH);
> 	if (!GetTempPath(MAX_PATH, pathtmpdir))
> 		syslog(LOG_ERR, "GetTempPath() failed: %m");
> 
> 	pathboot = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_BOOT, pathboot, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_BOOT) failed: %m\n");
> 	} else
>            {
> 	     if ((fp = fopen(pathboot, "r")) == NULL)
> 	       {
>                  /* try alternate name */
> 
> 	         if (!ExpandEnvironmentStrings(_ALT_PATH_BOOT, pathboot, MAX_PATH)) {
> 		   syslog(LOG_ERR, "ExpandEnvironmentStrings(_ALT_PATH_BOOT) failed: %m\n");
> 	         } else
> 		   bootfile = pathboot;
> 	       } /* else it opened ok so close it */
> 	      else
>                {
>                  fclose(fp);
>                  bootfile = pathboot;
>                }
>            }
>                
> 	pathpidfile = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_PIDFILE, pathpidfile, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_PIDFILE) failed: %m\n");
> 	} else
> 		PidFile = pathpidfile;
> 		 
> 	pathxfer = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_XFER, pathxfer, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_XFER) failed: %m\n");
> 	}
> 
> 	pathdebug = (char *)malloc(MAX_PATH);
> 	strcpy(pathdebug, pathtmpdir);
> 	debugfile = strcat(pathdebug, _PATH_DEBUG);
> 	
> 	pathdumpfile = (char *)malloc(MAX_PATH);
> 	strcpy(pathdumpfile, pathtmpdir);
> 	dumpfile = strcat(pathdumpfile, _PATH_DUMPFILE);
> 	 
> 	pathstats = (char *)malloc(MAX_PATH);
> 	strcpy(pathstats, pathtmpdir);
> 	statsfile = strcat(pathstats, _PATH_STATS);
> 	 
> 	pathxfertrace = (char *)malloc(MAX_PATH);
> 	strcpy(pathxfertrace, pathtmpdir);
> 	strcat(pathxfertrace, _PATH_XFERTRACE);
> 
> 	pathxferddt = (char *)malloc(MAX_PATH);
> 	strcpy(pathxferddt, pathtmpdir);
> 	strcat(pathxferddt, _PATH_XFERDDT);
> }
> 
> 
> /* new function for nt only l. kahn go through registry and get nt interfaces included masks... ignore wan inteffaces
>    for now */
>    
>   int get_winnt_interfaces(ifc)
> 
>     struct ifconf *ifc;
>     
> 
>   {
>         char *ifc_buffer = ifc->ifc_buf;
> 
>     	struct ifreq *ifr;
>         int maxsize = sizeof(ifc_buffer);
>         HKEY hk, hksub;                      /* registry key handle */
>         BOOL bSuccess;
>         char dummy[100] = "";
>         LONG rvalue;
>         char newkey[200];
>         DWORD dwIndex;
>         LONG cb;
> 
>         char servicename[50];
>         DWORD sizeofservicename = 50;
>         int Done = 0;
>         
>         /* these need to be big as they are multi_sz in type and hold all ip addresses and subnet mask for a
>            given interface */
>         char IpAddresses[10000];
>         char *ipptr = IpAddresses;
>         DWORD sizeofipaddresses = 10000;
>         char SubNetMasks[10000];
>         char *subptr = SubNetMasks;
>         DWORD sizeofsubnetmasks = 10000;
> 
>        char oneIpAddress[16];
>        char oneSubNetMask[16];
>        int count = 0;
> 
>     /* get key for our application */
>     bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,
>                           "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards",&hk);
>     if(bSuccess != ERROR_SUCCESS)
>     {
>       syslog(LOG_ERR, "failed to Open NetworkCards Registry key: %m");
>       return -1;
>     }
> 
>     /* now loop through and get all then netcard values */ 
>     dwIndex = 0;       
>     while (1)
>     {
> 
>         rvalue  = RegEnumKey(hk, dwIndex, dummy,sizeof(dummy));
>         if (rvalue == ERROR_NO_MORE_ITEMS)
>           break;
>         if (rvalue != ERROR_SUCCESS)
>            {
>              syslog(LOG_ERR, "Error in regenumkey fetching network cards info: %m");
>              RegCloseKey(hk);
>              return -1;
>            }
>         if (*dummy == '.')
>           continue; /* no more */
> 
>           
>         cb = sizeof(dummy);
>         /* now open the subkey */
>         strcpy(newkey,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\");
>         strncat(newkey,dummy,cb);
>         
>         bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,newkey,&hksub);
>         if(bSuccess != ERROR_SUCCESS)
>          {
>           sprintf(dummy,"failed to open network card key: %s",newkey);
>           syslog(LOG_ERR,dummy);
>           RegCloseKey(hk);
>           return -1;
>          }
>             
>          /* ok now get the servicename parameter  */
>          sizeofservicename = 50;
>          bSuccess = RegQueryValueEx(hksub,  /* subkey handle         */
>          "ServiceName",                     /* value name            */
>           NULL,                             /* must be zero          */
>           NULL,                             /* value type          not required  */
>           (LPBYTE) &servicename,             /* address of value data */
>           &sizeofservicename);   /* length of value data  */
>           if(bSuccess != ERROR_SUCCESS)
>             {
>              syslog(LOG_ERR, "Error in RegQueryValueEx fetching service name parameter: %m");
>              RegCloseKey(hksub);
>              RegCloseKey(hk);
>              return -1;
>         }
> 
>         /* skip services that are NDISWAN... since these are temporary interfaces like ras and if we bind to these
>            we would have to check if the socket is still ok everytime before using it as when the link goes down
>            and comes back up the socket is no longer any good... and the server eventually crashes if we don't check
>            this.. and to check it entails a lot of overhead... shouldn't be a problem with machines with only a RAS
>            interface anyway as we can bind to the loopback or 0.0.0.0 */
>         if ((strlen(servicename) >= 7) && (strncmp(strupr(servicename),"NDISWAN",7) == 0))
>           {
>             /* skip it */
> 	        dprintf(1, (ddt, "Skippping temporary interface [%s]\n",servicename));
>             RegCloseKey(hksub);
>           }
>        else {
>   
>         /* if opening this key fails we can assume it is not a network card ie digiboard and go on.. */
> 
>         /* ok now that we have the service name parameter close the key and go get the ipaddress and subnet mask */
>         RegCloseKey(hksub);
> 
>         strcpy(newkey,"SYSTEM\\Currentcontrolset\\Services\\");
>         strcat(newkey,servicename);
>         strcat(newkey,"\\parameters\\tcpip");
>        
>         bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,newkey,&hksub);
>         if(bSuccess != ERROR_SUCCESS)
>          {
>           dprintf(1, (ddt, "Skipping interface [%s] ... It is not a network card.\n",servicename));
>          }
> 
>          else { /* ok it is a network card */            
>          /* ok now get the ipaddress and subnetmask */
>          sizeofipaddresses = 10000;
>          bSuccess = RegQueryValueEx(hksub,  /* subkey handle         */
>          "IpAddress",                       /* value name            */
>           NULL,                             /* must be zero          */
>           NULL,                             /* value type          not required  */
>           (LPBYTE) &IpAddresses,               /* address of value data */
>           &sizeofipaddresses);                /* length of value data  */
>           if(bSuccess != ERROR_SUCCESS)
>             {
>              syslog(LOG_ERR, "Error in RegQueryValueEx fetching IpAddress parameter: %m");
>              RegCloseKey(hksub);
>              RegCloseKey(hk);
>              return -1;
>             }
> 
>          /* ok now get the ipaddress and subnetmask */
>          sizeofsubnetmasks = 10000;
>          bSuccess = RegQueryValueEx(hksub,  /* subkey handle         */
>          "SubNetMask",                      /* value name            */
>           NULL,                             /* must be zero          */
>           NULL,                             /* value type          not required  */
>           (LPBYTE) &SubNetMasks,              /* address of value data */
>           &sizeofsubnetmasks);               /* length of value data  */
>           if(bSuccess != ERROR_SUCCESS)
>             {
>              syslog(LOG_ERR, "Error in RegQueryValueEx fetching SubNetMask parameter: %m");
>              RegCloseKey(hksub);
>              RegCloseKey(hk);
>              return -1;
>             }
> 
>         RegCloseKey(hksub);
>         /* ok now that we have some addresses and subnet masks go through each one and add to our structure... */
>         /* multi_sz strings are terminated by two \0 in a row */
> 
>         ipptr = IpAddresses;
>         subptr = SubNetMasks;
>         Done = 0;
>         while (!Done)
>         {
>          ifr = (struct ifreq *)ifc_buffer;
>          if (sscanf(ipptr,"%s",oneIpAddress) != EOF)
>            ipptr+= strlen(oneIpAddress) + 1; /* add one for terminator \0 */
>          else Done = 1;
>          
>          if (sscanf(subptr,"%s",oneSubNetMask) != EOF)
>            subptr += strlen(oneSubNetMask) + 1;
>          else Done = 1;
> 
>          /* now add to interface structure */
>          if (!Done)                  
>           {
>            ifr->ifr_addr.sa_family = AF_INET;
>            ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr = inet_addr(oneIpAddress);
>            strcpy(ifr->ifr_mask,oneSubNetMask);
> 
>            if (strlen(servicename) > 15)
>              strncpy(ifr->ifr_name,servicename,15);
>            else strcpy(ifr->ifr_name,servicename);
> 
>            /* now increment pointer */
> 	       ifc_buffer += sizeof (ifr->ifr_name) + sizeof(ifr->ifr_addr) + sizeof(ifr->ifr_mask);
>            ++count;
>            if (((char *)ipptr == '\0') || ((char *)subptr == '\0')) 
>              Done = 1;
>          }
>           
>         }
>         } /* it is a network card */
>        } /* end of skip WAN interfaces */
>       
>       ++dwIndex;
>     } /* end of loop  */
> 
>     RegCloseKey(hk);
>     /* now reset the length */
>     ifc->ifc_len = count * (sizeof(ifr->ifr_name) + sizeof(ifr->ifr_addr) + sizeof(ifr->ifr_mask));
>     return 0;
> }
> 
> #endif /* WINNT */
> 
> 
diff --recurs m:\bindb32/named/ns_maint.c m:\bind/named/ns_maint.c
22,26c22,26
<  * 	This product includes software developed by the University of
<  * 	California, Berkeley and its contributors.
<  * 4. Neither the name of the University nor the names of its contributors
<  *    may be used to endorse or promote products derived from this software
<  *    without specific prior written permission.
---
>  *      This product includes software developed by the University of
>  *      California, Berkeley and its contributors.
>  * 4. Neither the name of the University nor the names of its contributors
>  *    may be used to endorse or promote products derived from this software
>  *    without specific prior written permission.
28,31c28,31
<  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
<  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
<  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
---
>  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
>  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
>  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60a61
> #ifndef WINNT
64a66
> #endif
66a69
> #ifndef WINNT
67a71
> #endif
68a73
> #ifndef WINNT
69a75
> #endif
76a83
> #ifndef WINNT
77a85,87
> #else
> # include <sys/utime.h>
> #endif
80,81c90,91
< static int		xfers_running,	/* # of xfers running */
< 			xfers_deferred,	/* # of needed xfers not run yet */
---
> static int              xfers_running,  /* # of xfers running */
> 			xfers_deferred, /* # of needed xfers not run yet */
83c93
< 			alarm_pending,	/* flag */
---
> 			alarm_pending,  /* flag */
86c96
< static void		startxfer __P((struct zoneinfo *)),
---
> static void             startxfer __P((struct zoneinfo *)),
91c101
< #define	qserial_qfull()	(qserials_running == MAXQSERIAL)
---
> #define qserial_qfull() (qserials_running == MAXQSERIAL)
94c104
< static time_t cache_time;
---
> static time_t cache_time = 0;
97c107
< static time_t stats_time;
---
> static time_t stats_time = 0;
98a109,182
> 
> #ifdef WINNT
> /* lgk since timer resolution on nt (at least my box) only goes to 1000 seconds
>  * our method using mmedia times is no good therefore use a thread that
>  * we create that sleeps the timeout period and then when done calls maint_alarm
>  * and exits...
>  * lgk dec. 95 change again to use a waitforsingleobject on an event for the specified
>  * timeout instead of sleep so it can be signaled with a reschedule request..
>  */
>     
> DWORD pending_delay = 0;
> volatile HANDLE rescheduleevent = 0x00;
> DWORD threadid;
> HANDLE threadhandle = 0x00;
> static void named_xfer __P((HANDLE *));
> static void CALLBACK maint_alarm __P((UINT,UINT,DWORD,DWORD,DWORD));
> extern CRITICAL_SECTION protected_zp;
> extern CRITICAL_SECTION maint_section;
> volatile BOOLEAN maint_thread_running = FALSE;
> PROCESS_INFORMATION *proc_info_copy;
> 
> DWORD thread_timer_fx(DWORD timeout)
>   {
> 
>     DWORD rvalue;
> 
>     /* now wait on the handle */
>     rvalue = WaitForSingleObject(rescheduleevent,timeout);
> 
>     /* now check reason we woke up */
>     switch (rvalue)
>      {
> 
>       case WAIT_FAILED:
>         dprintf(1, (ddt, "Wait for thread timer event object failed!\n")); 
>         syslog(LOG_ERR, "Wait for thread timer event object failed!");
>         EnterCriticalSection(&maint_section);
>         maint_thread_running = FALSE;
>         LeaveCriticalSection(&maint_section);
>         ExitThread(0);
>         break;
>       
>       case WAIT_OBJECT_0:
>         dprintf(1, (ddt, "In Maintenance thread... current thread is exiting for reschedule request!\n"));
>         /* don't set thread running to false here as by the time this gets hit and the
>            thread terminates we may overwrite someone else setting it to true */
>         ExitThread(0);
>         break;
> 
>       case WAIT_TIMEOUT:
>         dprintf(1, (ddt, "In Maintenance thread... timer has expired!\n"));
>         break;
>       
>       default:
>         dprintf(1, (ddt, "Unknown return type from WaitForSingleObject in thread_timer_fx (%d)!\n",rvalue));
>         syslog(LOG_ERR, "Unknown return type from WaitForSingleObject in thread_timer_fx (%d)!\n",rvalue);
>         EnterCriticalSection(&maint_section);
>         maint_thread_running = FALSE;
>         LeaveCriticalSection(&maint_section);
>         ExitThread(0);
>         break;
>       
>      }
> 
>     EnterCriticalSection(&maint_section);
>     maint_thread_running = FALSE;
>     LeaveCriticalSection(&maint_section);
>     maint_alarm(0,0,0,0,0);
>     return 0;
> }
> 
> 
> #endif /* WINNT */
> 
112d195
< 
114d196
< 
167c249,250
< 	if ((cache_time + cache_interval) <= tt.tv_sec) {
---
> 	if ((cache_time + cache_interval) <= tt.tv_sec)
> 	  {
169c252
< 			remove_zone(hashtab, 0, 0);
---
> 		  remove_zone(hashtab, 0, 0);
171c254
< 	}
---
> 	  }
174c257,259
< 	if (stats_time + stats_interval <= tt.tv_sec) {
---
>     dprintf(1, (ddt, "\nns_maint(); stats interval is %d\n",stats_interval));
> 	if (stats_time + stats_interval <= tt.tv_sec)
> 	  {
176c261
< 			ns_logstats();
---
> 		  ns_logstats();
178c263
< 	}
---
> 	  }
181c266
< 		sched_maint();
---
> 	  sched_maint();
192a278
> #ifndef WINNT
194c280,283
< #ifdef	CLEANCACHE
---
> #else
> 	DWORD wDelay;
> #endif
> #ifdef  CLEANCACHE
199c288
< 	static time_t next_alarm;
---
> 	static time_t next_alarm  ;
205c294
<         /*
---
> 	/*
209c298,300
< 	bzero((char *)&ival, sizeof ival);
---
> #ifndef WINNT
> 	bzero((char *)&ival, sizeof (ival));
> #endif
220a312
> #ifndef WINNT
223a316,320
> #else
> 		wDelay = (next_refresh - tt.tv_sec) * 1000;
> 		if ((long) wDelay < (maint_interval * 1000))
> 			wDelay = maint_interval * 1000;
> #endif
226a324
> #ifndef WINNT
229a328,374
> #else
>       /* lgk under my h/w for nt maximum timer values are 1000 seconds... the above values are not for resolution
>        * as the original author supposed but for the minimum and maximum timer values that mm timers supports..
>        * and since they don't supprt 1 hour... the create of the timer object was failing... therefore the only
>        * way I figured out to do this was create a thread that sleeps for the timeout and then waits up and calls
>        * maint alarm... seems to work ok now... 
>        * lgk dec. 95 change again to use a waitforsingleobject on an event for the specified
>        * timeout instead of sleep so it can be signaled with a reschedule request..
>        */
> 
>        /* lgk 12/95 there is a problem here were it tries to reschedule
>           when a timer thread is already running... under nt now see comment above */
> 
>       if (rescheduleevent == 0x00)
>         {
>           if ((rescheduleevent = CreateEvent(NULL,TRUE,FALSE,NULL)) == 0x00)
>             {
>              syslog(LOG_ERR,"Error: Couldn't create the maint. reschedule event object!");
>              dprintf(1, (ddt, "Error: Couldn't create the maint. reschedule event object!"));
>              return;
>             }
>         }
> 
>       /* first check if already one running */
>       EnterCriticalSection(&maint_section);
>       
>       if (maint_thread_running)
>         { /* ok now check if we have a smaller time */
>           dprintf(1,(ddt,"sched_maint: Rescheduling maint. from %d sec to %d sec.\n",pending_delay/1000,wDelay/1000));
>           /* signal other waiting thread to exit */
>           PulseEvent(rescheduleevent);
>         }
> 
>        maint_thread_running = TRUE;
> 
>        if (threadhandle != 0x00)
>          CloseHandle(threadhandle );
>        /* reset the event */
>        ResetEvent(rescheduleevent);   
> 
>        threadhandle = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)thread_timer_fx,(LPVOID)wDelay,0,&threadid);
> 
>        pending_delay = wDelay;
>  	   dprintf(1, (ddt, "sched_maint: Next interrupt in %d sec\n",wDelay/1000));
>        LeaveCriticalSection(&maint_section);
> 
> #endif
295c440
< 		return;		/* XXX - this is bad, we should do something */
---
> 		return;         /* XXX - this is bad, we should do something */
316c461
< 	qp->q_flags &= ~Q_ZSERIAL;	/* keeps us from being called twice */
---
> 	qp->q_flags &= ~Q_ZSERIAL;      /* keeps us from being called twice */
356a502
> #ifndef WINNT
382a529
> #endif
407c554,557
< 	int argc = 0, argc_ns = 0, pid, i;
---
> 	int argc = 0, argc_ns = 0, i;
> #ifdef WINNT
> 	extern char *pathxferddt, *pathxfertrace;
> #endif
414a565,576
> #ifdef WINNT
> 	char *pos;
> 	DWORD xfer_thread_id;
> 	PROCESS_INFORMATION xfer_proc;
> 	STARTUPINFO sui;
> 	static char CommandLine[NSMAX*(MAXDNAME+1)+20*10];
> 	HANDLE ppid;
>     
> 
> #else
> 	int pid;
> #endif
418c580,584
< 	argv[argc++] = _PATH_XFER;
---
> #ifndef WINNT
> 	argv[argc++] = "_PATH_XFER";
> #else
> 	argv[argc++] = "xfer";
> #endif
431c597
<  	if (zp->z_flags & Z_SYSLOGGED)
---
> 	if (zp->z_flags & Z_SYSLOGGED)
445a612
> #ifndef WINNT
446a614,616
> #else
> 		argv[argc++] = pathxferddt;
> #endif
448a619
> #ifndef WINNT
449a621,623
> #else
> 			argv[argc++] = pathxfertrace;
> #endif
477c651
<         }
---
> 	}
480a655,665
> #ifdef WINNT
> 	/* need the arguments in the form of a string not in argv format */
> 	pos = CommandLine;
> 	for (i = 0; i < argc; i++) {
> 		sprintf(pos, argv[i]);
> 		pos += strlen(pos);
> 		*pos++ = ' ';
> 	}
> 	*pos = '\0';
> #endif 
> 
486c671
<         }
---
> 	}
491,497c676,685
< 	holdsigchld();
< 	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
< 		if (xferstatus[i].xfer_pid == 0) {
< 			xferstatus[i].xfer_state = XFER_RUNNING;
< 			break;
< 		}
< 	}
---
> #ifndef WINNT
>    	holdsigchld();
> #endif
>   	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
>   		if (xferstatus[i].xfer_pid == 0) {
>   			xferstatus[i].xfer_state = XFER_RUNNING;
>   			break;
>   		}
>   	}
> #ifndef WINNT
500c688
< 		releasesigchld();
---
>   		releasesigchld();
509c697
< 		_exit(XFER_FAIL);	/* Avoid duplicate buffer flushes. */
---
> 		_exit(XFER_FAIL);       /* Avoid duplicate buffer flushes. */
511,513c699,739
< 	/* Parent. */
< 	xferstatus[i].xfer_pid = pid;  /* XXX - small race condition here if we
< 					* can't hold signals */
---
> #else /* WINNT */
> 	bzero((char *)&sui, sizeof(STARTUPINFO));
> 	sui.cb = sizeof(STARTUPINFO);
> 	if (!CreateProcess(NULL, CommandLine, NULL, NULL, FALSE, DETACHED_PROCESS, NULL,
> 					   NULL, &sui, (LPPROCESS_INFORMATION)&xfer_proc)) {
> 			syslog(LOG_ERR, "CreateProcess(): %m");
> 			return;
> 	}
>    if (proc_info_copy == 0x00){
>      proc_info_copy = (PROCESS_INFORMATION *)malloc(sizeof(PROCESS_INFORMATION));
>      }
> 
>   bcopy(&(xfer_proc), proc_info_copy, sizeof(PROCESS_INFORMATION));
>   ppid = xfer_proc.hProcess; 
> 
>     if (!CreateThread(
> 	NULL,                                /* no security attributes  */
> 	0,                                   /* use default stack size  */
> 	(LPTHREAD_START_ROUTINE) named_xfer, /* thread function         */
> 	(LPVOID) proc_info_copy,             /* argument to thread function   */
> 	0,                                   /* use default creation flags    */
> 	(LPDWORD) &xfer_thread_id)) {        /* returns the thread identifier */
> 			syslog(LOG_ERR, "CreateThread(): %m");
> 			return;
> 	}
> #endif /* WINNT */
> 	/* parent */
> #ifdef WINNT
> 	/* probably need a mutex here to synchronize access to zp variables
> 	 * between various endxfer's and startxfer's
> 	 */
>      /* lgk use critical section here for this and in endxfer where this is read */
> 
>     EnterCriticalSection(&protected_zp);
> 	dprintf(1, (ddt, "started xfer child %d\n", ppid));
> 	zp->z_xferpid = ppid;
>   	xferstatus[i].xfer_pid = (long)ppid;
> #else
> 	zp->z_xferpid = pid;
>   	xferstatus[i].xfer_pid = pid;  /* XXX - small race condition here if we
>   					* can't hold signals */
514a741
> #endif
517c744
< 	zp->z_xferpid = pid;
---
> 
520c747,752
< 	releasesigchld();
---
> #ifdef WINNT
>     LeaveCriticalSection(&protected_zp);
> #else
>   	releasesigchld();
> #endif
>     
527c759
< 	static char ret[sizeof "(4294967296?)"];	/* 2^32 */
---
> 	static char ret[sizeof "(4294967296?)"];        /* 2^32 */
530,531c762,763
< 	case Z_PRIMARY:		return ("primary");
< 	case Z_SECONDARY:	return ("secondary");
---
> 	case Z_PRIMARY:         return ("primary");
> 	case Z_SECONDARY:       return ("secondary");
533c765
< 	case Z_STUB:		return ("stub");
---
> 	case Z_STUB:            return ("stub");
535c767
< 	case Z_CACHE:		return ("cache");
---
> 	case Z_CACHE:           return ("cache");
563c795
<  	fprintf(ddt, ", type = %s", zoneTypeString(zp));
---
> 	fprintf(ddt, ", type = %s", zoneTypeString(zp));
593c825
< #ifdef	CLEANCACHE
---
> #ifdef  CLEANCACHE
660c892
< 	    !WILDCARD_P(dname)) {
---
>   	    !WILDCARD_P(dname)) {
663c895
< 				dp = rm_datum(dp, np, pdp);
---
> 			    dp = rm_datum(dp, np, pdp);
769c1001
< 		if (dp->d_rcode)	/* this should not occur */
---
> 		if (dp->d_rcode)        /* this should not occur */
793c1025
< 		nsa = zp->z_xaddr;	/* qserial overrode address */
---
> 		nsa = zp->z_xaddr;      /* qserial overrode address */
797c1029
< 		nsa = zp->z_addr[0];	/* first ns holds zone's xfer limit */
---
> 		nsa = zp->z_addr[0];    /* first ns holds zone's xfer limit */
800c1032
< 		return (-1);		/* probably ENOMEM */
---
> 		return (-1);            /* probably ENOMEM */
804c1036
< 		return (-1);		/* taking more than we have */
---
> 		return (-1);            /* taking more than we have */
809a1042
> 
812a1046
> 
816c1050,1051
< {
---
>    {
> 
821,822c1056,1057
< 			if (xferstatus[i].xfer_pid == zp->z_xferpid) {
< 				xferstatus[i].xfer_pid = 0;
---
> 			if (xferstatus[i].xfer_pid == (long)zp->z_xferpid) {
> 			    xferstatus[i].xfer_pid = 0;
831a1067
> #ifndef WINNT
838,840c1074,1077
< "zone transfer timeout for \"%s\"; second kill\
< pid %lu - forgetting, processes may accumulate",
< 			       zp->z_origin, (u_long)zp->z_xferpid);
---
>                             "zone transfer timeout for \"%s\"; second kill\
>                              pid %lu - forgetting, processes may accumulate",
> 			     zp->z_origin, (u_long)zp->z_xferpid);
> #else
841a1079,1085
> else
>  {
> 	TerminateProcess(zp->z_xferpid, (UINT)XFER_KILLED);
> 	CloseHandle(zp->z_xferpid);
>  	ns_retrytime(zp, tt.tv_sec);
>  }
> #endif
846c1090,1093
< 	} else if (kill(zp->z_xferpid, SIGKILL) == -1) {
---
> 	}
> 
> #ifndef WINNT
>         else if (kill(zp->z_xferpid, SIGKILL) == -1) {
861a1109,1158
> 	
> #else
>       else
>           {
>         int i;
> 	    TerminateProcess(zp->z_xferpid, (UINT)XFER_KILLED);
> 
>         // clear out the entry in the table
> 		for (i = 0; i < MAX_XFERS_RUNNING; i++) {
> 			if (xferstatus[i].xfer_pid == (long)zp->z_xferpid) {
> 				xferstatus[i].xfer_pid = 0;
> 				xferstatus[i].xfer_state = XFER_IDLE;
> 				break;
> 			}
> 		}
> 
> 
> 	    CloseHandle(zp->z_xferpid);
> 	    syslog(LOG_NOTICE,
> 		"zone transfer timeout for \"%s\"; pid %lu killed",
> 		zp->z_origin, (u_long)zp->z_xferpid);
> 		zp->z_flags |= Z_XFER_ABORTED;
> 	     ns_retrytime(zp, tt.tv_sec);
> 	     (void) nxfers(zp, -1);
> 	     xfers_running--;
> 	  }
> #endif
> 	
>    }
> 
> 
> /*
>  * Abort an xfer that has taken too long.
>  */
> 
> /* old code static void
> abortxfer(zp)
> 	struct zoneinfo *zp;
> {
> #ifndef WINNT
> 	kill(zp->z_xferpid, SIGKILL);
> #else
> 	TerminateProcess(zp->z_xferpid, (UINT)XFER_KILLED);
> 	CloseHandle(zp->z_xferpid);
> #endif
> 	syslog(LOG_NOTICE, "zone transfer timeout for \"%s\"; pid %lu killed",
> 	       zp->z_origin, (u_long)zp->z_xferpid);
> 	ns_retrytime(zp, tt.tv_sec);
> 	(void) nxfers(zp, -1);
> 	xfers_running--;
862a1160,1161
> */
> 
863a1163
> #ifndef WINNT
900a1201,1203
> 
> #endif
> 
902c1205,1206
<  * Finish processing of of finished xfers
---
>  * SIGCHLD signal handler: process exit of xfer's.
>  * (Note: also called when outgoing transfer completes.)
903a1208,1213
> /* the semantics here have changed now we call reapchild when a transfer ends which sets the
>    variable needendxfer... however under nt since there are no signals endxfer is called
>    directly when a transfer ends... therefore we need to clear out the entry here under 
>    nt, also under nt we determine the pid to clear because it is passed in ... lgk */
> 
> #ifndef WINNT
905a1216,1220
> #else
> void
> endxfer(pid)
> 	HANDLE pid;
> #endif
907,908c1222,1229
<     	register struct zoneinfo *zp;   
< 	int exitstatus, pid, i;
---
>     register struct zoneinfo *zp;
> #ifndef WINNT   
>  	int exitstatus, pid;
> #else
>     int i;
> 	DWORD exitstatus;
> #endif
> #ifndef WINNT
913a1235
> #endif
915c1237
< 	gettime(&tt);
---
> gettime(&tt);
917,922c1239,1255
< 	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
< 		if (xferstatus[i].xfer_state != XFER_DONE)
< 			continue;
< 		pid = xferstatus[i].xfer_pid;
< 		status = xferstatus[i].xfer_status;
< 		exitstatus = WIFEXITED(status) ?WEXITSTATUS(status) :0;
---
> // under nt this should not get called unless a transfer has complete or aborted
> #ifndef WINNT
>   	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
>   		if (xferstatus[i].xfer_state != XFER_DONE)
>   			continue;
>   		pid = xferstatus[i].xfer_pid;
>   		status = xferstatus[i].xfer_status;
> 
>     		exitstatus = WIFEXITED(status) ?WEXITSTATUS(status) :0;
> #else
>  
> 	if (!GetExitCodeProcess(pid, &exitstatus))
>           {
> 	    syslog(LOG_ERR, "endxfer: cannot determine return code of the xfer process: %m");
> 	    return;
> 	  }
> #endif /* WINNT */
924c1257,1258
< 		for (zp = zones; zp < &zones[nzones]; zp++) {
---
> 		for (zp = zones; zp < &zones[nzones]; zp++)
>                    {
926a1261,1275
>             // ok found our zone
> #ifdef WINNT
>             // regardless of how it terminated if under nt clear it out here
>             // first find the entry 
>              
>   	         for (i = 0; i < MAX_XFERS_RUNNING; i++) {
> 			    if (xferstatus[i].xfer_pid == (long)pid) {
> 				    xferstatus[i].xfer_status = exitstatus;
>                     xferstatus[i].xfer_state = XFER_IDLE;
> 			    	xferstatus[i].xfer_pid = 0;
> 			    	
> 			   } 
> 		      }   
> 		     CloseHandle(zp->z_xferpid);
> #endif
930,931c1279,1281
< 			zp->z_flags &=
< 				~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
---
>   			zp->z_flags &=
>   				~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
> #ifndef WINNT
933c1283
< 		 "\nendxfer: child %d zone %s returned status=%d termsig=%d\n",
---
> 		            "\nendxfer: child %d zone %s returned status=%d termsig=%d\n", 
945a1296
> #endif /* WINNT */
955a1307
>                     dprintf(1, (ddt, "named-xfer for %s ended successfully (child = %d)\n",zp->z_origin,pid));
962c1314
< 		      "zoneref: Masters for secondary zone \"%s\" unreachable",
---
> 		                      "zoneref: Masters for secondary zone \"%s\" unreachable",
967c1319,1323
< 
---
> #ifdef WINNT
> 				case XFER_KILLED:
> 					ns_retrytime(zp, tt.tv_sec);
> 					break;
> #endif
972,974c1328,1329
< 					     "named-xfer for \"%s\" exited %d",
< 						       zp->z_origin,
< 						       exitstatus);
---
> 					         "named-xfer for \"%s\" exited %d",
> 						    zp->z_origin, exitstatus);
981c1336
< 				}
---
> 				} /*switch*/
983,987c1338,1347
< 			}
< 		}
< 		xferstatus[i].xfer_state = XFER_IDLE;
< 		xferstatus[i].xfer_pid = 0;
< 	}
---
> #ifndef WINNT
> 			} /*if/else*/
> #endif
> 		   } /* inner for */
> 
> #ifndef WINNT
>  	 xferstatus[i].xfer_state = XFER_IDLE;
> 	 xferstatus[i].xfer_pid = 0;
> 	} /* outter for */
> 
988a1349
> #endif
1063c1424
<     	register struct zoneinfo *zp;   
---
> 	register struct zoneinfo *zp;   
1101a1463,1521
> 
> 
> #ifdef WINNT
> void CALLBACK maint_alarm (UINT wTimerID, UINT msg,
>     DWORD dwUser, DWORD dw1, DWORD dw2)
> {
> 	int len;
> 	char loopbuf[] = "";
> 	    struct sockaddr_in loopback; 
> 	    needmaint = 1;
> 	dprintf(1, (ddt, "in maint_alarm ...\n"));
> 	printf("in maint_alarm ...\n");
> 
> #ifdef NOWAIT
> 	loopback.sin_family = AF_INET;
> 	loopback.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> 	loopback.sin_port = htons(NAMESERVER_PORT);
> 	if(len = sendto(datagramq->dq_dfd, loopbuf, 1, 0, (struct sockaddr *)&loopback,
> 		  sizeof(struct sockaddr_in)) == SOCKET_ERROR)
> 		{
> 		syslog(LOG_ERR, "failed to break select for maintenance: %m, maintenance delayed");
> 		syslog(LOG_ERR, "WSA ERRORCODE WAS: %d", WSAGetLastError());
> 		}
> #endif
> 
> 
>     UNREFERENCED_PARAMETER(dw1);
>     UNREFERENCED_PARAMETER(dw2);
>     UNREFERENCED_PARAMETER(dwUser);
>     UNREFERENCED_PARAMETER(msg);
>     UNREFERENCED_PARAMETER(wTimerID);
> }
> 
> void
> named_xfer(PROCESS_INFORMATION *proc_info)
> {
> 	DWORD dwWait;
> 
> 	dwWait = WaitForSingleObject((*proc_info).hProcess, (DWORD) MAX_XFER_TIME * 1000);
> 	if ((dwWait == WAIT_FAILED) || (dwWait == WAIT_TIMEOUT)) {
> 		syslog(LOG_ERR, "WaitForSingleObject() on named-xfer process timed out: %m");
> 		ExitThread(1);
> 	}
> 
> 	/* probably need a mutex here to synchronize access to zp variables
> 	 * between various endxfer's and startxfer's
> 	 */
>     
>     /* lgk new code using critical section to synchronize */
>     EnterCriticalSection(&protected_zp);
> 	endxfer((*proc_info).hProcess);
>     LeaveCriticalSection(&protected_zp);
> 
> 	CloseHandle((*proc_info).hProcess);
>     CloseHandle((*proc_info).hThread);
> 	free((char *)proc_info);
> 	 ExitThread(0); 
> }
> #endif /* WINNT */
diff --recurs m:\bindb32/named/ns_ncache.c m:\bind/named/ns_ncache.c
9,14c9,18
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
diff --recurs m:\bindb32/named/ns_req.c m:\bind/named/ns_req.c
61,70c61,74
< #include <sys/param.h>
< #include <sys/uio.h>
< #include <sys/file.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <fcntl.h>
< #include <syslog.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/uio.h>
> #include <sys/file.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <fcntl.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <errno.h>
82a87,97
> #ifdef WINNT
> #define _exit(x) ExitThread(x)
> struct ntxfr {
> 	struct qstream *qsp;
> 	struct namebuf *np;
> 	u_char *soa;
> 	int soalen;
> 	int class;
> };
> #endif
> 
99a115
> #ifndef WINNT
100a117,119
> #else
> static void		fwritemsg __P((SOCKET, u_char *, int)),
> #endif
103a123
> #ifndef WINNT
105a126,129
> #else
> 			doaxfr __P((struct namebuf *, SOCKET,
> 				    struct namebuf *, int)),
> #endif
107a132,134
> #ifdef WINNT
> static void startxfr_child __P((struct ntxfr *));
> #endif
270c297
< 	sortmsgtxt = local(from) == NULL ? "Remote" : "Local";
---
>    	sortmsgtxt = local(from) == NULL ? "Remote" : "Local";
272c299
< 	sortmsgtxt = "(not sorting)";
---
>   	sortmsgtxt = "(not sorting)";
274,276c301,304
< 	dprintf(1, (ddt, "ns_req: answer -> %s fd=%d id=%d size=%d %s\n",
< 		    sin_ntoa(from), (qsp == QSTREAM_NULL) ? dfd : qsp->s_rfd,
< 		    ntohs(hp->id), cp - msg, sortmsgtxt));
---
>   	dprintf(1, (ddt, "ns_req: answer -> %s fd=%d id=%d size=%d %s\n",
>   		    sin_ntoa(from), (qsp == QSTREAM_NULL) ? dfd : qsp->s_rfd,
>   		    ntohs((u_short)hp->id), cp - msg, sortmsgtxt));
> 
468,471c496,499
< 	if ((ntohs(hp->qdcount) != 1)
< 	    || ntohs(hp->ancount) != 0
< 	    || ntohs(hp->nscount) != 0
< 	    || ntohs(hp->arcount) != 0) {
---
> 	if ((ntohs((u_short)  hp->qdcount) != 1)
>  	    || ntohs((u_short) hp->ancount) != 0
>  	    || ntohs((u_short) hp->nscount) != 0
>  	    || ntohs((u_short) hp->arcount) != 0) {
473,476c501,504
< 		hp->qdcount = htons(0);
< 		hp->ancount = htons(0);
< 		hp->nscount = htons(0);
< 		hp->arcount = htons(0);
---
>  		hp->qdcount = htons(0);
>  		hp->ancount = htons(0);
>  		hp->nscount = htons(0);
>  		hp->arcount = htons(0);
559c587
< 		    dname, ntohs(hp->id), type, class));
---
> 		    dname, ntohs((u_short)hp->id), type, class));
697c725
< 	hp->ancount = htons(ntohs(hp->ancount) + (u_int16_t)count);
---
> 	hp->ancount = htons((u_short)(ntohs((u_short)hp->ancount) + (u_int16_t)count));
740a769
> #ifndef WINNT
741a771
> #endif
788c818
< 			} else if (ntohs(hp->ancount) != 0) {
---
> 			} else if (ntohs((u_short)hp->ancount) != 0) {
987,990c1017,1020
< 	if (ntohs(hp->ancount) != 1
< 	    || ntohs(hp->qdcount) != 0
< 	    || ntohs(hp->nscount) != 0
< 	    || ntohs(hp->arcount) != 0) {
---
> 	if (ntohs((u_short) hp->ancount) != 1
> 	    || ntohs((u_short) hp->qdcount) != 0
> 	    || ntohs((u_short) hp->nscount) != 0
> 	    || ntohs((u_short) hp->arcount) != 0) {
992,995c1022,1025
< 		hp->qdcount = htons(0);
< 		hp->ancount = htons(0);
< 		hp->nscount = htons(0);
< 		hp->arcount = htons(0);
---
>  		hp->qdcount = htons(0);
>  		hp->ancount = htons(0);
>  		hp->nscount = htons(0);
>  		hp->arcount = htons(0);
1129a1160
> #ifndef WINNT
1133a1165,1170
> #else
> fwritemsg(rfd, msg, msglen)
> 	SOCKET rfd;
> 	u_char *msg;
> 	int msglen;
> #endif
1137a1175
> #ifndef WINNT
1139a1178,1181
> #else
> 	if (send(rfd, len, INT16SZ, 0) != INT16SZ ||
> 		send(rfd, msg, msglen, 0) != msglen) {
> #endif
1590c1632
< 	hp->nscount = htons(ntohs(hp->nscount) + 1);
---
> 	hp->nscount = htons((u_short)(ntohs((u_short)hp->nscount) + 1));
1604a1647
> #ifndef WINNT
1609a1653,1659
> #else
> doaxfr(np, rfd, top, class)
> 	register struct namebuf *np;
> 	SOCKET rfd;
> 	struct namebuf *top;
> 	int class;		/* Class to transfer */
> #endif
1652a1703
> #ifndef WINNT
1653a1705,1707
> #else
> 		fwritemsg(rfd, msg, n + HFIXEDSZ);
> #endif
1710a1765
> #ifndef WINNT
1711a1767,1769
> #else
>  			fwritemsg(rfd, msg, n + HFIXEDSZ);
> #endif
1742a1801
> #ifndef WINNT
1743a1803,1805
> #else
> 		fwritemsg(rfd, msg, n + HFIXEDSZ);
> #endif
1787a1850
> #ifndef WINNT
1788a1852,1854
> #else
> 			doaxfr(np, rfd, top, class);
> #endif
2026a2093
> #ifndef WINNT
2038a2106,2111
> #else /* WINNT */
> 	HANDLE xfr_thread_handle;
> 	struct ntxfr *xfr_child;
> 	char *xfrbuf;
> 	DWORD id;	
> #endif /* WINNT */
2041a2115
> #ifndef WINNT
2059a2134,2190
> #else
> 	if ((xfr_child = (struct ntxfr *)malloc(sizeof(struct ntxfr))) == NULL) {
> 		syslog(LOG_ERR, "startxfr: malloc: %m");
> 		return;
> 	}
> 	if ((xfrbuf = (u_char *)malloc(BUFSIZ)) == NULL) {
> 		syslog(LOG_ERR, "startxfr: malloc: %m");
> 		return;
> 	}
> 	xfr_child->qsp = qsp;
> 	xfr_child->np = np;
> 	bcopy(soa, xfrbuf, soalen);
> 	soa[soalen+1] = '\0';
> 	xfr_child->soa = xfrbuf;
> 	xfr_child->soalen = soalen;
> 	xfr_child->class = class;
> 
> 	xfr_thread_handle = CreateThread(NULL, 0,
> 									(LPTHREAD_START_ROUTINE)startxfr_child,
> 									(LPVOID)xfr_child, 0, &id);
> 	if(xfr_thread_handle == NULL)
> 		syslog(LOG_NOTICE, "startxfr(%s -> %s) failing; CreateThread(): %m",
> 		       dname, sin_ntoa(&qsp->s_from));
> 	else
> 		/* probably should store the thread handle and/or thread id
> 		 * and identify and kill a hung outgoing zone transfer thread
> 		 */
> 		syslog(LOG_DEBUG, "zone transfer of \"%s\" to %s (threadId %d)",
> 		       dname, sin_ntoa(&qsp->s_from), id);
>         /* lgk close errant handle here so we don't get too many */
>         CloseHandle(xfr_thread_handle);
> 	return;
> }
> 
> static void
> startxfr_child(pxfr_child)
> 	struct ntxfr *pxfr_child;
> {
> 	DWORD pid;
> #if defined(HAVE_SETVBUF) && !defined(WINNT)
> 	char *buf;
> #endif
> #ifdef SO_SNDBUF
> 	static const int sndbuf = XFER_BUFSIZE * 2;
> #endif
> #ifdef SO_LINGER
> 	static const struct linger ll = { 1, 120 };
> #endif
> 	struct qstream	*qsp = pxfr_child->qsp;
> 	struct namebuf	*np = pxfr_child->np;
> 	u_char		*soa = pxfr_child->soa;
> 	int		soalen = pxfr_child->soalen;
> 	int		class = pxfr_child->class;
> 	int off = 0;
> 
> 	pid = GetCurrentThreadId();
> #endif /* WINNT */
2066a2198
> #ifndef WINNT
2069a2202
> #endif
2073a2207,2209
> #ifdef WINNT
> 	(void) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
> #endif
2075a2212
> #ifndef WINNT
2079a2217
> #endif
2080a2219
> #ifndef WINNT
2086c2225,2232
< #ifdef HAVE_SETVBUF
---
> #else
> 	/* set the socket to be blocking again */
> 	if(ioctlsocket(qsp->s_rfd, FIONBIO, (u_long *)&off) == SOCKET_ERROR) {
> 		syslog(LOG_INFO, "ioctlsocket(rfd, BLOCK): %m");
> 		exit(1);
> 	}
> #endif /* WINNT */
> #if defined(HAVE_SETVBUF) && !defined(WINNT)
2105a2252
> #ifndef WINNT
2106a2254,2257
> #else
> 	fwritemsg(qsp->s_rfd, soa, soalen);
> #endif
> #ifndef WINNT
2107a2259,2262
> #else
> 	doaxfr(np, qsp->s_rfd, np, class);
> #endif
> #ifndef WINNT
2109a2265,2267
> #else
> 	fwritemsg(qsp->s_rfd, soa, soalen);
> #endif
2116a2275
> #ifndef WINNT
2117a2277,2282
> #else
> 	sqrm(qsp);
> #endif /* WINNT */
> #endif /* SO_LINGER */
> #ifdef WINNT
> 	/* endxfer(GetCurrentThread());	*/
2118a2284
> #ifndef WINNT
2119a2286,2288
> #else
> 	ExitThread(0);
> #endif
diff --recurs m:\bindb32/named/ns_resp.c m:\bind/named/ns_resp.c
61,70c61,74
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <syslog.h>
< #include <errno.h>
< #include <stdio.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <errno.h>
> #include <stdio.h>
> #include <resolv.h>
189c193
< 	int restart;	/* flag for processing cname response */
---
> 	int restart; /* flag for processing cname response */
213c217
< 		dprintf(1, (ddt, "DUP? dropped (id %d)\n", ntohs(hp->id)));
---
> 		dprintf(1, (ddt, "DUP? dropped (id %d)\n", ntohs( (u_short) hp->id)));
227,230c231,234
< 	qdcount = ntohs(hp->qdcount);
< 	ancount = ntohs(hp->ancount);
< 	aucount = ntohs(hp->nscount);	/* !!! */
< 	arcount = ntohs(hp->arcount);
---
> 	qdcount = ntohs( (u_short) hp->qdcount);
> 	ancount = ntohs( (u_short) hp->ancount);
> 	aucount = ntohs( (u_short) hp->nscount);	/* !!! */
> 	arcount = ntohs( (u_short) hp->arcount);
503a508
> 
691,692c696,697
< 	cname = 0;
< 
---
>         cname = 0;
> 	
779c784
< 		if (i < ancount) {
---
> 		if ( i < ancount ) {
790,791c795,796
< 			else
< 				cname = 1;
---
>   			else
>   				cname = 1;
868c873
< 	if (!restart && ancount && (qtype == T_ANY || !qp->q_cmsglen)) {
---
>    	if (!restart && ancount && (qtype == T_ANY || !qp->q_cmsglen)) {
915c920
< 	if ((!restart || !cname) && qp->q_cmsglen && ancount) {
---
>   	if ((!restart || !cname) && qp->q_cmsglen && ancount) {
918c923
< 		bcopy(qp->q_cmsg, newmsg, newmsglen);
---
>  		bcopy(qp->q_cmsg, newmsg, newmsglen);
948d952
< 
949a954
> 
967c972
< 	hp->ancount = htons(ntohs(hp->ancount) + (u_int16_t)count);
---
>   	hp->ancount = htons((u_short)(ntohs((u_short)hp->ancount) + (u_int16_t)count));
1043a1049
> 
2339,2340c2345,2346
< 					+
< 				0.95 * (int) (dp->d_ttl - tt.tv_sec);
---
> 					+ (int) (
> 				0.95 * (int) (dp->d_ttl - tt.tv_sec));
2555a2562
> 
diff --recurs m:\bindb32/named/ns_sort.c m:\bind/named/ns_sort.c
61,69c61,73
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <stdio.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
diff --recurs m:\bindb32/named/ns_stats.c m:\bind/named/ns_stats.c
66,72c66,76
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <errno.h>
74,75c78,79
< #include "named.h"
< #include "tree.h"
---
> #include "named.h"
> #include "tree.h"
249a254
> #ifndef WINNT
250a256,258
> #else
> 			SetLastError(save);
> #endif
diff --recurs m:\bindb32/named/ns_validate.c m:\bind/named/ns_validate.c
10,18c10,20
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< 
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< 
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #ifndef WINNT
> #include <arpa/inet.h>
> #include <syslog.h>
> #endif
Only in m:\bind/named: ntif.h
diff --recurs m:\bindb32/named/pathnames.h m:\bind/named/pathnames.h
61,62c61,63
< #ifdef _PATH_XFER
< # define _PATH_XFER_PREDEFINED	/* probably from Makefile */
---
> 
> #ifdef _PATH_XFER
> # define _PATH_XFER_PREDEFINED	/* probably from Makefile */
65,66c66,81
< #if defined (__sgi) && !defined(_SYSTYPE_SVR4) && !defined(__SYSTYPE_SVR4)
< #define	_PATH_BOOT	"/usr/etc/named.d/named.boot"
---
> #ifdef WINNT
> #define	_PATH_BOOT	"%windir%\\NAMED.BOOT"
> #define	_ALT_PATH_BOOT	"%windir%\\NAMED.INI"
> #ifndef _PATH_XFER
> # define _PATH_XFER	"%windir%\\SYSTEM32\\XFER.EXE"
> #endif
> #ifndef _PATH_PIDFILE
> # define _PATH_PIDFILE	"%windir%\\NAMED.PID"
> #endif
> /* following paths prepended with GetTempPath() */
> #define	_PATH_DEBUG		"NAMED.RUN" 
> #define	_PATH_DUMPFILE	"NAMDUMP.DB"
> #define	_PATH_STATS		"NAMED.STS"
> #define	_PATH_XFERTRACE	"XFER.TRC"
> #define _PATH_XFERDDT	"XFER.DDT"
> #define	_PATH_TMPXFER	"XFER.DDT.XXXXXX"
68c83,87
< #define	_PATH_BOOT	"/etc/named.boot"
---
> 
> #if defined (__sgi) && !defined(_SYSTYPE_SVR4) && !defined(__SYSTYPE_SVR4)
> #define	_PATH_BOOT	"/usr/etc/named.d/named.boot"
> #else
> #define	_PATH_BOOT	"/etc/named.boot"
122a142,143
> 
> #endif /* WINNT */
diff --recurs m:\bindb32/named/storage.c m:\bind/named/storage.c
56,57c56,59
< #include <sys/param.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <syslog.h>
> #endif
Only in m:\bind/named: xfer.mak
Only in m:\bind/named: xfer.mdp
Only in m:\bind/named: xfer.ncb
Only in m:\bind/named: xfer.vcp
Only in m:\bind: ntbind49324.zip
Only in m:\bind: ntbind49326_vc22.zip
Only in m:\bind: ntbind49326_vc40.zip
Only in m:\bind: ntbind49327.zip
Only in m:\bind: ntbind49331.zip
Only in m:\bind: ntdns49326bin_vc22.zip
Only in m:\bind: ntdns49326bin_vc40.zip
Only in m:\bind: ntdns49327bin.zip
Only in m:\bind: ntdns49331bin.zip
Only in m:\bind: ntdns49332bin.zip
Only in m:\bind: readme.nt
Only in m:\bind/res: WinRel
diff --recurs m:\bindb32/res/gethnamaddr.c m:\bind/res/gethnamaddr.c
61,70c61,72
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< 
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #include <ctype.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> 
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #include <ctype.h>	 
71a74
> #ifndef WINNT
72a76
> #endif
88a93,98
> #ifdef WINNT
> extern char *pathhosts;
> extern int res_paths_initialized;
> extern init_res_paths();
> #endif
> 
124a135
> #ifndef WINNT
125a137
> #endif
136a149
> #ifndef WINNT
137a151,153
> #else
> 		WSASetLastError(save);
> #endif
169,170c185,186
< 	ancount = ntohs(hp->ancount);
< 	qdcount = ntohs(hp->qdcount);
---
> 	ancount = ntohs( (u_short) hp->ancount);
> 	qdcount = ntohs( (u_short) hp->qdcount);
174a191
> #ifndef WINNT
175a193,195
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
178a199
> #ifndef WINNT
179a201,203
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
286c310
< 				       AskedForGot, qname, bp);
---
> 				       (char *) AskedForGot, qname, bp);
317c341
< 				       AskedForGot, host.h_name, bp);
---
> 				       (char *)AskedForGot, host.h_name, bp);
358a383
> #ifndef WINNT
359a385,387
> #else
> 			WSASetLastError(NO_RECOVERY);
> #endif
387a416
> #ifndef WINNT
388a418,420
> #else
> 		WSASetLastError(NETDB_SUCCESS);
> #endif
390a423
> #ifndef WINNT
391a425,427
> #else
> 		WSASetLastError(TRY_AGAIN);
> #endif
395a432
> #ifndef WINNT
428a466,468
> #else
> struct hostent FAR * PASCAL FAR gethostbyname(const char FAR * name)
> #endif
435a476
> #ifndef WINNT
436a478,480
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
462a507
> #ifndef WINNT
463a509,511
> #else
> 					WSASetLastError(HOST_NOT_FOUND);
> #endif
479a528
> #ifndef WINNT
480a530,532
> #else
> 				WSASetLastError(NETDB_SUCCESS);
> #endif
495a548
> #ifndef WINNT
499a553,555
> #else
> struct hostent FAR * PASCAL FAR gethostbyaddr(const char FAR * addr, int len, int type)
> #endif
513a570
> #ifndef WINNT
514a572,574
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
517a578
> #ifndef WINNT
519a581,584
> #else
> 		SetLastError(WSAEAFNOSUPPORT);
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
570a636
> #ifndef WINNT
571a638,640
> #else
> 	WSASetLastError(NETDB_SUCCESS);
> #endif
578a648,649
>     
> #ifndef WINNT
580a652,659
> #else
>         if (!res_paths_initialized)
>           init_res_paths();
> 
> 	if (!hostf)
> 		hostf = fopen(pathhosts, "r" );
> #endif
> 
600a680
> #ifndef WINNT
601a682,690
> #else
>         if (!res_paths_initialized)
>           init_res_paths();
> 
> 	if (!hostf && !(hostf = fopen(pathhosts, "r" ))) {
> #endif
> 
> 	
> #ifndef WINNT
602a692,694
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
606a699
> #ifndef WINNT
607a701,703
> #else
> 		WSASetLastError(HOST_NOT_FOUND);
> #endif
646a743
> #ifndef WINNT
647a745,747
> #else
> 	WSASetLastError(NETDB_SUCCESS);
> #endif
diff --recurs m:\bindb32/res/getnetbyaddr.c m:\bind/res/getnetbyaddr.c
40,45c40,48
< 
< extern int _net_stayopen;
< 
< struct netent *
< _getnetbyaddr(net, type)
< 	register long net;
---
> #ifdef WINNT
> #include "../conf/portability.h"
> #endif
> 
> extern int _net_stayopen;
> 
> struct netent *
> _getnetbyaddr(net, type)
> 	register u_long net;
diff --recurs m:\bindb32/res/getnetbyname.c m:\bind/res/getnetbyname.c
41a42,44
> #ifdef WINNT
> #include "../conf/portability.h"
> #endif
diff --recurs m:\bindb32/res/getnetent.c m:\bind/res/getnetent.c
49,53c49,55
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
55,58c57,66
< #include <stdio.h>
< #include <resolv.h>
< #include <netdb.h>
< #include <string.h>
---
> #include <stdio.h>
> #include <resolv.h>
> #include <netdb.h>
> #include <string.h>
> #ifdef WINNT
> #include "../conf/portability.h"
> extern char *pathnetworks;
> extern int res_paths_initialized;
> extern init_res_paths();
> #endif
63a72,73
> 
> 
96a107
> #ifndef WINNT
98a110,116
> #else
>        if (!res_paths_initialized)
>          init_res_paths();
> 
> 	if (netf == NULL)
> 		netf = fopen(pathnetworks, "r" );
> #endif
120a139
> #ifndef WINNT
121a141,147
> #else
>        if (!res_paths_initialized)
>          init_res_paths();
> 
> 	if (netf == NULL && (netf = fopen(pathnetworks, "r" )) == NULL)
> #endif
> 
diff --recurs m:\bindb32/res/getnetnamadr.c m:\bind/res/getnetnamadr.c
47,51c47,53
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
53,56c55,58
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #include <ctype.h>
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #include <ctype.h>
59a62
> #ifndef WINNT
60a64,66
> #else
> #include "../conf/portability.h"
> #endif
66c72
< struct netent *_getnetbyaddr __P((long net, int type));
---
> struct netent *_getnetbyaddr __P((u_long net, int type));
122,123c128,129
< 	ancount = ntohs(hp->ancount); /* #/records in the answer section */
< 	qdcount = ntohs(hp->qdcount); /* #/entries in the question section */
---
> 	ancount = ntohs( (u_short) hp->ancount); /* #/records in the answer section */
> 	qdcount = ntohs( (u_short) hp->qdcount); /* #/entries in the question section */
128a135
> #ifndef WINNT
129a137,139
> #else
> 			WSASetLastError(HOST_NOT_FOUND);
> #endif
130a141
> #ifndef WINNT
131a143,145
> #else
> 			WSASetLastError(HOST_NOT_FOUND);
> #endif
198a213
> #ifndef WINNT
199a215,217
> #else
> 	WSASetLastError(TRY_AGAIN);
> #endif
205c223
< 	register long net;
---
> 	register u_long net;
268a287
> #ifndef WINNT
269a289,291
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
diff --recurs m:\bindb32/res/herror.c m:\bind/res/herror.c
61,69c61,71
< #include <sys/param.h>
< #include <sys/uio.h>
< #include <netdb.h>
< #if defined(BSD) && (BSD >= 199103)
< # include <unistd.h>
< # include <string.h>
< #else
< # include "../conf/portability.h"
< #endif
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/uio.h>
> #endif
> #include <netdb.h>
> #if defined(BSD) && (BSD >= 199103)
> # include <unistd.h>
> # include <string.h>
> #else
> # include "../conf/portability.h"
> #endif
79a82
> #ifndef WINNT
80a84
> #endif
91a96,98
> #ifdef WINNT
> 	char err[50];
> #endif
100a108
> #ifndef WINNT
101a110,114
> #else
> 	/* XXX - map the error number to the corresponding message here */
> 	sprintf(err, "%d", h_errno);
> 	v->iov_base = err;
> #endif
108a122
> #ifndef WINNT
118a133
> #endif
diff --recurs m:\bindb32/res/inet_addr.c m:\bind/res/inet_addr.c
61,65c61,67
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <ctype.h>
< #include "../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <ctype.h>
> #include "../conf/portability.h"
67d68
< /* these are compatibility routines, not needed on recent BSD releases */
69,70c70,76
< /*
<  * Ascii internet address interpretation routine.
---
> #ifndef NEED_INETADDR
> int __inet_addr_unneeded__;
> #else
> /* these are compatibility routines, not needed on recent BSD releases */
> 
> /*
>  * Ascii internet address interpretation routine.
82a89
> #endif  /* NEED_INETADDR */
diff --recurs m:\bindb32/res/nsap_addr.c m:\bind/res/nsap_addr.c
5,10c5,12
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <ctype.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <ctype.h>
> #include <resolv.h>
12c14
< #include "../conf/portability.h"
---
> #include "../conf/portability.h"
14c16
< #if !defined(isxdigit)	/* XXX - could be a function */
---
> #if !defined(isxdigit)	/* XXX - could be a function */
34c36
< 	int maxlen;
---
> 	u_int maxlen;
diff --recurs m:\bindb32/res/res_comp.c m:\bind/res/res_comp.c
61,62c61,64
< #include <sys/param.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
diff --recurs m:\bindb32/res/res_data.c m:\bind/res/res_data.c
60,63c60,65
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/time.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/time.h>
> #include <netinet/in.h>
> #endif /* WINNT */
diff --recurs m:\bindb32/res/res_debug.c m:\bind/res/res_debug.c
61,64c61,66
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
66,70c68,72
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #if defined(BSD) && (BSD >= 199103)
< # include <string.h>
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #if defined(BSD) && (BSD >= 199103)
> # include <string.h>
178c180
< 	if (n = ntohs(cnt)) {
---
> 	if (n = ntohs( (u_short) cnt)) {
274c276
< 			ntohs(hp->id));
---
> 			ntohs( (u_short) hp->id));
293,296c295,298
< 		fprintf(file, "; Ques: %d", ntohs(hp->qdcount));
< 		fprintf(file, ", Ans: %d", ntohs(hp->ancount));
< 		fprintf(file, ", Auth: %d", ntohs(hp->nscount));
< 		fprintf(file, ", Addit: %d", ntohs(hp->arcount));
---
> 		fprintf(file, "; Ques: %d", ntohs( (u_short) hp->qdcount));
> 		fprintf(file, ", Ans: %d", ntohs( (u_short) hp->ancount));
> 		fprintf(file, ", Auth: %d", ntohs( (u_short) hp->nscount));
> 		fprintf(file, ", Addit: %d", ntohs( (u_short) hp->arcount));
305c307
< 	if (n = ntohs(hp->qdcount)) {
---
> 	if (n = ntohs( (u_short) hp->qdcount)) {
441a444
> #ifndef WINNT
442a446,448
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
diff --recurs m:\bindb32/res/res_init.c m:\bind/res/res_init.c
61,70c61,72
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/time.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< 
< #include <stdio.h>
< #include <ctype.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/time.h>
> #include <netinet/in.h>
> #endif /* WINNT */
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> 
> #include <stdio.h>
> #include <ctype.h>
> #include <resolv.h>
76c78
< # include "../conf/portability.h"
---
> #include "../conf/portability.h"
78a81,88
> #ifdef WINNT
> #include <netdb.h>
> #include "../conf/portability.h"
> extern char *pathresconf;
> extern int res_paths_initialized;
> extern init_res_paths();
> #endif
> 
168a179,190
> 
> #ifdef WINNT
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
> 
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		return (-1);
> 	}
> #endif /* WINNT */
> 
254a277
> #ifndef WINNT
255a279,285
> #else
>        if (!res_paths_initialized)
>          init_res_paths();
> 
> 	if ((fp = fopen(pathresconf, "r")) != NULL) {
> 
> #endif
diff --recurs m:\bindb32/res/res_mkquery.c m:\bind/res/res_mkquery.c
61,63c61,65
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
65,70c67,72
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #if defined(BSD) && (BSD >= 199103)
< # include <string.h>
< #else
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #if defined(BSD) && (BSD >= 199103)
> # include <string.h>
> #else
101a104
> #ifndef WINNT
102a106,108
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
Only in m:\bind/res: res_nt_misc.c
diff --recurs m:\bindb32/res/res_query.c m:\bind/res/res_query.c
61,64c61,66
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
66,70c68,72
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #include <ctype.h>
< #include <errno.h>
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #include <ctype.h>
> #include <errno.h>
88a91
> #ifndef WINNT
89a93
> #endif
114a119
> #ifndef WINNT
115a121,123
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
129a138
> #ifndef WINNT
130a140,142
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
138a151
> #ifndef WINNT
139a153,155
> #else
> 		WSASetLastError(TRY_AGAIN);
> #endif
143c159
< 	if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
---
> 	if (hp->rcode != NOERROR || ntohs( (u_short) hp->ancount) == 0) {
147c163
< 			    ntohs(hp->ancount));
---
> 			    ntohs( (u_short) hp->ancount));
150a167
> #ifndef WINNT
151a169,171
> #else
> 			WSASetLastError(HOST_NOT_FOUND);
> #endif
153a174
> #ifndef WINNT
154a176,178
> #else
> 			WSASetLastError(TRY_AGAIN);
> #endif
156a181
> #ifndef WINNT
157a183,185
> #else
> 			WSASetLastError(NO_DATA);
> #endif
162a191
> #ifndef WINNT
163a193,195
> #else
> 			WSASetLastError(NO_RECOVERY);
> #endif
190a223
> #ifndef WINNT
191a225,227
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
193a230
> #ifndef WINNT
195a233,235
> #else
> 	WSASetLastError(HOST_NOT_FOUND);
> #endif
254a295
> #ifndef WINNT
255a297,299
> #else
> 				WSASetLastError(TRY_AGAIN);
> #endif
302a347
> #ifndef WINNT
308a354,361
> #else
> 	if (saved_herrno != -1)
> 		WSASetLastError(saved_herrno);
> 	else if (got_nodata)
> 		WSASetLastError(NO_DATA);
> 	else if (got_servfail)
> 		WSASetLastError(TRY_AGAIN);
> #endif
327a381
> #ifndef WINNT
328a383,385
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
diff --recurs m:\bindb32/res/res_send.c m:\bind/res/res_send.c
72,78c72,80
< #include <sys/param.h>
< #include <sys/time.h>
< #include <sys/socket.h>
< #include <sys/uio.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/time.h>
> #include <sys/socket.h>
> #include <sys/uio.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
80,81c82,83
< #include <stdio.h>
< #include <netdb.h>
---
> #include <stdio.h>
> #include <netdb.h>
97a100
> #ifndef WINNT
98a102,105
> #else
> static SOCKET s = INVALID_SOCKET;
> typedef char * caddr_t;
> #endif
145a153
> #ifndef WINNT
146a155,157
> #else
> 	WSASetLastError(save);
> #endif
159a171
> #ifndef WINNT
160a173,175
> #else
> 	WSASetLastError(save);
> #endif
232c247
< 	int qdcount = ntohs(((HEADER*)buf)->qdcount);
---
> 	int qdcount = ntohs( (u_short) ((HEADER*)buf)->qdcount);
269c284
< 	int qdcount = ntohs(((HEADER*)buf1)->qdcount);
---
> 	int qdcount = ntohs( (u_short) ((HEADER*)buf1)->qdcount);
271c286
< 	if (qdcount != ntohs(((HEADER*)buf2)->qdcount))
---
> 	if (qdcount != ntohs( (u_short) ((HEADER*)buf2)->qdcount))
300a316,319
> #ifdef WINNT
> 	int optionValue = SO_SYNCHRONOUS_NONALERT;
> 	DWORD BytesRead;
> #endif
365c384,393
< 
---
> #ifdef WINNT
> 			/* set up things so that subsequent socket()
> 			   calls will open blocking sockets */
> 			if (setsockopt(INVALID_SOCKET, SOL_SOCKET,
> 				  	SO_OPENTYPE, (char *)&optionValue,
> 					sizeof(optionValue)) != NO_ERROR) {
> 						Perror(stderr, "cannot open nonoverlapped socket", errno);
> 						return (-1);
> 			}
> #endif
376a405
> #ifndef WINNT
377a407,409
> #else
> 				if (s == INVALID_SOCKET) {
> #endif
381a414
> #ifndef WINNT
382a416,418
> #else
> 				WSASetLastError(0);
> #endif
413a450
> #ifndef WINNT
414a452,456
> #else
> 			while (ReadFile((HANDLE)s, (char *)cp, (DWORD)len,
> 				             &BytesRead, NULL) &&
> 				   (n = (int)BytesRead) > 0) {
> #endif
450a493
> #ifndef WINNT
451a495,499
> #else
> 					ReadFile((HANDLE)s, (char *)cp, (DWORD)len,
> 				             &BytesRead, NULL) &&
> 				    (n = (int)BytesRead) > 0) {
> #endif
473a522
> #ifndef WINNT
474a524,528
> #else
> 					if (ReadFile((HANDLE)s, (char *)junk, (DWORD)n,
> 				             &BytesRead, NULL) &&
> 				        (n = (int)BytesRead) > 0)
> #endif
488c542
< 
---
> #ifndef WINNT
489a544,546
> #else
> 			if ((s == INVALID_SOCKET) || vc) {
> #endif
492a550
> #ifndef WINNT
493a552,554
> #else
> 				if (s == INVALID_SOCKET) {
> #endif
517a579
> #ifndef WINNT
542a605
> #endif /* WINNT */
559a623
> #ifndef WINNT
560a625,627
> #else
> 					if (s1 == INVALID_SOCKET)
> #endif
567a635
> #ifndef WINNT
568a637,639
> #else
> 					WSASetLastError(0);
> #endif
578a650
> #ifndef WINNT
579a652
> #endif
609a683
> #ifndef WINNT
610a685,687
> #else
> 			WSASetLastError(0);
> #endif
614a692
> #ifndef WINNT
615a694,696
> #else
> 				Perror(stderr, "recvfrom", WSAGetLastError());
> #endif
740a822
> #ifndef WINNT
741a824,826
> #else
> 			WSASetLastError(ECONNREFUSED);
> #endif
742a828
> #ifndef WINNT
743a830,832
> #else
> 			WSASetLastError(ETIMEDOUT);
> #endif
744a834
> #ifndef WINNT
745a836,838
> #else
> 		WSASetLastError(terrno);
> #endif
760a854
> #ifndef WINNT
761a856,858
> #else
> 		s = INVALID_SOCKET;
> #endif
Only in m:\bind/res: resolv.mak
Only in m:\bind/res: resolv.mdp
Only in m:\bind/res: resolv.ncb
Only in m:\bind/res: resolv.vcp
diff --recurs m:\bindb32/res/sethostent.c m:\bind/res/sethostent.c
39,40c39,42
< #include <sys/param.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
Only in m:\bind/shres/netbsd: .cvsignore
Only in m:\bind/shres/netbsd: Letter
Only in m:\bind/tools: WinRel
Only in m:\bind/tools: instsrv.c
Only in m:\bind/tools: instsrv.exe
Only in m:\bind/tools: instsrv.mak
Only in m:\bind/tools: instsrv.mdp
Only in m:\bind/tools: instsrv.ncb
Only in m:\bind/tools: instsrv.vcp
Only in m:\bind/tools/nslookup: BOG.WRI
Only in m:\bind/tools/nslookup: WINNTPORT
Only in m:\bind/tools/nslookup: WinRel
diff --recurs m:\bindb32/tools/nslookup/commands.l m:\bind/tools/nslookup/commands.l
210,219c210,219
< ^{WS}*\n				{
< 					    return(1);
< 					}
< ^.*\n					{
< 					    printf("Unrecognized command: %s",
< 							yytext);
< 					    return(1);
< 					}
< \n					{ ; }
< %%
---
> ^{WS}*\n   				{
> 					    return(1);
> 					}
> ^.*\n					{
> 					    printf("Unrecognized command: %s",
> 							yytext);
> 					    return(1);
> 					}
> \n					{ ; }
> %%                                      
diff --recurs m:\bindb32/tools/nslookup/debug.c m:\bind/tools/nslookup/debug.c
73,81c73,83
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <resolv.h>
< #include <netdb.h>
< #include <stdio.h>
< #include "res.h"
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <resolv.h>
> #include <netdb.h>
> #include <stdio.h>
> #include "res.h"
> #include "../../conf/portability.h"
89a92,98
>  *  Forward references
>  */
> 
> void Fprint_query(u_char *msg, u_char *eom, int printHeader, FILE *file);
> 
> 
> /*
100a110
> void
107a118
> void
127c138
< 	    fprintf(file,", id = %d", ntohs(hp->id));
---
> 	    fprintf(file,", id = %d", ntohs( (u_short) hp->id));
143,146c154,157
< 	    fprintf(file,"\n\tquestions = %d", ntohs(hp->qdcount));
< 	    fprintf(file,",  answers = %d", ntohs(hp->ancount));
< 	    fprintf(file,",  authority records = %d", ntohs(hp->nscount));
< 	    fprintf(file,",  additional = %d\n\n", ntohs(hp->arcount));
---
> 	    fprintf(file,"\n\tquestions = %d", ntohs( (u_short) hp->qdcount));
> 	    fprintf(file,",  answers = %d", ntohs( (u_short) hp->ancount));
> 	    fprintf(file,",  authority records = %d", ntohs( (u_short) hp->nscount));
> 	    fprintf(file,",  additional = %d\n\n", ntohs( (u_short) hp->arcount));
152c163
< 	if (n = ntohs(hp->qdcount)) {
---
> 	if (n = ntohs( (u_short) hp->qdcount)) {
170c181
< 	if (n = ntohs(hp->ancount)) {
---
> 	if (n = ntohs( (u_short) hp->ancount)) {
182c193
< 	if (n = ntohs(hp->nscount)) {
---
> 	if (n = ntohs( (u_short) hp->nscount)) {
194c205
< 	if (n = ntohs(hp->arcount)) {
---
> 	if (n = ntohs( (u_short) hp->arcount)) {
511c522
< 					s = getservbyport((int)htons(n),
---
> 					s = getservbyport((int)htons( (u_short) n),
diff --recurs m:\bindb32/tools/nslookup/getinfo.c m:\bind/tools/nslookup/getinfo.c
74,83c74,85
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <resolv.h>
< #include <stdio.h>
< #include <ctype.h>
< #include "res.h"
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif 
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <resolv.h>
> #include <stdio.h>
> #include <ctype.h>
> #include "res.h"
> #include "../../conf/portability.h"
84a87
> 
120a124,132
> /*
>  * Forward references
>  */
> 
> int GetHostDomain(struct in_addr *nsAddrPtr, int queryClass, int queryType, char *name, 
>               char *domain, HostInfo *hostPtr, Boolean isServer);
> static int GetAnswer(struct in_addr	*nsAddrPtr, int queryType, char *msg, int msglen, Boolean iquery, 
>                      register HostInfo	*hostPtr, Boolean isServer);
> 
193,196c205,208
<     qdcount = ntohs(headerPtr->qdcount);
<     ancount = ntohs(headerPtr->ancount);
<     arcount = ntohs(headerPtr->arcount);
<     nscount = ntohs(headerPtr->nscount);
---
>     qdcount = ntohs( (u_short) headerPtr->qdcount);
>     ancount = ntohs( (u_short) headerPtr->ancount);
>     arcount = ntohs( (u_short) headerPtr->arcount);
>     nscount = ntohs( (u_short) headerPtr->nscount);
602,616c614,628
< 
<     /*
<      * If there are dots in the name already, let's just give it a try
<      * 'as is'.  The threshold can be set with the "ndots" option.
<      */
<     if (n >= _res.ndots) {
< 	    result = GetHostDomain(nsAddrPtr, queryClass, queryType,
< 				   name, (char *)NULL, hostPtr, isServer);
<             if (result == SUCCESS)
< 	        return (result);
< 	    if (result == NO_INFO)
< 		got_nodata++;
<             tried_as_is++;
<     }
< 
---
>     
>         /*
>        * If there are dots in the name already, let's just give it a try
>        * 'as is'.  The threshold can be set with the "ndots" option.
>        */
>         if (n >= (int)_res.ndots) {
>     	    result = GetHostDomain(nsAddrPtr, queryClass, queryType,
>     				   name, (char *)NULL, hostPtr, isServer);
>                 if (result == SUCCESS)
>     	        return (result);
>     	    if (result == NO_INFO)
>     		got_nodata++;
>                 tried_as_is++;
>         }
>     
647c659
< 	}
---
>     }
665a678
> int
diff --recurs m:\bindb32/tools/nslookup/list.c m:\bind/tools/nslookup/list.c
73,82c73,84
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <resolv.h>
< #include <netdb.h>
< #include <stdio.h>
< #include <limits.h>
< #include <ctype.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <resolv.h>
> #include <netdb.h>
> #include <stdio.h>
> #include <limits.h>
> #include <ctype.h>
100a103,111
> 
> /*
>  * Forward references
>  */
> 
> int
> PrintListInfo(FILE *file, u_char *msg, u_char *eom, int qtype, char *domain);
> 
> 
311c322,323
< 
---
>     
>   #ifndef WINNT
313a326,331
>   #else
> 
>         if (send(sockFD,(const char *)&len,INT16SZ,0) != INT16SZ  ||
>             send(sockFD,(const char *)&buf,msglen,0) != msglen) {
>   #endif
> 
327c345
< 	    filePtr = OpenFile(cmd, file);
---
> 	    filePtr = AppOpenFile(cmd, file);
437a456
> #ifndef WINNT
438a458,460
> #else
> 	    while ((numRead = recv(sockFD, cp, amtToRead,0)) > 0) {
> #endif
469a492
>         #ifndef WINNT
470a494,497
> #else
> 	    while (amtToRead > 0 && (numRead=recv(sockFD, cp, amtToRead,0)) > 0) {
> 
> #endif
491c518
< 	    if (ntohs(((HEADER* )answer)->qdcount) > 0)
---
> 	    if (ntohs( (u_short) ((HEADER* )answer)->qdcount) > 0)
537,538c564,565
< 			ntohs(headerPtr->ancount), ntohs(headerPtr->nscount),
< 			ntohs(headerPtr->arcount));
---
> 			ntohs( (u_short) headerPtr->ancount), ntohs( (u_short) headerPtr->nscount),
> 			ntohs( (u_short) headerPtr->arcount));
584a612
> int
616c644
<     if (ntohs(headerPtr->ancount) == 0) {
---
>     if (ntohs( (u_short) headerPtr->ancount) == 0) {
619c647
< 	if (ntohs(headerPtr->qdcount) > 0) {
---
> 	if (ntohs( (u_short) headerPtr->qdcount) > 0) {
879a908
> void
914a944
>     #ifndef WINNT
915a946,950
>     #else
>     char f[5000];
>     int numread = 0;
>     int i;
>     #endif
971c1006
< 	    filePtr = OpenFile(string, file);
---
> 	    filePtr = AppOpenFile(string, file);
982a1018
> #ifndef WINNT
984c1020
< 	}
---
>         	}
987c1023,1030
< 	f = fdopen(sockFD, "r");
---
> #else
>    /* send(sockFD,"/W",3,0); */
>          }
> 	send(sockFD, name, strlen(name),0);
> 	send(sockFD, "\r\n", 2,0);
> 	#endif
> #ifndef WINNT	
> 	f = fdopen(sockFD, "r"); 
1003c1046,1070
< 	if (lastc != '\n') {
---
> #else
>     while ((numread = recv(sockFD,(char *)f,4999,0)) != 0)
>       {
> 
> 	   for (i=0; i<=numread; i++)
>         {
>           c = f[i];
>           switch (c) 
>           {
> 		    case 0210:
> 		    case 0211:
> 		    case 0212:
> 		    case 0214:
> 	  		      c -= 0200;
> 			      break;
> 		    case 0215:
> 			     c = '\n';
> 			     break;
> 	       }
> 	        putc(lastc = c, filePtr);
>       }       
>       }
>  #endif
> 	if (lastc != '\n') 
> 	  {
1005,1006c1072,1073
< 	}
< 	putc('\n', filePtr);
---
> 	  }
> 	  putc('\n', filePtr);
1017a1085
> void
diff --recurs m:\bindb32/tools/nslookup/main.c m:\bind/tools/nslookup/main.c
82,91c82,95
< #include <sys/param.h>
< #include <netdb.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <resolv.h>
< #include <signal.h>
< #include <setjmp.h>
< #include <ctype.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #include <setjmp.h>
> #endif
> #include <netdb.h>
> #ifndef WINNT
> #include <sys/socket.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <resolv.h>
> #include <signal.h>
> #include <ctype.h>
99c103,112
< 
---
>   /* 
>    * Forward references
>    */
>   void Usage();
>   void LocalServer(HostInfo *defaultPtr);
>   int  LookupHost(char *string, Boolean putToFile);
>   void res_re_init();
>   void res_dnsrch(register char *cp);
>   int  SetOption(register char *option);
>   
109a123,125
>   #ifdef WINNT
>   HANDLE hReadWriteEvent = NULL;
>   #endif
143c159
<  * Stuff for Interrupt (control-C) signal handler.
---
>  * Stuff for Interrupt (control-C) signal handler.                    
145a162
> #ifndef WINNT
147d163
< FILE		*filePtr;
149c165,168
< 
---
> #else
> 	char *pathnslookuprc, *pathpagercmd, *pathhelpfile;
> #endif
> FILE		*filePtr;
158a178,203
> #ifdef WINNT
> /* Expand environmental variables in file pathnames */
> /* XXX - Would it be better to store/retrieve pathnames from the registry? */
> void
> expand_paths(void)
> {
> 
> 	pathnslookuprc = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_NSLOOKUPRC, pathnslookuprc, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_NSLOOKUPRC) failed: %m\n");
> 	} else
> 
> 	pathpagercmd = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_PAGERCMD, pathpagercmd, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_PAGERCMD) failed: %m\n");
> 	} else
> 		 
> 	pathhelpfile = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_HELPFILE, pathhelpfile, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_HELPFILE) failed: %m\n");
> 	}
> 
> }
> #endif /* WINNT */
> 
> 
184a230,250
>      
> #ifdef WINNT
> /* lgk moved startup to beginning.. */
> 
> 
> 
> 
> 	hReadWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
>    {
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
> 
>         expand_paths();
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		return (-1);
> 	}
> 
>    }
> #endif /* WINNT */
322a389
> #ifndef WINNT 
323a391,393
> #else
>             pager = pathpagercmd;
> #endif
325d394
< 
329c398
< 
---
> #ifndef WINNT
338c407
< 
---
> #endif
345a415
> 
354a425
> void
362,363c433,435
<     defaultAddr.s_addr = htonl(INADDR_ANY);
<     (void) GetHostInfoByName(&defaultAddr, C_IN, T_A,
---
> #ifndef WINNT
>     defaultAddr.s_addr = htonl(INADDR_ANY); 
>       (void) GetHostInfoByName(&defaultAddr, C_IN, T_A,
364a437,443
> #else /* lgk the 0.0.0.0 doesn't work for nt so set to loopback */
>     defaultAddr.s_addr = htonl(INADDR_LOOPBACK);
>           (void) GetHostInfoByName(&defaultAddr, C_IN, T_A,
> 			     "127.0.0.1", defaultPtr, 1);
> 
> #endif
>   
380a460
> void 
678c758
< 	filePtr = OpenFile(string, file);
---
> 	filePtr = AppOpenFile(string, file);
739c819
< 	filePtr = OpenFile(string, file);
---
> 	filePtr = AppOpenFile(string, file);
927a1008
> void
949a1031
> void
1046c1128
< 
---
> #ifndef WINNT
1047a1130,1134
> #else
> 	sprintf(cmd, "%s < %s", pager, pathhelpfile);
> #endif
> 
>         /* printf("path helpfile = %s ",pathhelpfile); */
1099a1187
> #ifndef WINNT
1100a1189,1191
> #else
> 	(void) strcat(buf, pathnslookuprc);
> #endif
Only in m:\bind/tools/nslookup: nslookup.exe
Only in m:\bind/tools/nslookup: nslookup.mak
Only in m:\bind/tools/nslookup: nslookup.mdp
Only in m:\bind/tools/nslookup: nslookup.ncb
Only in m:\bind/tools/nslookup: nslookup.vcp
Only in m:\bind/tools/nslookup: nslookupnt.zip
diff --recurs m:\bindb32/tools/nslookup/pathnames.h m:\bind/tools/nslookup/pathnames.h
62,68c62,77
< #define _PATH_PAGERCMD		"more"
< 
< #ifndef _PATH_HELPFILE
< #if defined(BSD) && BSD >= 198810
< #define	_PATH_HELPFILE		"/usr/share/misc/nslookup.help"
< #else
< #define _PATH_HELPFILE		"/usr/lib/nslookup.help"
---
> 
> #ifndef WINNT
> #define _PATH_PAGERCMD		"more"
> #else
> #define _PATH_PAGERCMD		"more"
> #endif
> 
> #ifndef _PATH_HELPFILE
> #if defined(BSD) && BSD >= 198810
> #define	_PATH_HELPFILE		"/usr/share/misc/nslookup.help"
> #else
> #ifdef WINNT
> #define _PATH_HELPFILE		"%windir%\\system32\\nslookup.help"
> #else
> #define _PATH_HELPFILE		"/usr/lib/nslookup.help"
> #endif
Only in m:\bind/tools/nslookup: readme.nt
diff --recurs m:\bindb32/tools/nslookup/res.h m:\bind/tools/nslookup/res.h
76,78c76,87
< #define TRUE	1
< #define FALSE	0
< typedef int Boolean;
---
> #ifndef _RES_H_
> #define _RES_H_
> 
> #ifdef WINNT
> #include <winsock.h>
> #include "../../conf/portability.h"
> #include <stdio.h>
> #endif
> 
> #define TRUE	1
> #define FALSE	0
> typedef int Boolean;
81,82c90,91
<  *  Define return statuses in addtion to the ones defined in namserv.h
<  *   let SUCCESS be a synonym for NOERROR
---
>  *  Define return statuses in addtion to the ones defined in namserv.h
>  *   let SUCCESS be a synonym for NOERROR
84,85c93,94
<  *	TIME_OUT	- a socket connection timed out.
<  *	NO_INFO		- the server didn't find any info about the host.
---
>  *	TIME_OUT	- a socket connection timed out.
>  *	NO_INFO		- the server didn't find any info about the host.
158c167,173
< extern int  Print_query();
---
> 
> /*
>  * debug.c definitions
>  */
> 
> void Print_query(char *msg, char *eom, int printHeader);
> 
163d177
< extern char *DecodeError();
165c179
< extern char *Malloc();
---
> 
168c182
< extern void PrintHostInfo();
---
> 
170,171d183
< extern void FreeHostInfoPtr();
< extern FILE *OpenFile();
172a185,230
> 
> /*
>  * subr.c definitions
>  */
> 
> char * Malloc(int size);
> void PrintHostInfo(FILE	*file, char	*title, register HostInfo *hp);
> FILE * AppOpenFile(char *string, char *file);
> char * DecodeError(int result);
> int StringToType(char *type, int dflt, FILE *errorfile);
> int StringToClass(char *class, int dflt, FILE *errorfile);
> char * DecodeType(int type);
> 
> 
> /*
>  * getinfo.c definitions
>  */
> 
> static int GetAnswer(struct in_addr *nsAddrPtr, int queryType, char *msg, int msglen,
>                      Boolean iquery, register HostInfo *hostPtr, Boolean isServer);
> int GetHostInfoByName(struct in_addr	*nsAddrPtr, int queryClass, int queryType,
>                       char *name, HostInfo *hostPtr, Boolean isServer);
> int GetHostInfoByAddr(struct in_addr *nsAddrPtr, struct in_addr	*address, HostInfo *hostPtr);
> void FreeHostInfoPtr( register HostInfo *hostPtr);
> 
> 
> /*
>  * send.c definitions
>  */
> 
> int SendRequest(struct in_addr	*nsAddrPtr, char *buf, int buflen,
> 	            char *answer, u_int anslen, int *trueLenPtr);
> 
> 
> /* lgk new definitions */
> extern int SetDefaultServer();
> extern int Finger();
> extern void ViewList();
> extern void ListHosts();
> extern void ListHostsByType();
> extern int SetOption();
> extern int LookupHost();
> extern int LookupHostWithServer();
> extern int yylex();
> 
> #endif /* _RES_H_ */
diff --recurs m:\bindb32/tools/nslookup/send.c m:\bind/tools/nslookup/send.c
77,86c77,87
< 
< #include <sys/param.h>
< #include <sys/time.h>
< #include <sys/socket.h>
< #include <sys/uio.h>
< #include <netinet/in.h>
< #include <stdio.h>
< #include <errno.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/time.h>
> #include <sys/socket.h>
> #include <sys/uio.h>
> #include <netinet/in.h>
> #endif 
> #include <stdio.h>
> #include <errno.h>
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
88d88
< #include "res.h"
89a90,91
> #include "res.h"
> 
239c241
< 			if ((resplen = _getshort((u_char*)cp)) > anslen) {
---
> 			if ( (u_int)(resplen = _getshort((u_char*)cp)) > anslen) {
405a408
> void
diff --recurs m:\bindb32/tools/nslookup/skip.c m:\bind/tools/nslookup/skip.c
78,83c78,85
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <resolv.h>
< #include <stdio.h>
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <resolv.h>
> #include <stdio.h>
> #include "../../conf/portability.h"
85c87
< char *res_skip_rr();
---
> char *res_skip_rr();
87c89
< 
---
> 
129c131
< 	if (n = ntohs(hp->qdcount) ) {
---
> 	if (n = ntohs( (u_short) hp->qdcount) ) {
143c145
< 	if (n = ntohs(hp->ancount)) {
---
> 	if (n = ntohs( (u_short) hp->ancount)) {
154c156
< 	if (n = ntohs(hp->nscount)) {
---
> 	if (n = ntohs( (u_short) hp->nscount)) {
165c167
< 	if (n = ntohs(hp->arcount)) {
---
> 	if (n = ntohs( (u_short) hp->arcount)) {
diff --recurs m:\bindb32/tools/nslookup/subr.c m:\bind/tools/nslookup/subr.c
77,86c77,92
< #include <sys/types.h>
< #include <sys/param.h>
< #include <netdb.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <signal.h>
< #include <setjmp.h>
< #include <stdio.h>
---
> #ifndef WINNT
> #include <sys/types.h>
> #include <sys/param.h>
> #endif
> #include <netdb.h>
> #ifndef WINNT
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <signal.h>
> #ifndef WINNT
> #include <setjmp.h>
> #endif
> #include <stdio.h>
114a121
>  #ifndef WINNT
138c145
< 
---
>  #endif
189c196,198
<     { int saveMask;
---
>     { 
>       #ifndef WINNT
> 	  int saveMask;
190a200
>       #endif
191a202
>      #ifndef WINNT
192a204
>      #endif
319c331
<  *  OpenFile --
---
>  *  AppOpenFile --
333c345
< OpenFile(string, file)
---
> AppOpenFile(string, file)
Only in m:\bind/tools/nslookup: winntport.txt
Only in m:\bind/tools/nslookup: yylex.c
Only in m:\bind: winntport.txt
