[389-commits] config.h.in configure configure.ac include/base include/ldaputil include/libadmin include/netsite.h include/public ldap/include ldap/libraries ldap/servers ldap/systools lib/base lib/ldaputil lib/libaccess lib/libadmin

Mark Reynolds mreynolds at fedoraproject.org
Mon Jun 15 16:27:34 UTC 2015


 config.h.in                                       |    3 
 configure                                         |   12 
 configure.ac                                      |    4 
 include/base/eventlog.h                           |   14 
 include/base/file.h                               |   27 
 include/base/fsmutex.h                            |    4 
 include/base/systems.h                            |   41 
 include/ldaputil/cert.h                           |    4 
 include/ldaputil/dbconf.h                         |    4 
 include/ldaputil/encode.h                         |    4 
 include/ldaputil/errors.h                         |    4 
 include/ldaputil/extcmap.h                        |   17 
 include/ldaputil/ldapauth.h                       |    4 
 include/libadmin/libadmin.h                       |    7 
 include/netsite.h                                 |   28 
 include/public/base/systems.h                     |   32 
 include/public/nsacl/aclapi.h                     |   11 
 include/public/nsapi.h                            |   57 -
 ldap/include/disptmpl.h                           |   12 
 ldap/include/ldaplog.h                            |   31 
 ldap/include/lthread.h                            |   58 -
 ldap/include/ntslapdregparms.h                    |   78 -
 ldap/include/ntwatchdog.h                         |  105 --
 ldap/include/regex.h                              |    4 
 ldap/include/srchpref.h                           |   12 
 ldap/libraries/libavl/avl.c                       |    6 
 ldap/libraries/libavl/testavl.c                   |    3 
 ldap/servers/plugins/acl/acl.h                    |    5 
 ldap/servers/plugins/acl/acldllmain.c             |   88 -
 ldap/servers/plugins/acl/aclplugin.c              |    9 
 ldap/servers/plugins/chainingdb/cb_debug.c        |    9 
 ldap/servers/plugins/chainingdb/cb_init.c         |    4 
 ldap/servers/plugins/chainingdb/cbdllmain.c       |   91 -
 ldap/servers/plugins/collation/config.c           |    2 
 ldap/servers/plugins/collation/debug.c            |    9 
 ldap/servers/plugins/collation/dllmain.c          |   87 -
 ldap/servers/plugins/cos/cos.c                    |   14 
 ldap/servers/plugins/cos/dllmain.c                |   79 -
 ldap/servers/plugins/distrib/dllmain.c            |   73 -
 ldap/servers/plugins/dna/dna.c                    |   15 
 ldap/servers/plugins/http/dllmain.c               |   79 -
 ldap/servers/plugins/http/http_client.c           |   31 
 ldap/servers/plugins/http/http_impl.c             |    3 
 ldap/servers/plugins/pam_passthru/pam_ptdebug.c   |    8 
 ldap/servers/plugins/pam_passthru/pam_ptdllmain.c |   91 -
 ldap/servers/plugins/passthru/ptdebug.c           |    8 
 ldap/servers/plugins/passthru/ptdllmain.c         |   88 -
 ldap/servers/plugins/presence/dllmain.c           |   78 -
 ldap/servers/plugins/presence/presence.c          |   27 
 ldap/servers/plugins/pwdstorage/crypt_pwd.c       |    4 
 ldap/servers/plugins/pwdstorage/dllmain.c         |   73 -
 ldap/servers/plugins/pwdstorage/pwd_init.c        |    2 
 ldap/servers/plugins/pwdstorage/pwdstorage.h      |    2 
 ldap/servers/plugins/referint/dllmain.c           |   77 -
 ldap/servers/plugins/referint/referint.c          |   19 
 ldap/servers/plugins/replication/cl5_api.c        |    5 
 ldap/servers/plugins/replication/cl5_config.c     |    9 
 ldap/servers/plugins/replication/repl.h           |    2 
 ldap/servers/plugins/replication/repl5.h          |    5 
 ldap/servers/plugins/replication/repl_init.c      |    8 
 ldap/servers/plugins/replication/replutil.c       |    4 
 ldap/servers/plugins/retrocl/dllmain.c            |   74 -
 ldap/servers/plugins/retrocl/retrocl.c            |    8 
 ldap/servers/plugins/rever/dllmain.c              |   73 -
 ldap/servers/plugins/roles/dllmain.c              |   79 -
 ldap/servers/plugins/roles/roles_plugin.c         |    8 
 ldap/servers/plugins/statechange/dllmain.c        |   79 -
 ldap/servers/plugins/statechange/statechange.c    |   15 
 ldap/servers/plugins/syntaxes/debug.c             |    8 
 ldap/servers/plugins/syntaxes/dllmain.c           |   89 -
 ldap/servers/plugins/uiduniq/7bit.c               |    6 
 ldap/servers/plugins/vattrsp_template/dllmain.c   |   78 -
 ldap/servers/plugins/vattrsp_template/vattrsp.c   |    3 
 ldap/servers/plugins/views/dllmain.c              |   78 -
 ldap/servers/plugins/views/views.c                |   17 
 ldap/servers/slapd/abandon.c                      |    2 
 ldap/servers/slapd/add.c                          |   10 
 ldap/servers/slapd/agtmmap.c                      |  145 --
 ldap/servers/slapd/agtmmap.h                      |   16 
 ldap/servers/slapd/attr.c                         |    2 
 ldap/servers/slapd/auth.c                         |    2 
 ldap/servers/slapd/ava.c                          |    2 
 ldap/servers/slapd/back-ldbm/back-ldbm.h          |   14 
 ldap/servers/slapd/back-ldbm/dblayer.c            |   42 
 ldap/servers/slapd/back-ldbm/dllmain.c            |   82 -
 ldap/servers/slapd/back-ldbm/import-threads.c     |   20 
 ldap/servers/slapd/back-ldbm/init.c               |   10 
 ldap/servers/slapd/back-ldbm/ldbm_bind.c          |  166 ---
 ldap/servers/slapd/back-ldbm/monitor.c            |   22 
 ldap/servers/slapd/back-ldbm/perfctrs.c           |  149 --
 ldap/servers/slapd/back-ldif/back-ldif.h          |   10 
 ldap/servers/slapd/back-ldif/dllmain.c            |  107 --
 ldap/servers/slapd/back-ldif/init.c               |    8 
 ldap/servers/slapd/bind.c                         |    3 
 ldap/servers/slapd/ch_malloc.c                    |  364 -------
 ldap/servers/slapd/charray.c                      |    2 
 ldap/servers/slapd/compare.c                      |    2 
 ldap/servers/slapd/config.c                       |   10 
 ldap/servers/slapd/configdse.c                    |    2 
 ldap/servers/slapd/connection.c                   | 1120 ++--------------------
 ldap/servers/slapd/conntable.c                    |   36 
 ldap/servers/slapd/csngen.c                       |    7 
 ldap/servers/slapd/daemon.c                       |  966 +-----------------
 ldap/servers/slapd/delete.c                       |    2 
 ldap/servers/slapd/detach.c                       |    2 
 ldap/servers/slapd/dn.c                           |    2 
 ldap/servers/slapd/dse.c                          |    3 
 ldap/servers/slapd/entry.c                        |    2 
 ldap/servers/slapd/fe.h                           |    7 
 ldap/servers/slapd/fedse.c                        |    3 
 ldap/servers/slapd/fileio.c                       |  268 -----
 ldap/servers/slapd/filter.c                       |    2 
 ldap/servers/slapd/filterentry.c                  |    2 
 ldap/servers/slapd/generation.c                   |    7 
 ldap/servers/slapd/getopt_ext.h                   |   11 
 ldap/servers/slapd/globals.c                      |   12 
 ldap/servers/slapd/init.c                         |   14 
 ldap/servers/slapd/intrinsics.h                   |   37 
 ldap/servers/slapd/ldaputil.c                     |    4 
 ldap/servers/slapd/libglobs.c                     |   54 -
 ldap/servers/slapd/libslapd.def                   |    2 
 ldap/servers/slapd/localhost.c                    |  136 +-
 ldap/servers/slapd/lock.c                         |   16 
 ldap/servers/slapd/log.c                          |  180 ---
 ldap/servers/slapd/log.h                          |    6 
 ldap/servers/slapd/main.c                         |  179 ---
 ldap/servers/slapd/mempool.c                      |   35 
 ldap/servers/slapd/modify.c                       |    4 
 ldap/servers/slapd/modrdn.c                       |    2 
 ldap/servers/slapd/modutil.c                      |    2 
 ldap/servers/slapd/monitor.c                      |   18 
 ldap/servers/slapd/operation.c                    |    2 
 ldap/servers/slapd/opshared.c                     |    8 
 ldap/servers/slapd/plugin.c                       |   12 
 ldap/servers/slapd/protect_db.c                   |  252 ----
 ldap/servers/slapd/proto-slap.h                   |   17 
 ldap/servers/slapd/pw.c                           |    6 
 ldap/servers/slapd/result.c                       |    2 
 ldap/servers/slapd/saslbind.c                     |    2 
 ldap/servers/slapd/slap.h                         |   52 -
 ldap/servers/slapd/snmp_collator.c                |  157 +--
 ldap/servers/slapd/ssl.c                          |  144 --
 ldap/servers/slapd/start_tls_extop.c              |   48 
 ldap/servers/slapd/str2filter.c                   |    2 
 ldap/servers/slapd/stubs.c                        |    9 
 ldap/servers/slapd/task.c                         |    7 
 ldap/servers/slapd/test-plugins/dllmain.c         |   84 -
 ldap/servers/slapd/test-plugins/testbind.c        |    3 
 ldap/servers/slapd/test-plugins/testdatainterop.c |    3 
 ldap/servers/slapd/test-plugins/testentry.c       |    6 
 ldap/servers/slapd/test-plugins/testextendedop.c  |    3 
 ldap/servers/slapd/test-plugins/testgetip.c       |    5 
 ldap/servers/slapd/test-plugins/testpostop.c      |   20 
 ldap/servers/slapd/test-plugins/testpreop.c       |    3 
 ldap/servers/slapd/test-plugins/testsaslbind.c    |    3 
 ldap/servers/slapd/time.c                         |   38 
 ldap/servers/slapd/tools/dbscan.c                 |   10 
 ldap/servers/slapd/tools/ldaptool-sasl.c          |   33 
 ldap/servers/slapd/tools/ldclt/data.c             |   95 -
 ldap/servers/slapd/tools/ldclt/ldapfct.c          |  191 ---
 ldap/servers/slapd/tools/ldclt/ldclt.c            |  146 --
 ldap/servers/slapd/tools/ldclt/parser.c           |   59 -
 ldap/servers/slapd/tools/ldclt/port.c             |  212 ----
 ldap/servers/slapd/tools/ldclt/port.h             |   28 
 ldap/servers/slapd/tools/ldclt/scalab01.c         |   72 -
 ldap/servers/slapd/tools/ldclt/threadMain.c       |   93 -
 ldap/servers/slapd/tools/ldclt/workarounds.c      |    4 
 ldap/servers/slapd/tools/ldif.c                   |    9 
 ldap/servers/slapd/tools/migratecred.c            |   35 
 ldap/servers/slapd/tools/mmldif.c                 |   17 
 ldap/servers/slapd/tools/pwenc.c                  |   16 
 ldap/servers/slapd/tools/rsearch/addthread.c      |    2 
 ldap/servers/slapd/tools/rsearch/main.c           |    3 
 ldap/servers/slapd/tools/rsearch/nametable.c      |   14 
 ldap/servers/slapd/tools/rsearch/rsearch.c        |    2 
 ldap/servers/slapd/tools/rsearch/searchthread.c   |    2 
 ldap/servers/slapd/unbind.c                       |    2 
 ldap/servers/slapd/uniqueidgen.c                  |    4 
 ldap/servers/slapd/util.c                         |   64 -
 ldap/servers/slapd/uuid.c                         |    7 
 ldap/servers/slapd/uuid.h                         |    5 
 ldap/servers/snmp/ntagt/msrvdefs.mak              |   11 
 ldap/systools/idsktune.c                          |   86 -
 lib/base/dns.cpp                                  |    6 
 lib/base/dnsdmain.cpp                             |    9 
 lib/base/file.cpp                                 |  287 -----
 lib/base/fsmutex.cpp                              |   44 
 lib/base/net.cpp                                  |    6 
 lib/base/shexp.cpp                                |    8 
 lib/base/system.cpp                               |    4 
 lib/base/systhr.cpp                               |   92 -
 lib/base/util.cpp                                 |    8 
 lib/ldaputil/dbconf.c                             |   46 
 lib/ldaputil/init.c                               |    9 
 lib/libaccess/acl.yy.cpp                          |    4 
 lib/libaccess/aclscan.l                           |    4 
 lib/libaccess/lasdns.cpp                          |    7 
 lib/libaccess/permhash.h                          |    4 
 lib/libadmin/error.c                              |   22 
 lib/libadmin/util.c                               |   13 
 200 files changed, 497 insertions(+), 8828 deletions(-)

New commits:
commit 003651c23272437aae5177de22138dec3695fd09
Author: Mark Reynolds <mreynolds at redhat.com>
Date:   Mon Jun 15 12:03:25 2015 -0400

    Ticket 47998 - cleanup WINDOWS ifdef's
    
    Description:  Remove all the windows specific code (#ifdef's, etc)
    
    https://fedorahosted.org/389/ticket/47998
    
    Reviewed by: rmeggins & nhosoi(Thanks!!)

diff --git a/config.h.in b/config.h.in
index 762cbf7..041a18f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -423,9 +423,6 @@
 /* package version */
 #undef VERSION
 
-/* UNIX */
-#undef XP_UNIX
-
 /* GNU Source */
 #undef _GNU_SOURCE
 
diff --git a/configure b/configure
index 8d8ca08..7d14f33 100755
--- a/configure
+++ b/configure
@@ -18454,9 +18454,6 @@ sttyexec=/bin/stty
 case $host in
   *-*-linux*)
 
-$as_echo "#define XP_UNIX 1" >>confdefs.h
-
-
 $as_echo "#define Linux 1" >>confdefs.h
 
 
@@ -18566,9 +18563,6 @@ $as_echo "#define USE_POSIX_RWLOCKS 1" >>confdefs.h
     ;;
   ia64-hp-hpux*)
 
-$as_echo "#define XP_UNIX 1" >>confdefs.h
-
-
 $as_echo "#define hpux 1" >>confdefs.h
 
 
@@ -18604,9 +18598,6 @@ $as_echo "#define _INCLUDE_STDC__SOURCE_199901 1" >>confdefs.h
     ;;
   hppa*-hp-hpux*)
 
-$as_echo "#define XP_UNIX 1" >>confdefs.h
-
-
 $as_echo "#define hpux 1" >>confdefs.h
 
 
@@ -18645,9 +18636,6 @@ $as_echo "#define ATOMIC_64BIT_OPERATIONS 1" >>confdefs.h
     ;;
   *-*-solaris*)
 
-$as_echo "#define XP_UNIX 1" >>confdefs.h
-
-
 $as_echo "#define SVR4 1" >>confdefs.h
 
 
diff --git a/configure.ac b/configure.ac
index c151870..b65b217 100644
--- a/configure.ac
+++ b/configure.ac
@@ -527,7 +527,6 @@ fi
 sttyexec=/bin/stty
 case $host in
   *-*-linux*)
-    AC_DEFINE([XP_UNIX], [1], [UNIX])
     AC_DEFINE([Linux], [1], [Linux])
     AC_DEFINE([LINUX], [1], [Linux])
     AC_DEFINE([LINUX2_0], [1], [Linux 2.0])
@@ -571,7 +570,6 @@ case $host in
     AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks])
     ;;
   ia64-hp-hpux*)
-    AC_DEFINE([XP_UNIX], [1], [UNIX])
     AC_DEFINE([hpux], [1], [HP-UX])
     AC_DEFINE([HPUX], [1], [HP-UX])
     AC_DEFINE([HPUX11], [1], [HP-UX 11])
@@ -589,7 +587,6 @@ case $host in
     initdir=/init.d
     ;;
   hppa*-hp-hpux*)
-    AC_DEFINE([XP_UNIX], [1], [UNIX])
     AC_DEFINE([hpux], [1], [HP-UX])
     AC_DEFINE([HPUX], [1], [HP-UX])
     AC_DEFINE([HPUX11], [1], [HP-UX 11])
@@ -608,7 +605,6 @@ case $host in
     initdir=/init.d
     ;;
   *-*-solaris*)
-    AC_DEFINE([XP_UNIX], [1], [UNIX])
     AC_DEFINE([SVR4], [1], [SVR4])
     AC_DEFINE([__svr4], [1], [SVR4])
     AC_DEFINE([__svr4__], [1], [SVR4])
diff --git a/include/base/eventlog.h b/include/base/eventlog.h
index 5e6c6ac..bd75eb8 100644
--- a/include/base/eventlog.h
+++ b/include/base/eventlog.h
@@ -54,18 +54,4 @@
 
 #include "netsite.h"
 
-
-#if defined(XP_WIN32)
-
-NSPR_BEGIN_EXTERN_C
-
-NSAPI_PUBLIC HANDLE InitializeLogging(char *szEventLogName);
-NSAPI_PUBLIC BOOL TerminateLogging(HANDLE hEventSource);
-NSAPI_PUBLIC BOOL LogErrorEvent(HANDLE hEventSource, WORD fwEventType, WORD fwCategory, DWORD IDEvent, LPTSTR chMsg, LPTSTR lpszMsg);
-
-NSPR_END_EXTERN_C
-
-#endif /* XP_WIN32 */
-
-
 #endif
diff --git a/include/base/file.h b/include/base/file.h
index 6ad9fc7..9bb7e1b 100644
--- a/include/base/file.h
+++ b/include/base/file.h
@@ -80,11 +80,6 @@ NSAPI_PUBLIC int INTsystem_tlock(SYS_FILE fd);
 NSAPI_PUBLIC int INTsystem_flock(SYS_FILE fd);
 NSAPI_PUBLIC int INTsystem_ulock(SYS_FILE fd);
 
-#ifdef XP_WIN32
-NSAPI_PUBLIC SYS_DIR INTdir_open(char *path);
-NSAPI_PUBLIC SYS_DIRENT *INTdir_read(SYS_DIR ds);
-NSAPI_PUBLIC void INTdir_close(SYS_DIR ds);
-#endif /* XP_WIN32 */
 
 /* --- OBSOLETE ----------------------------------------------------------
  * The following macros/functions are obsolete and are only maintained for
@@ -92,14 +87,6 @@ NSAPI_PUBLIC void INTdir_close(SYS_DIR ds);
  * -----------------------------------------------------------------------
  */
 
-#ifdef XP_WIN32
-NSAPI_PUBLIC char *INTsystem_winsockerr(void);
-NSAPI_PUBLIC char *INTsystem_winerr(void);
-NSAPI_PUBLIC int INTsystem_pread(SYS_FILE fd, char *buf, int sz);
-NSAPI_PUBLIC int INTsystem_pwrite(SYS_FILE fd, char *buf, int sz);
-NSAPI_PUBLIC void INTfile_unix2local(char *path, char *p2);
-#endif /* XP_WIN32 */
-
 NSAPI_PUBLIC int INTsystem_nocoredumps(void);
 NSAPI_PUBLIC int INTfile_setinherit(SYS_FILE fd, int value);
 NSAPI_PUBLIC int INTfile_notfound(void);
@@ -124,20 +111,6 @@ NSPR_END_EXTERN_C
 #define system_tlock INTsystem_tlock
 #define system_flock INTsystem_flock
 #define system_ulock INTsystem_ulock
-#ifdef XP_WIN32
-#define dir_open INTdir_open
-#define dir_read INTdir_read
-#define dir_close INTdir_close
-#endif /* XP_WIN32 */
-
-/* Obsolete */
-#ifdef XP_WIN32
-#define system_winsockerr INTsystem_winsockerr
-#define system_winerr INTsystem_winerr
-#define system_pread INTsystem_pread
-#define system_pwrite INTsystem_pwrite
-#define file_unix2local INTfile_unix2local
-#endif /* XP_WIN32 */
 
 #define system_nocoredumps INTsystem_nocoredumps
 #define file_setinherit INTfile_setinherit
diff --git a/include/base/fsmutex.h b/include/base/fsmutex.h
index 5eca55c..f321c73 100644
--- a/include/base/fsmutex.h
+++ b/include/base/fsmutex.h
@@ -94,15 +94,11 @@ NSAPI_PUBLIC FSMUTEX fsmutex_init(char *name, int number, int flags);
    Sets the ownership of the underlying filesystem object to the given
    uid and gid. Only effective if the server is running as root.
  */
-#ifdef XP_UNIX
 #include <unistd.h>
 #ifdef __sony
 #include <sys/types.h>
 #endif
 NSAPI_PUBLIC void fsmutex_setowner(FSMUTEX fsm, uid_t uid, gid_t gid);
-#endif
-
-
 
 /*
    fsmutex_terminate deletes a filesystem-based mutex. A mutex will only
diff --git a/include/base/systems.h b/include/base/systems.h
index 5703547..044cb83 100644
--- a/include/base/systems.h
+++ b/include/base/systems.h
@@ -438,46 +438,9 @@
 #define SA_HANDLER_T(x) (void (*)(int))x
 #endif
 
-#elif defined (XP_WIN32)      /* Windows NT */
-
-#include <wtypes.h>
-#include <winbase.h>
-
-typedef void* PASSWD;
-
-#define ACCELERATOR_CACHE
-#define AUTH_DBM
-/* size has been raised to 200 with NT 4.0 server; NT 4.0 workstation is still
- * limited
- */
-#define DAEMON_LISTEN_SIZE 200
-#define DAEMON_WIN32
-#define DLL_CAPABLE
-#define DLL_WIN32
-#define DNS_CACHE
-#define LOG_BUFFERING
-#define HAVE_STRFTIME /* no cftime */
-#define NEED_CRYPT_PROTO
-#define NEEDS_WRITEV
-#define NET_SOCKETS
-#ifndef NO_DOMAINNAME
-#define NO_DOMAINNAME
-#endif
-#ifdef BUILD_DLL
-#define NSAPI_PUBLIC __declspec(dllexport)
 #else
-#define NSAPI_PUBLIC
-#endif /* BUILD_DLL */
-#define THREAD_ANY
-#define THREAD_NSPR_KERNEL
-#define USE_NSPR
-#define USE_STRFTIME /* no cftime */
-
-#else
-
 #error "Missing defines in ns/netsite/include/base/systems.h"
-
-#endif	/* Windows NT */
+#endif
 
 /* Pick up the configuration symbols in the public interface */
 #ifndef PUBLIC_BASE_SYSTEMS_H
@@ -513,7 +476,6 @@ typedef void* PASSWD;
 /* NS_MAIL builds sec-key.c which calls systhread_init, which requires */
 /* that USE_NSPR is defined when systhr.c is compiled.  --lachman */
 /* MCC_PROXY does the same thing now --nbreslow -- LIKE HELL --ari */
-#if defined(XP_UNIX)
 #define USE_NSPR
 /* XXXrobm This is UNIX-only for the moment */
 #define LOG_BUFFERING
@@ -527,7 +489,6 @@ typedef void* PASSWD;
 #endif /* IRIX */
 #endif /* SW_THREADS */
 #define THREAD_ANY
-#endif /* XP_UNIX */
 
 /* --- End the great debate --- */
 
diff --git a/include/ldaputil/cert.h b/include/ldaputil/cert.h
index 051940c..403866f 100644
--- a/include/ldaputil/cert.h
+++ b/include/ldaputil/cert.h
@@ -44,12 +44,8 @@
 #define _LDAPU_CERT_H
 
 #ifndef NSAPI_PUBLIC
-#ifdef XP_WIN32
-#define NSAPI_PUBLIC __declspec(dllexport)
-#else
 #define NSAPI_PUBLIC 
 #endif
-#endif
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/ldaputil/dbconf.h b/include/ldaputil/dbconf.h
index b6dd1ed..2655f36 100644
--- a/include/ldaputil/dbconf.h
+++ b/include/ldaputil/dbconf.h
@@ -46,12 +46,8 @@
 #include <stdio.h>
 
 #ifndef NSAPI_PUBLIC
-#ifdef XP_WIN32
-#define NSAPI_PUBLIC __declspec(dllexport)
-#else
 #define NSAPI_PUBLIC 
 #endif
-#endif
 
 typedef struct dbconf_propval {
     char *prop;			    /* Property name */
diff --git a/include/ldaputil/encode.h b/include/ldaputil/encode.h
index 5aa63b7..a2e7082 100644
--- a/include/ldaputil/encode.h
+++ b/include/ldaputil/encode.h
@@ -44,12 +44,8 @@
 #define _LDAPU_ENCODE_H
 
 #ifndef NSAPI_PUBLIC
-#ifdef XP_WIN32
-#define NSAPI_PUBLIC __declspec(dllexport)
-#else
 #define NSAPI_PUBLIC 
 #endif
-#endif
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/ldaputil/errors.h b/include/ldaputil/errors.h
index 7b36a47..0b7f9b8 100644
--- a/include/ldaputil/errors.h
+++ b/include/ldaputil/errors.h
@@ -44,12 +44,8 @@
 #define _LDAPU_ERRORS_H
 
 #ifndef NSAPI_PUBLIC
-#ifdef XP_WIN32
-#define NSAPI_PUBLIC __declspec(dllexport)
-#else
 #define NSAPI_PUBLIC 
 #endif
-#endif
 
 #ifdef DBG_PRINT
 #include <stdio.h>
diff --git a/include/ldaputil/extcmap.h b/include/ldaputil/extcmap.h
index 0327135..320376e 100644
--- a/include/ldaputil/extcmap.h
+++ b/include/ldaputil/extcmap.h
@@ -46,12 +46,8 @@
 #include <ldap.h>
 
 #ifndef NSAPI_PUBLIC
-#if defined( _WINDOWS ) || defined( _WIN32 ) || defined( XP_WIN32 )
-#define NSAPI_PUBLIC __declspec(dllexport)
-#else
 #define NSAPI_PUBLIC 
 #endif
-#endif
 
 
 #define LDAPU_ATTR_INITFN		"InitFn"
@@ -311,20 +307,9 @@ NSAPI_PUBLIC extern int CertMapDLLInitFn(LDAPUDispatchVector_t **table);
 
 extern LDAPUDispatchVector_t *__ldapu_table;
 
-#if defined( _WINDOWS ) || defined( _WIN32 ) || defined( XP_WIN32 )
-#define CertmapDLLInitFnTbl LDAPUDispatchVector_t *__ldapu_table;
-#define CertmapDLLInit(rv, libname) \
-{\
-	HANDLE h = LoadLibrary((libname)); \
-	CertMapDLLInitFn_t init_fn; \
-	if (!h) return LDAPU_CERT_MAP_INITFN_FAILED; \
-	init_fn = (CertMapDLLInitFn_t)GetProcAddress(h, "CertMapDLLInitFn"); \
-	rv = init_fn(&__ldapu_table); \
-}
-#else
 #define CertmapDLLInit(rv, libname)
 #define CertmapDLLInitFnTbl
-#endif
+
 
 #endif /* INTLDAPU */
 
diff --git a/include/ldaputil/ldapauth.h b/include/ldaputil/ldapauth.h
index fc1ab93..b3fa511 100644
--- a/include/ldaputil/ldapauth.h
+++ b/include/ldaputil/ldapauth.h
@@ -47,12 +47,8 @@
 #include <ldap.h>
 
 #ifndef NSAPI_PUBLIC
-#ifdef XP_WIN32
-#define NSAPI_PUBLIC __declspec(dllexport)
-#else
 #define NSAPI_PUBLIC 
 #endif
-#endif
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/libadmin/libadmin.h b/include/libadmin/libadmin.h
index 05d0b09..a0fad68 100644
--- a/include/libadmin/libadmin.h
+++ b/include/libadmin/libadmin.h
@@ -51,17 +51,10 @@
 
 #include <stdio.h>
 #include <limits.h>
-
 #include "base/systems.h"
 #include "base/systhr.h"
 #include "base/util.h"
- 
-#ifdef XP_UNIX
 #include <unistd.h>
-#else /* XP_WIN32 */
-#include <winsock.h>
-#endif /* XP_WIN32 */
-
 #include "prinit.h"
 #include "prthread.h"
 #include "prlong.h"
diff --git a/include/netsite.h b/include/netsite.h
index 2bdfc8d..9147430 100644
--- a/include/netsite.h
+++ b/include/netsite.h
@@ -78,38 +78,10 @@
 #define VOID void
 #endif
 
-#ifdef XP_UNIX
-/*
- * Provide some typedefs that are commonly used on windows
- *
- * DO NOT USE THESE!  They will be deleted later!
- *
- */
-#define CONST const
-typedef unsigned long       DWORD;
-typedef int                 BOOL;
-typedef unsigned char       BYTE;
-typedef unsigned short      WORD;
-typedef float               FLOAT;
-typedef FLOAT               *PFLOAT;
-typedef BOOL                *PBOOL;
-typedef BOOL                *LPBOOL;
-typedef BYTE                *PBYTE;
-typedef BYTE                *LPBYTE;
-typedef int                 *PINT;
-typedef int                 *LPINT;
-typedef WORD                *PWORD;
-typedef WORD                *LPWORD;
-typedef long                *LPLONG;
-typedef DWORD               *PDWORD;
-typedef DWORD               *LPDWORD;
-typedef void                *LPVOID;
-
 #ifndef SNI
 #if !defined (boolean) && !defined (__GNUC__)
 typedef int                  boolean;
 #endif
-#endif
 
 #endif
 #define NS_TRUE              1
diff --git a/include/public/base/systems.h b/include/public/base/systems.h
index fc9b045..cfd1388 100644
--- a/include/public/base/systems.h
+++ b/include/public/base/systems.h
@@ -212,41 +212,11 @@
 #define SHMEM_UNIX_MMAP
 #define ZERO(ptr,len) memset(ptr,0,len)
 
-#elif defined (XP_WIN32)      /* Windows NT */
-
-#include <wtypes.h>
-#include <winbase.h>
-
-typedef void* PASSWD;
-
-#define caddr_t PCHAR
-#define CASECMPARG_T const
-#define FILE_WIN32
-#define FILE_WIN32_MMAP
-#define MALLOC_POOLS
-#define NEED_STRCASECMP
-#define NEED_STRNCASECMP
-#define NET_WINSOCK
-#define NSAPI_PUBLIC __declspec(dllexport)
-/* The stat call under NT doesn't define these macros */
-#ifndef S_ISDIR
-#define S_ISDIR(mode)   ((mode&S_IFMT) == S_IFDIR)
-#endif
-#ifndef S_ISREG
-#define S_ISREG(mode)   ((mode&S_IFMT) == S_IFREG)                             
-#endif
-#ifndef S_ISLNK
-#define S_ISLNK(x) (0)
-#endif
-#define SEM_WIN32
-#define SHMEM_WIN32_MMAP
-#define ZERO(ptr, len) ZeroMemory(ptr, len)
-
 #else
 
 #error "Missing defines in ns/netsite/include/public/base/systems.h"
 
-#endif	/* Windows NT */
+#endif
 
 #ifndef NSPR_BEGIN_EXTERN_C
 #ifdef __cplusplus
diff --git a/include/public/nsacl/aclapi.h b/include/public/nsacl/aclapi.h
index e3abb25..e312d99 100644
--- a/include/public/nsacl/aclapi.h
+++ b/include/public/nsacl/aclapi.h
@@ -274,19 +274,8 @@ struct ACLDispatchVector {
     int (*f_ACL_GetDefaultResult)(ACLEvalHandle_t *acleval);
 };
 
-#ifdef XP_WIN32
-
-#ifdef INTNSACL
-NSAPI_PUBLIC extern ACLDispatchVector_t *__nsacl_table;
-#else
-__declspec(dllimport) ACLDispatchVector_t *__nsacl_table;
-#endif /* INTNSACL */
-
-#else /* !XP_WIN32 */
-
 NSAPI_PUBLIC extern ACLDispatchVector_t *__nsacl_table;
 
-#endif /* XP_WIN32 */
 
 #ifndef INTNSACL
 
diff --git a/include/public/nsapi.h b/include/public/nsapi.h
index c3f1748..5dde361 100644
--- a/include/public/nsapi.h
+++ b/include/public/nsapi.h
@@ -63,11 +63,7 @@
 /* Used in some places as a length limit on error messages */
 #define MAGNUS_ERROR_LEN 1024
 
-#ifdef XP_WIN32
-#define ENDLINE "\r\n"
-#else
 #define ENDLINE "\n"
-#endif
 
 /*
  * The maximum length of an error message. NOT RUN-TIME CHECKED
@@ -134,17 +130,9 @@
 /* The disk page size on this machine. */
 #define FILE_BUFFERSIZE 4096
 
-#ifdef XP_UNIX
-
 #define FILE_PATHSEP '/'
 #define FILE_PARENT "../"
 
-#elif defined(XP_WIN32)
-
-#define FILE_PATHSEP '/'
-#define FILE_PARENT "..\\"
-
-#endif /* XP_WIN32 */
 
 /* WILDPAT uses shell expressions */
 #define WILDPAT_VALID(exp)              shexp_valid(exp)
@@ -174,17 +162,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef FILE_WIN32
-#include <direct.h>
-#endif /* FILE_WIN32 */
-
-#ifdef NET_WINSOCK
-#include <winsock.h>
-struct iovec {
-	char		*iov_base;
-    unsigned	iov_len;
-};
-#else
 #if !defined(SUNOS4) && !defined(HPUX) && !defined(LINUX)
 #include <sys/select.h>
 #endif
@@ -192,10 +169,7 @@ struct iovec {
 #include <sys/socket.h>
 #include <netinet/in.h> /* sockaddr and in_addr */
 #include <sys/uio.h>
-#endif /* NET_WINSOCK */
-
 #include <sys/stat.h>
-
 #include <ctype.h>  /* isspace */
 #include <stdio.h>
 #include <stdarg.h>
@@ -203,11 +177,8 @@ struct iovec {
 #include <string.h>
 #include <errno.h>
 #include <time.h>
-
-#ifdef XP_UNIX
 #include <dirent.h>
 #include <pwd.h>                /* struct passwd */
-#endif /* XP_UNIX */
 
 #ifndef BIG_LINE
 #define BIG_LINE 1024
@@ -228,28 +199,8 @@ typedef void *SYS_FILE;
 typedef void* CONDVAR;
 typedef void *COUNTING_SEMAPHORE;
 typedef void* CRITICAL;
-
-#ifdef XP_UNIX
 typedef DIR* SYS_DIR;
 typedef struct dirent SYS_DIRENT;
-#endif /* XP_UNIX */
-
-#ifdef XP_WIN32
-
-typedef struct {
-    char *d_name;
-} dirent_s;
-
-typedef struct {
-    HANDLE dp;
-    WIN32_FIND_DATA fdata;
-    dirent_s de;
-} dir_s;
-
-typedef dir_s* SYS_DIR;
-typedef dirent_s SYS_DIRENT;
-
-#endif /* XP_WIN32 */
 
 typedef struct {
     char *name,*value;
@@ -318,7 +269,6 @@ typedef struct {
 #define strncasecmp(s1, s2, n) util_strncasecmp(s1, s2, n)
 #endif /* NEED_STRNCASECMP */
 
-#ifdef XP_UNIX
 #define dir_open opendir
 #define dir_read readdir
 #define dir_close closedir
@@ -326,13 +276,6 @@ typedef struct {
 #define dir_remove rmdir
 #define system_chdir chdir
 #define file_unix2local(path,p2) strcpy(p2,path)
-#endif /* XP_UNIX */
-
-#ifdef XP_WIN32
-#define dir_create _mkdir
-#define dir_remove _rmdir
-#define system_chdir SetCurrentDirectory
-#endif /* XP_WIN32 */
 
 /*
  * Thread-safe variant of localtime
diff --git a/ldap/include/disptmpl.h b/ldap/include/disptmpl.h
index 226470c..d326637 100644
--- a/ldap/include/disptmpl.h
+++ b/ldap/include/disptmpl.h
@@ -64,22 +64,10 @@ extern "C" {
 
 /* calling conventions used by library */
 #ifndef LDAP_CALL
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_C __cdecl
-#ifndef _WIN32 
-#define __stdcall _far _pascal
-#define LDAP_CALLBACK _loadds
-#else
-#define LDAP_CALLBACK
-#endif /* _WIN32 */
-#define LDAP_PASCAL __stdcall
-#define LDAP_CALL LDAP_PASCAL
-#else /* _WINDOWS */
 #define LDAP_C
 #define LDAP_CALLBACK
 #define LDAP_PASCAL
 #define LDAP_CALL
-#endif /* _WINDOWS */
 #endif /* LDAP_CALL */
 
 #define LDAP_TEMPLATE_VERSION	1
diff --git a/ldap/include/ldaplog.h b/ldap/include/ldaplog.h
index 6ced113..20f0101 100644
--- a/ldap/include/ldaplog.h
+++ b/ldap/include/ldaplog.h
@@ -86,36 +86,6 @@ extern "C" {
 #  undef LDAPDebug2Args
 #  undef LDAPDebugLevelIsSet
 
-#    ifdef _WIN32
-#      ifndef DONT_DECLARE_SLAPD_LDAP_DEBUG /* see libglobs.c for info */
-       extern __declspec(dllimport) int	slapd_ldap_debug;
-#      endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */
-#      define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
-       { \
-		if ( *module_ldap_debug & level ) { \
-		        slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
-	    } \
-       }
-#      define LDAPDebug0Args( level, fmt )	\
-       { \
-		if ( *module_ldap_debug & level ) { \
-		        slapd_log_error_proc( NULL, fmt ); \
-	    } \
-       }
-#      define LDAPDebug1Arg( level, fmt, arg )      \
-       { \
-		if ( *module_ldap_debug & level ) { \
-		        slapd_log_error_proc( NULL, fmt, arg ); \
-	    } \
-       }
-#      define LDAPDebug2Args( level, fmt, arg1, arg2 )    \
-       { \
-		if ( *module_ldap_debug & level ) { \
-		        slapd_log_error_proc( NULL, fmt, arg1, arg2 ); \
-	    } \
-       }
-#      define LDAPDebugLevelIsSet( level ) (0 != (*module_ldap_debug & level))
-#    else /* Not _WIN32 */
        extern int	slapd_ldap_debug;
 #      define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
        { \
@@ -142,7 +112,6 @@ extern "C" {
 	    } \
        }
 #      define LDAPDebugLevelIsSet( level ) (0 != (slapd_ldap_debug & level))
-#    endif /* Win32 */
 #endif /* LDAP_DEBUG */
 
 #ifdef __cplusplus
diff --git a/ldap/include/lthread.h b/ldap/include/lthread.h
index bfdd4f3..910adb3 100644
--- a/ldap/include/lthread.h
+++ b/ldap/include/lthread.h
@@ -317,64 +317,6 @@ typedef struct irix_cv {
 
 #else
 
-#if defined( WIN32_KERNEL_THREADS )
-
-/***********************************
- *                                 *
- * thread definitions for Win32    *
- *                                 *
- ***********************************/
-
-#define _THREAD
-
-#include <windows.h>
-#include <process.h>
-#include "ldap.h"
-#include "ldaplog.h"
-
-typedef void	(*VFP)(void *);
-
-/* Win32 threads are preemptive */
-#define PTHREAD_PREEMPTIVE	1
-
-/* thread attributes and thread type */
-typedef int	pthread_attr_t;
-typedef HANDLE	pthread_t;
-
-/* default attr states */
-#define pthread_mutexattr_default	0
-#define pthread_condattr_default	0
-
-/* thread state - joinable or not */
-#define PTHREAD_CREATE_JOINABLE	0
-#define PTHREAD_CREATE_DETACHED	1
-/* thread scope - who is in scheduling pool */
-#define PTHREAD_SCOPE_PROCESS	0
-#define PTHREAD_SCOPE_SYSTEM	1
-
-/* mutex attributes and mutex type */
-typedef int	pthread_mutexattr_t;
-typedef HANDLE	pthread_mutex_t;
-
-/* mutex and condition variable scope - process or system */
-#define PTHREAD_SHARE_PRIVATE	0
-#define PTHREAD_SHARE_PROCESS	1
-
-/* condition variable attributes and condition variable type */
-typedef int	pthread_condattr_t;
-
-/* simulated condition variable */
-struct win32_cv_waiter {
-	pthread_t			icvw_pthread;
-	struct win32_cv_waiter	*icvw_next;
-};
-typedef struct win32_cv {
-	pthread_mutex_t		icv_mutex;
-	pthread_mutex_t		*icv_waitermutex;
-	struct win32_cv_waiter	*icv_waiterq;
-} pthread_cond_t;
-
-#endif /* NATIVE_WIN32_THREADS */
 #endif /* sgi sproc */
 #endif /* dce pthreads */
 #endif /* hp dce pthreads */
diff --git a/ldap/include/ntslapdregparms.h b/ldap/include/ntslapdregparms.h
deleted file mode 100644
index 78eed47..0000000
--- a/ldap/include/ntslapdregparms.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- * 
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- * 
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception. 
- * 
- * 
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-/******************************************************
- *
- *
- *  ntslapdregparms.h - NT Registry keys for Slapd.
- *
- ******************************************************/
-
-#if defined( _WIN32 )
-
-#if !defined( _NTSLAPDREGPARMS_H_ )
-#define	_NTSLAPDREGPARMS_H_
-
-#define COMPANY_KEY "SOFTWARE\\Netscape"
-#define COMPANY_NAME		VENDOR
-#define PROGRAM_GROUP_NAME	VENDOR
-#define PRODUCT_NAME		"slapd"
-#define PRODUCT_BIN			"ns-slapd"
-#define SLAPD_EXE		    "slapd.exe"
-#define SERVICE_EXE		    SLAPD_EXE
-#define	SLAPD_CONF			"slapd.conf"
-#define	MAGNUS_CONF			SLAPD_CONF
-#define SLAPD_DONGLE_FILE	"password.dng"
-#define DONGLE_FILE_NAME	SLAPD_DONGLE_FILE
-#define PRODUCT_VERSION		"1.0"
-#define EVENTLOG_APPNAME	VENDOR "Slapd"
-#define DIRECTORY_SERVICE_PREFIX	CAPBRAND " Directory Server "
-#define SERVICE_PREFIX		DIRECTORY_SERVICE_PREFIX
-#define CONFIG_PATH_KEY		"ConfigurationPath"
-#define EVENTLOG_MESSAGES_KEY "EventMessageFile"
-#define EVENT_LOG_KEY		"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application"
-#define ADMIN_REGISTRY_ROOT_KEY "Admin Server"
-#define SLAPD_REGISTRY_ROOT_KEY	"Slapd Server"
-#define PRODUCT_KEY			SLAPD_REGISTRY_ROOT_KEY
-#endif /* _NTSLAPDREGPARMS_H_ */
-
-#endif /* _WIN32 */
diff --git a/ldap/include/ntwatchdog.h b/ldap/include/ntwatchdog.h
deleted file mode 100644
index 0c8be74..0000000
--- a/ldap/include/ntwatchdog.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- * 
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- * 
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception. 
- * 
- * 
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-/******************************************************
- *
- *
- *  ntwatchdog.h - Defs for NT Watchdog Service.
- *
- ******************************************************/
-
-#if defined( _WIN32 )
-
-#if !defined( _NTWATCHDOG_H_ )
-#define	_NTWATCHDOG_H_
-
-#define FILE_PATHSEP '/'
-
-#define SLAPD_ROOT             "SLAPD_ROOT"   // environment variable holding server root path
-#define MORTALITY_KEY          "MortalityTimeSecs"
-#define MINRAMFREE_KEY         "MinRamFree"
-#define MINRAMTOTAL_KEY        "MinRamTotal"
-#define MINRAMPERSERVER_KEY    "MinRamPerServer"
-#define DEFAULT_MORTALITY_TIME  60              // seconds after startup up until server will NOT be restarted
-#define DEFAULT_KILL_TIME       600             // seconds to wait for httpd.exe to shutdown
-#define DEFAULT_CRON_TIME       60              // seconds to wait before rechecking cron.conf
-#define DEFAULT_RESTART_TIME    10              // seconds to wait before restarting server
-#define DEFAULT_MINRAMFREE      0               // KB free physical memory remaining
-#define DEFAULT_MINRAMTOTAL     (30 * 1024)     // KB free physical memory installed
-#define DEFAULT_MINRAMPERSERVER (15 * 1024)     // KB free physical memory per server
-
-#define MSG_RESOURCES         "Not enough physical memory to start server."
-
-// offsets for extra window bytes, used in Set/GetWindowLong()
-#define GWL_PROCESS_HANDLE  (sizeof(LONG) * 0)
-#define GWL_PASSWORD_ADDR   (sizeof(LONG) * 1)
-#define GWL_PASSWORD_LENGTH (sizeof(LONG) * 2)
-
-#define MAX_LINE      512
-#define MAX_PASSWORD  256
-#define MAX_TOKENNAME 50
-
-typedef struct PK11_PIN
-{
-	char TokenName[MAX_TOKENNAME];
-	int  TokenLength;
-	char Password[MAX_PASSWORD];
-	int  PasswordLength;
-}PK11_PIN;
-
-#define CLOSEHANDLE(X) \
-{ \
-	if(X) \
-	{ \
-		CloseHandle(X); \
-		X = 0; \
-	} \
-}
-
-// in ntcron.c
-LPTHREAD_START_ROUTINE CRON_ThreadProc(HANDLE hevWatchDogExit);
-
-// in watchdog.c
-BOOL WD_SysLog(WORD fwEventType, DWORD IDEvent, char *szData);
-
-#endif /* _NTWATCHDOG_H_ */
-#endif /* _WIN32 */
diff --git a/ldap/include/regex.h b/ldap/include/regex.h
index 7748dcf..8caa96f 100644
--- a/ldap/include/regex.h
+++ b/ldap/include/regex.h
@@ -40,7 +40,7 @@
 #  include <config.h>
 #endif
 
-#if defined( macintosh ) || defined( DOS ) || defined( _WINDOWS ) || defined( NEED_BSDREGEX )
+#if defined( macintosh ) || defined( NEED_BSDREGEX )
 /*
  * Copyright (c) 1993 Regents of the University of Michigan.
  * All rights reserved.
@@ -97,4 +97,4 @@ int  re_subs();
 #ifdef __cplusplus
 }
 #endif
-#endif /* macintosh or DOS or or _WIN32 or NEED_BSDREGEX */
+#endif /* macintosh or NEED_BSDREGEX */
diff --git a/ldap/include/srchpref.h b/ldap/include/srchpref.h
index d5918f8..687fe25 100644
--- a/ldap/include/srchpref.h
+++ b/ldap/include/srchpref.h
@@ -65,22 +65,10 @@ extern "C" {
 
 /* calling conventions used by library */
 #ifndef LDAP_CALL
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_C __cdecl
-#ifndef _WIN32 
-#define __stdcall _far _pascal
-#define LDAP_CALLBACK _loadds
-#else
-#define LDAP_CALLBACK
-#endif /* _WIN32 */
-#define LDAP_PASCAL __stdcall
-#define LDAP_CALL LDAP_PASCAL
-#else /* _WINDOWS */
 #define LDAP_C
 #define LDAP_CALLBACK
 #define LDAP_PASCAL
 #define LDAP_CALL
-#endif /* _WINDOWS */
 #endif /* LDAP_CALL */
 
 struct ldap_searchattr {
diff --git a/ldap/libraries/libavl/avl.c b/ldap/libraries/libavl/avl.c
index 18c43e0..92c3847 100644
--- a/ldap/libraries/libavl/avl.c
+++ b/ldap/libraries/libavl/avl.c
@@ -58,12 +58,6 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
 static char avl_version[] = "AVL library version 1.0\n";
 #endif
 
-#ifdef _WIN32
-typedef char *caddr_t;
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#endif
-
 #include <sys/types.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/ldap/libraries/libavl/testavl.c b/ldap/libraries/libavl/testavl.c
index eae9b7a..aa95d9f 100644
--- a/ldap/libraries/libavl/testavl.c
+++ b/ldap/libraries/libavl/testavl.c
@@ -41,9 +41,6 @@
 #endif
 
 /* testavl.c - Test Tim Howes AVL code */
-#ifdef _WIN32
-#include <windows.h>
-#endif
 #include <sys/types.h>
 #include <stdio.h>
 #include "avl.h"
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
index 86ac12f..420b2e6 100644
--- a/ldap/servers/plugins/acl/acl.h
+++ b/ldap/servers/plugins/acl/acl.h
@@ -69,13 +69,10 @@
 #include 	<string.h>
 #include 	<sys/types.h>
 #include	<limits.h>
-#ifndef _WIN32
 #include 	<sys/socket.h>
 #include 	<netinet/in.h>
 #include 	<arpa/inet.h>
 #include 	<netdb.h>
-#endif
-
 #include 	<ldap.h>
 #include 	<las.h>
 #include	<aclproto.h>
@@ -86,9 +83,7 @@
 #include	"slapi-private.h"
 #include	"portable.h"
 #include	"avl.h"
-
 #include	"cert.h"
-
 #include	<plhash.h>
 
 #ifdef SOLARIS
diff --git a/ldap/servers/plugins/acl/acldllmain.c b/ldap/servers/plugins/acl/acldllmain.c
index 627ecc8..ac219ad 100644
--- a/ldap/servers/plugins/acl/acldllmain.c
+++ b/ldap/servers/plugins/acl/acldllmain.c
@@ -41,96 +41,17 @@
 #endif
 
 #include "acl.h"
+#include <stdio.h>
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
 
 #ifdef LDAP_DEBUG
-#ifndef _WIN32
 #include <stdarg.h>
-#include <stdio.h>
 
 void LDAPDebug( int level, char* fmt, ... )
 {
@@ -148,13 +69,7 @@ void LDAPDebug( int level, char* fmt, ... )
 	}
 }
 #endif
-#endif
-
-#ifndef _WIN32
 
-/* The 16-bit version of the RTL does not implement perror() */
-
-#include <stdio.h>
 
 void perror( const char *msg )
 {
@@ -163,4 +78,3 @@ void perror( const char *msg )
 	OutputDebugString( buf );
 }
 
-#endif
diff --git a/ldap/servers/plugins/acl/aclplugin.c b/ldap/servers/plugins/acl/aclplugin.c
index c6ad719..7784210 100644
--- a/ldap/servers/plugins/acl/aclplugin.c
+++ b/ldap/servers/plugins/acl/aclplugin.c
@@ -405,12 +405,3 @@ acl_access_allowed_main ( Slapi_PBlock *pb, Slapi_Entry *e, char **attrs,
 
 	return rc;
 }
-#ifdef _WIN32
-
-int *module_ldap_debug = 0;
-void plugin_init_debug_level ( int *level_ptr )
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
-
diff --git a/ldap/servers/plugins/chainingdb/cb_debug.c b/ldap/servers/plugins/chainingdb/cb_debug.c
index 07fbc88..e93104e 100644
--- a/ldap/servers/plugins/chainingdb/cb_debug.c
+++ b/ldap/servers/plugins/chainingdb/cb_debug.c
@@ -49,12 +49,3 @@
 #include <sys/types.h>
 #include "cb.h"
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-        module_ldap_debug = level_ptr;
-}
-#endif
-
diff --git a/ldap/servers/plugins/chainingdb/cb_init.c b/ldap/servers/plugins/chainingdb/cb_init.c
index b9a4cb0..9f3e286 100644
--- a/ldap/servers/plugins/chainingdb/cb_init.c
+++ b/ldap/servers/plugins/chainingdb/cb_init.c
@@ -59,10 +59,6 @@ static void cb_set_backend_type(cb_backend * cb) {
 }
 
 /* Initialization function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
-
 int
 chaining_back_init( Slapi_PBlock *pb )
 {
diff --git a/ldap/servers/plugins/chainingdb/cbdllmain.c b/ldap/servers/plugins/chainingdb/cbdllmain.c
index 77c840b..16ccc5c 100644
--- a/ldap/servers/plugins/chainingdb/cbdllmain.c
+++ b/ldap/servers/plugins/chainingdb/cbdllmain.c
@@ -41,96 +41,18 @@
 #endif
 
 #include "cb.h"
+#include <stdio.h>
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
+
 
 #ifdef LDAP_DEBUG
-#ifndef _WIN32
 #include <stdarg.h>
-#include <stdio.h>
 
 void LDAPDebug( int level, char* fmt, ... )
 {
@@ -147,13 +69,6 @@ void LDAPDebug( int level, char* fmt, ... )
 	}
 }
 #endif
-#endif
-
-#ifndef _WIN32
-
-/* The 16-bit version of the RTL does not implement perror() */
-
-#include <stdio.h>
 
 void perror( const char *msg )
 {
@@ -161,5 +76,3 @@ void perror( const char *msg )
 	wsprintf( buf, "%s: error %d\n", msg, WSAGetLastError()) ;
 	OutputDebugString( buf );
 }
-
-#endif
diff --git a/ldap/servers/plugins/collation/config.c b/ldap/servers/plugins/collation/config.c
index 3a155dc..413d13d 100644
--- a/ldap/servers/plugins/collation/config.c
+++ b/ldap/servers/plugins/collation/config.c
@@ -78,11 +78,9 @@ strtok_quote( char *line, char *sep )
 	    }
 	    break;
 
-#ifndef _WIN32
 	  case '\\':
 	    *d++ = *++next;
 	    break;
-#endif
 
 	  default:
 	    if ( ! inquote ) {
diff --git a/ldap/servers/plugins/collation/debug.c b/ldap/servers/plugins/collation/debug.c
index fb64855..46ebddf 100644
--- a/ldap/servers/plugins/collation/debug.c
+++ b/ldap/servers/plugins/collation/debug.c
@@ -40,12 +40,3 @@
 #  include <config.h>
 #endif
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void
-plugin_init_debug_level (int *level_ptr)
-{
-    module_ldap_debug = level_ptr;
-}
-#endif
diff --git a/ldap/servers/plugins/collation/dllmain.c b/ldap/servers/plugins/collation/dllmain.c
index cc3d016..f8cca09 100644
--- a/ldap/servers/plugins/collation/dllmain.c
+++ b/ldap/servers/plugins/collation/dllmain.c
@@ -44,96 +44,18 @@
  * Microsoft Windows specifics for collation DLL
  */
 #include "ldap.h"
+#include <stdio.h>
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
 
 #ifdef LDAP_DEBUG
-#ifndef _WIN32
+
 #include <stdarg.h>
-#include <stdio.h>
 
 void LDAPDebug( int level, char* fmt, ... )
 {
@@ -151,11 +73,7 @@ void LDAPDebug( int level, char* fmt, ... )
 	}
 }
 #endif
-#endif
 
-#ifndef _WIN32
-/* The 16-bit version of the RTL does not implement perror() */
-#include <stdio.h>
 
 void perror( const char *msg )
 {
@@ -164,4 +82,3 @@ void perror( const char *msg )
 	OutputDebugString( buf );
 }
 
-#endif
diff --git a/ldap/servers/plugins/cos/cos.c b/ldap/servers/plugins/cos/cos.c
index 1e963e5..7ec18e8 100644
--- a/ldap/servers/plugins/cos/cos.c
+++ b/ldap/servers/plugins/cos/cos.c
@@ -48,11 +48,8 @@
 #include "slapi-private.h"
 #include "cos_cache.h"
 #include "vattr_spi.h"
-
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
+
 
 /*** secret slapd stuff ***/
 
@@ -98,15 +95,6 @@ static Slapi_PluginDesc pdesc = { "cos", VENDOR, DS_PACKAGE_VERSION,
 static void * cos_plugin_identity = NULL;
 
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
-
 /*
 ** Plugin identity mgmt
 */
diff --git a/ldap/servers/plugins/cos/dllmain.c b/ldap/servers/plugins/cos/dllmain.c
index 1fb17e4..d23057a 100644
--- a/ldap/servers/plugins/cos/dllmain.c
+++ b/ldap/servers/plugins/cos/dllmain.c
@@ -47,87 +47,10 @@
 #include "lber.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
+
diff --git a/ldap/servers/plugins/distrib/dllmain.c b/ldap/servers/plugins/distrib/dllmain.c
index 32715ff..3e072ff 100644
--- a/ldap/servers/plugins/distrib/dllmain.c
+++ b/ldap/servers/plugins/distrib/dllmain.c
@@ -46,82 +46,9 @@
 #include "ldap.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   /* successful DLL_PROCESS_ATTACH */
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 7da853b..4613fd2 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -60,10 +60,7 @@
 #error Need to define portable format macros such as PRIu64
 #endif /* HAVE_INTTYPES_H */
 
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
 
 #define DNA_PLUGIN_SUBSYSTEM "dna-plugin"
 #define DNA_PLUGIN_VERSION 0x00020000
@@ -318,18 +315,6 @@ static int dna_be_txn_mod_pre_op(Slapi_PBlock *pb);
 void dna_dump_config();
 void dna_dump_config_entry(struct configEntry *);
 
-/**
- * set the debug level
- */
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-    module_ldap_debug = level_ptr;
-}
-#endif
-
 /*
  * During the plugin startup we delay the creation of the shared config entries
  * so all the other betxn plugins have time to start.  During the "delayed"
diff --git a/ldap/servers/plugins/http/dllmain.c b/ldap/servers/plugins/http/dllmain.c
index 9bf3c1b..86418cb 100644
--- a/ldap/servers/plugins/http/dllmain.c
+++ b/ldap/servers/plugins/http/dllmain.c
@@ -47,89 +47,10 @@
 #include "ldap.h"
 #include "lber.h"
 
-#ifdef _WIN32
 
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   /* successful DLL_PROCESS_ATTACH */
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/http/http_client.c b/ldap/servers/plugins/http/http_client.c
index 821f895..acba665 100644
--- a/ldap/servers/plugins/http/http_client.c
+++ b/ldap/servers/plugins/http/http_client.c
@@ -47,20 +47,14 @@
 
 #include <stdio.h>
 #include <string.h>
-
 #include "portable.h"
 #include "nspr.h"
-
 #include "slapi-plugin.h"
 #include "slapi-private.h"
-
 #include "http_client.h"
 #include "http_impl.h"
-
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
+
 
 /*** from proto-slap.h ***/
 
@@ -81,23 +75,13 @@ extern "C" {
 #define LDAP_DEBUG_PLUGIN	0x10000		/* 65536 */
 
 /* debugging stuff */
-#    ifdef _WIN32
-       extern int	*module_ldap_debug;
-#      define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
-       { \
-		if ( *module_ldap_debug & level ) { \
-		        slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
-	    } \
-       }
-#    else /* _WIN32 */
-       extern int	slapd_ldap_debug;
-#      define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
+extern int	slapd_ldap_debug;
+#define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
        { \
 		if ( slapd_ldap_debug & level ) { \
 		        slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
 	    } \
        }
-#    endif /* Win32 */
 
 #ifdef __cplusplus
 }
@@ -145,15 +129,6 @@ static int _http_get_redirected_uri(char *url, char **data, int *bytesRead);
 static int _http_post(char *url, httpheader **httpheaderArray, char *body, char **data, int *bytesRead);
 static void _http_shutdown( void );
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
-
 /**
  *	
  * Get the presence plug-in version
diff --git a/ldap/servers/plugins/http/http_impl.c b/ldap/servers/plugins/http/http_impl.c
index db02b67..98d0506 100644
--- a/ldap/servers/plugins/http/http_impl.c
+++ b/ldap/servers/plugins/http/http_impl.c
@@ -60,10 +60,7 @@
 #include "slap.h"
 #include "slapi-private.h"
 #include "slapi-plugin-compat4.h"
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
 
 /*** from proto-slap.h ***/
 
diff --git a/ldap/servers/plugins/pam_passthru/pam_ptdebug.c b/ldap/servers/plugins/pam_passthru/pam_ptdebug.c
index d72967a..d2abf2a 100644
--- a/ldap/servers/plugins/pam_passthru/pam_ptdebug.c
+++ b/ldap/servers/plugins/pam_passthru/pam_ptdebug.c
@@ -49,11 +49,3 @@
 #include <sys/types.h>
 #include "pam_passthru.h"
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
diff --git a/ldap/servers/plugins/pam_passthru/pam_ptdllmain.c b/ldap/servers/plugins/pam_passthru/pam_ptdllmain.c
index 6948a1f..a17bc1b 100644
--- a/ldap/servers/plugins/pam_passthru/pam_ptdllmain.c
+++ b/ldap/servers/plugins/pam_passthru/pam_ptdllmain.c
@@ -42,97 +42,19 @@
 #include "ldap.h"
 #include "lber.h"
 #include "passthru.h"
+#include <stdio.h>
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
+
 
 #ifdef LDAP_DEBUG
-#ifndef _WIN32
 #include <stdarg.h>
-#include <stdio.h>
 
 void LDAPDebug( int level, char* fmt, ... )
 {
@@ -150,13 +72,6 @@ void LDAPDebug( int level, char* fmt, ... )
 	}
 }
 #endif
-#endif
-
-#ifndef _WIN32
-
-/* The 16-bit version of the RTL does not implement perror() */
-
-#include <stdio.h>
 
 void perror( const char *msg )
 {
@@ -164,5 +79,3 @@ void perror( const char *msg )
 	wsprintf( buf, "%s: error %d\n", msg, WSAGetLastError()) ;
 	OutputDebugString( buf );
 }
-
-#endif
diff --git a/ldap/servers/plugins/passthru/ptdebug.c b/ldap/servers/plugins/passthru/ptdebug.c
index f504aed..607161c 100644
--- a/ldap/servers/plugins/passthru/ptdebug.c
+++ b/ldap/servers/plugins/passthru/ptdebug.c
@@ -50,11 +50,3 @@
 #include <sys/types.h>
 #include "passthru.h"
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
diff --git a/ldap/servers/plugins/passthru/ptdllmain.c b/ldap/servers/plugins/passthru/ptdllmain.c
index f3a7e88..ef471bc 100644
--- a/ldap/servers/plugins/passthru/ptdllmain.c
+++ b/ldap/servers/plugins/passthru/ptdllmain.c
@@ -43,97 +43,17 @@
 #include "ldap.h"
 #include "lber.h"
 #include "passthru.h"
+#include <stdio.h>
 
-
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
 
 #ifdef LDAP_DEBUG
-#ifndef _WIN32
 #include <stdarg.h>
-#include <stdio.h>
 
 void LDAPDebug( int level, char* fmt, ... )
 {
@@ -151,14 +71,9 @@ void LDAPDebug( int level, char* fmt, ... )
 	}
 }
 #endif
-#endif
 
-#ifndef _WIN32
 
 /* The 16-bit version of the RTL does not implement perror() */
-
-#include <stdio.h>
-
 void perror( const char *msg )
 {
 	char buf[128];
@@ -166,4 +81,3 @@ void perror( const char *msg )
 	OutputDebugString( buf );
 }
 
-#endif
diff --git a/ldap/servers/plugins/presence/dllmain.c b/ldap/servers/plugins/presence/dllmain.c
index 1fb17e4..21b45cc 100644
--- a/ldap/servers/plugins/presence/dllmain.c
+++ b/ldap/servers/plugins/presence/dllmain.c
@@ -47,87 +47,9 @@
 #include "lber.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/presence/presence.c b/ldap/servers/plugins/presence/presence.c
index 5e47841..b105afe 100644
--- a/ldap/servers/plugins/presence/presence.c
+++ b/ldap/servers/plugins/presence/presence.c
@@ -54,13 +54,9 @@
 #include "vattr_spi.h"
 #include "plhash.h"
 #include "ldif.h"
-
 #include "http_client.h"
-
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
+
 
 /*** from proto-slap.h ***/
 
@@ -81,13 +77,8 @@ extern "C" {
 #define LDAP_DEBUG_PLUGIN	0x10000		/* 65536 */
 
 /* debugging stuff */
-#    ifdef _WIN32
-       extern int	*module_ldap_debug;
-#      define LDAPDebugLevelIsSet( level )	( *module_ldap_debug & level )
-#    else /* _WIN32 */
-       extern int	slapd_ldap_debug;
-#      define LDAPDebugLevelIsSet( level )	( slapd_ldap_debug & level )
-#    endif /* Win32 */
+extern int slapd_ldap_debug;
+#define LDAPDebugLevelIsSet( level )	( slapd_ldap_debug & level )
 
 #define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
        { \
@@ -245,18 +236,6 @@ PRIntn printIdVattrMapTable(PLHashEntry *he, PRIntn i, void *arg);
 PRIntn printIdConfigMapTable(PLHashEntry *he, PRIntn i, void *arg);
 
 /**
- * set the debug level
- */
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
-
-/**
  *	
  * Get the presence plug-in version
  *
diff --git a/ldap/servers/plugins/pwdstorage/crypt_pwd.c b/ldap/servers/plugins/pwdstorage/crypt_pwd.c
index 666fd4b..cdf3831 100644
--- a/ldap/servers/plugins/pwdstorage/crypt_pwd.c
+++ b/ldap/servers/plugins/pwdstorage/crypt_pwd.c
@@ -48,9 +48,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifdef _WIN32
-char *crypt(char *key, char *salt);
-#else
 #include <sys/socket.h>
 #if defined( hpux ) || defined ( AIX ) || defined (LINUX) || defined (OSF1)
 #ifndef __USE_XOPEN
@@ -60,7 +57,6 @@ char *crypt(char *key, char *salt);
 #else /* hpux */
 #include <crypt.h>
 #endif /* hpux */
-#endif /* _WIN32 */
 
 #include "pwdstorage.h"
 
diff --git a/ldap/servers/plugins/pwdstorage/dllmain.c b/ldap/servers/plugins/pwdstorage/dllmain.c
index 7c9faa1..892c41f 100644
--- a/ldap/servers/plugins/pwdstorage/dllmain.c
+++ b/ldap/servers/plugins/pwdstorage/dllmain.c
@@ -47,82 +47,9 @@
 #include "ldap.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   /* successful DLL_PROCESS_ATTACH */
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/pwdstorage/pwd_init.c b/ldap/servers/plugins/pwdstorage/pwd_init.c
index 23b7417..4678f31 100644
--- a/ldap/servers/plugins/pwdstorage/pwd_init.c
+++ b/ldap/servers/plugins/pwdstorage/pwd_init.c
@@ -63,9 +63,7 @@ static Slapi_PluginDesc sha512_pdesc = { "sha512-password-storage-scheme", VENDO
 
 static Slapi_PluginDesc ssha512_pdesc = { "ssha512-password-storage-scheme", VENDOR, DS_PACKAGE_VERSION, "Salted Secure Hashing Algorithm (SSHA512)" };
 
-#ifndef _WIN32
 static Slapi_PluginDesc crypt_pdesc = { "crypt-password-storage-scheme", VENDOR, DS_PACKAGE_VERSION, "Unix crypt algorithm (CRYPT)" };
-#endif
 
 static Slapi_PluginDesc clear_pdesc = { "clear-password-storage-scheme", VENDOR, DS_PACKAGE_VERSION, "No encryption (CLEAR)" };
 
diff --git a/ldap/servers/plugins/pwdstorage/pwdstorage.h b/ldap/servers/plugins/pwdstorage/pwdstorage.h
index f215ba2..b8548df 100644
--- a/ldap/servers/plugins/pwdstorage/pwdstorage.h
+++ b/ldap/servers/plugins/pwdstorage/pwdstorage.h
@@ -101,11 +101,9 @@ char * sha512_pw_enc( const char *pwd );
 char * salted_sha512_pw_enc( const char *pwd );
 int clear_pw_cmp( const char *userpwd, const char *dbpwd );
 char *clear_pw_enc( const char *pwd );
-#ifndef _WIN32
 void crypt_init();
 int crypt_pw_cmp( const char *userpwd, const char *dbpwd );
 char *crypt_pw_enc( const char *pwd );
-#endif
 int ns_mta_md5_pw_cmp( const char *userpwd, const char *dbpwd );
 int md5_pw_cmp( const char *userpwd, const char *dbpwd );
 char *md5_pw_enc( const char *pwd );
diff --git a/ldap/servers/plugins/referint/dllmain.c b/ldap/servers/plugins/referint/dllmain.c
index ca2ab1c..4474511 100644
--- a/ldap/servers/plugins/referint/dllmain.c
+++ b/ldap/servers/plugins/referint/dllmain.c
@@ -46,83 +46,6 @@
 #include "ldap.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c
index 66bb95e..c3b6e9c 100644
--- a/ldap/servers/plugins/referint/referint.c
+++ b/ldap/servers/plugins/referint/referint.c
@@ -45,25 +45,14 @@
 #include "portable.h"
 #include "slapi-plugin.h"
 #include "slap.h"
-
-/* include NSPR header files */
 #include "prthread.h"
 #include "prlock.h"
 #include "prerror.h"
 #include "prcvar.h"
 #include "prio.h"
-
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
 
-#ifdef _WIN32
-#define REFERINT_DEFAULT_FILE_MODE	0
-#else
 #define REFERINT_DEFAULT_FILE_MODE S_IRUSR | S_IWUSR
-#endif
-
 #define REFERINT_PLUGIN_SUBSYSTEM   "referint-plugin"   /* used for logging */
 #define REFERINT_PREOP_DESC "referint preop plugin"
 #define REFERINT_ATTR_DELAY "referint-update-delay"
@@ -129,14 +118,6 @@ static void* referint_plugin_identity = NULL;
 static int use_txn = 0;
 static int premodfn = SLAPI_PLUGIN_PRE_MODIFY_FN;
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
 
 static void
 referint_lock()
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 2d9a0bd..81c0408 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -174,13 +174,8 @@
 #define DEFAULT_THREAD_STACKSIZE 	0
 #endif
 
-#ifdef _WIN32
-#define FILE_CREATE_MODE S_IREAD | S_IWRITE
-#define DIR_CREATE_MODE  0755
-#else /* _WIN32 */
 #define FILE_CREATE_MODE S_IRUSR | S_IWUSR
 #define DIR_CREATE_MODE  0755
-#endif
 
 #define NO_DISK_SPACE 1024
 #define MIN_DISK_SPACE 10485760    /* 10 MB */
diff --git a/ldap/servers/plugins/replication/cl5_config.c b/ldap/servers/plugins/replication/cl5_config.c
index f4da738..b81fe24 100644
--- a/ldap/servers/plugins/replication/cl5_config.c
+++ b/ldap/servers/plugins/replication/cl5_config.c
@@ -507,11 +507,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
 			goto done;
 		}
 
-#ifdef _WIN32
-		if (strcasecmp (currentDir, config.dir) != 0)
-#else /* On Unix, path are case sensitive */
 		if (strcmp (currentDir, config.dir) != 0)
-#endif
 		{
 			if (!cl5DbDirIsEmpty(config.dir))
 			{
@@ -918,9 +914,6 @@ static int _is_absolutepath (char * dir)
 {
 	if (dir[0] == '/')
 		return 1;
-#if defined(_WIN32)
-	if (dir[2] == '/' && dir[1] == ':') 
-		return 1;
-#endif
+
 	return 0;
 }
diff --git a/ldap/servers/plugins/replication/repl.h b/ldap/servers/plugins/replication/repl.h
index 802e69c..3342d17 100644
--- a/ldap/servers/plugins/replication/repl.h
+++ b/ldap/servers/plugins/replication/repl.h
@@ -64,9 +64,7 @@
 #include <time.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef _WIN32
 #include <sys/param.h>
-#endif /* _WIN32 */
 
 #include "portable.h" /* GGOODREPL - is this cheating? */
 #include "ldaplog.h"
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 8381c97..60cb9a7 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -51,10 +51,7 @@
 #include <time.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef _WIN32
 #include <sys/param.h>
-#endif /* _WIN32 */
-
 #include "portable.h" /* GGOODREPL - is this cheating? */
 #include "repl_shared.h"
 #include "llist.h"
@@ -191,7 +188,7 @@ extern const char *type_winSyncWindowsFilter;
 extern const char *type_winSyncDirectoryFilter;
 extern const char *type_winSyncSubtreePair;
 
-/* To Allow Consumer Initialisation when adding an agreement - */
+/* To Allow Consumer Initialization when adding an agreement - */
 extern const char *type_nsds5BeginReplicaRefresh;
 
 /* For tuning replica release */
diff --git a/ldap/servers/plugins/replication/repl_init.c b/ldap/servers/plugins/replication/repl_init.c
index 7a7c32c..7e3d4ca 100644
--- a/ldap/servers/plugins/replication/repl_init.c
+++ b/ldap/servers/plugins/replication/repl_init.c
@@ -71,14 +71,6 @@ NOTE: This plugin depends on the Multi-Master Replication Plugin
 #include "repl_shared.h"
 #include "cl4.h"	/* changelog interface */
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
 
 /* ----------------------------- Legacy Replication Plugin */
 
diff --git a/ldap/servers/plugins/replication/replutil.c b/ldap/servers/plugins/replication/replutil.c
index 9b94308..e861f33 100644
--- a/ldap/servers/plugins/replication/replutil.c
+++ b/ldap/servers/plugins/replication/replutil.c
@@ -184,9 +184,6 @@ entry_print( Slapi_Entry *e )
 
 int copyfile(char* source, char * destination, int overwrite, int mode) 
 {
-#if defined _WIN32
-	return (0 == CopyFile(source,destination,overwrite ? FALSE : TRUE));
-#else
 #ifdef DB_USE_64LFS
 #define OPEN_FUNCTION dblayer_open_large
 #else
@@ -252,7 +249,6 @@ error:
 	}
 	slapi_ch_free_string(&buffer);
 	return return_value;
-#endif
 }
 
 /* convert time from string like 1h (1 hour) to corresponding time in seconds */
diff --git a/ldap/servers/plugins/retrocl/dllmain.c b/ldap/servers/plugins/retrocl/dllmain.c
index 1a089b2..c460cd5 100644
--- a/ldap/servers/plugins/retrocl/dllmain.c
+++ b/ldap/servers/plugins/retrocl/dllmain.c
@@ -46,82 +46,10 @@
 #include "ldap.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   /* successful DLL_PROCESS_ATTACH */
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
+
diff --git a/ldap/servers/plugins/retrocl/retrocl.c b/ldap/servers/plugins/retrocl/retrocl.c
index 8a0f350..1d9866e 100644
--- a/ldap/servers/plugins/retrocl/retrocl.c
+++ b/ldap/servers/plugins/retrocl/retrocl.c
@@ -64,14 +64,6 @@ nsslapd-plugindescription: Retrocl Plugin
 
 #include "retrocl.h"
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-    module_ldap_debug = level_ptr;
-}
-#endif
 
 void* g_plg_identity [PLUGIN_MAX];
 Slapi_Backend *retrocl_be_changelog = NULL;
diff --git a/ldap/servers/plugins/rever/dllmain.c b/ldap/servers/plugins/rever/dllmain.c
index 50afe62..f107648 100644
--- a/ldap/servers/plugins/rever/dllmain.c
+++ b/ldap/servers/plugins/rever/dllmain.c
@@ -47,82 +47,9 @@
 #include "rever.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   /* successful DLL_PROCESS_ATTACH */
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/roles/dllmain.c b/ldap/servers/plugins/roles/dllmain.c
index 1fb17e4..de55d26 100644
--- a/ldap/servers/plugins/roles/dllmain.c
+++ b/ldap/servers/plugins/roles/dllmain.c
@@ -46,88 +46,9 @@
 #include "ldap.h"
 #include "lber.h"
 
-
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/roles/roles_plugin.c b/ldap/servers/plugins/roles/roles_plugin.c
index 80794df..5e3f1a5 100644
--- a/ldap/servers/plugins/roles/roles_plugin.c
+++ b/ldap/servers/plugins/roles/roles_plugin.c
@@ -63,14 +63,6 @@ static void * roles_plugin_identity = NULL;
 static Slapi_PluginDesc pdesc = { "roles",
 		VENDOR, DS_PACKAGE_VERSION, "roles plugin" };
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
 
 static int roles_start( Slapi_PBlock *pb );
 static int roles_post_op( Slapi_PBlock *pb );
diff --git a/ldap/servers/plugins/statechange/dllmain.c b/ldap/servers/plugins/statechange/dllmain.c
index 1fb17e4..d23057a 100644
--- a/ldap/servers/plugins/statechange/dllmain.c
+++ b/ldap/servers/plugins/statechange/dllmain.c
@@ -47,87 +47,10 @@
 #include "lber.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
+
diff --git a/ldap/servers/plugins/statechange/statechange.c b/ldap/servers/plugins/statechange/statechange.c
index ad2cc0a..ec30f40 100644
--- a/ldap/servers/plugins/statechange/statechange.c
+++ b/ldap/servers/plugins/statechange/statechange.c
@@ -47,11 +47,8 @@
 #include "portable.h"
 #include "slapi-plugin.h"
 #include "statechange.h"
-
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
+
 
 /* the circular list of systems to notify */
 typedef struct _statechange_notify
@@ -100,16 +97,6 @@ static Slapi_PluginDesc pdesc = { "statechange", VENDOR, DS_PACKAGE_VERSION,
 	"state change notification service plugin" };
 
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
-
-
 /* 
 	statechange_init
 	--------
diff --git a/ldap/servers/plugins/syntaxes/debug.c b/ldap/servers/plugins/syntaxes/debug.c
index c887875..51f02c6 100644
--- a/ldap/servers/plugins/syntaxes/debug.c
+++ b/ldap/servers/plugins/syntaxes/debug.c
@@ -47,11 +47,3 @@
 #include <sys/types.h>
 #include "syntax.h"
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
diff --git a/ldap/servers/plugins/syntaxes/dllmain.c b/ldap/servers/plugins/syntaxes/dllmain.c
index d1555c3..0dd3ff0 100644
--- a/ldap/servers/plugins/syntaxes/dllmain.c
+++ b/ldap/servers/plugins/syntaxes/dllmain.c
@@ -45,97 +45,18 @@
  */
 #include "ldap.h"
 #include "syntax.h"
+#include <stdio.h>
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
 
 #ifdef LDAP_DEBUG
-#ifndef _WIN32
 #include <stdarg.h>
-#include <stdio.h>
 
 void LDAPDebug( int level, char* fmt, ... )
 {
@@ -153,13 +74,7 @@ void LDAPDebug( int level, char* fmt, ... )
 	}
 }
 #endif
-#endif
-
-#ifndef _WIN32
-
-/* The 16-bit version of the RTL does not implement perror() */
 
-#include <stdio.h>
 
 void perror( const char *msg )
 {
@@ -167,5 +82,3 @@ void perror( const char *msg )
 	wsprintf( buf, "%s: error %d\n", msg, WSAGetLastError()) ;
 	OutputDebugString( buf );
 }
-
-#endif
diff --git a/ldap/servers/plugins/uiduniq/7bit.c b/ldap/servers/plugins/uiduniq/7bit.c
index a96951e..c326b9a 100644
--- a/ldap/servers/plugins/uiduniq/7bit.c
+++ b/ldap/servers/plugins/uiduniq/7bit.c
@@ -53,12 +53,6 @@
 #include <string.h>
 
 /* DBDB this should be pulled from a common header file */
-#ifdef _WIN32
-#ifndef strcasecmp
-#define strcasecmp(x,y) strcmpi(x,y)
-#endif
-#endif
-
 #if defined( LDAP_DEBUG ) && !defined( DEBUG )
 #define DEBUG
 #endif
diff --git a/ldap/servers/plugins/vattrsp_template/dllmain.c b/ldap/servers/plugins/vattrsp_template/dllmain.c
index 1fb17e4..21b45cc 100644
--- a/ldap/servers/plugins/vattrsp_template/dllmain.c
+++ b/ldap/servers/plugins/vattrsp_template/dllmain.c
@@ -47,87 +47,9 @@
 #include "lber.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/vattrsp_template/vattrsp.c b/ldap/servers/plugins/vattrsp_template/vattrsp.c
index c815761..6e14269 100644
--- a/ldap/servers/plugins/vattrsp_template/vattrsp.c
+++ b/ldap/servers/plugins/vattrsp_template/vattrsp.c
@@ -51,10 +51,7 @@
 /* the global plugin handle */
 static volatile vattr_sp_handle *vattr_handle = NULL;
 
-/* get file mode flags for unix */
-#ifndef _WIN32
 #include <sys/stat.h>
-#endif
 
 
 #define VATTRSP_PLUGIN_SUBSYSTEM   "vattrsp-template-plugin"   /* used for logging */
diff --git a/ldap/servers/plugins/views/dllmain.c b/ldap/servers/plugins/views/dllmain.c
index 1fb17e4..21b45cc 100644
--- a/ldap/servers/plugins/views/dllmain.c
+++ b/ldap/servers/plugins/views/dllmain.c
@@ -47,87 +47,9 @@
 #include "lber.h"
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
diff --git a/ldap/servers/plugins/views/views.c b/ldap/servers/plugins/views/views.c
index 282acfd..08d623a 100644
--- a/ldap/servers/plugins/views/views.c
+++ b/ldap/servers/plugins/views/views.c
@@ -48,21 +48,14 @@
 #include "slapi-plugin.h"
 #include "statechange.h"
 #include "views.h"
-
+#include <sys/stat.h>
 #include "slapi-plugin-compat4.h"
 #include "slapi-private.h"
 
-
 #define VIEW_OBJECTCLASS "nsView"
 #define VIEW_FILTER_ATTR	"nsViewFilter"
 #define STATECHANGE_VIEWS_ID "Views"
 #define STATECHANGE_VIEWS_CONFG_FILTER "objectclass=" VIEW_OBJECTCLASS
-
-/* get file mode flags for unix */
-#ifndef _WIN32
-#include <sys/stat.h>
-#endif
-
 #define VIEWS_PLUGIN_SUBSYSTEM   "views-plugin"   /* used for logging */
 
 /* cache data structs */
@@ -162,14 +155,6 @@ static void * view_plugin_identity = NULL;
 
 static Slapi_RWLock *g_views_cache_lock;
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
 
 /*
 ** Plugin identity mgmt
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
index 9797f7c..0a88a3b 100644
--- a/ldap/servers/slapd/abandon.c
+++ b/ldap/servers/slapd/abandon.c
@@ -56,9 +56,7 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 
 void
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 12b97e8..b38dbd5 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -63,9 +63,7 @@
 #include <string.h>
 #include <time.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "pratom.h"
 #include "csngen.h"
@@ -879,15 +877,7 @@ add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
 	slapi_entry_attr_replace(e, "modifiersname", bvals);
 
 	curtime = current_time();
-#ifdef _WIN32
-{
-	struct tm *pt;
-	pt = gmtime(&curtime);
-	memcpy(&ltm, pt, sizeof(struct tm));
-}
-#else
 	gmtime_r(&curtime, &ltm);
-#endif
 	strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", &ltm);
 
 	bv.bv_val = buf;
diff --git a/ldap/servers/slapd/agtmmap.c b/ldap/servers/slapd/agtmmap.c
index 7f65b35..7d38a5e 100644
--- a/ldap/servers/slapd/agtmmap.c
+++ b/ldap/servers/slapd/agtmmap.c
@@ -53,29 +53,15 @@
  
 
 #include "agtmmap.h"
-#ifndef  _WIN32
 #include <sys/mman.h>
 #include <unistd.h>
-#else
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <time.h>
-#include "nt/regparms.h"
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 
-#ifndef  _WIN32
 agt_mmap_context_t 	mmap_tbl [2] = { {AGT_MAP_UNINIT, -1, (caddr_t) -1}, 
 	 				 {AGT_MAP_UNINIT, -1, (caddr_t) -1} };
-#else
-agt_mmap_context_t 	mmap_tbl[2] = { {AGT_MAP_UNINIT, NULL, (caddr_t) -1, NULL}, 
-					 {AGT_MAP_UNINIT, NULL, (caddr_t) -1, NULL} };
-#endif /* ! _WIN32 */
-
 
 /****************************************************************************
  *
@@ -99,16 +85,14 @@ agt_mmap_context_t 	mmap_tbl[2] = { {AGT_MAP_UNINIT, NULL, (caddr_t) -1, NULL},
 int 
 agt_mopen_stats (char * statsfile, int mode, int *hdl)
 {
-	caddr_t 	fp;
-	char 		*path;
-	int		rc = 0;
-#ifndef  _WIN32
-	int 		fd;
-        char            *buf;
-	int 		err;
-	size_t		sz;
-	struct stat     fileinfo;
-#endif /*  _WIN32 */
+	caddr_t fp;
+	char *path;
+	char *buf;
+	int rc = 0;
+	int fd;
+	int err;
+	size_t sz;
+	struct stat fileinfo;
 
 	switch (mode)
 	{
@@ -142,8 +126,6 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
 	else
 	     path = AGT_STATS_FILE;
 
-
-#ifndef  _WIN32
 	switch (mode)
 	{
 	     case O_RDONLY:
@@ -232,105 +214,6 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
                rc = 0;
            break;
 	} /* end switch */
-#else
-	/* _WIN32 */
-	switch (mode) {
-		case O_RDONLY:
-		{
-			HANDLE	hFile = NULL;
-			HANDLE	hMapFile = NULL;
-		
-			/* Open existing disk file for read */
-			hFile = CreateFile(path, 
-						GENERIC_READ | GENERIC_WRITE,
-						FILE_SHARE_READ | FILE_SHARE_WRITE, 
-						NULL, 
-						OPEN_EXISTING,
-						FILE_ATTRIBUTE_NORMAL, 
-						NULL);
-			if ( hFile == INVALID_HANDLE_VALUE || hFile == NULL ) return GetLastError();
-
-			/* Create mapped file handle for reading */
-			hMapFile = CreateFileMapping( hFile, NULL, PAGE_READONLY, 0,
-						sizeof(struct agt_stats_t),
-						NULL);
-			if ( hMapFile == NULL ) {
-				CloseHandle( hFile );
-				rc = GetLastError();
-				goto bail;
-			}
-
-				/* Create addr ptr to the start of the file */
-			fp = (caddr_t) MapViewOfFileEx( hMapFile, FILE_MAP_READ, 0, 0,
-					sizeof(struct agt_stats_t), NULL );
-			if ( fp == NULL ) {
-				CloseHandle( hMapFile );
-				CloseHandle( hFile );
-				rc = GetLastError();
-				goto bail;
-			}
-
-			/* Fill in info on this opaque handle */
-			mmap_tbl[0].maptype = AGT_MAP_READ;
-			mmap_tbl[0].fd = hFile;
-			mmap_tbl[0].fp = fp;
-			mmap_tbl[0].mfh = hMapFile;
-			*hdl = 0;
-
-			rc = 0;
-			break;
-		}
-		
-		case O_RDWR:
-		{
-		
-			HANDLE	hFile = NULL;
-			HANDLE	hMapFile = NULL;
-		
-			hFile = CreateFile( path, 
-						GENERIC_WRITE | GENERIC_READ,
-						FILE_SHARE_READ | FILE_SHARE_WRITE, 
-						NULL, 
-						OPEN_ALWAYS,
-						FILE_ATTRIBUTE_NORMAL, 
-						NULL );
-			if ( hFile == INVALID_HANDLE_VALUE || hFile == NULL ) return GetLastError();
-
-			/* Create mapped file handle for reading */
-			hMapFile = CreateFileMapping( hFile, NULL, PAGE_READWRITE, 0,
-						sizeof(struct agt_stats_t),
-						NULL );
-			if ( hMapFile == NULL ) {
-				CloseHandle( hFile );
-				rc = GetLastError();
-				goto bail;
-			}
-
-				/* Create addr ptr to the start of the file */
-			fp = (caddr_t) MapViewOfFileEx( hMapFile, FILE_MAP_ALL_ACCESS, 0, 0,
-					sizeof(struct agt_stats_t), NULL );
-			if ( fp == NULL ) {
-				CloseHandle( hMapFile );
-				CloseHandle( hFile );
-				rc = GetLastError();
-				goto bail;
-			}
-
-			mmap_tbl[1].maptype = AGT_MAP_RDWR;
-			mmap_tbl[1].fd = hFile;
-			mmap_tbl[1].fp = fp;
-			mmap_tbl[1].mfh = hMapFile;
-			*hdl = 1;
-
-			rc = 0;
-			break;
-
-		}
-		
-
-	}
-
-#endif /* !__WINNT__ */
 
 bail:
     return rc;
@@ -366,22 +249,10 @@ agt_mclose_stats (int hdl)
 
 	if (mmap_tbl [hdl].fp > (caddr_t) 0)
 	{
-#ifndef  _WIN32
 		munmap (mmap_tbl [hdl].fp, sizeof (struct agt_stats_t));
 		mmap_tbl [hdl].fp = (caddr_t) -1;
 		close (mmap_tbl [hdl].fd);
 		mmap_tbl [hdl].fd = -1;
-#else
-		BOOL	bUnmapped;
-
-		bUnmapped = UnmapViewOfFile( mmap_tbl[hdl].fp );
-		if ( mmap_tbl[hdl].mfh ) CloseHandle( mmap_tbl[hdl].mfh );
-		if ( mmap_tbl[hdl].fd ) CloseHandle( mmap_tbl[hdl].fd );
-
-		mmap_tbl[hdl].fp = (caddr_t) -1;
-		mmap_tbl[hdl].mfh = NULL;
-		mmap_tbl[hdl].fd = NULL;
-#endif /* ! _WIN32 */
 		mmap_tbl [hdl].maptype = AGT_MAP_UNINIT;
 		return (0);
 	}
diff --git a/ldap/servers/slapd/agtmmap.h b/ldap/servers/slapd/agtmmap.h
index b7a5d5e..0a9bff9 100644
--- a/ldap/servers/slapd/agtmmap.h
+++ b/ldap/servers/slapd/agtmmap.h
@@ -59,10 +59,6 @@
 #include <fcntl.h>
 #include <errno.h>
 #include "nspr.h"
-#ifdef  _WIN32
-#include <windows.h> 
-#define caddr_t PCHAR
-#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -72,9 +68,7 @@ extern "C" {
 #define NUM_SNMP_INT_TBL_ROWS 5
 #define SNMP_FIELD_LENGTH 100
 
-#ifndef  _WIN32
 extern int			errno;
-#endif
 
 #if !defined(_MAX_PATH)
 #define _MAX_PATH 256
@@ -87,22 +81,12 @@ extern int			errno;
 
 typedef enum { AGT_MAP_UNINIT = 0, AGT_MAP_READ, AGT_MAP_RDWR } agt_mmap_type;
 
-#ifndef  _WIN32
 typedef struct
 {
         agt_mmap_type   maptype;
         int             fd;
         caddr_t         fp;
 }  agt_mmap_context_t;
-#else
-typedef struct
-{
-        agt_mmap_type   maptype;
-        HANDLE          fd;
-        caddr_t         fp;
-		HANDLE			mfh;
-}  agt_mmap_context_t;
-#endif /* ! _WIN32 */
 
 struct hdr_stats_t{
     /*
diff --git a/ldap/servers/slapd/attr.c b/ldap/servers/slapd/attr.c
index f19e7e6..8a2d6b1 100644
--- a/ldap/servers/slapd/attr.c
+++ b/ldap/servers/slapd/attr.c
@@ -47,12 +47,10 @@
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifndef _WIN32
 #include <sys/time.h>
 #include <sys/param.h>
 #include <fcntl.h>
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #undef DEBUG                    /* disable counters */
 #include <prcountr.h>
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index ae4af50..965a1c5 100644
--- a/ldap/servers/slapd/auth.c
+++ b/ldap/servers/slapd/auth.c
@@ -45,9 +45,7 @@
 #include <ldaputil/ldaputil.h> /* LDAPU_SUCCESS, ldapu_VTable_set */
 #include <ldaputil/init.h> /* ldaputil_init */
 #include <ldaputil/certmap.h> /* ldapu_cert_to_ldap_entry */
-#ifndef _WIN32
 #include <sys/param.h>	/* MAXPATHLEN */
-#endif
 #include "slap.h" /* slapi_ch_malloc */
 #include "fe.h"
 
diff --git a/ldap/servers/slapd/ava.c b/ldap/servers/slapd/ava.c
index e97e9e7..70d59d7 100644
--- a/ldap/servers/slapd/ava.c
+++ b/ldap/servers/slapd/ava.c
@@ -45,9 +45,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 
 int
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index b3badbc..074aa4c 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -84,30 +84,16 @@
 #include "prio.h"  /* for PR_OpenDir etc */
 #include "prlog.h" /* for PR_ASSERT */
 /* The following cruft is for ldif2db only */
-#ifndef XP_WIN32
 #include <unistd.h>	/* write/close (ldbm2ldif_write) */
-#else
-#include <io.h>	/* write/close (ldbm2ldif_write) */
-#endif
 #include <fcntl.h>
 #include <time.h>
 /* And this cruft is from nextid.c */
-#ifndef _WIN32
 #include <sys/param.h>
-#endif /* ! _WIN32 */
 #include <limits.h> /* Used in search.c (why?) */
 
-
-
-#ifndef _WIN32
 /* for MAXPATHLEN */
 #include <sys/param.h>
 #define MKDIR(path,mode) mkdir((path),(mode))
-#else
-/* for mkdir */
-#include <direct.h>
-#define MKDIR(path,mode) mkdir(path)
-#endif
 
 #ifdef HPUX11
 #define	__BIT_TYPES_DEFINED__
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index ac315bb..41646b2 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -95,11 +95,9 @@
 #include "dblayer.h"
 #include <prthread.h>
 #include <prclist.h>
-#ifndef XP_WIN32
 #include <sys/types.h>
 #include <sys/statvfs.h>
 #include <sys/resource.h>
-#endif
 
 #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100
 #define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval)    \
@@ -793,20 +791,6 @@ static void dblayer_select_ncache(size_t cachesize, int *ncachep)
 			*ncachep, 0, 0);
 	}
 #endif
-	/* On Windows, we know that it's hard to allocate more than some 
-	 * maximum chunk. In that case
-	 * we set ncache to a sensible value.
-	 */
-#if defined(_WIN32)
-	{
-		size_t max_windows_chunk = (300 * MEGABYTE); /* This number was determined empirically on Win2k */
-		if (cachesize > max_windows_chunk) {
-			*ncachep = (cachesize / max_windows_chunk) + 1;
-			LDAPDebug(LDAP_DEBUG_ANY,"Setting ncache to: %d for Windows memory address space fragmentation\n",
-                *ncachep, 0, 0);
-		}
-	}
-#endif
 }
 
 /* This function is no longer called : 
@@ -935,7 +919,6 @@ static void dblayer_init_dbenv(DB_ENV *pEnv, dblayer_private *priv)
 #include <sys/pstat.h>
 #endif
 
-#if !defined(_WIN32)
 static size_t dblayer_getvirtualmemsize()
 {
     struct rlimit rl;
@@ -944,7 +927,6 @@ static size_t dblayer_getvirtualmemsize()
     getrlimit(RLIMIT_AS, &rl);
     return rl.rlim_cur;
 }
-#endif
 
 /* pages = number of pages of physical ram on the machine (corrected for 32-bit build on 64-bit machine).
  * procpages = pages currently used by this process (or working set size, sometimes)
@@ -956,26 +938,6 @@ void dblayer_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size_
     if (procpages)
         *procpages = 0;
 
-#ifdef _WIN32
-    {
-        SYSTEM_INFO si;
-        MEMORYSTATUS ms;
-
-        GetSystemInfo(&si);
-        ms.dwLength = sizeof(ms);
-        GlobalMemoryStatus(&ms);
-        *pagesize = si.dwPageSize;
-        *pages = ms.dwTotalPhys  / si.dwPageSize;
-        *availpages = ms.dwAvailVirtual / *pagesize;
-        if (procpages) {
-            DWORD minwss = 0, maxwss = 0;
-
-            GetProcessWorkingSetSize(GetCurrentProcess(), &minwss, &maxwss);
-            *procpages = (int)(maxwss / si.dwPageSize);
-        }
-    }
-#endif
-
 #ifdef OS_solaris
     *pagesize = (int)sysconf(_SC_PAGESIZE);
     *pages = (int)sysconf(_SC_PHYS_PAGES);
@@ -5859,9 +5821,6 @@ static int count_dbfiles_in_dir(char *directory, int *count, int recurse)
 int
 dblayer_copyfile(char *source, char *destination, int overwrite, int mode) 
 {
-#if defined _WIN32
-    return (0 == CopyFile(source,destination,overwrite ? FALSE : TRUE));
-#else
 #ifdef DB_USE_64LFS
 #define OPEN_FUNCTION dblayer_open_large
 #else
@@ -5935,7 +5894,6 @@ error:
     }
     slapi_ch_free((void**)&buffer);
     return return_value;
-#endif
 }
 
 /*
diff --git a/ldap/servers/slapd/back-ldbm/dllmain.c b/ldap/servers/slapd/back-ldbm/dllmain.c
index 056ccc3..b0e49dc 100644
--- a/ldap/servers/slapd/back-ldbm/dllmain.c
+++ b/ldap/servers/slapd/back-ldbm/dllmain.c
@@ -44,88 +44,14 @@
  * Microsoft Windows specifics for BACK-LDBM DLL
  */
 #include "back-ldbm.h"
+#include <stdio.h>
 
-
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
 
 #ifdef LDAP_DEBUG
 #ifndef _WIN32
@@ -150,12 +76,7 @@ void LDAPDebug( int level, char* fmt, ... )
 #endif
 #endif
 
-#ifndef _WIN32
-
 /* The 16-bit version of the RTL does not implement perror() */
-
-#include <stdio.h>
-
 void perror( const char *msg )
 {
 	char buf[128];
@@ -163,4 +84,3 @@ void perror( const char *msg )
 	OutputDebugString( buf );
 }
 
-#endif
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 6ad1c48..2100abb 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -52,9 +52,6 @@
 #include "back-ldbm.h"
 #include "vlv_srch.h"
 #include "import.h"
-#ifdef XP_WIN32
-#define STDIN_FILENO 0
-#endif
 
 static void import_wait_for_space_in_fifo(ImportJob *job, size_t new_esize);
 static int import_get_and_add_parent_rdns(ImportWorkerInfo *info, ldbm_instance *inst, DB *db, ID id, ID *total_id, Slapi_RDN *srdn, int *curr_entry);
@@ -347,15 +344,7 @@ import_add_created_attrs(Slapi_Entry *e)
     }
 
     curtime = current_time();
-#ifdef _WIN32
-{
-    struct tm *pt;
-    pt = gmtime(&curtime);
-    memcpy(&ltm, pt, sizeof(struct tm));
-}
-#else
     gmtime_r(&curtime, &ltm);
-#endif
     strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", &ltm);
 
     bv.bv_val = buf;
@@ -476,15 +465,6 @@ import_producer(void *param)
                 fd = STDIN_FILENO;
             } else {
                 int o_flag = O_RDONLY;
-#ifdef XP_WIN32
-                /* 613041 Somehow the windows low level io lose "\n"
-                   at a very particular situation using O_TEXT mode read.
-                   I think it is a windows bug for O_TEXT mode read.
-                   Use O_BINARY instead, which honestly returns chars
-                   without any translation.
-                */
-                o_flag |= O_BINARY;
-#endif
                 fd = dblayer_open_huge_file(curr_filename, o_flag, 0);
             }
             if (fd < 0) {
diff --git a/ldap/servers/slapd/back-ldbm/init.c b/ldap/servers/slapd/back-ldbm/init.c
index 6859b29..8bfadb2 100644
--- a/ldap/servers/slapd/back-ldbm/init.c
+++ b/ldap/servers/slapd/back-ldbm/init.c
@@ -51,16 +51,6 @@ static void *IDL_api[3];
 static Slapi_PluginDesc pdesc = { "ldbm-backend", VENDOR,
         DS_PACKAGE_VERSION, "high-performance LDAP backend database plugin" };
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void 
-plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
-
 /* pb: not used */
 int
 ldbm_back_add_schema( Slapi_PBlock *pb )
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_bind.c b/ldap/servers/slapd/back-ldbm/ldbm_bind.c
index aaa7b26..ec6c7b8 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_bind.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_bind.c
@@ -44,160 +44,6 @@
 
 #include "back-ldbm.h"
 
-#if defined( XP_WIN32 )
-
-typedef enum LDAPWAEnum {
-	LDAPWA_NoDomainAttr = -3,
-	LDAPWA_InvalidCredentials = -2,
-	LDAPWA_Failure = -1,
-	LDAPWA_Success= 0
-} LDAPWAStatus;
-
-int
-GetDomainUsername(
-	char *pszNTuserdomainid,
-	char *pszNTDomain,
-	char *pszNTUsername 
-)
-{
-	char	*pszAttr, *pDomain, *pUsername;
-
-	if( !pszNTuserdomainid )
-		return( 1 );
-
-	// Split the specially constructed attribute.
-	pszAttr = slapi_ch_strdup( pszNTuserdomainid );
-
-	pDomain = pszAttr;
-
-	pUsername = strchr( pszAttr, ':' );
-	if( pUsername == NULL )
-		return( 1 );
-
-	// Set the end of the NT Domain name, 
-	// and the start of the NT username.
-	*pUsername = (char)NULL;
-	pUsername++;
-
-	strcpy( pszNTDomain, pDomain);
-	strcpy( pszNTUsername, pUsername);
-
-	slapi_ch_free( (void**)&pszAttr );
-
-	return( 0 );
-}
-
-/* Attempt Windows NT Authentication, using the password from the client app, 
-   with the NT Domain and NT username, both stored in the entry.  
-   If successful, the ldap_bind() is completed successsfully. */
-
-LDAPWAStatus
-WindowsAuthentication( 
-	struct backentry	*e,
-    struct berval	*cred
-)
-{
-	Slapi_Attr	*a; 
-	Slapi_Value *sval = NULL;
-	int iStatus;
-	char szNTDomain[MAX_PATH], szNTUsername[MAX_PATH];
-	HANDLE	hToken = NULL;
-	BOOL bLogonStatus = FALSE;
-	int i= -1;
- 
-	/* Get the NT Domain and username - if the entry has such an attribute */
-	if( !e || !e->ep_entry ||
-		slapi_entry_attr_find( e->ep_entry, "ntuserdomainid", &a ) != 0)
-	{
-		return( LDAPWA_NoDomainAttr );
-	}
-
-	i= slapi_attr_first_value( a, &sval );
-	if(sval==NULL)
-	{
-		return( LDAPWA_NoDomainAttr );	
-	}
-
-    while(i != -1)
-	{
-		const struct berval *val = slapi_value_get_berval(sval);
-		char * colon = NULL;
-
-		if (!val->bv_val || (strlen(val->bv_val) > (MAX_PATH<<1))) {
-			LDAPDebug( LDAP_DEBUG_TRACE,
-				"WindowsAuthentication => validation FAILED for \"%s\" on NT Domain : "
-				"ntuserdomainid attr value too long\n",
-				val->bv_val, 0, 0);
-			i= slapi_attr_next_value(a, i, &sval);
-			continue;
-		}
-		colon = strchr( val->bv_val, ':' );
-		if (!colon || ((colon - val->bv_val)/sizeof(char) > MAX_PATH)) {
-			if (!colon) {
-				LDAPDebug( LDAP_DEBUG_TRACE,
-					"WindowsAuthentication => validation FAILED for \"%s\" on NT Domain : "
-					"a colon is missing in ntuserdomainid attr value\n",
-					val->bv_val, 0, 0);
-			}
-			else {
-				LDAPDebug( LDAP_DEBUG_TRACE,
-					"WindowsAuthentication => validation FAILED for \"%s\" on NT Domain : "
-					"domain in ntuserdomainid attr value too long\n",
-					val->bv_val, 0, 0);
-			}
-			i= slapi_attr_next_value(a, i, &sval);
-			continue;
-		}
-
-		if(( iStatus = GetDomainUsername( val->bv_val, 
-										  szNTDomain, 
-										  szNTUsername )) != 0) 
-		{
-			i= slapi_attr_next_value(a, i, &sval);
-			continue;
-		}
-
-#if !defined( LOGON32_LOGON_NETWORK )
-/* This is specified in the WIn32 LogonUser() documentation, but not defined
-   in the Visual C++ 4.2 include file winbase.h. A search of the lastest version 
-   of this file at www.microsoft.com finds that LOGON32_LOGON_NETWORK == 3.
- */
-#define LOGON32_LOGON_NETWORK 3
-#endif
-		/* Now do the Logon attempt */	
-		bLogonStatus = LogonUser( szNTUsername, // string that specifies the user name
-								  szNTDomain,   // string that specifies the domain or server
-								  cred->bv_val,	// string that specifies the password
-								  LOGON32_LOGON_NETWORK, //  the type of logon operation, 
-								  LOGON32_PROVIDER_DEFAULT,	 // specifies the logon provider
-							      &hToken ); // pointer to variable to receive token handle 
-		if( bLogonStatus && hToken ) 
-			CloseHandle( hToken );
-		
-		if( bLogonStatus ) 
-		{
-			// Successful validation
-			LDAPDebug( LDAP_DEBUG_TRACE,
-				"WindowsAuthentication => validated \"%s\" on NT Domain \"%s\"\n",
-				szNTUsername, szNTDomain, 0 );
-			return( LDAPWA_Success );
-		}
-		else
-		{
-			LDAPDebug( LDAP_DEBUG_TRACE,
-				"WindowsAuthentication => validation FAILED for \"%s\" on NT Domain \"%s\", reason %d\n",
-				szNTUsername, szNTDomain, GetLastError() );
-			return( LDAPWA_InvalidCredentials );
-		}
-		i= slapi_attr_next_value(a, i, &sval);
-	}
- 
-
-	return( LDAPWA_Failure );	
-
-}
-#endif
-
 int
 ldbm_back_bind( Slapi_PBlock *pb )
 {
@@ -256,11 +102,6 @@ ldbm_back_bind( Slapi_PBlock *pb )
 		{
 		Slapi_Value cv;
 		if ( slapi_entry_attr_find( e->ep_entry, "userpassword", &attr ) != 0 ) {
-#if defined( XP_WIN32 )
-			if( WindowsAuthentication( e, cred ) == LDAPWA_Success ) {
-				break;
-			}
-#endif
 			slapi_send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
 			    NULL, 0, NULL );
 			CACHE_RETURN( &inst->inst_cache, &e );
@@ -270,13 +111,6 @@ ldbm_back_bind( Slapi_PBlock *pb )
 		bvals= attr_get_present_values(attr);
 		slapi_value_init_berval(&cv,cred);
 		if ( slapi_pw_find_sv( bvals, &cv ) != 0 ) {
-#if defined( XP_WIN32 )
-			/* One last try - attempt Windows authentication, 
-			   if the user has a Windows account. */
-			if( WindowsAuthentication( e, cred ) == LDAPWA_Success ) {
-				break;
-			}
-#endif
 			slapi_send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL,
 			    NULL, 0, NULL );
 			CACHE_RETURN( &inst->inst_cache, &e );
diff --git a/ldap/servers/slapd/back-ldbm/monitor.c b/ldap/servers/slapd/back-ldbm/monitor.c
index 469778d..ac2ef4c 100644
--- a/ldap/servers/slapd/back-ldbm/monitor.c
+++ b/ldap/servers/slapd/back-ldbm/monitor.c
@@ -186,10 +186,6 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
     }
 
     for (i = 0;(mpfstat[i] && (mpfstat[i]->file_name != NULL)); i++) {
-#ifdef _WIN32
-        int fpos = 0;
-#endif
-
         /* only print out stats on files used by this instance */
         if (strlen(mpfstat[i]->file_name) < strlen(inst->inst_dir_name))
             continue;
@@ -205,7 +201,6 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
 	slapi_ch_free_string(&absolute_pathname);
 	absolute_pathname = slapi_ch_smprintf("%s%c%s" , inst->inst_parent_dir_name, get_sep(inst->inst_parent_dir_name), mpfstat[i]->file_name );
 
-/* NPCTE fix for bugid 544365, esc 0. <P.R> <04-Jul-2001> */
 	/* Hide statistic of deleted files (mainly indexes) */
 	if (stat(absolute_pathname,&astat))
 	    continue;
@@ -219,25 +214,10 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
 			break;
 	if (j<i)
 		continue;
-/* end of NPCTE fix for bugid 544365 */
 
         /* Get each file's stats */
         PR_snprintf(buf, sizeof(buf), "%s", mpfstat[i]->file_name);
-#ifdef _WIN32
-        /* 
-         * For NT, switch the last
-         * backslash to a foward
-         * slash. - RJP
-         */
-        for (fpos = strlen(buf); fpos >= 0; fpos--) {
-            if (buf[fpos] == '\\') {
-                buf[fpos] = '/';
-                break;
-            }
-        }
-#endif
         MSETF("dbFilename-%d", i);
-        
         sprintf(buf, "%lu", (unsigned long)mpfstat[i]->st_cache_hit);
         MSETF("dbFileCacheHit-%d", i);
         sprintf(buf, "%lu", (unsigned long)mpfstat[i]->st_cache_miss);
@@ -247,7 +227,7 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
         sprintf(buf, "%lu", (unsigned long)mpfstat[i]->st_page_out);
         MSETF("dbFilePageOut-%d", i);
 
-	slapi_ch_free_string(&absolute_pathname);
+        slapi_ch_free_string(&absolute_pathname);
     }
 
     slapi_ch_free_string(&absolute_pathname);
diff --git a/ldap/servers/slapd/back-ldbm/perfctrs.c b/ldap/servers/slapd/back-ldbm/perfctrs.c
index a1957db..3b43f0e 100644
--- a/ldap/servers/slapd/back-ldbm/perfctrs.c
+++ b/ldap/servers/slapd/back-ldbm/perfctrs.c
@@ -80,142 +80,21 @@ static void perfctrs_update(perfctrs_private *priv, DB_ENV *db_env);
 static void perfctr_add_to_entry( Slapi_Entry *e, char *type,
 	PRUint32 countervalue );
 
-/*
- * Win32 specific code (to support the Windows NT/2000 Performance Monitor).
- */
-#if defined(_WIN32)
-static 
-char * string_concatenate(char *a, char* b)
-{
-	size_t string_length = 0;
-	char *string = NULL;
-
-	string_length = strlen(a) + strlen(b) + 1;
-	string = slapi_ch_malloc(string_length);
-
-	sprintf(string,"%s%s",a,b);
-	return string;
-}
-
-static void init_shared_memory(perfctrs_private *priv)
-{
-	performance_counters *perf = (performance_counters*)priv->memory;
-	if (NULL != perf) {
-		memset(perf,0,sizeof(performance_counters));
-	}
-}
-
-static int open_event(char *name, perfctrs_private *priv)
-{
-	HANDLE hEvent = INVALID_HANDLE_VALUE;
-
-	hEvent = OpenEvent(EVENT_ALL_ACCESS,FALSE,name);
-	if (NULL == hEvent) {
-		hEvent = CreateEvent(NULL,FALSE,FALSE,name);
-		if (NULL == hEvent) {
-			LDAPDebug(LDAP_DEBUG_ANY,"BAD EV 1, err=%d\n",GetLastError(),0,0);
-			return -1;
-		}
-	}
-	priv->hEvent = hEvent;
-	return 0;
-}
-
-static int open_shared_memory(char *name, perfctrs_private *priv)
-{
-	HANDLE hMapping = INVALID_HANDLE_VALUE;
-	void *pMemory = NULL;
-	/* We fear a bug in NT where it fails to attach to an existing region on calling CreateFileMapping, so let's call OpenFileMapping first */
-	hMapping = OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,name);
-	if (NULL == hMapping) {
-		hMapping = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE,0,sizeof(performance_counters),name);
-		if (NULL == hMapping) {
-			LDAPDebug(LDAP_DEBUG_ANY,"BAD MAP 1, err=%d\n",GetLastError(),0,0);
-			return -1;
-		}
-	}
-	/* If we got to here, we have the mapping object open */
-	pMemory = MapViewOfFile(hMapping,FILE_MAP_ALL_ACCESS,0,0,0);
-	if (NULL == pMemory) {
-		LDAPDebug(LDAP_DEBUG_ANY,"BAD MAP 2, err=%d\n",GetLastError(),0,0);
-		return -1;
-	}
-	priv->memory = pMemory;
-	priv->hMemory = hMapping;
-	return 0;
-}
-#endif
-
 /* Init perf ctrs */
 void perfctrs_init(struct ldbminfo *li, perfctrs_private **ret_priv)
 {
 	perfctrs_private *priv = NULL;
 
-#if defined(_WIN32)
-	/* XXX What's my instance name ? */
-
-	/* 
-	 * We have a single DB environment for all backend databases.
-	 * Therefore the instance name can be the server instance name.
-	 * To match the db perf ctr DLL the instance name should be the
-	 * name of a key defined in the registry under:
-	 *   HKEY_LOCAL_MACHINE\SOFTWARE\Netscape\Directory\5
-	 * i.e. slapd-servername
-	 */
-
-	char *string = NULL;
-	char *instance_name = li->li_plugin->plg_name; /* XXX does not identify server instance */
-#endif
-
 	*ret_priv = NULL;
 
-#if defined(_WIN32)
-	/*
-	 * On Windows, the performance counters reside in shared memory.
-	 */
-	if (NULL == instance_name) {
-		goto error;
-	}
-	/* Invent the name for the shared memory region */
-	string = string_concatenate(instance_name,PERFCTRS_REGION_SUFFIX);
-	if (NULL == string) {
-		goto error;
-	}
-#endif
-
 	/*
 	 * We need the perfctrs_private area on all platforms.
 	 */
 	priv = (perfctrs_private *)slapi_ch_calloc(1,sizeof(perfctrs_private));
-
-#if defined(_WIN32)
-	/* Try to open the shared memory region */
-	open_shared_memory(string,priv);
-	free(string);
-	/* Invent the name for the update mutex */
-	string = string_concatenate(instance_name,PERFCTRS_MUTEX_SUFFIX);
-	if (NULL == string) {
-		goto error;
-	}
-	open_event(string,priv);
-	free(string);
-	init_shared_memory(priv);
-
-#else
-	/*
-	 * On other platforms, the performance counters reside in regular memory.
-	 */
 	priv->memory = slapi_ch_calloc( 1, sizeof( performance_counters ));
-#endif
 
 	*ret_priv = priv;
 	return;
-
-#if defined(_WIN32)
-error:
-	slapi_ch_free((void**)&priv);
-	return;
-#endif
 }
 
 /* Terminate perf ctrs */
@@ -234,21 +113,9 @@ void perfctrs_terminate(perfctrs_private **priv, DB_ENV *db_env)
 	slapi_ch_free((void**)&logstat);
 	LOCK_STAT(db_env, &lockstat, DB_STAT_CLEAR, (void *)slapi_ch_malloc);
 	slapi_ch_free((void**)&lockstat);
-#if defined(_WIN32)
-	if (NULL != (*priv)->memory) {
-		UnmapViewOfFile((*priv)->memory);
-	}
-	if (NULL != (*priv)->hMemory) {
-		CloseHandle((*priv)->hMemory);
-	}
-	if (NULL != (*priv)->hEvent) {
-		CloseHandle((*priv)->hEvent);
-	}
-#else
 	if (NULL != (*priv)->memory) {
 		slapi_ch_free(&(*priv)->memory);
 	}
-#endif
 
 	slapi_ch_free( (void **)priv );
 }
@@ -256,26 +123,10 @@ void perfctrs_terminate(perfctrs_private **priv, DB_ENV *db_env)
 /* Wait while checking for perfctr update requests */
 void perfctrs_wait(size_t milliseconds,perfctrs_private *priv,DB_ENV *db_env)
 {
-#if defined(_WIN32)
-	if (NULL != priv) {
-		DWORD ret = 0;
-		if (NULL != priv->hEvent) {
-			/* Sleep waiting on the perfctrs update event */
-			ret = WaitForSingleObject(priv->hEvent,milliseconds);
-			/* If we didn't time out, update the perfctrs */
-			if (ret == WAIT_OBJECT_0) {
-				perfctrs_update(priv,db_env);
-			}
-		} else {
-			Sleep(milliseconds);
-		}
-	}
-#else
 	/* Just sleep */
 	PRIntervalTime    interval;   /*NSPR timeout stuffy*/
 	interval = PR_MillisecondsToInterval(milliseconds);
 	DS_Sleep(interval);
-#endif
 }
 
 /* Update perfctrs */
diff --git a/ldap/servers/slapd/back-ldif/back-ldif.h b/ldap/servers/slapd/back-ldif/back-ldif.h
index a286898..61179ed 100644
--- a/ldap/servers/slapd/back-ldif/back-ldif.h
+++ b/ldap/servers/slapd/back-ldif/back-ldif.h
@@ -50,20 +50,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-
-/* include NSPR header files */
 #include "prlock.h"
-
 #include "ldaplog.h"
 #include "portable.h"
 #include "slap.h"
-
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#else
 #include <sys/socket.h>
-#endif /* _WIN32 */
+
 
 /*Defines*/
 #define LDIF_DB_ADD     0
diff --git a/ldap/servers/slapd/back-ldif/dllmain.c b/ldap/servers/slapd/back-ldif/dllmain.c
index 6b3ef87..282dce9 100644
--- a/ldap/servers/slapd/back-ldif/dllmain.c
+++ b/ldap/servers/slapd/back-ldif/dllmain.c
@@ -44,122 +44,18 @@
  * Microsoft Windows specifics for LIBLDAP DLL
  */
 #include "ldap.h"
+#include <stdio.h>
 
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-	WSADATA	wsadata;
-
-	switch (fdwReason)
-	{
-	case DLL_PROCESS_ATTACH:
-		 /* Code from LibMain inserted here.  Return TRUE to keep the
-		    DLL loaded or return FALSE to fail loading the DLL.
-
-		    You may have to modify the code in your original LibMain to
-		    account for the fact that it may be called more than once.
-		    You will get one DLL_PROCESS_ATTACH for each process that
-		    loads the DLL. This is different from LibMain which gets
-		    called only once when the DLL is loaded. The only time this
-		    is critical is when you are using shared data sections.
-		    If you are using shared data sections for statically
-		    allocated data, you will need to be careful to initialize it
-		    only once. Check your code carefully.
-
-		    Certain one-time initializations may now need to be done for
-		    each process that attaches. You may also not need code from
-		    your original LibMain because the operating system may now
-		    be doing it for you.
-		 */
-		/*
-		 * 16 bit code calls UnlockData()
-		 * which is mapped to UnlockSegment in windows.h
-		 * in 32 bit world UnlockData is not defined anywhere
-		 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-		 * and the docs for both UnlockSegment and GlobalUnfix say 
-		 * ".. function is oboslete.  Segments have no meaning 
-		 *  in the 32-bit environment".  So we do nothing here.
-		 */
-
-		if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-			return FALSE;
-
-		break;
-
-	case DLL_THREAD_ATTACH:
-		/* Called each time a thread is created in a process that has
-		   already loaded (attached to) this DLL. Does not get called
-		   for each thread that exists in the process before it loaded
-		   the DLL.
-
-		   Do thread-specific initialization here.
-		*/
-		break;
-
-	case DLL_THREAD_DETACH:
-		/* Same as above, but called when a thread in the process
-		   exits.
-
-		   Do thread-specific cleanup here.
-		*/
-		break;
-
-	case DLL_PROCESS_DETACH:
-		/* Code from _WEP inserted here.  This code may (like the
-		   LibMain) not be necessary.  Check to make certain that the
-		   operating system is not doing it for you.
-		*/
-		WSACleanup();
-
-		break;
-	}
-	/* The return value is only used for DLL_PROCESS_ATTACH; all other
-	conditions are ignored.  */
-	return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 	/*UnlockData( 0 );*/
  	return( 1 );
 }
-#endif
-
-#ifdef LDAP_DEBUG
-#ifndef _WIN32
-#include <stdarg.h>
-#include <stdio.h>
-
-void LDAPDebug( int level, char* fmt, ... )
-{
-	static char debugBuf[1024];
-
-	if (slapd_ldap_debug & level)
-	{
-		va_list ap;
-		va_start (ap, fmt);
-		_snprintf (debugBuf, sizeof(debugBuf), fmt, ap);
-		debugBuf[sizeof(debugBuf)-1] = 0;
-		va_end (ap);
-
-		OutputDebugString (debugBuf);
-	}
-}
-#endif
-#endif
-
-#ifndef _WIN32
 
 /* The 16-bit version of the RTL does not implement perror() */
 
-#include <stdio.h>
-
 void perror( const char *msg )
 {
 	char buf[128];
@@ -167,4 +63,3 @@ void perror( const char *msg )
 	OutputDebugString( buf );
 }
 
-#endif
diff --git a/ldap/servers/slapd/back-ldif/init.c b/ldap/servers/slapd/back-ldif/init.c
index 584c82a..696fc73 100644
--- a/ldap/servers/slapd/back-ldif/init.c
+++ b/ldap/servers/slapd/back-ldif/init.c
@@ -54,14 +54,6 @@
 static Slapi_PluginDesc pdesc = { "ldif-backend", "Netscape", DS_PACKAGE_VERSION,
 	"LDIF backend database plugin" };
 
-#ifdef _WIN32
-int *module_ldap_debug = 0;
-
-void plugin_init_debug_level(int *level_ptr)
-{
-	module_ldap_debug = level_ptr;
-}
-#endif
 
 /*
  *  Function: ldif_back_init
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index acc65ce..99df72d 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -64,12 +64,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "fe.h"
-
 #include "pratom.h"
 #include <sasl.h>
 
diff --git a/ldap/servers/slapd/ch_malloc.c b/ldap/servers/slapd/ch_malloc.c
index b2afbe0..3aca001 100644
--- a/ldap/servers/slapd/ch_malloc.c
+++ b/ldap/servers/slapd/ch_malloc.c
@@ -47,9 +47,7 @@
 #include <stdlib.h>
 #include <string.h> /* strdup */
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #undef DEBUG                    /* disable counters */
 #include <prcountr.h>
 #include "slap.h"
@@ -67,10 +65,6 @@ PR_DEFINE_COUNTER(slapi_ch_counter_exist);
 static void *oom_emergency_area = NULL;
 static PRLock *oom_emergency_lock = NULL;
 
-#if defined(_WIN32)
-static int recording= 0;
-#endif
-
 #define SLAPD_MODULE	"memory allocator"
 
 static const char* const oom_advice =
@@ -83,13 +77,6 @@ static const char* const oom_advice =
   "  nsslapd-import-cachesize (LDBM Plug-in Settings - Import cache size).\n"
   "Can't recover; calling exit(1).\n";
 
-#if defined(_WIN32) && defined(DEBUG)
-static void add_memory_record(void *p,unsigned long size);
-static void remove_memory_record(void *p);
-static int memory_record_dump( caddr_t data, caddr_t arg );
-static int memory_record_delete( caddr_t data, caddr_t arg );
-#endif
-
 static void
 create_counters()
 {
@@ -169,12 +156,6 @@ slapi_ch_malloc(
     PR_INCREMENT_COUNTER(slapi_ch_counter_malloc);
     PR_INCREMENT_COUNTER(slapi_ch_counter_created);
     PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		add_memory_record(newmem,size);
-	}
-#endif
 
 	return( newmem );
 }
@@ -211,13 +192,6 @@ slapi_ch_realloc(
 		counters_created= 1;
 	}
     PR_INCREMENT_COUNTER(slapi_ch_counter_realloc);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		remove_memory_record(block);
-		add_memory_record(newmem,size);
-	}
-#endif
 
 	return( newmem );
 }
@@ -257,12 +231,7 @@ slapi_ch_calloc(
     PR_INCREMENT_COUNTER(slapi_ch_counter_calloc);
     PR_INCREMENT_COUNTER(slapi_ch_counter_created);
     PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		add_memory_record(newmem,size);
-	}
-#endif
+
 	return( newmem );
 }
 
@@ -293,12 +262,7 @@ slapi_ch_strdup ( const char* s1)
     PR_INCREMENT_COUNTER(slapi_ch_counter_strdup);
     PR_INCREMENT_COUNTER(slapi_ch_counter_created);
     PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		add_memory_record(newmem,strlen(s1)+1);
-	}
-#endif
+
     return newmem;
 }
 #endif /* !MEMPOOL_EXPERIMENTAL */
@@ -325,13 +289,13 @@ slapi_ch_bvecdup (struct berval** v)
 {
     struct berval** newberval = NULL;
     if (v != NULL) {
-	size_t i = 0;
-	while (v[i] != NULL) ++i;
-	newberval = (struct berval**) slapi_ch_malloc ((i + 1) * sizeof (struct berval*));
-	newberval[i] = NULL;
-	while (i-- > 0) {
-	    newberval[i] = slapi_ch_bvdup (v[i]);
-	}
+        size_t i = 0;
+        while (v[i] != NULL) ++i;
+        newberval = (struct berval**) slapi_ch_malloc ((i + 1) * sizeof (struct berval*));
+        newberval[i] = NULL;
+        while (i-- > 0) {
+            newberval[i] = slapi_ch_bvdup (v[i]);
+        }
     }
     return newberval;
 }
@@ -351,15 +315,9 @@ void
 slapi_ch_free(void **ptr)
 {
 	if (ptr==NULL || *ptr == NULL){
-	return;
+		return;
 	}
 
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		remove_memory_record(*ptr);
-	}
-#endif
 	free (*ptr);
 	*ptr = NULL;
 	if(!counters_created)
@@ -436,305 +394,3 @@ slapi_ch_smprintf(const char *fmt, ...)
 	return p;
 }
 #endif
-
-/* ========================= NT Specific Leak Checking Code ================================== */
-
-#if defined(_WIN32) && defined(DEBUG)
-#define STOP_TRAVERSAL -2 
-#define MR_CALL_STACK 16
-#define MR_DUMP_AMOUNT 16
-static Avlnode *mr_tree= NULL;
-static PRLock *mr_tree_lock= NULL;
-#endif
-
-void
-slapi_ch_start_recording()
-{
-#if defined(_WIN32) && defined(DEBUG)
-	if(mr_tree_lock==NULL)
-	{
-        mr_tree_lock = PR_NewLock();
-	}
-    PR_Lock( mr_tree_lock );
-	recording= 1;
-    PR_Unlock( mr_tree_lock );
-#endif
-}
-
-void
-slapi_ch_stop_recording()
-{
-#if defined(_WIN32) && defined(DEBUG)
-    PR_Lock( mr_tree_lock );
-	recording= 0;
-    avl_apply( mr_tree, memory_record_dump, NULL, STOP_TRAVERSAL, AVL_INORDER );
-    avl_free( mr_tree, memory_record_delete );
-	mr_tree= NULL;
-    PR_Unlock( mr_tree_lock );
-#endif
-}
-
-#if defined(_WIN32) && defined(DEBUG)
-
-struct memory_record
-{
-	void *p;
-	unsigned long size;
-	DWORD ra[MR_CALL_STACK];
-};
-
-
-static void
-mr_to_hex_dump(char* dest, void *addr, int size, int MaxBytes)
-{
-	int i;
-	for (i=0; i<MaxBytes; i++)
-	{
-		if(i<size)
-		{
-			wsprintf(dest+i*2, "%02x", ((unsigned char*)addr)[i]);
-		}
-		else
-		{
-			strcpy(dest+i*2, "  ");
-		}
-	}
-}
-
-static void
-mr_to_char_dump(char* dest, void *addr, int size, int MaxBytes)
-{
-	int i;
-	char *c= (char*)addr;
-	for(i=0;i<MaxBytes;i++)
-	{
-		if(i<size)
-		{
-			*(dest+i)= (isprint(*c)?*c:'.');
-			c++;
-		}
-		else
-		{
-			*(dest+i)= ' ';
-		}
-	}
-	*(dest+i)= '\0';
-}
-
-
-/*
- * Check that the address is (probably) valid
- */
-static int ValidateBP(UINT bp)
-{
-    return !(IsBadReadPtr((void*)bp, 4) || IsBadWritePtr((void*)bp, 4));
-}
-
-/*
- * Check that the address is (probably) valid
- */
-static int ValidateIP(UINT ip)
-{
-    return !IsBadReadPtr((void*)ip, 4);
-}
-
-static int
-memory_record_delete( caddr_t data, caddr_t arg )
-{
-    struct memory_record *mr = (struct memory_record *)data;
-	free(mr);
-    return 0;
-}
-
-static int
-memory_record_duplicate_disallow( caddr_t d1, caddr_t d2 )
-{
-    return -1;
-}
-
-static int
-memory_record_compare( caddr_t d1, caddr_t d2 )
-{
-    struct memory_record *mr1 = (struct memory_record *)d1;
-    struct memory_record *mr2 = (struct memory_record *)d2;
-	return (mr1->p==mr2->p);
-}
-
-static void
-grab_stack(DWORD *ra,int framestograb,int framestoskip)
-{
-	int framelookingat = 0;
-	int framestoring = 0;
-	DWORD _bp = 0;
-
-	/* for every function the frame layout is:
-	 * ---------
-	 * |ret add|
-	 * ---------
-	 * |old bp | <- new bp
-	 * ---------
-	 */
-
-	__asm mov _bp, ebp;
-
-	if(framestoskip==0)
-	{
-		ra[framestoring]= _bp;
-		framestoring++;
-	}
-	while (framelookingat < framestograb+framestoskip-1)
-	{
-		DWORD returnAddress = *(((DWORD*)_bp)+1);
-		_bp = *((DWORD*)_bp);
-		if (!ValidateBP(_bp)) break;
-		if (!ValidateIP(returnAddress)) break;
-		if(framelookingat>=framestoskip)
-		{
-			ra[framestoring]= returnAddress;
-			framestoring++;
-		}
-		framelookingat++;
-	}
-	ra[framestoring]= 0;
-}
-
-static void
-add_memory_record(void *p,unsigned long size)
-{
-    struct memory_record *mr= (struct memory_record *)malloc(sizeof(struct memory_record));
-	mr->p= p;
-	mr->size= size;
-	grab_stack(mr->ra,MR_CALL_STACK,1);
-    PR_Lock( mr_tree_lock );
-    avl_insert( &mr_tree, mr, memory_record_compare, memory_record_duplicate_disallow );
-    PR_Unlock( mr_tree_lock );
-}
-
-static void
-remove_memory_record(void *p)
-{
-    struct memory_record *mr = NULL;
-    struct memory_record search;
-    PR_Lock( mr_tree_lock );
-    search.p= p;
-    mr = (struct memory_record *)avl_find( mr_tree, &search, memory_record_compare );
-	if(mr!=NULL)
-	{
-		avl_delete( &mr_tree, mr, memory_record_compare );
-	}
-    PR_Unlock( mr_tree_lock );
-}
-
-#include <imagehlp.h>
-#pragma comment(lib, "imagehlp")
-
-static BOOL SymInitialized= FALSE;
-static HANDLE s_hProcess= NULL;
-
-BOOL InitialiseImageHelp()
-{
-	if (!SymInitialized)
-	{
-		/* OBSOLETE: we don't have this directory structure any longer */
-		/*
-		 * searchpath= <instancedir>\bin\slapd\server;<instancedir>\lib
-		 */
-		char *searchpath= NULL;
-		/* char *id= config_get_instancedir(); eliminated */
-		if(id!=NULL)
-		{
-			char *p= id;
-			while(p!=NULL)
-			{
-				p= strchr(id,'/');
-				if(p!=NULL) *p='\\';
-			}
-			p= strrchr(id,'\\');
-			if(p!=NULL)
-			{
-				*p= '\0';
-				searchpath= slapi_ch_malloc(100+strlen(p)*2);
-				strcpy(searchpath,id);
-				strcat(searchpath,"\\bin\\slapd\\server;");
-				strcat(searchpath,id);
-				strcat(searchpath,"\\lib");
-			}
-		}
-		s_hProcess = GetCurrentProcess();
-		SymInitialized = SymInitialize(s_hProcess, searchpath, TRUE);
-		slapi_ch_free((void**)&id);
-		slapi_ch_free((void**)&searchpath);
-		if (SymInitialized)
-		{
-			SymSetOptions(SYMOPT_DEFERRED_LOADS);
-		}
-	}
-	return SymInitialized;
-}
-
-BOOL AddressToName(DWORD Addr, LPTSTR Str, int Max)
-{
-	DWORD base;
-	if (!InitialiseImageHelp())
-		return FALSE;
-	base = SymGetModuleBase(s_hProcess, Addr);
-	if (base)
-	{
-		struct
-		{
-			IMAGEHLP_SYMBOL ihs;
-			char NameBuf[256];
-		} SymInfo;
-		DWORD Displacement = 0;
-		SymInfo.ihs.SizeOfStruct = sizeof(SymInfo);
-		SymInfo.ihs.MaxNameLength = sizeof(SymInfo.NameBuf);
-		if (SymGetSymFromAddr(s_hProcess, Addr, &Displacement, &SymInfo.ihs))
-		{
-			if (Displacement)
-				_snprintf(Str, Max-1, "%s+%x", SymInfo.ihs.Name, Displacement);
-			else
-				_snprintf(Str, Max-1, "%s", SymInfo.ihs.Name);
-			return TRUE;
-		}
-		else
-		{
-			_snprintf(Str, Max, "SymGetSymFromAddr failed (%d)", GetLastError());
-		}
-	}
-	else
-	{
-		_snprintf(Str, Max, "SymGetModuleBase failed (%d)", GetLastError());
-	}
-	return FALSE;
-}
-
-static int
-memory_record_dump( caddr_t data, caddr_t arg )
-{
-	int frame= 0;
-	char b1[MR_DUMP_AMOUNT*2+1];
-	char b2[MR_DUMP_AMOUNT+1];
-	char b3[128];
-	int size= 0;
-    struct memory_record *mr = (struct memory_record *)data;
-    if(!IsBadReadPtr(mr->p, MR_DUMP_AMOUNT))
-	{
-		size= MR_DUMP_AMOUNT;
-	}
-	mr_to_hex_dump(b1, mr->p, size, MR_DUMP_AMOUNT);
-	mr_to_char_dump(b2, mr->p, size, MR_DUMP_AMOUNT);
-	PR_snprintf(b3,sizeof(b3),"%p %ld %s %s",mr->p,mr->size,b1,b2);
-	LDAPDebug( LDAP_DEBUG_ANY, "%s\n",b3,0,0);
-	while(mr->ra[frame]!=0)
-	{
-		char fn[100];
-		AddressToName(mr->ra[frame], fn, 100);
-		LDAPDebug( LDAP_DEBUG_ANY, "%d %p %s\n",frame,mr->ra[frame],fn);
-		frame++;
-	}
-    return 0;
-}
-
-#endif
-
-
diff --git a/ldap/servers/slapd/charray.c b/ldap/servers/slapd/charray.c
index f86ddc2..ad53335 100644
--- a/ldap/servers/slapd/charray.c
+++ b/ldap/servers/slapd/charray.c
@@ -45,9 +45,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 
 void
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
index 5fb1d2f..62aeb7d 100644
--- a/ldap/servers/slapd/compare.c
+++ b/ldap/servers/slapd/compare.c
@@ -54,9 +54,7 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "pratom.h"
 
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index 8dbb103..d003f70 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -47,14 +47,10 @@
 #include <sys/types.h>
 #include <errno.h>
 #include <stdlib.h>
-#ifdef _WIN32
-#include <direct.h> /* for getcwd */
-#else
 #include <sys/socket.h>
 #include <sys/param.h>
 #include <unistd.h>
 #include <pwd.h>
-#endif
 #include "slap.h"
 #include "pw.h"
 #include <sys/stat.h>
@@ -255,7 +251,7 @@ slapd_bootstrap_config(const char *configdir)
 					continue;
 				}
 				/* increase file descriptors */
-#if !defined(_WIN32) && !defined(AIX)
+#if !defined(AIX)
 				if (!maxdescriptors[0] &&
 					entry_has_attr_and_value(e, CONFIG_MAXDESCRIPTORS_ATTRIBUTE,
 									 maxdescriptors, sizeof(maxdescriptors)))
@@ -269,7 +265,7 @@ slapd_bootstrap_config(const char *configdir)
 								  CONFIG_MAXDESCRIPTORS_ATTRIBUTE, errorbuf);
 					}
 				}
-#endif /* !defined(_WIN32) && !defined(AIX) */
+#endif /* !defined(AIX) */
 
 				/* see if we need to enable error logging */
 				if (!logenabled[0] &&
@@ -287,7 +283,6 @@ slapd_bootstrap_config(const char *configdir)
 					}
 				}
 
-#ifndef _WIN32
 				/* set the local user name; needed to set up error log */
 				if (!_localuser[0] &&
 					entry_has_attr_and_value(e, CONFIG_LOCALUSER_ATTRIBUTE,
@@ -300,7 +295,6 @@ slapd_bootstrap_config(const char *configdir)
 								  CONFIG_LOCALUSER_ATTRIBUTE, errorbuf);
 					}
 				}
-#endif
 				
 				/* set the log file name */
 				workpath[0] = '\0';
diff --git a/ldap/servers/slapd/configdse.c b/ldap/servers/slapd/configdse.c
index 5f26e6b..954d446 100644
--- a/ldap/servers/slapd/configdse.c
+++ b/ldap/servers/slapd/configdse.c
@@ -46,10 +46,8 @@
 #include <string.h>
 #include <sys/types.h>
 #include <errno.h>
-#ifndef _WIN32
 #include <sys/socket.h>
 #include <sys/param.h>
-#endif
 #include "log.h"
 #include "slap.h"
 #include "pw.h"
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 8227756..3ea0576 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -214,29 +214,11 @@ connection_cleanup(Connection *conn)
 	 * PRLock *c_pdumutex;
 	 * Conn_private *c_private;
 	 */
-
-#ifdef _WIN32
-	if (conn->c_prfd && (conn->c_flags & CONN_FLAG_SSL))
-	{
-		LDAPDebug( LDAP_DEBUG_CONNS,
-		  "conn=%" PRIu64 " fd=%d closed now\n",
-		  conn->c_connid, conn->c_sd,0);
-		PR_Close(conn->c_prfd);
-	}
-	else if (conn->c_sd)
-	{
-		LDAPDebug( LDAP_DEBUG_CONNS,
-		  "conn=%" PRIu64 " fd=%d closed now\n",
-		  conn->c_connid, conn->c_sd,0);
-		closesocket(conn->c_sd);
-	}
-#else
 	if (conn->c_prfd)
 	{
 		PR_Close(conn->c_prfd);
 		enable_listeners = 1; /* re-enable listeners disabled due to no fds */
 	}
-#endif
 
 	conn->c_sd= SLAPD_INVALID_SOCKET;
 	conn->c_ldapversion= 0;
@@ -293,11 +275,11 @@ connection_cleanup(Connection *conn)
 void
 connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is_SSL)
 {
-    char *		pTmp = is_SSL ? "SSL " : "";
-    char		*str_ip = NULL, *str_destip;
-    char		buf_ip[ 256 ], buf_destip[ 256 ];
-    char		*str_unknown = "unknown";
-    int			in_referral_mode = config_check_referral_mode();
+    char *pTmp = is_SSL ? "SSL " : "";
+    char *str_ip = NULL, *str_destip;
+    char buf_ip[ 256 ], buf_destip[ 256 ];
+    char *str_unknown = "unknown";
+    int in_referral_mode = config_check_referral_mode();
 
     LDAPDebug( LDAP_DEBUG_CONNS, "new %sconnection on %d\n", pTmp, conn->c_sd, 0 );
 
@@ -305,8 +287,8 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
     conn->c_connid = slapi_counter_increment(num_conns);
 
     if (! in_referral_mode) {
-	slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
-	slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnections);
+        slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
+        slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnections);
     }
 
     /* 
@@ -314,74 +296,74 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
      */
     slapi_ch_free( (void**)&conn->cin_addr ); /* just to be conservative */
     if ( from->raw.family == PR_AF_LOCAL ) { /* ldapi */
-	conn->cin_addr = (PRNetAddr *) slapi_ch_malloc( sizeof( PRNetAddr ) );
-	PL_strncpyz(buf_ip, from->local.path, sizeof(from->local.path));
-	memcpy( conn->cin_addr, from, sizeof( PRNetAddr ) );
-	if (!buf_ip[0]) {
-	    PR_GetPeerName( conn->c_prfd, from );
-	    PL_strncpyz(buf_ip, from->local.path, sizeof(from->local.path));
-	    memcpy( conn->cin_addr, from, sizeof( PRNetAddr ) );
-	}
-	if (!buf_ip[0]) {
-	    /* cannot derive local address */
-	    /* need something for logging */
-	    PL_strncpyz(buf_ip, "local", sizeof(buf_ip));
-	}
-	str_ip = buf_ip;
+        conn->cin_addr = (PRNetAddr *) slapi_ch_malloc( sizeof( PRNetAddr ) );
+        PL_strncpyz(buf_ip, from->local.path, sizeof(from->local.path));
+        memcpy( conn->cin_addr, from, sizeof( PRNetAddr ) );
+        if (!buf_ip[0]) {
+            PR_GetPeerName( conn->c_prfd, from );
+            PL_strncpyz(buf_ip, from->local.path, sizeof(from->local.path));
+            memcpy( conn->cin_addr, from, sizeof( PRNetAddr ) );
+            if (!buf_ip[0]) {
+                /* Cannot derive local address, need something for logging */
+                PL_strncpyz(buf_ip, "local", sizeof(buf_ip));
+            }
+        }
+        str_ip = buf_ip;
     } else if ( ((from->ipv6.ip.pr_s6_addr32[0] != 0) || /* from contains non zeros */
 	  (from->ipv6.ip.pr_s6_addr32[1] != 0) || 
 	  (from->ipv6.ip.pr_s6_addr32[2] != 0) || 
 	  (from->ipv6.ip.pr_s6_addr32[3] != 0)) || 
-	 ((conn->c_prfd != NULL) && (PR_GetPeerName( conn->c_prfd, from ) == 0)) ) {
-	conn->cin_addr = (PRNetAddr *) slapi_ch_malloc( sizeof( PRNetAddr ) );
-	memcpy( conn->cin_addr, from, sizeof( PRNetAddr ) );
+	 ((conn->c_prfd != NULL) && (PR_GetPeerName( conn->c_prfd, from ) == 0)) )
+    {
+        conn->cin_addr = (PRNetAddr *) slapi_ch_malloc( sizeof( PRNetAddr ) );
+        memcpy( conn->cin_addr, from, sizeof( PRNetAddr ) );
 		
-	if ( PR_IsNetAddrType( conn->cin_addr, PR_IpAddrV4Mapped ) ) {
-	     PRNetAddr v4addr;
-	     memset( &v4addr, 0, sizeof( v4addr ) );
-	     v4addr.inet.family = PR_AF_INET;
-	     v4addr.inet.ip = conn->cin_addr->ipv6.ip.pr_s6_addr32[3];
-	     PR_NetAddrToString( &v4addr, buf_ip, sizeof( buf_ip ) );
-	} else {
-	     PR_NetAddrToString( conn->cin_addr, buf_ip, sizeof( buf_ip ) );
-	}
-	buf_ip[ sizeof( buf_ip ) - 1 ] = '\0';
-	str_ip = buf_ip;		        
+        if ( PR_IsNetAddrType( conn->cin_addr, PR_IpAddrV4Mapped ) ) {
+            PRNetAddr v4addr;
+            memset( &v4addr, 0, sizeof( v4addr ) );
+            v4addr.inet.family = PR_AF_INET;
+            v4addr.inet.ip = conn->cin_addr->ipv6.ip.pr_s6_addr32[3];
+            PR_NetAddrToString( &v4addr, buf_ip, sizeof( buf_ip ) );
+        } else {
+            PR_NetAddrToString( conn->cin_addr, buf_ip, sizeof( buf_ip ) );
+        }
+        buf_ip[ sizeof( buf_ip ) - 1 ] = '\0';
+        str_ip = buf_ip;
     } else {
-	/* try syscall since "from" was not given and PR_GetPeerName failed */
-	/* a corner case */
-	struct sockaddr_in addr; /* assuming IPv4 */
+        /* try syscall since "from" was not given and PR_GetPeerName failed */
+        /* a corner case */
+        struct sockaddr_in addr; /* assuming IPv4 */
 #if ( defined( hpux ) )
-	int                addrlen;
+        int addrlen;
 #else
-	socklen_t          addrlen;
+        socklen_t addrlen;
 #endif
 
-	addrlen = sizeof( addr );
-	memset( &addr, 0, addrlen );
-
-	if ( (conn->c_prfd == NULL) && 
-	     (getpeername( conn->c_sd, (struct sockaddr *)&addr, &addrlen )
-	      == 0) ) {
-	    conn->cin_addr = (PRNetAddr *)slapi_ch_malloc( sizeof( PRNetAddr ));
-	    memset( conn->cin_addr, 0, sizeof( PRNetAddr ) );
-	    PR_NetAddrFamily( conn->cin_addr ) = AF_INET6;
-	    /* note: IPv4-mapped IPv6 addr does not work on Windows */
-	    PR_ConvertIPv4AddrToIPv6(addr.sin_addr.s_addr, &(conn->cin_addr->ipv6.ip));
-	    PRLDAP_SET_PORT(conn->cin_addr, addr.sin_port);
-
-	    /* copy string equivalent of address into a buffer to use for
-	     * logging since each call to inet_ntoa() returns a pointer to a
-	     * single thread-specific buffer (which prevents us from calling
-	     * inet_ntoa() twice in one call to slapi_log_access()).
-	     */
-	    str_ip = inet_ntoa( addr.sin_addr );
-	    strncpy( buf_ip, str_ip, sizeof( buf_ip ) - 1 );
-	    buf_ip[ sizeof( buf_ip ) - 1 ] = '\0';
-	    str_ip = buf_ip;
-	} else {
-	    str_ip = str_unknown;
-	}
+        addrlen = sizeof( addr );
+        memset( &addr, 0, addrlen );
+
+        if ( (conn->c_prfd == NULL) &&
+	         (getpeername( conn->c_sd, (struct sockaddr *)&addr, &addrlen ) == 0) )
+        {
+            conn->cin_addr = (PRNetAddr *)slapi_ch_malloc( sizeof( PRNetAddr ));
+            memset( conn->cin_addr, 0, sizeof( PRNetAddr ) );
+            PR_NetAddrFamily( conn->cin_addr ) = AF_INET6;
+            /* note: IPv4-mapped IPv6 addr does not work on Windows */
+            PR_ConvertIPv4AddrToIPv6(addr.sin_addr.s_addr, &(conn->cin_addr->ipv6.ip));
+            PRLDAP_SET_PORT(conn->cin_addr, addr.sin_port);
+
+            /* copy string equivalent of address into a buffer to use for
+             * logging since each call to inet_ntoa() returns a pointer to a
+             * single thread-specific buffer (which prevents us from calling
+             * inet_ntoa() twice in one call to slapi_log_access()).
+             */
+            str_ip = inet_ntoa( addr.sin_addr );
+            strncpy( buf_ip, str_ip, sizeof( buf_ip ) - 1 );
+            buf_ip[ sizeof( buf_ip ) - 1 ] = '\0';
+            str_ip = buf_ip;
+        } else {
+            str_ip = str_unknown;
+        }
     }
 
     /*
@@ -389,76 +371,73 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
      */
     slapi_ch_free( (void**)&conn->cin_destaddr ); /* just to be conservative */
     if ( conn->c_prfd != NULL ) {
-	conn->cin_destaddr = (PRNetAddr *) slapi_ch_malloc( sizeof( PRNetAddr ) );
-	memset( conn->cin_destaddr, 0, sizeof( PRNetAddr ));
-	if (PR_GetSockName( conn->c_prfd, conn->cin_destaddr ) == 0) {
-	    if ( conn->cin_destaddr->raw.family == PR_AF_LOCAL ) { /* ldapi */
-		PL_strncpyz(buf_destip, conn->cin_destaddr->local.path,
-			    sizeof(conn->cin_destaddr->local.path));
-		if (!buf_destip[0]) {
-		    PL_strncpyz(buf_destip, "unknown local file", sizeof(buf_destip));
-		}
-	    } else if ( PR_IsNetAddrType( conn->cin_destaddr, PR_IpAddrV4Mapped ) ) {
-		PRNetAddr v4destaddr;
-		memset( &v4destaddr, 0, sizeof( v4destaddr ) );
-		v4destaddr.inet.family = PR_AF_INET;
-		v4destaddr.inet.ip = conn->cin_destaddr->ipv6.ip.pr_s6_addr32[3];
-		PR_NetAddrToString( &v4destaddr, buf_destip, sizeof( buf_destip ) );
-	    } else {
-		PR_NetAddrToString( conn->cin_destaddr, buf_destip, sizeof( buf_destip ) );
-	    }
-	    buf_destip[ sizeof( buf_destip ) - 1 ] = '\0';
-	    str_destip = buf_destip;		        
-	} else {
-	    str_destip = str_unknown;
-	}
+        conn->cin_destaddr = (PRNetAddr *) slapi_ch_malloc( sizeof( PRNetAddr ) );
+        memset( conn->cin_destaddr, 0, sizeof( PRNetAddr ));
+        if (PR_GetSockName( conn->c_prfd, conn->cin_destaddr ) == 0) {
+            if ( conn->cin_destaddr->raw.family == PR_AF_LOCAL ) { /* ldapi */
+                PL_strncpyz(buf_destip, conn->cin_destaddr->local.path,
+                    sizeof(conn->cin_destaddr->local.path));
+                if (!buf_destip[0]) {
+                    PL_strncpyz(buf_destip, "unknown local file", sizeof(buf_destip));
+                }
+            } else if ( PR_IsNetAddrType( conn->cin_destaddr, PR_IpAddrV4Mapped ) ) {
+                PRNetAddr v4destaddr;
+                memset( &v4destaddr, 0, sizeof( v4destaddr ) );
+                v4destaddr.inet.family = PR_AF_INET;
+                v4destaddr.inet.ip = conn->cin_destaddr->ipv6.ip.pr_s6_addr32[3];
+                PR_NetAddrToString( &v4destaddr, buf_destip, sizeof( buf_destip ) );
+            } else {
+                PR_NetAddrToString( conn->cin_destaddr, buf_destip, sizeof( buf_destip ) );
+            }
+            buf_destip[ sizeof( buf_destip ) - 1 ] = '\0';
+            str_destip = buf_destip;
+        } else {
+            str_destip = str_unknown;
+        }
     } else {
-	/* try syscall since c_prfd == NULL */
-	/* a corner case */
-	struct sockaddr_in	destaddr; /* assuming IPv4 */
+        /* try syscall since c_prfd == NULL */
+        /* a corner case */
+        struct sockaddr_in	destaddr; /* assuming IPv4 */
 #if ( defined( hpux ) )
-	int			destaddrlen;
+        int destaddrlen;
 #else
-	socklen_t		destaddrlen;
+        socklen_t destaddrlen;
 #endif
 
-	destaddrlen = sizeof( destaddr );
-	memset( &destaddr, 0, destaddrlen );
-	if ( (getsockname( conn->c_sd, (struct sockaddr *)&destaddr,
-					&destaddrlen ) == 0) ) {
-	    conn->cin_destaddr =
-		    (PRNetAddr *)slapi_ch_malloc( sizeof( PRNetAddr ));
-	    memset( conn->cin_destaddr, 0, sizeof( PRNetAddr ));
-	    PR_NetAddrFamily( conn->cin_destaddr ) = AF_INET6;
-	    PRLDAP_SET_PORT( conn->cin_destaddr, destaddr.sin_port );
-	    /* note: IPv4-mapped IPv6 addr does not work on Windows */
-	    PR_ConvertIPv4AddrToIPv6(destaddr.sin_addr.s_addr,
-				     &(conn->cin_destaddr->ipv6.ip));
-
-	    /* copy string equivalent of address into a buffer to use for
-	     * logging since each call to inet_ntoa() returns a pointer to a
-	     * single thread-specific buffer (which prevents us from calling
-	     * inet_ntoa() twice in one call to slapi_log_access()).
-	     */
-	    str_destip = inet_ntoa( destaddr.sin_addr );
-	    strncpy( buf_destip, str_destip, sizeof( buf_destip ) - 1 );
-	    buf_destip[ sizeof( buf_destip ) - 1 ] = '\0';
-	    str_destip = buf_destip;
-	} else {
-	    str_destip = str_unknown;
-	}      
+        destaddrlen = sizeof( destaddr );
+        memset( &destaddr, 0, destaddrlen );
+        if ( (getsockname( conn->c_sd, (struct sockaddr *)&destaddr, &destaddrlen ) == 0) ) {
+            conn->cin_destaddr = (PRNetAddr *)slapi_ch_malloc( sizeof( PRNetAddr ));
+            memset( conn->cin_destaddr, 0, sizeof( PRNetAddr ));
+            PR_NetAddrFamily( conn->cin_destaddr ) = AF_INET6;
+            PRLDAP_SET_PORT( conn->cin_destaddr, destaddr.sin_port );
+            /* note: IPv4-mapped IPv6 addr does not work on Windows */
+            PR_ConvertIPv4AddrToIPv6(destaddr.sin_addr.s_addr, &(conn->cin_destaddr->ipv6.ip));
+
+            /* copy string equivalent of address into a buffer to use for
+             * logging since each call to inet_ntoa() returns a pointer to a
+             * single thread-specific buffer (which prevents us from calling
+             * inet_ntoa() twice in one call to slapi_log_access()).
+             */
+            str_destip = inet_ntoa( destaddr.sin_addr );
+            strncpy( buf_destip, str_destip, sizeof( buf_destip ) - 1 );
+            buf_destip[ sizeof( buf_destip ) - 1 ] = '\0';
+            str_destip = buf_destip;
+        } else {
+            str_destip = str_unknown;
+        }
     }
 
 
     if ( !in_referral_mode ) {
-	/* create a sasl connection */
-	ids_sasl_server_new(conn);
+        /* create a sasl connection */
+        ids_sasl_server_new(conn);
     }
 
     /* log useful stuff to our access log */
     slapi_log_access( LDAP_DEBUG_STATS,
-	    "conn=%" NSPRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
-	    conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
+        "conn=%" NSPRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
+        conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
 
     /* initialize the remaining connection fields */
     conn->c_ldapversion = LDAP_VERSION3;
@@ -507,8 +486,8 @@ init_op_threads()
 		                     (VFP) (void *) connection_threadmain, NULL,
 		                     PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
 		                     PR_UNJOINABLE_THREAD,
-		                     SLAPD_DEFAULT_THREAD_STACKSIZE
-		) == NULL ) {
+		                     SLAPD_DEFAULT_THREAD_STACKSIZE ) == NULL )
+		{
 			int prerr = PR_GetError();
 			LDAPDebug( LDAP_DEBUG_ANY, "PR_CreateThread failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				prerr, slapd_pr_strerror( prerr ), 0 );
@@ -619,14 +598,15 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
 	 * we let SEARCH operations through as well.  The search code
 	 * is responsible for checking if the operation is a root DSE
 	 * search. */
-        if ((slapi_sdn_get_dn(&(op->o_sdn)) == NULL ) &&
-            /* anon access off and something other than BIND, EXTOP, UNBIND or ABANDON */
+	if ((slapi_sdn_get_dn(&(op->o_sdn)) == NULL ) &&
+		/* anon access off and something other than BIND, EXTOP, UNBIND or ABANDON */
 	    (((config_get_anon_access_switch() == SLAPD_ANON_ACCESS_OFF) && (op->o_tag != LDAP_REQ_BIND) &&
-             (op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) && (op->o_tag != LDAP_REQ_ABANDON)) ||
-            /* root DSE access only and something other than BIND, EXTOP, UNBIND, ABANDON, or SEARCH */
+		 (op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) && (op->o_tag != LDAP_REQ_ABANDON)) ||
+		/* root DSE access only and something other than BIND, EXTOP, UNBIND, ABANDON, or SEARCH */
 	    ((config_get_anon_access_switch() == SLAPD_ANON_ACCESS_ROOTDSE) && (op->o_tag != LDAP_REQ_BIND) &&
-	     (op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) &&
-	     (op->o_tag != LDAP_REQ_ABANDON) && (op->o_tag != LDAP_REQ_SEARCH)))) {
+	    (op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) &&
+	    (op->o_tag != LDAP_REQ_ABANDON) && (op->o_tag != LDAP_REQ_SEARCH))))
+	{
 		slapi_log_access( LDAP_DEBUG_STATS,
 			"conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
 			" - Anonymous access not allowed\n",
@@ -803,827 +783,6 @@ int connection_is_active_nolock (Connection *conn)
            !(conn->c_flags & CONN_FLAG_CLOSING);
 }
 
-/* returns non-0 if this is an active connection meaning it is in use
-   and not in the closing mode */
-
-#if defined LDAP_IOCP
-/*
- * IO Completion ports are currently only available on NT.
- */
-
-typedef enum  {read_data, write_data, new_connection} work_type;
-static int wait_on_new_work(Connection **ppConn, work_type *type);
-static int issue_new_read(Connection *conn);
-static int finished_chomping(Connection *conn);
-static int read_the_data(Connection *op, int *process_op, int *defer_io, int *defer_pushback);
-static int is_new_operation(Connection *conn);
-static int process_operation(Connection *conn, Operation *op);
-static int connection_operation_new(Connection *conn, Operation **ppOp);
-Operation *get_current_op(Connection *conn);
-static int handle_read_data(Connection *conn,Operation **op,
-	 int * connection_referenced);
-int queue_pushed_back_data(Connection *conn);
-static int add_to_select_set(Connection *conn);
-
-static void inc_op_count(Connection* conn)
-{
-	PR_AtomicIncrement(&conn->c_opscompleted);
-	slapi_counter_increment(ops_completed);
-}
-
-static int connection_increment_reference(Connection *conn)
-{
-	int rc = 0;
-	PR_Lock( conn->c_mutex );
-	rc = connection_acquire_nolock (conn);
-	PR_Unlock( conn->c_mutex );
-	return rc;
-}
-
-static void connection_decrement_reference(Connection *conn)
-{
-	PR_Lock( conn->c_mutex );
-	connection_release_nolock (conn);
-	PR_Unlock( conn->c_mutex );
-}
-
-static void
-connection_threadmain()
-{
-	/*
-	 * OK, so this is the thread main routine for the thread pool.
-	 * This is the general idea : wait on the i/o completion port.
-	 * then get some data. There are three cases here:
-	 * 1) This is the first piece of data read for a new LDAP op.
-	 * 2) This is a subsequent, but not final, piece of data read in the current LDAP op on this connection
-	 * 3) This is the last piece of the current LDAP op on the current connection.
-	 * Note that these cases are NOT exclusive ! In particular, all three can occur for the same read.
-	 * based on detecting these cases, we end up doing one or more of the following things:
-	 * a) Create new structures for a new op.
-	 * b) Read data into the BER buffer for the op.
-	 * c) Press on to service the operation request (note that the results are currently written
-	 * synchronously.
-	 * We always queue a new read on the socket too.
-	 * (Note, we need to make sure we don't issue the new read operation until we've copied
-	 * the data from the existing one. Otherwise we'd open ourselves to getting OOO data.)
-	 *
-	 * The intention is that this code will be clean enough to be used for the UNIX build,
-	 * once we fake up I/O completion ports with select and another thread.
-	 */
-
-	Connection *conn = NULL;
-	Operation *op = NULL;
-	int return_value = -1;
-	int abandon_connection = 0;
-	work_type command = 0;
-	int connection_referenced = 0;
-
-	/* Don't ask me, and I will tell you no lies */
-#if defined( OSF1 ) || defined( hpux ) || defined( LINUX )
-	/* Arrange to ignore SIGPIPE signals. */
-	SIGNAL( SIGPIPE, SIG_IGN );
-#endif
-
-	while (1) {
-
-		abandon_connection = 1; /* we start off assuming that we'll fail somewhere */
-		conn = NULL; /* just make sure we don't step on an old connection by mistake */
-		op = NULL; /* Same goes for the operation */
-
-		return_value = wait_on_new_work(&conn,&command);
-        if( op_shutdown ) 
-            break;
-		if (0 == return_value) {
-			connection_referenced = 0; /* No outstanding ref count on connection if wait for work returned OK */
-			switch (command) {
-				case read_data:
-					return_value = handle_read_data(conn,&op,&connection_referenced);
-					if (0 == return_value)
-					{
-						abandon_connection = 0;
-					}
-					break;
-				case write_data:
-					/* NYI, but we need to go and find the state for the connection, find the operation
-					 * which queued the write, and then get whatever data we need to write, then write it ! */
-					break;
-				case new_connection:
-					/* NYI, but this would consist of the same stuff which is currently in daemon.c.
-					 * On NT, we'd use AcceptEx() */
-					break;
-				default:
-					break;
-			}
-			finished_chomping(conn);
-		} else {
-			PR_SetError(PR_IO_ERROR, return_value);
-			connection_referenced = 1; /* There is an outstanding refcnt on the conn, so we get to close the right one ! */
-		}
-
-		/* If anything went wrong with the connection above, such that we need to
-		 * disconnect it, we'll know here and shoot it in the foot.
-		 */
-		if ( (NULL != conn) && abandon_connection) {
-			disconnect_server(conn, conn->c_connid, op ? op->o_opid : -1, SLAPD_DISCONNECT_ABORT, 0 );
-			if (connection_referenced) {
-				connection_decrement_reference(conn);
-			}
-		}
-	}
-	g_decr_active_threadcnt();
-}
-
-static int handle_read_data(Connection *conn,Operation **op,
-			 int * connection_referenced)
-{
-	int return_value = 0;
-	int return_value2 = 0;
-	int process_op = 0; /* Do we or do we not process a complete operation now ? */
-	int defer_io = 0;
-	int defer_pushback = 0;
-
-	if (is_new_operation(conn)) {
-		return_value = connection_operation_new(conn,op);
-	} else {
-		*op = get_current_op(conn);
-	}
-	
-	/* if connection is closing */
-	if (return_value != 0) {
-	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "handle_read_data returns as conn %" NSPRIu64 " closing, fd=%d\n",
-		      conn->c_connid,conn->c_sd,0);
-	    return return_value;
-	}
-
-	return_value = read_the_data(conn,&process_op, &defer_io, &defer_pushback);
-
-	if (0 == return_value) {
-		int replication_session = conn->c_isreplication_session;
-		if (0 != process_op)
-			return_value = process_operation(conn,*op);
-		/* Post any pending I/O operation _after_ processing any operation */
-		if (replication_session) {
-			/* Initiate any deferred I/O here */
-			if (defer_io) {
-				if (conn->c_flags & CONN_FLAG_SSL) {
-					add_to_select_set(conn);
-					return_value2 = 0;
-				} else {
-					return_value2 = issue_new_read(conn);
-				}
-			}
-			if (defer_pushback) {
-				return_value2 = queue_pushed_back_data(conn);
-			}
-		}
-	}
-	else
-		*connection_referenced = 1;
-
-	if (return_value) {
-		return return_value;
-	} else {
-		return return_value2;
-	}
-}
-
-/* Function which does the work involved in servicing an LDAP operation. */
-static int process_operation(Connection *conn, Operation *op)
-{
-	Slapi_PBlock	*pb = NULL;
-	ber_len_t	len;
-	ber_tag_t	tag;
-	ber_int_t	msgid;
-	int return_value = 0;
-	int destroy_content = 1;
-
-
-	pb = (Slapi_PBlock *) slapi_ch_calloc( 1, sizeof(Slapi_PBlock) );
-	pb->pb_conn = conn;
-	pb->pb_op = op;
-    /* destroy operation content when done */
-    slapi_pblock_set (pb, SLAPI_DESTROY_CONTENT, &destroy_content);
-
-	if (! config_check_referral_mode()) {
-		slapi_counter_increment(ops_initiated);
-		slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsInOps); 
-	}
-
-	if ( (tag = ber_get_int( op->o_ber, &msgid ))
-		!= LDAP_TAG_MSGID ) {
-		/* log, close and send error */
-		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%" NSPRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
-		return_value = -1;
-		goto done;
-	}
-	op->o_msgid = msgid;
-
-	tag = ber_peek_tag( op->o_ber, &len );
-	switch ( tag ) {
-	  case LBER_ERROR:
-	  case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
-		/* log, close and send error */
-		LDAPDebug( LDAP_DEBUG_ANY,
-			"conn=%" NSPRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
-		return_value = -1;
-		goto done;
-	  default:
-		break;
-	}
-	op->o_tag = tag;
-
-	/* are we in referral-only mode? */
-	if (config_check_referral_mode() && tag != LDAP_REQ_UNBIND)
-	{
-	    referral_mode_reply(pb);
-	    goto done;
-	}
-
-	/* check if new password is required */
-	if(connection_need_new_password(conn, op, pb))
-	{
-		goto done;
-	}
-
-        /* if this is a bulk import, only "add" and "import done (extop)" are 
-         * allowed */
-        if (conn->c_flags & CONN_FLAG_IMPORT) {
-            if ((tag != LDAP_REQ_ADD) && (tag != LDAP_REQ_EXTENDED)) {
-                /* no cookie for you. */
-                LDAPDebug(LDAP_DEBUG_ANY, "Attempted operation %d from "
-                          "within bulk import\n", tag, 0, 0);
-                slapi_send_ldap_result(pb, LDAP_PROTOCOL_ERROR, NULL, NULL,
-                                       0, NULL);
-                return_value = -1;
-                goto done;
-            }
-        }
-
-	/*
-	 * Call the do_<operation> function to process this request.
-	 */
-	connection_dispatch_operation(conn, op, pb);
-
-done:
-
-	/* If we're here, it means that we successfully completed an operation , so bump the counts */
-	inc_op_count(conn);
-
-	if ( !( pb->pb_op->o_flags & OP_FLAG_PS )) {
-	    /*
-	     * If not a persistent search, remove the operation
-	     * from this connection's list.
-	     */
-	    PR_Lock( conn->c_mutex );
-	    connection_remove_operation( conn, op );
-	    PR_Unlock( conn->c_mutex );
-
-		/* destroying the pblock will cause destruction of the operation
-		 * so this must happen before releasing the connection
-		 */
-	    slapi_pblock_destroy( pb );
-
-	    PR_Lock( conn->c_mutex );
-        if (connection_release_nolock (conn) != 0)
-	    {
-			return_value = -1;
-		}
-	    PR_Unlock( conn->c_mutex );
-
-	} else { /* ps code acquires ref to conn - we need to release ours here */
-	    PR_Lock( conn->c_mutex );
-        if (connection_release_nolock (conn) != 0)
-	    {
-			return_value = -1;
-		}
-	    PR_Unlock( conn->c_mutex );
-	}
-	return return_value;
-}
-
-/* Helper functions for the code above: */
-
- 
-struct Conn_private {
-	/* First the platform-dependent part */
-#ifdef _WIN32
-	OVERLAPPED c_overlapped;
-	DWORD c_buffer_size;
-	char *c_buffer;
-	DWORD c_number_of_async_bytes_read;
-	DWORD c_buffer_offset;
-	DWORD c_deferred_length;
-#else
-#endif
-	/* Now the platform independent part */
-	Operation *c_current_op;
-	int c_flags;
-};
-
-static void connection_free_private_buffer(Connection *conn)
-{
-#ifdef _WIN32
-	if (NULL != conn->c_private) {
-		slapi_ch_free( (void**)&conn->c_private->c_buffer);
-	}
-#else
-#endif
-}
-
-#define FLAG_CONN_HAD_SOME 1 /* Set when we've read the first piece of data already, means we don't need to allocate a new op */
-#define FLAG_CONN_COMPLETE 2 /* Set when we've read all of an LDAP operation request, means we can proceed to process it */
-
-
-/* Little helper functions */
-
-Operation *get_current_op(Connection *conn)
-{
-	Operation *return_op = conn->c_private->c_current_op;
-	PR_ASSERT(NULL != return_op);
-	return return_op;
-}
-
-static int is_new_operation(Connection *conn)
-{
-	if (0 == conn->c_private->c_flags) {
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-/* Called when a new operation comes in on a connection */
-static int connection_operation_new(Connection *conn, Operation **ppOp)
-{
-	/* we need to make a new operation structure and chain it onto the connection */
-	Operation *temp_op = NULL;
-	int rc;
-
-	PR_Lock( conn->c_mutex );
-	if (connection_is_active_nolock(conn) == 0) {
-	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "not creating a new operation when conn %" NSPRIu64 " closing\n",
-		      conn->c_connid,0,0);
-	    PR_Unlock( conn->c_mutex );
-	    return -1;
-	}
-	temp_op = operation_new( plugin_build_operation_action_bitmap( 0,
-			plugin_get_server_plg() ));
-	connection_add_operation( conn, temp_op);
-	rc = connection_acquire_nolock (conn); 
-	PR_Unlock( conn->c_mutex );
-	/* Stash the op pointer in the connection structure for later use */
-	PR_ASSERT(NULL == conn->c_private->c_current_op);
-	conn->c_private->c_current_op = temp_op;
-	*ppOp = temp_op;
-	return rc;
-}
-
-/* Call this to tell the select thread to put us back into the read-ready signal set */
-static int add_to_select_set(Connection *conn)
-{
-	conn->c_gettingber = 0;
-	signal_listner();
-	return 0;
-}
-
-static int remove_from_select_set(Connection *conn)
-{
-	conn->c_gettingber = 1;
-	return 0;
-}
-
-/* Helper functions from here on are platform-dependent */
-/* First the NT ones */
-
-#ifdef _WIN32
-
-static HANDLE completion_port = INVALID_HANDLE_VALUE;
-#define COMPKEY_DIE ((DWORD) -1L) /* used to kill off workers */
-
-static void push_back_data(Connection *conn, size_t offset, size_t length);
-static int queue_pushed_back_data(Connection *conn);
-
-/* Called when we've read from the completion queue, so there's data
- * waiting for us to pickup. We're told: the number of bytes read, the
- * address of the buffer, the state of this connection (new op, middle of op).
- */
-static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *defer_pushback)
-{
-	Conn_private *priv = conn->c_private;
-	Operation *op = NULL;
-	DWORD Bytes_Read = 0;
-	char *Buffer = NULL;
-	ber_tag_t tag = 0;
-	int return_value = -1;
-	ber_len_t ber_len = 0;
-	ber_len_t Bytes_Scanned = 0;
-
-	*defer_io = 0;
-	*defer_pushback = 0;
-
-	op = priv->c_current_op;
-	Bytes_Read = priv->c_number_of_async_bytes_read;
-	Buffer = priv->c_buffer + priv->c_buffer_offset;
-
-	PR_ASSERT(NULL != op->o_ber);
-	
-	/* Is this an SSL connection ? */
-	if (0 == (conn->c_flags & CONN_FLAG_SSL)) {
-		/* Not SSL */
-
-		if (! config_check_referral_mode()) {
-		/* Update stats */
-			PR_Lock( op_thread_lock );
-			(*(g_get_global_snmp_vars()->ops_tbl.dsBytesRecv)) += Bytes_Read;	 
-			PR_Unlock( op_thread_lock );
-		}
-
-		/* We need to read the data into the BER buffer */
-		/* This can return a tag pr LBER_DEFAULT, indicating some error condition */
-		tag = ber_get_next_buffer_ext( Buffer, Bytes_Read, &ber_len, op->o_ber, &Bytes_Scanned, conn->c_sb );
-		if (LBER_DEFAULT == tag || LBER_OVERFLOW == tag)
-		{
-			if (0 == Bytes_Scanned)
-			{
-				/* Means we encountered an error---eg the client sent us pure crap---
-				a bunch of bytes which we took to be a tag, length, then we ran off the
-				end of the buffer. The next time we get here, we'll be returned LBER_DEFAULT
-				This means that everything we've seen up till now is useless because it wasn't
-				an LDAP message. 
-				So, we toss it away ! */
-				if (LBER_OVERFLOW == tag) {
-					slapi_log_error( SLAPI_LOG_FATAL, "connection",
-						"conn=%" NSPRIu64 " fd=%d The length of BER Element was too long.\n",
-						conn->c_connid, conn->c_sd );
-				}
-				PR_Lock( conn->c_mutex );
-				connection_remove_operation( conn, op );
-				operation_free(&op, conn);
-				priv->c_current_op = NULL;
-				PR_Unlock( conn->c_mutex );
-				return -1; /* Abandon Connection */
-			}
-		}
-		if (is_ber_too_big(conn,ber_len))
-		{
-			PR_Lock( conn->c_mutex );
-			connection_remove_operation( conn, op );
-			operation_free(&op, conn);
-			priv->c_current_op = NULL;
-			PR_Unlock( conn->c_mutex );
-			return -1; /* Abandon Connection */
-		}
-
-		/* We set the flag to indicate that we'er in the middle of an op */
-		priv->c_flags |= FLAG_CONN_HAD_SOME;
-		
-		/* Then we decide whether this is the last read for the current op */
-		/* and set the flag accordingly */
-		if (LBER_DEFAULT != tag) {	/* we received a complete message */
-			if (LDAP_TAG_MESSAGE == tag) {	/* looks like an LDAP message */
-				/* It's time to process this operation */
-				*process_op = 1;
-				priv->c_current_op = NULL;
-				priv->c_flags = 0;
-			} else {
-				/*
-				 * We received a non-LDAP message.  Log and close connection.
-				 */
-				LDAPDebug( LDAP_DEBUG_ANY,
-					"conn=%" NSPRIu64 " received a non-LDAP message"
-					" (tag 0x%lx, expected 0x%lx)\n",
-					conn->c_connid, tag, LDAP_TAG_MESSAGE );
-				PR_Lock( conn->c_mutex );
-				connection_remove_operation( conn, op );
-	     	    operation_free(&op, conn);
-				priv->c_current_op = NULL;
-				PR_Unlock( conn->c_mutex );
-				return -1; /* Abandon Connection */
-			}
-		}
-
-		/* Finally, mark whether there's the beginning of another operation remaining in the buffer */
-		/* If there is, queue up another I/O completion request on the port to get it handled OK */
-		/* If not, issue a new read on the socket. */
-		if (Bytes_Scanned != Bytes_Read) {
-		        if (connection_increment_reference(conn) == -1) {
-			    LDAPDebug(LDAP_DEBUG_CONNS,
-				      "could not acquire lock in issue_new_read as conn %" NSPRIu64 " closing fd=%d\n",
-				      conn->c_connid,conn->c_sd,0); 
-			    /* XXX how to handle this error? */
-			    /* MAB: 25 Jan 01: let's try like this and pray this won't leak... */
-			    /* GB : this should be OK because an error here 
-			     * means some other thread decided to close the
-		             * connection, which mean a fatal error happened
-			     * in that case just forget about the remaining 
-		 	     * data and return
-			     */
-			    return (0);
-			}
-			push_back_data(conn,priv->c_overlapped.Offset + Bytes_Scanned,Bytes_Read-Bytes_Scanned);
-			if (!conn->c_isreplication_session) {
-				if ((return_value = queue_pushed_back_data(conn)) == -1) {
-		 			/* MAB: 25 jan 01 we need to decrement the conn refcnt before leaving... Otherwise,
-					 * this thread will unbalance the ref_cnt inc and dec for this connection
-					 * and the result is that the connection is never closed and instead is kept 
-					 * forever an never released -> this was causing a fd starvation on NT
-					 */
-					connection_decrement_reference(conn);
-					LDAPDebug(LDAP_DEBUG_CONNS,
-						  "push_back_data failed: closing conn %" NSPRIu64 " fd=%d\n",
-						  conn->c_connid,conn->c_sd,0); 
-				}
-			} else {
-				/* Queue the I/O later to serialize */
-				*defer_pushback = 1;
-				return_value = 0;
-			}
-		} else {
-			priv->c_overlapped.Offset = 0;
-			if (!conn->c_isreplication_session) {
-				return_value = issue_new_read(conn);
-			} else {
-				/* Queue the I/O later to serialize */
-				*defer_io = 1;
-				return_value = 0;
-			}
-		}
-	} else {
-		/* SSL */
-		if ( (tag = ber_get_next( conn->c_sb, &ber_len, op->o_ber ))
-			   != LDAP_TAG_MESSAGE ) {
-			return( -1 );
-		}
-		if(is_ber_too_big(conn,ber_len))
-		{
-		    return( -1 );
-		}
-		/* Put this connection back into the read-ready signal state */
-		/* priv->c_flags |= FLAG_CONN_COMPLETE; Redundant now */
-		/* It's time to process this operation */
-		*process_op = 1;
-		priv->c_current_op = NULL;
-		priv->c_flags = 0;
-		return_value = 0;
-		if (!conn->c_isreplication_session) {
-			add_to_select_set(conn);
-		} else {
-			*defer_io = 1;
-		}
-	}
-
-	return return_value;
-}
- 
-void push_back_data(Connection *conn, size_t offset, size_t length)
-{
-	conn->c_private->c_overlapped.Offset = offset;
-	conn->c_private->c_deferred_length = length;
-}
-
-int queue_pushed_back_data(Connection *conn)
-{
-	/* Use PostQueuedCompletionStatus() to push the data back up the pipe */
-	BOOL return_bool = FALSE;
-
-	return_bool = PostQueuedCompletionStatus(completion_port,conn->c_private->c_deferred_length,(DWORD)conn,&conn->c_private->c_overlapped); 
-
-	if (return_bool) {
-		return 0;
-	} else {
-		return -1;
-	}
-}
-
-/* This function issues a new read operation on the connection.
- * Called once we've finished reading everything from the buffer.
- * VMS crusties will notice the similarity to $QIO.
- */
-int issue_new_read(Connection *conn)
-{
-	BOOL return_bool = FALSE;
-	HANDLE socket = INVALID_HANDLE_VALUE;
-	void **buffer = NULL;
-	DWORD bytes_read = 0;
-	DWORD buffer_size = 0;
-	OVERLAPPED *overlapped = NULL;
-
-	PR_ASSERT(NULL != conn);
-	socket = (HANDLE)conn->c_sd;
-	PR_ASSERT(NULL != socket);
-
-	/* here we make sure that we have a buffer allocated */
-	buffer = &conn->c_private->c_buffer;
-	if (NULL == *buffer) {
-		*buffer = (void*)slapi_ch_malloc(LDAP_SOCKET_IO_BUFFER_SIZE);
-		if (NULL == *buffer) {
-			/* memory allocation failure */
-			return -1;
-		}
-		conn->c_private->c_buffer_size = LDAP_SOCKET_IO_BUFFER_SIZE;
-	}
-
-	buffer_size = conn->c_private->c_buffer_size;
-	overlapped = &conn->c_private->c_overlapped;
-
-	if (connection_increment_reference(conn) == -1) {
-	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "could not acquire lock in issue_new_read as conn %" NSPRIu64 " closing fd=%d\n",
-		      conn->c_connid,conn->c_sd,0); 
-	    /* This means that the connection is closing */
-	    return -1;
-	}
-	return_bool = ReadFile(socket,*buffer,buffer_size,&bytes_read,overlapped);
-	if ( !return_bool && ERROR_IO_PENDING != GetLastError( ) ) {
-		/* This means that the connection is shot for some reason */
-		connection_decrement_reference(conn);
-		return -1;
-    } else {
-		/* Our work is done, i/o read now queued */
-		return 0;
-	}
-}
-
-static int wait_on_new_work(Connection **ppConn, work_type *type)
-{
-	/* Here, we wait on the I/O completion port for new data */
-	/* because we're not sure whether the completion port has been created yet,
-	 * we wait 'till it has been.
-	 */
-	Connection *temp_conn = NULL;
-	DWORD Bytes_Received = 0;
-	OVERLAPPED *pOverlapped = NULL;
-	BOOL return_bool = FALSE;
-
-	*type = read_data;
-
-	while ( (INVALID_HANDLE_VALUE == completion_port) && (!op_shutdown) ) {
-		Sleep(100);
-	}
-	while (1) {
-		if (op_shutdown) {
-			return EINTR;
-		}
-		return_bool = GetQueuedCompletionStatus(completion_port,&Bytes_Received,(DWORD*)&temp_conn,&pOverlapped,INFINITE);
-        if ((unsigned long)temp_conn == COMPKEY_DIE ) {                       
-			 continue;  /* kill this worker */
-        }
-		if (TRUE == return_bool) {
-			/* we successfully completed the I/O operation */
-			/* set the connection pointer the caller gave us to the one from the port */
-			PR_ASSERT(NULL != pOverlapped);
-			PR_ASSERT(NULL != temp_conn);
-			*ppConn = temp_conn;
-			/* store the # bytes read in the connection structure */
-			(*ppConn)->c_private->c_number_of_async_bytes_read = Bytes_Received;
-			(*ppConn)->c_private->c_buffer_offset = (*ppConn)->c_private->c_overlapped.Offset;
-			if( Bytes_Received == 0 )
-			{
-				/* 0 bytes received from a completed overlapped I/O 
-				 operation means the socket's been closed. */
-				break;
-			}
-			(*ppConn)->c_idlesince = current_time();
-			/* If we exit here, everything is OK */
-			connection_decrement_reference(temp_conn);
-			return 0;
-		}
-		if ( (FALSE == return_bool) && (NULL == pOverlapped) ) {
-			/* we timed out */
-            /* slapi_log_error( SLAPI_LOG_FATAL, "connection",
-		                     "GetQueuedCompletionStatus call timed out\n");*/
-			continue;
-		}
-		if ( (FALSE == return_bool) && (NULL != pOverlapped)) {
-			/* signifies some sort of i/o error, most likely an abortive close */
-            /* slapi_log_error( SLAPI_LOG_FATAL, "connection",
-		            "GetQueuedCompletionStatus call failed; error - %ld\n", GetLastError());*/
-			if (NULL != temp_conn) {
-				/* If we were told the connection, return it--otherwise we can't tell which connection to close */
-				*ppConn = temp_conn;
-			}
-			break;
-		}
-	}
-	return EPIPE; /* we failed to read for some reason */
-}
-
-int connection_new_private(Connection *conn)
-{
-	/* first add to the completion port */
-	DWORD threads = 10; /* DBDB hackhack */
-	HANDLE socket = INVALID_HANDLE_VALUE;
-	HANDLE return_port = NULL;
-	Conn_private *priv = NULL;
-	int return_value = -1;
-	
-	PR_ASSERT(NULL != conn);
-
-	socket = (HANDLE) conn->c_sd;
-
-	/* make the private data if it isn't already there */
-
-	if (NULL == conn->c_private) {
-		Conn_private *new_private = (Conn_private *)slapi_ch_malloc(sizeof(Conn_private));
-		if (NULL == new_private) {
-			/* memory allocation failed */
-			return -1;
-		}
-		conn->c_private = new_private;
-		ZeroMemory(conn->c_private,sizeof(Conn_private));
-	}
-	priv = conn->c_private;
-	/* Make sure the private structure is cleared */
-	/* Note: you must modify this code if the contents
-	 * of the structure are changed---we can't simply 
-	 * zero the structure because we want to preserve the
-	 * buffer. IMPORTANT---here we reuse the I/O buffer
-	 * from before. This is deliberate, to avoid mallocing again */
-	ZeroMemory(&(priv->c_overlapped),sizeof(OVERLAPPED));
-	priv->c_number_of_async_bytes_read = 0;
-	priv->c_buffer_offset = 0;
-	priv->c_flags = 0;
-	priv->c_current_op = NULL;
-
-
-	if (INVALID_HANDLE_VALUE == completion_port) {
-		/* completion port not yet setup, we need to make it */
-		completion_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE,NULL,0,0);
-		if (NULL == completion_port) {
-			LDAPDebug(LDAP_DEBUG_ANY,"Failed to create master I/O completion port\n",0,0,0);
-			return -1;
-		}
-	}
-	/* If the connection is SSL, don't do the right thing */
-	if (0 == (conn->c_flags & CONN_FLAG_SSL)) {
-		return_port = CreateIoCompletionPort(socket,completion_port,(DWORD)conn,0);
-		if (NULL == return_port) {
-			LDAPDebug(LDAP_DEBUG_ANY,"Failed to associate socket with I/O completion port, fd=%d,GetLastError = %d\n",socket,GetLastError(),0);
-			return -1;
-		}
-		/* Now queue the initial read on this connection */
-		return_value = issue_new_read(conn);
-	} else {
-		return_value = 0;
-	}
-
-	return return_value;
-}
-
-/* If all is well, this only gets called for SSL connections */
-int connection_activity(Connection *conn)
-{
-	/* First check that this really is an SSL connection */
-	if (0 == (conn->c_flags & CONN_FLAG_SSL)) {
-		return -1;
-	}
-	/* Now, the plan here is to push something up the IOCP pipe */
-	/* We need to fake something up so that the code which pulls 
-	 * it off the queue does the right thing. Here's what we do:
-	 * We just call PostQueuedCompletionStatus like normal.
-	 * The connection is marked as SSL, and it is this that the
-	 * reading code notices. Simple !
-	 */
-	/* Also, we need to participate in the signaling protocol to the select thread */
-	remove_from_select_set(conn);
-	/* We hold the lock already, increment the reference count, which will
-	   be decremented in wait_for_new_work(). */
-	if (connection_acquire_nolock (conn) == -1) {
-	    LDAPDebug(LDAP_DEBUG_CONNS,
-		      "could not acquire lock in connection_activity as conn %" NSPRIu64 " closing fd=%d\n",
-		      conn->c_connid,conn->c_sd,0); 
-	    /* XXX how to handle this error? */
-	    /* MAB: 25 Jan 01: let's return on error and pray this won't leak */
-	    return (-1);
-	}
-	push_back_data(conn, 0, 1);
-	return queue_pushed_back_data(conn);
-}
-
-static int finished_chomping(Connection *conn)
-{
-	/* On NT we don't need to do anything here */
-	return 0;
-}
-
-#else /* WIN32/UNIX */
-
-/*
- * This is where the UNIX Helper functions would be if IO
- * Completion Ports were supported on UNIX.
- */
-
-#endif	/* WIN32/UNIX */
-
-#else /* LDAP_IOCP */
-
-/*
- * IO Completion Ports are not available on this platform.
- */
-
 /* The connection private structure for UNIX turbo mode */
 struct Conn_private
 {
@@ -1681,7 +840,7 @@ openldap_read_function(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
 		errno = EWOULDBLOCK;
 #elif defined(EAGAIN)
 		errno = EAGAIN;
-#endif			
+#endif
 		PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
 	} else {
 		/* copy buffered data into output buf */
@@ -2789,8 +1948,6 @@ get_work_q(struct Slapi_op_stack **op_stack_obj)
 
 	return (wqitem);
 }
-#endif /* LDAP_IOCP */
-
 
 /* Helper functions common to both varieties of connection code: */
 
@@ -2801,12 +1958,6 @@ get_work_q(struct Slapi_op_stack **op_stack_obj)
 void
 op_thread_cleanup()
 {
-#ifdef _WIN32
-	int i;
-	PRIntervalTime    interval;
-	int max_threads = config_get_threadnumber();
-	interval = PR_SecondsToInterval(3);
-#endif	
 	LDAPDebug( LDAP_DEBUG_ANY,
 		   "slapd shutting down - signaling operation threads - op stack size %d max work q size %d max work q stack size %d\n",
 		   op_stack_size, work_q_size_max, work_q_stack_size_max);
@@ -2815,17 +1966,6 @@ op_thread_cleanup()
 	PR_Lock( work_q_lock );
 	PR_NotifyAllCondVar ( work_q_cv ); /* tell any thread waiting in connection_wait_for_new_work to shutdown */
 	PR_Unlock( work_q_lock );
-#ifdef _WIN32 
-	LDAPDebug( LDAP_DEBUG_ANY,
-		"slapd shutting down - waiting for %d threads to terminate\n",
-		g_get_active_threadcnt(), 0, 0 );
-	/* kill off each worker waiting on GetQueuedCompletionStatus */
-	for ( i = 0; i < max_threads; ++ i )
-	{
-		PostQueuedCompletionStatus( completion_port, 0, COMPKEY_DIE ,0);
-	}
-	/* don't sleep: there's no reason to do so here DS_Sleep(interval); */ /* sleep 3 seconds */
-#endif
 }
 
 /* do this after all worker threads have terminated */
@@ -3181,7 +2321,7 @@ connection_abandon_operations( Connection *c )
 		 * handle it here until a better solution is found
 		 */	
 		if ( op->o_status != SLAPI_OP_STATUS_RESULT_SENT ||
-			op->o_flags & OP_FLAG_PS ) {
+			(op->o_flags & OP_FLAG_PS) ) {
 			op->o_status = SLAPI_OP_STATUS_ABANDONED;
 		}
 	}
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index cd05313..7845a5d 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -77,10 +77,9 @@ connection_table_new(int table_size)
 		ber_sockbuf_set_option( ct->c[i].c_sb, LBER_SOCKBUF_OPT_NO_READ_AHEAD, LBER_OPT_ON );
 		ber_sockbuf_set_option( ct->c[i].c_sb, LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE, &maxbersize );
 #endif /* !USE_OPENLDAP */
-#ifndef _WIN32
 		/* all connections start out invalid */
 		ct->fd[i].fd = SLAPD_INVALID_SOCKET;
-#endif
+
 		/* The connection table has a double linked list running through it.
 		 * This is used to find out which connections should be looked at
 		 * in the poll loop.  Slot 0 in the table is always the head of 
@@ -109,31 +108,6 @@ void connection_table_free(Connection_Table *ct)
 	slapi_ch_free((void**)&ct);
 }
 
-
-#ifdef _WIN32
-/*
- * This function looks up connection by nspr fd. It is
- * slow because it iterrates through the entire connection
- * array. Currently, it is only used on NT in secure_read_function
- * to handle I/O timeout on SSL socket we should almost never
- * happen.
- */
-Connection*
-connection_table_get_connection_from_fd(Connection_Table *ct,PRFileDesc *prfd)
-{
-    int i;
-    for (i = 0; i < ct->size; i++)
-    {
-        if (ct->c[i].c_prfd == prfd)
-        {
-            return (&(ct->c[i]));
-        }
-    }
-
-    return NULL;
-}
-#endif
-
 void
 connection_table_abandon_all_operations(Connection_Table *ct)
 {
@@ -434,15 +408,7 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
 				nreadwaiters++;
 			}
 
-#ifdef _WIN32
-			{
-			struct tm *pt;
-			pt = gmtime( &ct->c[i].c_starttime );
-			memcpy(&utm, pt, sizeof(struct tm) );
-			}
-#else
 			gmtime_r( &ct->c[i].c_starttime, &utm );
-#endif
 			strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", &utm );
 
 			/*
diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c
index f87f2d1..5214c45 100644
--- a/ldap/servers/slapd/csngen.c
+++ b/ldap/servers/slapd/csngen.c
@@ -40,16 +40,9 @@
 #  include <config.h>
 #endif
 
-
 /*
  *  csngen.c - CSN Generator
  */
-
-#ifdef _WIN32
-#define _WIN32_WINNT 0x0400
-#include <windows.h>
-#endif
-
 #include <string.h>
 #include "prcountr.h"
 #include "slap.h"
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index af378f5..820921c 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -42,12 +42,6 @@
 
 #include <string.h>
 #include <sys/types.h>
-#ifdef _WIN32
-#include <windows.h>
-#include <process.h> /* for getpid */
-#include "proto-ntutil.h"
-#include "ntslapdmessages.h"
-#else
 #include <unistd.h>
 #include <sys/socket.h>
 #include <errno.h>
@@ -62,7 +56,6 @@
 #if defined(HAVE_MNTENT_H)
 #include <mntent.h>
 #endif
-#endif
 #include <time.h>
 #include <signal.h>
 #if defined(IRIX6_2) || defined(IRIX6_3)
@@ -74,13 +67,11 @@
 #endif
 #include <fcntl.h>
 #define TCPLEN_T	int
-#if !defined( _WIN32 )
 #ifdef NEED_FILIO
 #include <sys/filio.h>
 #else /* NEED_FILIO */
 #include <sys/ioctl.h>
 #endif /* NEED_FILIO */
-#endif /* !defined( _WIN32 ) */
 /* for some reason, linux tty stuff defines CTIME */
 #include <stdio.h>
 #ifdef LINUX
@@ -116,9 +107,6 @@ int slapd_wakeup_timer = SLAPD_WAKEUP_TIMER; /* time in ms to wakeup */
 short	slapd_housekeeping_timer = 10;
 #endif /* notdef GGOODREPL */
 
-/* Do we support timeout on socket send() ? */
-int have_send_timeouts = 0;
-
 PRFileDesc*		signalpipe[2];
 static int writesignalpipe = SLAPD_INVALID_SOCKET;
 static int readsignalpipe = SLAPD_INVALID_SOCKET;
@@ -155,9 +143,6 @@ static int get_configured_connection_table_size();
 static void get_loopback_by_addr( void );
 #endif
 
-#ifdef XP_WIN32
-static int createlistensocket(unsigned short port, const PRNetAddr *listenaddr);
-#endif
 static PRFileDesc **createprlistensockets(unsigned short port,
 	PRNetAddr **listenaddr, int secure, int local);
 static const char *netaddr2string(const PRNetAddr *addr, char *addrbuf,
@@ -173,141 +158,21 @@ static void setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileD
 static void* catch_signals();
 #endif
 
-#if defined( _WIN32 )
-HANDLE  hServDoneEvent = NULL;
-#endif
-
 static int createsignalpipe( void );
 
-#if defined( _WIN32 )
-/* Set an event to hook the NT Service termination */
-void *slapd_service_exit_wait()
-{
-#if defined( PURIFYING )
-
-#include <sys/types.h> 
-#include <sys/stat.h>
-
-	char module[_MAX_FNAME];
-	char exit_file_name[_MAX_FNAME];
-	char drive[_MAX_DRIVE];
-	char dir[_MAX_DIR];
-	char fname[_MAX_FNAME];
-	char ext[_MAX_EXT];
-	struct stat statbuf;
-
-	memset( module, 0, sizeof( module ) );
-	memset( exit_file_name, 0, sizeof( exit_file_name ) );
-
-	GetModuleFileName(GetModuleHandle( NULL ), module, sizeof( module ) );
-
-	_splitpath( module, drive, dir, fname, ext );
-
-	PR_snprintf( exit_file_name, sizeof(exit_file_name), "%s%s%s", drive, dir, "exitnow.txt" );
-
-    LDAPDebug( LDAP_DEBUG_ANY, "PURIFYING - Create %s to terminate the process.\n", exit_file_name, 0, 0 );
-
-	while ( TRUE )
-	{
-		if( stat( exit_file_name, &statbuf ) < 0)
-		{
-			Sleep( 5000 );  /* 5 Seconds */
-			continue;
-		}
-	    LDAPDebug( LDAP_DEBUG_ANY, "slapd shutting down immediately, "
-		"\"%s\" exists - don't forget to delete it\n", exit_file_name, 0, 0 );
-		g_set_shutdown( SLAPI_SHUTDOWN_SIGNAL );
-		return NULL;
-	}
-
-#else /*  PURIFYING  */
-
-	DWORD dwWait;
-	char szDoneEvent[256];
-
-	PR_snprintf(szDoneEvent, sizeof(szDoneEvent), "NS_%s", pszServerName);
-
-	hServDoneEvent = CreateEvent( NULL,			// default security attributes (LocalSystem)
-								  TRUE,			// manual reset event
-								  FALSE,		// not-signalled
-								  szDoneEvent );// named after the service itself.
-
-    /*  Wait indefinitely until hServDoneEvent is signaled. */
-    dwWait = WaitForSingleObject( hServDoneEvent,  // event object
-								  INFINITE );      // wait indefinitely
-
-	/* The termination event has been signalled, log this occurrence, and signal to exit. */
-	ReportSlapdEvent( EVENTLOG_INFORMATION_TYPE, MSG_SERVER_SHUTDOWN_STARTING, 0, NULL );
-
-	g_set_shutdown( SLAPI_SHUTDOWN_SIGNAL );
-	return NULL;
-#endif /* PURIFYING  */
-}
-#endif /* _WIN32 */
-
 static char *
 get_pid_file()
 {
     return(pid_file);
 }
 
-static int daemon_configure_send_timeout(int s,size_t timeout /* Miliseconds*/)
-{
-	/* Currently this function is only good for NT, and expects the s argument to be a SOCKET */
-#if defined(_WIN32)
-	return setsockopt(
-		s,
-		SOL_SOCKET,
-		SO_SNDTIMEO,
-		(char*) &timeout,
-		sizeof(timeout)
-		);
-#else
-	return 0;
-#endif
-}
-
-#if defined (_WIN32)
-/* This function is a workaround for accept problem on NT. 
-   Accept call fires on NT during syn scan even though the connection is not
-   open. This causes a resource leak. For more details, see bug 391414.
-   Experimentally, we determined that, in case of syn scan, the local     
-   address is set to 0. This in undocumented and my change in the future
-    
-   The function returns 0 if this is normal connection
-                        1 if this is syn_scan connection
-                       -1 in case of any other error
- */
-static int 
-syn_scan (int sock)
-{
-    int rc;
-    struct sockaddr_in addr;
-    int size = sizeof (addr);
-
-    if (sock == SLAPD_INVALID_SOCKET)
-        return -1;
-
-    rc = getsockname (sock, (struct sockaddr*)&addr,  &size); 
-    if (rc != 0)
-        return -1;
-    else if (addr.sin_addr.s_addr == 0)
-        return 1;
-    else
-        return 0;
-}
-
-#endif
-
 static int
-accept_and_configure(int s, PRFileDesc *pr_acceptfd, PRNetAddr *pr_netaddr, 
+accept_and_configure(int s, PRFileDesc *pr_acceptfd, PRNetAddr *pr_netaddr,
 	int addrlen, int secure, int local, PRFileDesc **pr_clonefd)
 {
 	int ns = 0;
-
 	PRIntervalTime pr_timeout = PR_MillisecondsToInterval(slapd_wakeup_timer);
 
-#if !defined( XP_WIN32 ) /* UNIX */
 	(*pr_clonefd) = PR_Accept(pr_acceptfd, pr_netaddr, pr_timeout);
 	if( !(*pr_clonefd) ) {
 		PRErrorCode prerr = PR_GetError();
@@ -316,95 +181,22 @@ accept_and_configure(int s, PRFileDesc *pr_acceptfd, PRNetAddr *pr_netaddr,
 				prerr, slapd_pr_strerror(prerr), 0 );
 		return(SLAPD_INVALID_SOCKET);
 	}
-
 	ns = configure_pr_socket( pr_clonefd, secure, local );
 
-#else /* Windows */
-	if( secure ) {
-		(*pr_clonefd) = PR_Accept(pr_acceptfd, pr_netaddr, pr_timeout);
-		if( !(*pr_clonefd) ) {
-			PRErrorCode prerr = PR_GetError();
-			LDAPDebug( LDAP_DEBUG_ANY, "PR_Accept() failed, "
-				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n", 
-			    prerr, slapd_pr_strerror(prerr), 0 );
-
-			/* Bug 613324: Call PR_NT_CancelIo if an error occurs */
-			if( (prerr == PR_IO_TIMEOUT_ERROR ) ||
-			    (prerr == PR_PENDING_INTERRUPT_ERROR) ) {
-				if( (PR_NT_CancelIo( pr_acceptfd )) != PR_SUCCESS) {
-					prerr = PR_GetError();
-					LDAPDebug( LDAP_DEBUG_ANY, 
-						"PR_NT_CancelIo() failed, "
-						SLAPI_COMPONENT_NAME_NSPR 
-						" error %d (%s)\n",
-						prerr, slapd_pr_strerror(prerr), 0 );
-				}
-			}
-			return(SLAPD_INVALID_SOCKET);
-		}
-
-		ns = configure_pr_socket( pr_clonefd, secure, local );
-
-	} else { /* !secure */
-		struct sockaddr *addr; /* NOT IPv6 enabled */
-
-		addr = (struct sockaddr *) slapi_ch_malloc( sizeof(struct sockaddr) );
-		ns = accept (s, addr, (TCPLEN_T *)&addrlen);
-
-		if (ns == SLAPD_INVALID_SOCKET) {
-			int oserr = errno;
-			
-			LDAPDebug( LDAP_DEBUG_ANY,
-				   "accept(%d) failed errno %d (%s)\n",
-				   s, oserr, slapd_system_strerror(oserr));
-		}
-
-		else if (syn_scan (ns))
-		{
-			/* this is a work around for accept problem with SYN scan on NT.
-			See bug 391414 for more details */
-			LDAPDebug(LDAP_DEBUG_ANY, "syn-scan request is received - ignored\n", 0, 0, 0);				
-			closesocket (ns);
-			ns = SLAPD_INVALID_SOCKET;
-		}
-
-		PRLDAP_SET_PORT( pr_netaddr, ((struct sockaddr_in *)addr)->sin_port );
-		PR_ConvertIPv4AddrToIPv6(((struct sockaddr_in *)addr)->sin_addr.s_addr, &(pr_netaddr->ipv6.ip));
-
-		(*pr_clonefd) = NULL;
-
-		slapi_ch_free( (void **)&addr );
-		configure_ns_socket( &ns );
-	}
-#endif
-
 	return ns;
 }
 
 /* 
  * This is the shiny new re-born daemon function, without all the hair
  */
-#ifdef _WIN32
-static void setup_read_fds(Connection_Table *ct, fd_set *readfds, int n_tcps, int s_tcps );
-static void handle_read_ready(Connection_Table *ct, fd_set *readfds);
-static void set_timeval_ms(struct timeval *t, int ms);
-#endif
 /* GGOODREPL static void handle_timeout( void ); */
 static int handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, int secure, int local, Connection **newconn );
 #ifdef ENABLE_NUNC_STANS
 static void ns_handle_new_connection(struct ns_job_t *job);
 #endif
 static void handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll);
-#ifdef _WIN32
-static int clear_signal(fd_set *readfdset);
-#else
 static int clear_signal(struct POLL_STRUCT *fds);
-#endif
-#ifdef _WIN32
-static void unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, int n_tcps, PRFileDesc *s_tcps);
-#else
 static void unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_unix);
-#endif
 static int write_pid_file();
 static int init_shutdown_detect();
 
@@ -417,59 +209,27 @@ int daemon_pre_setuid_init(daemon_ports_t *ports)
 	int	rc = 0;
 
 	if (0 != ports->n_port) {
-#if defined( XP_WIN32 )
-		ports->n_socket = createlistensocket((unsigned short)ports->n_port,
-											 &ports->n_listenaddr);
-#else
 		ports->n_socket = createprlistensockets(ports->n_port,
 											   ports->n_listenaddr, 0, 0);
-#endif
 	}
 
 	if ( config_get_security() && (0 != ports->s_port) ) {
 		ports->s_socket = createprlistensockets((unsigned short)ports->s_port,
 		    									ports->s_listenaddr, 1, 0);
-#ifdef XP_WIN32
-		ports->s_socket_native = PR_FileDesc2NativeHandle(ports->s_socket);
-#endif
 	} else {
 	    ports->s_socket = SLAPD_INVALID_SOCKET;
-#ifdef XP_WIN32
-	    ports->s_socket_native = SLAPD_INVALID_SOCKET;
-#endif
 	}
 
-#ifndef XP_WIN32
 #if defined(ENABLE_LDAPI)
 	/* ldapi */
 	if(0 != ports->i_port) {
 		ports->i_socket = createprlistensockets(1, ports->i_listenaddr, 0, 1);
 	}
 #endif /* ENABLE_LDAPI */
-#endif
 
 	return( rc );
 }
 
-
-/* Decide whether we're running on a platform which supports send with timeouts */
-static void detect_timeout_support()
-{
-	/* Currently we know that NT4.0 or higher DOES support timeouts */
-#if defined _WIN32
-	/* Get the OS revision */
-	OSVERSIONINFO ver;
-	ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-	GetVersionEx(&ver);
-	if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT && ver.dwMajorVersion >= 4) {
-		have_send_timeouts = 1;
-	}
-#else
-	/* Some UNIXen do, but for now I don't feel confident which , and whether timeouts really work there */
-#endif
-}
-
-
 /*
  * The time_shutdown static variable is used to signal the time thread
  * to shutdown.  We used to shut down the time thread when g_get_shutdown()
@@ -1292,17 +1052,10 @@ void slapd_daemon( daemon_ports_t *ports )
 	 * If you want me to do SSL, pass me something in the ssl port number.
 	 * If you don't, pass me zero.
 	 */
-
-#if defined( XP_WIN32 )
-	int n_tcps = 0;
-	int s_tcps_native = 0;
-	PRFileDesc *s_tcps = NULL; 
-#else
 	PRFileDesc **n_tcps = NULL; 
 	PRFileDesc **s_tcps = NULL; 
 	PRFileDesc **i_unix = NULL;
 	PRFileDesc **fdesp = NULL; 
-#endif
 	PRIntn num_poll = 0;
 	PRIntervalTime pr_timeout = PR_MillisecondsToInterval(slapd_wakeup_timer);
 	PRThread *time_thread_p;
@@ -1335,13 +1088,10 @@ void slapd_daemon( daemon_ports_t *ports )
 	/* Retrieve the sockets from their hiding place */
 	n_tcps = ports->n_socket;
 	s_tcps = ports->s_socket;
-#ifdef XP_WIN32
-	s_tcps_native = ports->s_socket_native;
-#else
+
 #if defined(ENABLE_LDAPI)
 	i_unix = ports->i_socket;
 #endif /* ENABLE_LDAPI */
-#endif
 
 	if (!enable_nunc_stans) {
 		createsignalpipe();
@@ -1350,14 +1100,10 @@ void slapd_daemon( daemon_ports_t *ports )
 	init_shutdown_detect();
 
 	if (
-#if defined( XP_WIN32 )
-		(n_tcps == SLAPD_INVALID_SOCKET) && 
-#else
 		(n_tcps == NULL) &&
 #if defined(ENABLE_LDAPI)
 		(i_unix == NULL) &&
 #endif /* ENABLE_LDAPI */
-#endif
 	    (s_tcps == NULL) ) {	/* nothing to do */
 	    LDAPDebug( LDAP_DEBUG_ANY,
 		"no port to listen on\n", 0, 0, 0 );
@@ -1365,7 +1111,6 @@ void slapd_daemon( daemon_ports_t *ports )
 	}
 
 	init_op_threads ();
-	detect_timeout_support();
 
     /* Start the time thread */
     time_thread_p = PR_CreateThread(PR_SYSTEM_THREAD,
@@ -1419,20 +1164,6 @@ void slapd_daemon( daemon_ports_t *ports )
     }
 
 	/* We are now ready to accept incoming connections */
-#if defined( XP_WIN32 )
-	if ( n_tcps != SLAPD_INVALID_SOCKET
-				&& listen( n_tcps, config_get_listen_backlog_size() ) == -1 ) {
-		int		oserr = errno;
-		char	addrbuf[ 256 ];
-
-		slapi_log_error(SLAPI_LOG_FATAL, "slapd_daemon",
-			"listen() on %s port %d failed: OS error %d (%s)\n",
-			netaddr2string(&ports->n_listenaddr, addrbuf, sizeof(addrbuf)),
-			ports->n_port, oserr, slapd_system_strerror( oserr ) );
-		g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
-		listeners++;
-	}
-#else
 	if ( n_tcps != NULL ) {
 		PRFileDesc **fdesp;
 		PRNetAddr  **nap = ports->n_listenaddr;
@@ -1451,7 +1182,6 @@ void slapd_daemon( daemon_ports_t *ports )
 			listeners++;
 		}
 	}
-#endif
 
 	if ( s_tcps != NULL ) {
 		PRFileDesc **fdesp;
@@ -1472,7 +1202,6 @@ void slapd_daemon( daemon_ports_t *ports )
 		}
 	}
 
-#if !defined( XP_WIN32 )
 #if defined(ENABLE_LDAPI)
 	if( i_unix != NULL ) {
 		PRFileDesc **fdesp;
@@ -1491,7 +1220,7 @@ void slapd_daemon( daemon_ports_t *ports )
 		}
 	}
 #endif /* ENABLE_LDAPI */
-#endif
+
 	listener_idxs = (listener_info *)slapi_ch_calloc(listeners, sizeof(*listener_idxs));
 #ifdef ENABLE_NUNC_STANS
 	if (enable_nunc_stans) {
@@ -1555,64 +1284,27 @@ void slapd_daemon( daemon_ports_t *ports )
 	/* The meat of the operation is in a loop on a call to select */
 	while(!enable_nunc_stans && !g_get_shutdown())
 	{
-#ifdef _WIN32
-		fd_set			readfds;
-		struct timeval	wakeup_timer;
-		int			oserr;
-#endif
 		int select_return = 0;
-
-#ifndef _WIN32
 		PRErrorCode prerr;
-#endif
 
-#ifdef _WIN32
-		set_timeval_ms(&wakeup_timer, slapd_wakeup_timer);
-		setup_read_fds(the_connection_table,&readfds,n_tcps, s_tcps_native);
-		/* This select needs to timeout to give the server a chance to test for shutdown */
-		select_return = select(connection_table_size, &readfds, NULL, 0, &wakeup_timer);
-#else
 		setup_pr_read_pds(the_connection_table,n_tcps,s_tcps,i_unix,&num_poll);
 		select_return = POLL_FN(the_connection_table->fd, num_poll, pr_timeout);
-#endif
 		switch (select_return) {
 		case 0: /* Timeout */
 			/* GGOODREPL handle_timeout(); */
 			break;
 		case -1: /* Error */
-#ifdef _WIN32
-			oserr = errno;
-			LDAPDebug( LDAP_DEBUG_TRACE,
-				   "select failed errno %d (%s)\n", oserr,
-				   slapd_system_strerror(oserr), 0 );
-#else
 			prerr = PR_GetError();
 			LDAPDebug( LDAP_DEBUG_TRACE, "PR_Poll() failed, "
 				   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				   prerr, slapd_system_strerror(prerr), 0 );
-#endif
 			break;
 		default: /* either a new connection or some new data ready */
-			/* Figure out if we are dealing with one of the listen sockets */
-#ifdef _WIN32
-			/* If so, then handle a new connection */
-			if ( n_tcps != SLAPD_INVALID_SOCKET && FD_ISSET( n_tcps, &readfds ) ) {
-				handle_new_connection(the_connection_table,n_tcps,NULL,0,0);
-			}
-			/* If so, then handle a new connection */
-			if ( s_tcps != SLAPD_INVALID_SOCKET && FD_ISSET( s_tcps_native,&readfds ) ) {
-				handle_new_connection(the_connection_table,SLAPD_INVALID_SOCKET,s_tcps,1,0);
-			}
-			/* handle new data ready */
-			handle_read_ready(the_connection_table,&readfds);
-			clear_signal(&readfds);
-#else
 			/* handle new connections from the listeners */
 			handle_listeners(the_connection_table);
 			/* handle new data ready */
 			handle_pr_read_ready(the_connection_table, connection_table_size);
 			clear_signal(the_connection_table->fd);
-#endif
 			break;
 		}
 	}
@@ -1625,14 +1317,6 @@ void slapd_daemon( daemon_ports_t *ports )
 		ps_stop_psearch_system(); /* stop any persistent searches */
 	}
 
-#ifdef _WIN32
-	if ( n_tcps != SLAPD_INVALID_SOCKET ) {
-		closesocket( n_tcps );
-	}
-	if ( s_tcps != NULL ) {
- 		PR_Close( s_tcps );
-	}
-#else
 	/* free the listener indexes */
 	slapi_ch_free((void **)&listener_idxs);
 
@@ -1670,7 +1354,6 @@ void slapd_daemon( daemon_ports_t *ports )
 		slapi_ch_free ((void**)&ports->i_listenaddr);
 #endif
 	}
-#endif
 
 	/* Might compete with housecleaning thread, but so far so good */
 	be_flushall();
@@ -1678,14 +1361,12 @@ void slapd_daemon( daemon_ports_t *ports )
 	housekeeping_stop(); /* Run this after op_thread_cleanup() logged sth */
 	disk_monitoring_stop(disk_thread_p);
 
-#ifndef _WIN32
 	threads = g_get_active_threadcnt();
 	if ( threads > 0 ) {
 		LDAPDebug( LDAP_DEBUG_ANY,
 			"slapd shutting down - waiting for %d thread%s to terminate\n",
 			threads, ( threads > 1 ) ? "s" : "", 0 );
 	}
-#endif
 
 	threads = g_get_active_threadcnt();
 	while ( threads > 0 ) {
@@ -1778,16 +1459,12 @@ void slapd_daemon( daemon_ports_t *ports )
 	time_shutdown = 1;
 	PR_JoinThread( time_thread_p );
 
-#ifdef _WIN32
-	WSACleanup();
-#else
 	if ( g_get_shutdown() == SLAPI_SHUTDOWN_DISKFULL ){
 		/* This is a server-induced shutdown, we need to manually remove the pid file */
 		if( unlink(get_pid_file()) ){
 			LDAPDebug( LDAP_DEBUG_ANY, "Failed to remove pid file %s\n", get_pid_file(), 0, 0 );
 		}
 	}
-#endif
 }
 
 int signal_listner()
@@ -1796,161 +1473,37 @@ int signal_listner()
 		return( 0 );
 	}
 	/* Replaces previous macro---called to bump the thread out of select */
-#if defined( _WIN32 )
-	if ( PR_Write( signalpipe[1], "", 1) != 1 ) {
-			/* this now means that the pipe is full
-			 * this is not a problem just go-on
-			 */
-			LDAPDebug( LDAP_DEBUG_CONNS,
-				"listener could not write to signal pipe %d\n",
-				errno, 0, 0 );
-	}
-	
-#else
 	if ( write( writesignalpipe, "", 1) != 1 ) {
-			/* this now means that the pipe is full
-			 * this is not a problem just go-on
-			 */
-			LDAPDebug( LDAP_DEBUG_CONNS,
-				"listener could not write to signal pipe %d\n",
-				errno, 0, 0 );
+		/* this now means that the pipe is full
+		 * this is not a problem just go-on
+		 */
+		LDAPDebug( LDAP_DEBUG_CONNS,
+			"listener could not write to signal pipe %d\n",
+			errno, 0, 0 );
 	}
-#endif
 	return( 0 );
 }
 
-#ifdef _WIN32
-static int clear_signal(fd_set *readfdset)
-#else
 static int clear_signal(struct POLL_STRUCT *fds)
-#endif
 {
 	if (enable_nunc_stans) {
 		return 0;
 	}
-#ifdef _WIN32
-	if ( FD_ISSET(readsignalpipe, readfdset)) {
-#else
 	if ( fds[FDS_SIGNAL_PIPE].out_flags & SLAPD_POLL_FLAGS ) {
-#endif
 		char	buf[200];
 
-		LDAPDebug( LDAP_DEBUG_CONNS,
-			"listener got signaled\n",
-			0, 0, 0 );
-#ifdef _WIN32
-		if ( PR_Read( signalpipe[0], buf, 20 ) < 1 ) {
-#else
+		LDAPDebug( LDAP_DEBUG_CONNS, "listener got signaled\n",	0, 0, 0 );
 		if ( read( readsignalpipe, buf, 200 ) < 1 ) {
-#endif
-			LDAPDebug( LDAP_DEBUG_ANY,
-				"listener could not clear signal pipe\n",
+			LDAPDebug( LDAP_DEBUG_ANY, "listener could not clear signal pipe\n",
 				0, 0, 0 );
 		}
 	} 
 	return 0;
 }
 
-#ifdef _WIN32
-static void set_timeval_ms(struct timeval *t, int ms)
-{
-	t->tv_sec = ms/1000;
-	t->tv_usec = (ms % 1000)*1000;
-}
-#endif
-
-#ifdef _WIN32
-static void setup_read_fds(Connection_Table *ct, fd_set *readfds, int n_tcps, int s_tcps)
-{
-	Connection *c= NULL;
-	Connection *next= NULL;
-	int accept_new_connections;
-	static int last_accept_new_connections = -1;
-   	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
-	LBER_SOCKET socketdesc = SLAPD_INVALID_SOCKET;
-
-	FD_ZERO( readfds );
-
-	accept_new_connections = ((ct->size - g_get_current_conn_count())
-	    > slapdFrontendConfig->reservedescriptors);
-	if ( ! accept_new_connections ) {
-		if ( last_accept_new_connections ) {
-			LDAPDebug( LDAP_DEBUG_ANY, "Not listening for new "
-			    "connections - too many fds open\n", 0, 0, 0 );
-		}
-	} else {
-		if ( ! last_accept_new_connections &&
-		    last_accept_new_connections != -1 ) {
-			LDAPDebug( LDAP_DEBUG_ANY, "Listening for new "
-			    "connections again\n", 0, 0, 0 );
-		}
-	}
-	last_accept_new_connections = accept_new_connections;
-	if (n_tcps != SLAPD_INVALID_SOCKET && accept_new_connections) {
-		FD_SET( n_tcps, readfds );
-		LDAPDebug( LDAP_DEBUG_HOUSE,
-			"listening for connections on %d\n", n_tcps, 0, 0 );
-	}
-	if (s_tcps != SLAPD_INVALID_SOCKET && accept_new_connections) {
-		FD_SET( s_tcps, readfds );
-		LDAPDebug( LDAP_DEBUG_HOUSE,
-			"listening for connections on %d\n", s_tcps, 0, 0 );
-	}
-
-	if ((s_tcps != SLAPD_INVALID_SOCKET)
-		 && (readsignalpipe != SLAPD_INVALID_SOCKET)) {
-		FD_SET( readsignalpipe, readfds );
-	}
-
-	/* Walk down the list of active connections to find 
-	 * out which connections we should poll over.  If a connection
-	 * is no longer in use, we should remove it from the linked 
-	 * list. */
-	c= connection_table_get_first_active_connection (ct);
-	while (c)
-    {
-	    next = connection_table_get_next_active_connection (ct, c);
-	    if ( c->c_mutex == NULL )
-	    {
-		    connection_table_move_connection_out_of_active_list(ct,c);
-	    }
-	    else
-	    {
-	        PR_Lock( c->c_mutex );
-			if ( c->c_flags & CONN_FLAG_CLOSING )
-			{
-			    /* A worker thread has marked that this connection
-			     * should be closed by calling disconnect_server. 
-				 * move this connection out of the active list
-				 * the last thread to use the connection will close it
-			     */
-				connection_table_move_connection_out_of_active_list(ct,c);
-			}
-			else if ( c->c_sd == SLAPD_INVALID_SOCKET )
-			{
-				connection_table_move_connection_out_of_active_list(ct,c);
-			}
-			else
-			{
-#if defined(LDAP_IOCP)	 /* When we have IO completion ports, we don't want to do this */
-			    if ( !c->c_gettingber && (c->c_flags & CONN_FLAG_SSL) )
-#else
-			    if ( !c->c_gettingber )
-#endif
-				{
-					FD_SET( c->c_sd, readfds );
-			    }
-			}
-			PR_Unlock( c->c_mutex );
-	    }
-		c = next;
-	}
-}
-#endif   /* _WIN32 */
-
 static int first_time_setup_pr_read_pds = 1;
 static int listen_addr_count = 0;
+
 static void
 setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_unix, PRIntn *num_to_read)
 {
@@ -1997,13 +1550,9 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 		if (!enable_nunc_stans) {
 			/* The fds entry for the signalpipe is always FDS_SIGNAL_PIPE (== 0) */
 			count = FDS_SIGNAL_PIPE;
-#if !defined(_WIN32)
 			ct->fd[count].fd = signalpipe[0];
 			ct->fd[count].in_flags = SLAPD_POLL_FLAGS;
 			ct->fd[count].out_flags = 0;
-#else
-			ct->fd[count].fd = NULL;
-#endif
 			count++;
 		}
 		/* The fds entry for n_tcps starts with n_tcps and less than n_tcpe */
@@ -2050,7 +1599,6 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 		ct->s_tcpe = count;
 
 
-#if !defined(_WIN32)
 #if defined(ENABLE_LDAPI)
 		ct->i_unixs = count;
 		/* The fds entry for i_unix starts with i_unixs and less than i_unixe */
@@ -2074,7 +1622,6 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 		}
 		ct->i_unixe = count;
 #endif
-#endif
  
 		first_time_setup_pr_read_pds = 0;
 		listen_addr_count = count;
@@ -2208,154 +1755,26 @@ daemon_register_reslimits( void )
 			&idletimeout_reslimit_handle ));
 }
 
-#ifdef _WIN32
-static void
-handle_read_ready(Connection_Table *ct, fd_set *readfds)
-{
-	Connection *c= NULL;
-	time_t curtime = current_time();
-	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-	int idletimeout;
-	int maxthreads = config_get_maxthreadsperconn();
-
-#ifdef LDAP_DEBUG
-	if ( slapd_ldap_debug & LDAP_DEBUG_CONNS )
-	{
-		connection_table_dump_activity_to_errors_log(ct);
-	}
-#endif /* LDAP_DEBUG */
-
-
-	/* Instead of going through the whole connection table to see which
-	 * connections we can read from, we'll only check the slots in the
-	 * linked list */
-	c = connection_table_get_first_active_connection (ct);
-	while ( c!=NULL )
-	{
-	    if ( c->c_mutex != NULL )
-		{
-		    PR_Lock( c->c_mutex );
-		    if (connection_is_active_nolock (c) && c->c_gettingber == 0 )
-		    {
-		        /* read activity */
-		        short readready= ( FD_ISSET( c->c_sd, readfds ) );
-
-				/* read activity */
-				if ( readready )
-				{
-					LDAPDebug( LDAP_DEBUG_CONNS, "read activity on %d\n", c->c_ci, 0, 0 );
-					c->c_idlesince = curtime;
-
-					/* This is where the work happens ! */
-					connection_activity( c, maxthreads);
-
-					/* idle timeout */
-				}
-				else if (( c->c_idletimeout > 0 &&
-						(curtime - c->c_idlesince) >= c->c_idletimeout &&
-						NULL == c->c_ops )
-				{
-					disconnect_server_nomutex( c, c->c_connid, -1,
-								   SLAPD_DISCONNECT_IDLE_TIMEOUT, EAGAIN );
-				}
-			}
-			PR_Unlock( c->c_mutex );
-		}
-		c = connection_table_get_next_active_connection (ct, c);
-	}
-}
-#endif   /* _WIN32 */
-
-
 static void
 handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
 {
 	Connection *c;
 	time_t curtime = current_time();
 	int maxthreads = config_get_maxthreadsperconn();
-#if defined( XP_WIN32 )
-	int i;
-#endif
 
-#if LDAP_DEBUG 
+#if LDAP_DEBUG
 	if ( slapd_ldap_debug & LDAP_DEBUG_CONNS )
 	{
 		connection_table_dump_activity_to_errors_log(ct);
 	}
 #endif /* LDAP_DEBUG */
 
-#if defined( XP_WIN32 )
-	/*
-	 * WIN32: this function is only called for SSL connections and
-	 * num_poll indicates exactly how many PR fds we polled on.
-	 */
-	for ( i = 0; i < num_poll; i++ )
-	{
-		short readready;
-		readready = (ct->fd[i].out_flags & SLAPD_POLL_FLAGS);
-
-		/* Find the connection we are referring to */
-		for ( c = connection_table_get_first_active_connection (ct); c != NULL; 
-              c = connection_table_get_next_active_connection (ct, c) )
-		{
-			if ( c->c_mutex != NULL )
-			{
-				PR_Lock( c->c_mutex );
-				if ( c->c_prfd == ct->fd[i].fd )
-				{
-					break;	/* c_mutex is still locked! */
-				}
-				PR_Unlock( c->c_mutex );
-			}
-		}
-
-		if ( c == NULL )
-		{	/* connection not found! */
-			LDAPDebug( LDAP_DEBUG_CONNS, "handle_pr_read_ready: "
-			    "connection not found for poll slot %d\n", i,0,0 );
-		}
-		else
-		{
-			/* c_mutex is still locked... check for activity and errors */
-			if ( !readready && ct->fd[i].out_flags && c->c_prfd == ct->fd[i].fd )
-			{
-				/* some error occured */
-				LDAPDebug( LDAP_DEBUG_CONNS,
-					"poll says connection on sd %d is bad "
-					"(closing)\n", c->c_sd, 0, 0 );
-				disconnect_server_nomutex( c, c->c_connid, -1, SLAPD_DISCONNECT_POLL, EPIPE );
-			}
-			else if ( readready && c->c_prfd == ct->fd[i].fd )
-			{
-				/* read activity */
-				LDAPDebug( LDAP_DEBUG_CONNS,
-					"read activity on %d\n", i, 0, 0 );
-				c->c_idlesince = curtime;
-
-				/* This is where the work happens ! */
-				connection_activity( c );
-			}
-			else if (( c->c_ideltimeout > 0 &&
-					c->c_prfd == ct->fd[i].fd &&
-					(curtime - c->c_idlesince) >= c->c_ideltimeout &&
-					NULL == c->c_ops )
-			{
-				/* idle timeout */
-				disconnect_server_nomutex( c, c->c_connid, -1,
-							   SLAPD_DISCONNECT_IDLE_TIMEOUT, EAGAIN );
-			}
-
-			PR_Unlock( c->c_mutex );
-		}
-	}
-#else
 
 	/*
-	 * non-WIN32: this function is called for all connections, so we
-	 * traverse the entire active connection list to find any errors,
-	 * activity, etc.
+	 * This function is called for all connections, so we traverse the entire
+	 * active connection list to find any errors, activity, etc.
 	 */
-	for ( c = connection_table_get_first_active_connection (ct); c != NULL; 
+	for ( c = connection_table_get_first_active_connection (ct); c != NULL;
           c = connection_table_get_next_active_connection (ct, c) )
 	{
 		if ( c->c_mutex != NULL )
@@ -2401,7 +1820,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
 						 */
 						LDAPDebug (LDAP_DEBUG_ANY,
 							"connection_activity: abandoning conn %" NSPRIu64 " as fd=%d is already closing\n",
-							c->c_connid,c->c_sd,0); 
+							c->c_connid,c->c_sd,0);
 						/* The call disconnect_server should do nothing,
 						 * as the connection c should be already set to CLOSING */
 						disconnect_server_nomutex( c, c->c_connid, -1,
@@ -2420,7 +1839,6 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
 			PR_Unlock( c->c_mutex );
 		}
 	}
-#endif
 }
 
 #ifdef ENABLE_NUNC_STANS
@@ -2602,35 +2020,8 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
 static int
 slapd_poll( void *handle, int output )
 {
-    int		rc;
-	int ioblock_timeout = config_get_ioblocktimeout();
-	
-#if defined( XP_WIN32 )
-	if( !secure ) {
-		fd_set		handle_set;
-		struct timeval	timeout;
-		int windows_handle = (int) handle;
-
-		memset (&timeout, 0, sizeof(timeout));
-		if (ioblock_timeout > 0) {
-			timeout.tv_sec = ioblock_timeout / 1000;
-			timeout.tv_usec = (ioblock_timeout % 1000) * 1000;
-		}
-		FD_ZERO(&handle_set);
-		FD_SET(windows_handle, &handle_set);
-		rc = output ? select(FD_SETSIZE, NULL, &handle_set, NULL, &timeout)
-			: select(FD_SETSIZE, &handle_set, NULL, NULL, &timeout);
-	} else {
-		struct POLL_STRUCT	pr_pd;
-		PRIntervalTime	timeout = PR_MillisecondsToInterval( ioblock_timeout );
-
-		if (timeout < 0) timeout = 0;
-		pr_pd.fd = (PRFileDesc *)handle;
-		pr_pd.in_flags = output ? PR_POLL_WRITE : PR_POLL_READ;
-		pr_pd.out_flags = 0;
-		rc = POLL_FN(&pr_pd, 1, timeout);
-	}
-#else
+    int rc;
+    int ioblock_timeout = config_get_ioblocktimeout();
     struct POLL_STRUCT	pr_pd;
     PRIntervalTime	timeout = PR_MillisecondsToInterval(ioblock_timeout);
 
@@ -2638,70 +2029,24 @@ slapd_poll( void *handle, int output )
     pr_pd.in_flags = output ? PR_POLL_WRITE : PR_POLL_READ;
     pr_pd.out_flags = 0;
     rc = POLL_FN(&pr_pd, 1, timeout);
-#endif
 
     if (rc < 0) {
-#if defined( XP_WIN32 )
-	if( !secure ) {
-		int	oserr = errno;
-
-		LDAPDebug(LDAP_DEBUG_CONNS, "slapd_poll(%d) error %d (%s)\n",
-			  handle, oserr, slapd_system_strerror(oserr));
-		if ( SLAPD_SYSTEM_WOULD_BLOCK_ERROR(oserr)) {
-		    rc = 0;		/* try again */
-		}
-	} else {
-		PRErrorCode prerr = PR_GetError();
-		LDAPDebug(LDAP_DEBUG_CONNS, "slapd_poll(%d) "
-				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
-				handle, prerr, slapd_pr_strerror(prerr));
-		if ( prerr == PR_PENDING_INTERRUPT_ERROR ||
-			SLAPD_PR_WOULD_BLOCK_ERROR(prerr)) {
-		    rc = 0;		/* try again */
-		}
-	}
-#else
-	PRErrorCode prerr = PR_GetError();
-	LDAPDebug(LDAP_DEBUG_ANY, "slapd_poll(%d) "
-			SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
-			handle, prerr, slapd_pr_strerror(prerr));
-	if ( prerr == PR_PENDING_INTERRUPT_ERROR ||
-		SLAPD_PR_WOULD_BLOCK_ERROR(prerr)) {
-	    rc = 0;		/* try again */
-	}
-#endif
-
+        PRErrorCode prerr = PR_GetError();
+        LDAPDebug(LDAP_DEBUG_ANY, "slapd_poll(%d) "
+            SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+            handle, prerr, slapd_pr_strerror(prerr));
+        if ( prerr == PR_PENDING_INTERRUPT_ERROR ||
+             SLAPD_PR_WOULD_BLOCK_ERROR(prerr))
+        {
+            rc = 0; /* try again */
+        }
     } else if (rc == 0 && ioblock_timeout > 0) {
-	PRIntn ihandle;
-#if !defined( XP_WIN32 )
-	ihandle = PR_FileDesc2NativeHandle((PRFileDesc *)handle);
-#else
-	if( secure )
-		ihandle = PR_FileDesc2NativeHandle((PRFileDesc *)handle);
-	else
-		ihandle = (PRIntn)handle;
-#endif
-	LDAPDebug(LDAP_DEBUG_ANY, "slapd_poll(%d) timed out\n",
-		  ihandle, 0, 0);
-#if defined( XP_WIN32 )
-	/*
-	 * Bug 624303 - This connection will be cleaned up soon.
-	 * During cleanup (see connection_cleanup()), SSL3_SendAlert()
-	 * will be called by PR_Close(), and its default wTimeout
-	 * in sslSocket associated with the handle
-	 * is no time out (I gave up after waited for 30 minutes).
-	 * It was during this closing period that server won't
-	 * response to new connection requests.
-	 * PR_Send() null is a hack here to change the default wTimeout
-	 * (see ssl_Send()) to one second which affects PR_Close()
-	 * only in the current scenario.
-	 */ 
-	if( secure ) {
-		PR_Send ((PRFileDesc *)handle, NULL, 0, 0, PR_SecondsToInterval(1));
-	}
-#endif
-	PR_SetError(PR_IO_TIMEOUT_ERROR, EAGAIN); /* timeout */
-	rc = -1;
+        PRIntn ihandle;
+        ihandle = PR_FileDesc2NativeHandle((PRFileDesc *)handle);
+        LDAPDebug(LDAP_DEBUG_ANY, "slapd_poll(%d) timed out\n",
+                ihandle, 0, 0);
+        PR_SetError(PR_IO_TIMEOUT_ERROR, EAGAIN); /* timeout */
+        rc = -1;
     }
     return rc;
 }
@@ -3166,12 +2511,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
 	 */
 	conn->c_idletimeout = fecfg->idletimeout;
 	conn->c_idletimeout_handle = idletimeout_reslimit_handle;
-
-#if defined( XP_WIN32 )
-	if( !secure )
-		ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&ns);
-#endif
-
 	conn->c_sd = ns;
 	conn->c_prfd = pr_clonefd;
 	conn->c_flags &= ~CONN_FLAG_CLOSING;
@@ -3181,7 +2520,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
 		conn->c_flags |= CONN_FLAG_SSL;
 	}
 
-#ifndef _WIN32
 	/*
 	 * clear the "returned events" field in ns' slot within the poll fds
 	 * array so that handle_read_ready() doesn't look at out_flags for an
@@ -3193,7 +2531,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
      * the connection table to the fds array.  This new connection
      * won't have a mapping. */
 	/* fds[ns].out_flags = 0; */
-#endif
 
 #if defined(USE_OPENLDAP)
 	ber_sockbuf_add_io( conn->c_sb, &openldap_sockbuf_io,
@@ -3206,11 +2543,7 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
 		func_pointers.lbextiofn_read = NULL; /* see connection_read_function */
 		func_pointers.lbextiofn_write = write_function;
 		func_pointers.lbextiofn_writev = NULL;
-#ifdef _WIN32
-		func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) ns;
-#else
 		func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) pr_clonefd;
-#endif
 		ber_sockbuf_set_option(conn->c_sb,
 		                       LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers);
 	}
@@ -3247,7 +2580,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
 	conn->c_extension = factory_create_extension(connection_type,conn,NULL /* Parent */);
 
 #if defined(ENABLE_LDAPI)
-#if !defined( XP_WIN32 )
 	/* ldapi */
 	if( local )
 	{
@@ -3255,7 +2587,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
 		conn->c_local_ssf = config_get_localssf();
 		slapd_identify_local_user(conn);
 	}
-#endif
 #endif /* ENABLE_LDAPI */
 
 	connection_new_private(conn);
@@ -3331,10 +2662,6 @@ ns_handle_new_connection(struct ns_job_t *job)
 
 static int init_shutdown_detect()
 {
-
-#ifdef _WIN32
-	PRThread *service_exit_wait_tid;
-#else
   /* First of all, we must reset the signal mask to get rid of any blockages
    * the process may have inherited from its parent (such as the console), which
    * might result in the process not delivering those blocked signals, and thus, 
@@ -3350,22 +2677,8 @@ static int init_shutdown_detect()
     LDAPDebug( LDAP_DEBUG_TRACE, " %s \n", 
 	       rc ? "Failed to reset signal mask":"....Done (signal mask reset)!!", 0, 0 );
   }
-#endif
   
-#ifdef _WIN32
-
-	/* Create a thread to wait on the Win32 event which will 
-	   be signalled by the watchdog when the Service is 
-	   being halted. */
-	service_exit_wait_tid = PR_CreateThread( PR_USER_THREAD, 
-		(VFP) (void *) slapd_service_exit_wait, (void *) NULL, 
-		PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 
-		SLAPD_DEFAULT_THREAD_STACKSIZE);
-	if( service_exit_wait_tid == NULL ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
-		"Error: PR_CreateThread(slapd_service_exit_wait) failed\n", 0, 0, 0 );
-	}
-#elif defined ( HPUX10 )
+#if defined ( HPUX10 )
     PR_CreateThread ( PR_USER_THREAD,
                       catch_signals,
                       NULL,
@@ -3397,36 +2710,18 @@ static int init_shutdown_detect()
 		(void) SIGNAL( SIGTERM, set_shutdown );
 		(void) SIGNAL( SIGHUP,  set_shutdown );
 	}
-#endif /* _WIN32 */
+#endif /* HPUX */
 	return 0;
 }
 
-#if defined( XP_WIN32 )
-static void
-unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, int n_tcps, PRFileDesc *s_tcps)
-#else
 static void
 unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_unix)
-#endif
 {
 	slapdFrontendConfig_t	*slapdFrontendConfig = getFrontendConfig();
 	char					addrbuf[ 256 ];
 	int			isfirsttime = 1;
 
 	if ( ct->size <= slapdFrontendConfig->reservedescriptors ) {
-#ifdef _WIN32
-		LDAPDebug( LDAP_DEBUG_ANY,
-		    "ERROR: Not enough descriptors to accept any connections. "
-		    "This may be because the maxdescriptors configuration "
-		    "directive is too small, or the reservedescriptors "
-		    "configuration directive is too large. "
-		    "Try increasing the number of descriptors available to "
-		    "the slapd process. The current value is %d. %d "
-		    "descriptors are currently reserved for internal "
-		    "slapd use, so the total number of descriptors available "
-		    "to the process must be greater than %d.\n",
-		    ct->size, slapdFrontendConfig->reservedescriptors, slapdFrontendConfig->reservedescriptors );
-#else /* _WIN32 */
 		LDAPDebug( LDAP_DEBUG_ANY,
 		    "ERROR: Not enough descriptors to accept any connections. "
 		    "This may be because the maxdescriptors configuration "
@@ -3439,7 +2734,6 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 		    "slapd use, so the total number of descriptors available "
 		    "to the process must be greater than %d.\n",
 		    ct->size, slapdFrontendConfig->reservedescriptors, slapdFrontendConfig->reservedescriptors );
-#endif /* _WIN32 */
 		exit( 1 );
 	}
 
@@ -3449,8 +2743,7 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 	 * "slapd started." because some of the administrative programs
 	 * depend on this.  See ldap/admin/lib/dsalib_updown.c.
 	 */
-#if !defined( XP_WIN32 )
-	if ( n_tcps != NULL ) {					/* standard LDAP */
+	if ( n_tcps != NULL ) { /* standard LDAP */
 		PRNetAddr   **nap = NULL;
 
 		for (nap = ports->n_listenaddr; nap && *nap; nap++) {
@@ -3469,7 +2762,7 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 		}
 	}
 
-	if ( s_tcps != NULL ) {					/* LDAP over SSL; separate port */
+	if ( s_tcps != NULL ) { /* LDAP over SSL; separate port */
 		PRNetAddr   **sap = NULL;
 
 		for (sap = ports->s_listenaddr; sap && *sap; sap++) {
@@ -3487,23 +2780,7 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 			}
 		}
 	}
-#else
-	if ( n_tcps != SLAPD_INVALID_SOCKET ) {	/* standard LDAP; XP_WIN32 */
-		LDAPDebug( LDAP_DEBUG_ANY,
-			"slapd started.  Listening on %s port %d for LDAP requests\n",
-			netaddr2string(&ports->n_listenaddr, addrbuf, sizeof(addrbuf)),
-		    ports->n_port, 0 );
-	}
-
-	if ( s_tcps != NULL ) {					/* LDAP over SSL; separate port */
-		LDAPDebug( LDAP_DEBUG_ANY,
-			"Listening on %s port %d for LDAPS requests\n",
-			netaddr2string(&ports->s_listenaddr, addrbuf, sizeof(addrbuf)),
-		    ports->s_port, 0 );
-	}
-#endif
 
-#if !defined( XP_WIN32 )
 #if defined(ENABLE_LDAPI)
 	if ( i_unix != NULL ) {                                 /* LDAPI */
 		PRNetAddr   **iap = ports->i_listenaddr;
@@ -3513,33 +2790,8 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 			(*iap)->local.path, 0 );
 	}
 #endif /* ENABLE_LDAPI */
-#endif
-
 }
 
-#if defined( _WIN32 )
-/* On Windows, we signal the SCM when we're ready to accept connections */
-static int
-write_pid_file()
-{
-	if( SlapdIsAService() )
-	{
-		/* Initialization complete and successful. Set service to running */
-		LDAPServerStatus.dwCurrentState	= SERVICE_RUNNING;
-		LDAPServerStatus.dwCheckPoint = 0;
-		LDAPServerStatus.dwWaitHint = 0;
-			
-		if (!SetServiceStatus(hLDAPServerServiceStatus, &LDAPServerStatus)) {
-			ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_START_FAILED, 1, 
-				"Could not set Service status.");
-			exit(1);
-		}
-	}
-
-	ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_STARTED, 0, NULL );
-	return 0;
-}
-#else /* WIN32 */
 /* On UNIX, we create a file with our PID in it */
 static int
 write_pid_file()
@@ -3561,7 +2813,6 @@ write_pid_file()
 	}
 	return -1;
 }
-#endif /* WIN32 */
 
 static void
 set_shutdown (int sig)
@@ -3575,14 +2826,12 @@ set_shutdown (int sig)
     LDAPDebug( LDAP_DEBUG_ANY, "slapd got shutdown signal\n", 0, 0, 0 );
 #endif
 	g_set_shutdown( SLAPI_SHUTDOWN_SIGNAL );
-#ifndef _WIN32
 #ifndef LINUX
 	/* don't mess with USR1/USR2 on linux, used by libpthread */
 	(void) SIGNAL( SIGUSR2, set_shutdown );
 #endif
 	(void) SIGNAL( SIGTERM, set_shutdown );
 	(void) SIGNAL( SIGHUP,  set_shutdown );
-#endif
 }
 
 #ifdef ENABLE_NUNC_STANS
@@ -3621,9 +2870,7 @@ slapd_do_nothing (int sig)
 #if 0
 	LDAPDebug( LDAP_DEBUG_TRACE, "slapd got SIGUSR1\n", 0, 0, 0 );
 #endif
-#ifndef _WIN32
 	(void) SIGNAL( SIGUSR1, slapd_do_nothing );
-#endif
 
 #if 0
 	/*
@@ -3635,7 +2882,6 @@ slapd_do_nothing (int sig)
 }
 #endif   /* LINUX */
 
-#ifndef _WIN32
 void
 slapd_wait4child(int sig)
 {
@@ -3658,80 +2904,6 @@ slapd_wait4child(int sig)
 
         (void) SIGNAL( SIGCHLD, slapd_wait4child );
 }
-#endif
-
-#ifdef XP_WIN32
-static int
-createlistensocket(unsigned short port, const PRNetAddr *listenaddr)
-{
-	int					tcps;
-	struct sockaddr_in	addr;
-	char				*logname = "createlistensocket";
-	char				addrbuf[ 256 ];
-
-	if (!port) goto suppressed;
-
-	PR_ASSERT( listenaddr != NULL );
-
-	/* create TCP socket */
-	if ((tcps = socket(AF_INET, SOCK_STREAM, 0))
-		== SLAPD_INVALID_SOCKET) {
-		int oserr = errno;
-
-		slapi_log_error(SLAPI_LOG_FATAL, logname,
-			"socket() failed: OS error %d (%s)\n",
-			oserr, slapd_system_strerror( oserr ));
-		goto failed;
-	}
-	
-	/* initialize listener address */
-	(void) memset( (void *) &addr, '\0', sizeof(addr) );
-	addr.sin_family = AF_INET;
-	addr.sin_port = htons( port );
-	if (listenaddr->raw.family == PR_AF_INET) {
-		addr.sin_addr.s_addr = listenaddr->inet.ip;
-	} else if (PR_IsNetAddrType(listenaddr,PR_IpAddrAny)) {
-		addr.sin_addr.s_addr = INADDR_ANY;
-	} else {
-		if (!PR_IsNetAddrType(listenaddr,PR_IpAddrV4Mapped)) {
-			/*
-			 * When Win32 supports IPv6, we will be able to use IPv6
-			 * addresses here. But not yet.
-			 */
-			slapi_log_error(SLAPI_LOG_FATAL, logname,
-					"unable to listen on %s port %d (IPv6 addresses "
-					"are not supported on this platform)\n",
-					netaddr2string(listenaddr, addrbuf, sizeof(addrbuf)),
-					port );
-			goto failed;
-		}
-
-		addr.sin_addr.s_addr = listenaddr->ipv6.ip.pr_s6_addr32[3];
-	}
-
-	LDAPDebug( LDAP_DEBUG_TRACE, "%s - binding to %s:%d\n",
-	    logname, inet_ntoa( addr.sin_addr ), port )
-
-	if ( bind( tcps, (struct sockaddr *) &addr, sizeof(addr) ) == -1 ) {
-		int oserr = errno;
-
-		slapi_log_error(SLAPI_LOG_FATAL, logname,
-			"bind() on %s port %d failed: OS error %d (%s)\n",
-			inet_ntoa( addr.sin_addr ), port, oserr,
-			slapd_system_strerror( oserr ));
-		goto failed;
-	}
-
-	return tcps;
-
-failed:
-	WSACleanup();
-	exit( 1 );
-suppressed:
-	return -1;
-}  /* createlistensocket */
-#endif   /* XP_WIN32 */
-
 
 static PRFileDesc **
 createprlistensockets(PRUint16 port, PRNetAddr **listenaddr,
@@ -3839,9 +3011,6 @@ createprlistensockets(PRUint16 port, PRNetAddr **listenaddr,
 	return( sock );
 
 failed:
-#ifdef XP_WIN32
-	WSACleanup();
-#endif   /* XP_WIN32 */
 	exit( 1 );
 
 suppressed:
@@ -3997,17 +3166,6 @@ createsignalpipe( void )
 	if (enable_nunc_stans) {
 		return( 0 );
 	}
-#if defined( _WIN32 )
-	if ( PR_NewTCPSocketPair(&signalpipe[0])) {
-		PRErrorCode prerr = PR_GetError();
-		LDAPDebug( LDAP_DEBUG_ANY, "PR_CreatePipe() failed, "
-			SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
-			prerr, slapd_pr_strerror(prerr), SLAPD_DEFAULT_THREAD_STACKSIZE );
-		return( -1 );
-	}
-	writesignalpipe = PR_FileDesc2NativeHandle(signalpipe[1]);
-	readsignalpipe = PR_FileDesc2NativeHandle(signalpipe[0]);
-#else
 	if ( PR_CreatePipe( &signalpipe[0], &signalpipe[1] ) != 0 ) {
 		PRErrorCode prerr = PR_GetError();
 		LDAPDebug( LDAP_DEBUG_ANY, "PR_CreatePipe() failed, "
@@ -4025,7 +3183,6 @@ createsignalpipe( void )
 		LDAPDebug( LDAP_DEBUG_ANY,"createsignalpipe: failed to set FD for read pipe (%d).\n",
 				errno, 0, 0);
 	}
-#endif
 	return( 0 );
 } 
 
@@ -4126,7 +3283,6 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
   
 	ns = PR_FileDesc2NativeHandle( *pr_socket );
 	
-#if !defined(_WIN32)
 	/*
 	 * Some OS or third party libraries may require that low
 	 * numbered file descriptors be available, e.g., the DNS resolver
@@ -4160,7 +3316,6 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 				slapd_system_strerror( oserr ) );
 		}
 	}
-#endif /* !_WIN32 */
 
 	/* Set keep_alive to keep old connections from lingering */
 	pr_socketoption.option = PR_SockOpt_Keepalive;
@@ -4174,7 +3329,6 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 	}
 
 	if ( secure ) {
-	  
 		pr_socketoption.option = PR_SockOpt_Nonblocking;
 		pr_socketoption.value.non_blocking = 0;
 		if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE ) {
@@ -4186,24 +3340,18 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 		}
 	} else {
 		/* We always want to have non-blocking I/O */
-			pr_socketoption.option = PR_SockOpt_Nonblocking;
-			pr_socketoption.value.non_blocking = 1;
-			if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE ) {
-			     PRErrorCode prerr = PR_GetError();
-			     LDAPDebug( LDAP_DEBUG_ANY,
-					"PR_SetSocketOption(PR_SockOpt_Nonblocking) failed, "
-					SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
-					prerr, slapd_pr_strerror(prerr), 0 );
-			}
-		 
-		 if ( have_send_timeouts ) {
-		        daemon_configure_send_timeout(ns,config_get_ioblocktimeout());
-		 }
-
+		pr_socketoption.option = PR_SockOpt_Nonblocking;
+		pr_socketoption.value.non_blocking = 1;
+		if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE ) {
+			PRErrorCode prerr = PR_GetError();
+			LDAPDebug( LDAP_DEBUG_ANY,
+				"PR_SetSocketOption(PR_SockOpt_Nonblocking) failed, "
+				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+				prerr, slapd_pr_strerror(prerr), 0 );
+		}
 	} /* else (secure) */
 
 	if ( !enable_nagle && !local ) {
-
 		 pr_socketoption.option = PR_SockOpt_NoDelay;
 		 pr_socketoption.value.no_delay = 1;
 		 if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE) {
@@ -4214,25 +3362,20 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 					prerr, slapd_pr_strerror( prerr ), 0 );
 		 }
 	} else if( !local) {
-		 pr_socketoption.option = PR_SockOpt_NoDelay;
-		 pr_socketoption.value.no_delay = 0;
-		 if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE) {
+		pr_socketoption.option = PR_SockOpt_NoDelay;
+		pr_socketoption.value.no_delay = 0;
+		if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE) {
 			PRErrorCode prerr = PR_GetError();
 			LDAPDebug( LDAP_DEBUG_ANY,
-				   "PR_SetSocketOption(PR_SockOpt_NoDelay) failed, "
-					SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
-					prerr, slapd_pr_strerror( prerr ), 0 );
+				"PR_SetSocketOption(PR_SockOpt_NoDelay) failed, "
+				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+				prerr, slapd_pr_strerror( prerr ), 0 );
 		 }
 	} /* else (!enable_nagle) */
-		 
 	
 	return ns;
-	       
 }
 
-
-
-
 void configure_ns_socket( int * ns )
 {
 
@@ -4244,9 +3387,6 @@ void configure_ns_socket( int * ns )
 	enable_nagle = 1;
 #endif
 
-	if ( have_send_timeouts ) {
-		daemon_configure_send_timeout( *ns, config_get_ioblocktimeout() );
-	}
 	/* set the nagle */
 	if ( !enable_nagle ) {
 		on = 1;
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
index 6d1a45b..025df9f 100644
--- a/ldap/servers/slapd/delete.c
+++ b/ldap/servers/slapd/delete.c
@@ -55,9 +55,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "pratom.h"
 
diff --git a/ldap/servers/slapd/detach.c b/ldap/servers/slapd/detach.c
index 51a369c..3516c65 100644
--- a/ldap/servers/slapd/detach.c
+++ b/ldap/servers/slapd/detach.c
@@ -58,12 +58,10 @@
 #include <sys/stat.h>
 #endif /* svr4 */
 #include <fcntl.h>
-#ifndef _WIN32
 #include <errno.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/resource.h>
-#endif
 #include <signal.h>
 #ifdef LINUX
 #undef CTIME
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index d10715e..0e22f55 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -46,10 +46,8 @@
 #include <ctype.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/time.h>
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include <plhash.h>
 
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index 55e5aa5..7d7276f 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -67,10 +67,7 @@
 #include <prio.h>
 #include <prcountr.h>
 #include "slap.h"
-
-#if	!defined (_WIN32)
 #include <pwd.h>
-#endif  /* _WIN32 */
 
 /* #define SLAPI_DSE_DEBUG */ 	/* define this to force trace log	*/
 								/* messages to always be logged		*/
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 981a02d..f931fa6 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -46,9 +46,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #undef DEBUG                    /* disable counters */
 #include <prcountr.h>
 #include "slap.h"
diff --git a/ldap/servers/slapd/fe.h b/ldap/servers/slapd/fe.h
index 27d858e..ae67491 100644
--- a/ldap/servers/slapd/fe.h
+++ b/ldap/servers/slapd/fe.h
@@ -49,13 +49,6 @@
 /*
  * Global Variables...
  */
-#ifdef LDAP_DEBUG
-#if defined( _WIN32 )
-#ifndef DONT_DECLARE_SLAPD_LDAP_DEBUG
-extern __declspec(dllimport) int slapd_ldap_debug;
-#endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */
-#endif
-#endif
 extern Slapi_Counter *ops_initiated;
 extern Slapi_Counter *ops_completed;
 extern Slapi_Counter *max_threads_count;
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
index d10fb3e..ce4e1f1 100644
--- a/ldap/servers/slapd/fedse.c
+++ b/ldap/servers/slapd/fedse.c
@@ -70,10 +70,7 @@
 #include <dlfcn.h>
 #include "slap.h"
 #include "fe.h"
-
-#if	!defined (_WIN32)
 #include <pwd.h>
-#endif  /* _WIN32 */
 
 extern char ** getSupportedCiphers();
 extern char ** getEnabledCiphers();
diff --git a/ldap/servers/slapd/fileio.c b/ldap/servers/slapd/fileio.c
index 8a2482a..181d163 100644
--- a/ldap/servers/slapd/fileio.c
+++ b/ldap/servers/slapd/fileio.c
@@ -47,260 +47,20 @@
 #include <sys/types.h>
 #include <errno.h>
 #include <stdlib.h>
-#ifndef _WIN32
 #include <sys/param.h>
 #include <unistd.h>
 #include <pwd.h>
-#endif
 #include "slap.h"
 #include "pw.h"
 #include <prio.h>
 
-#if defined( XP_WIN32 )
-
-#include <prinit.h> /* PR_CallOnce */
-#include <string.h> /* memmove, memcpy */
-
-#define g_EOF (-1)
-
-static PRInt32 PR_CALLBACK readText(PRFileDesc *f, void *buf, PRInt32 amount)
-{
-	auto PRInt32 size = *(signed char*)&(f->secret);
-	auto char* readAhead = ((char*)&(f->secret)) + 1;
-	if ( size == g_EOF ) {
-		f->secret = NULL;
-		return 0;
-	}
-	if ( size > amount ) {
-		return 0;
-	}
-	if ( size > 0 ) {
-		memcpy( buf, readAhead, size );
-	}
-	f->secret = NULL;
-	while (1) {
-		auto PRInt32 len = amount - size;
-		auto char* head;
-		auto PRInt32 rval;
-		if (len > 0) {
-			head = (char*)buf + size;
-		} else if (size > 0 && '\r' == ((char*)buf)[size-1]) {
-			head = readAhead;
-			len = 1;
-		} else {
-			break;		
-		}
-		rval = PR_Read( f->lower, head, len );
-		if ( rval < 0 ) { /* error */
-			return rval;
-		}
-		if ( rval == 0 ) { /* EOF */
-			if ( size ) {
-				*(signed char*)&(f->secret) = g_EOF;
-			}
-			return size;
-		}
-		if (head == readAhead) {
-			if ( '\n' == *readAhead ) {
-				((char*)buf)[size-1] = '\n';
-			} else {
-				*(signed char*)&(f->secret) = rval;
-			}
-			break;
-		} else {
-			auto char* tail = head + rval;
-			auto char* dest = NULL;
-			auto char* p;
-			for ( p = head; p < tail; p++ ) {
-				if ( *p == '\n' && p > (char*)buf && *(p - 1) == '\r' )
-				{
-					if ( dest == NULL ) {	/* first CRLF */
-						dest = p - 1;
-					} else {
-						auto size_t len = (p - 1) - head;
-						memmove( dest, head, len );
-						dest += len;
-					}
-					head = p;  /* '\n' */
-					--rval;	/* ignore '\r' */
-				}
-			}
-			if ( dest != NULL ) {
-				auto size_t len = tail - head;
-				memmove( dest, head, len );
-			}
-			size += rval;
-		}
-	}
-	return size;
-}
-
-static PRInt32 PR_CALLBACK seekText(PRFileDesc *f, PRInt32 offset, PRSeekWhence how)
-{
-	f->secret = NULL;
-	return PR_Seek(f->lower, offset, how);
-}
-
-static PRInt64 PR_CALLBACK seek64Text(PRFileDesc *f, PRInt64 offset, PRSeekWhence how)
-{
-	f->secret = NULL;
-	return PR_Seek64(f->lower, offset, how);
-}
-
-static PRInt32 PR_CALLBACK writeText(PRFileDesc *f, const void *buf, PRInt32 amount)
-{
-	/* note: buf might not be null-terminated */
-	auto PRInt32 size = 0;
-	auto char* head = (char*)buf;
-	auto char* tail = head + amount;
-	auto char* p;
-	for ( p = head; p <= tail; ++p ) {
-		if ( p == tail || *p == '\n' ) {
-			auto PRInt32 len = p - head;
-			auto PRInt32 rval;
-			if ( len > 0 ) {
-				rval = PR_Write( f->lower, head, len );
-				if ( rval < 0 ) {
-					return rval;
-				}
-				size += rval;
-				if ( rval < len ) {
-					break;
-				}
-			}
-			if ( p == tail ) {
-				break;
-			}
-			rval = PR_Write( f->lower, "\r", 1 );
-			if ( rval < 0 ) {
-				return rval;
-			}
-			if ( rval < 1 ) {
-				break;
-			}
-			head = p;
-		}
-	}
-	return size;
-}
-
-static PRInt32 PR_CALLBACK writevText(PRFileDesc *fd, const PRIOVec *iov, PRInt32 size, PRIntervalTime timeout)
-{
-    auto PRInt32 i;
-    auto size_t total = 0;
-    for (i = 0; i < size; ++i) {
-		register PRInt32 rval = PR_Write(fd, iov[i].iov_base, iov[i].iov_len);
-		if (rval < 0) return rval;
-		total += rval;
-		if (rval < iov[i].iov_len) break;
-    }
-    return total;
-}
-
-/* ONREPL - this is bad because it allows only one thread to use this functionality.
-   Noriko said she would fix this before 5.0 ships.
- */
-
-static const char* const g_LayerName = "MdsTextIO";
-static PRDescIdentity    g_LayerID;
-static PRIOMethods       g_IoMethods;
-
-static PRStatus PR_CALLBACK closeLayer(PRFileDesc* stack)
-{
-	auto PRFileDesc* layer = PR_PopIOLayer(stack, g_LayerID);
-	if (!layer)
-		return PR_FAILURE;
-	if (layer->dtor) {
-		layer->secret = NULL;
-		layer->dtor(layer);
-	}
-	return PR_Close(stack);
-}
-
-static PRStatus PR_CALLBACK initialize(void)
-{
-	g_LayerID = PR_GetUniqueIdentity(g_LayerName);
-	if (PR_INVALID_IO_LAYER == g_LayerID) {
-		return PR_FAILURE;
-	} else {
-		auto const PRIOMethods* defaults = PR_GetDefaultIOMethods();
-		if (!defaults) {
-			return PR_FAILURE;
-		} else {
-			memcpy (&g_IoMethods, defaults, sizeof(g_IoMethods));
-		}
-	}
-	/* Customize methods: */
-	g_IoMethods.read = readText;
-	g_IoMethods.seek = seekText;
-	g_IoMethods.seek64 = seek64Text;
-	g_IoMethods.write = writeText;
-	g_IoMethods.writev = writevText; /* ??? Is this necessary? */
-	g_IoMethods.close = closeLayer; /* ??? Is this necessary? */
-	return PR_SUCCESS;
-}
-
-static PRCallOnceType g_callOnce = {0,0};
-
-/* Push a layer that converts from "\n" to the local filesystem's
- * end-of-line sequence on output, and vice-versa on input.
- * The layer pops itself (if necessary) when the file is closed.
- *
- * This layer does not affect the behavior of PR_Seek or PR_Seek64;
- * their parameters still measure bytes in the lower-level file,
- * and consequently will not add up with the results of PR_Read
- * or PR_Write.  For example, if you add up PR_Read return values,
- * and seek backward in the file that many bytes, the cursor will
- * *not* be restored to its original position (unless the data you
- * read didn't require conversion; that is, they didn't contain
- * any newlines, or you're running on Unix).
- * 
- * Likewise, the results of PR_Read or PR_Write won't add up to
- * the 'size' field in the result of PRFileInfo or PRFileInfo64.
- */
-static PRStatus pushTextIOLayer(PRFileDesc* stack)
-{
-	auto PRStatus rv = PR_CallOnce(&g_callOnce, initialize);
-	if (PR_SUCCESS == rv) {
-		auto PRFileDesc* layer = PR_CreateIOLayerStub(g_LayerID, &g_IoMethods);
-		layer->secret = NULL;
-		rv = PR_PushIOLayer(stack, PR_TOP_IO_LAYER, layer);
-	}
-	return rv;
-}
-
-static PRFileDesc *popTextIOLayer(PRFileDesc* stack)
-{
-	PRFileDesc *layer;
-	layer = PR_PopIOLayer(stack, g_LayerID);
-	if (layer && layer->dtor) {
-		layer->secret = NULL;
-		layer->dtor(layer);
-	}
-	return layer;
-}
-
-#endif /* XP_WIN32 */
-
 PRInt32
 slapi_read_buffer( PRFileDesc *fd, void *buf, PRInt32 amount )
 {
 	PRInt32 rval = 0;
-#if defined( XP_WIN32 )
-	PRStatus rv;
-
-	rv = pushTextIOLayer( fd );
-	if ( PR_SUCCESS != rv ) {
-		return -1;
-	}
-#endif
 
 	rval = PR_Read( fd, buf, amount );
 
-#if defined( XP_WIN32 )
-	popTextIOLayer( fd );
-#endif
-
     return rval;
 }
 
@@ -313,21 +73,9 @@ PRInt32
 slapi_write_buffer( PRFileDesc *fd, void *buf, PRInt32 amount )
 {
 	PRInt32 rval = 0;
-#if defined( XP_WIN32 )
-	PRStatus rv;
-
-	rv = pushTextIOLayer( fd );
-	if ( PR_SUCCESS != rv ) {
-		return -1;
-	}
-#endif
 
     rval = PR_Write( fd, buf, amount );
 
-#if defined( XP_WIN32 )
-	popTextIOLayer( fd );
-#endif
-
     return rval;
 }
 
@@ -340,15 +88,11 @@ int
 slapi_destructive_rename(const char *srcfilename, const char *destfilename)
 {
 	int rv = 0;
-#if defined( XP_WIN32 )
-	if (!MoveFileEx(srcfilename, destfilename, MOVEFILE_REPLACE_EXISTING)) {
-		rv = GetLastError();
-	}
-#else
+
 	if ( rename(srcfilename, destfilename) < 0 ) {
 		rv = errno;
 	}
-#endif
+
 	return rv;
 }
 
@@ -359,15 +103,11 @@ int
 slapi_copy(const char *srcfilename, const char *destfilename)
 {
 	int rv = 0;
-#if defined( XP_WIN32 )
-	if (!CopyFile(srcfilename, destfilename, FALSE)) {
-		rv = GetLastError();
-	}
-#else
+
 	unlink(destfilename);
 	if ( link(srcfilename, destfilename) < 0 ) {
 		rv = errno;
 	}
-#endif
+
 	return rv;
 }
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
index 5bebefe..1612147 100644
--- a/ldap/servers/slapd/filter.c
+++ b/ldap/servers/slapd/filter.c
@@ -45,9 +45,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "slapi-plugin.h"
 
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index 880169a..1d08c1f 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -45,9 +45,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 
 static int	test_filter_list();
diff --git a/ldap/servers/slapd/generation.c b/ldap/servers/slapd/generation.c
index 55319d4..97b7784 100644
--- a/ldap/servers/slapd/generation.c
+++ b/ldap/servers/slapd/generation.c
@@ -54,12 +54,9 @@ new_dataversion()
 {
     struct tm t;
     char* dataversion;
-	time_t curtime= current_time();
-#ifdef _WIN32
-    memcpy (&t, gmtime (&curtime), sizeof(t));
-#else
+	time_t curtime = current_time();
+
     gmtime_r (&curtime, &t);
-#endif
     dataversion = slapi_ch_smprintf("0%.4li%.2i%.2i%.2i%.2i%.2i", 1900L + t.tm_year, 1 + t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
 	return dataversion;
 }
diff --git a/ldap/servers/slapd/getopt_ext.h b/ldap/servers/slapd/getopt_ext.h
index 92fb434..c702471 100644
--- a/ldap/servers/slapd/getopt_ext.h
+++ b/ldap/servers/slapd/getopt_ext.h
@@ -54,17 +54,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#if defined( _WIN32 )
-#include <io.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <ldap.h>
-#include "ntslapdmessages.h"
-#include "proto-ntutil.h"
-#endif
-
 #ifdef LINUX
 #include <getopt.h>
 #endif
diff --git a/ldap/servers/slapd/globals.c b/ldap/servers/slapd/globals.c
index 3eeb2cf..e28362f 100644
--- a/ldap/servers/slapd/globals.c
+++ b/ldap/servers/slapd/globals.c
@@ -59,16 +59,11 @@
 #include <time.h>
 #include <stdarg.h>
 #include <stdlib.h>
-#if defined( _WIN32 )
-#include "ntslapdmessages.h"
-#include "proto-ntutil.h"
-#else
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#endif
 #include "slap.h"
 #include "fe.h"
 
@@ -141,13 +136,6 @@ int __delayed_free = 1;
 */
 #endif
 
-
-#if defined( _WIN32 )
-/* String constants (no change for international) */
-SERVICE_STATUS LDAPServerStatus;
-SERVICE_STATUS_HANDLE hLDAPServerServiceStatus;
-#endif
-
 Connection_Table *the_connection_table = NULL;
 
 char *pid_file = "/dev/null";
diff --git a/ldap/servers/slapd/init.c b/ldap/servers/slapd/init.c
index e7c8ab8..31e08da 100644
--- a/ldap/servers/slapd/init.c
+++ b/ldap/servers/slapd/init.c
@@ -45,31 +45,17 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/time.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#endif
 #include "slap.h"
 #include "fe.h"
 
 void
 slapd_init()
 {
-#ifdef _WIN32
-	WSADATA	wsadata;
-	int	err;
-
-	if( err = WSAStartup(0x0101, &wsadata ) != 0 ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
-		    "Windows Sockets initialization failed, error %d (%s)\n",
-		    err, slapd_system_strerror( err ), 0 );
-		exit( 1 );
-	}
-#endif /* _WIN32 */
-
 	/* We don't worry about free'ing this stuff
          * since the only time we want to do that is when
          * the process is exiting. */
diff --git a/ldap/servers/slapd/intrinsics.h b/ldap/servers/slapd/intrinsics.h
index d07b37c..60c3a15 100644
--- a/ldap/servers/slapd/intrinsics.h
+++ b/ldap/servers/slapd/intrinsics.h
@@ -43,42 +43,6 @@
 
 /* Header file used to declare functions which we beat on heavily as intrinsic */
 
-/* For NT ...*/
-
-#ifdef _WIN32
-__inline static int  strcmpi_fast(const char * dst, const char * src)
-{
-	int f,l;
-	do {
-		if ( ((f = (unsigned char)(*(dst++))) >= 'A') && (f <= 'Z') )
-			f -= ('A' - 'a');
-		if ( ((l = (unsigned char)(*(src++))) >= 'A') && (l <= 'Z') )
-			l -= ('A' - 'a');
-	} while ( f && (f == l) );
-	return(f - l);
-}
-#ifdef strcasecmp
-#undef strcasecmp
-#endif
-#define strcasecmp(x,y) strcmpi_fast(x,y)
-#ifdef strcmpi
-#undef strcmpi
-#endif
-#define strcmpi(x,y) strcmpi_fast(x,y)
-
-__inline static int tolower_fast(int c)
-{
-	if ( (c >= 'A') && (c <= 'Z') )
-		c = c + ('a' - 'A');
-	return c;
-}
-#ifdef tolower
-#undef tolower
-#endif
-#define tolower(x) tolower_fast(x)
-
-#else
-
 #if defined(HPUX)
 #define INLINE_DIRECTIVE __inline
 #elif defined(LINUX)
@@ -145,4 +109,3 @@ INLINE_DIRECTIVE static int strncasecmp_fast(const char * dst, const char * src,
 #undef strncasecmp
 #endif
 #define strncasecmp(x,y,z) strncasecmp_fast(x,y,z)
-#endif /* NT */
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 7daaaf3..5d028a4 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -82,14 +82,10 @@
 #endif
 
 /* ldaputil.c   -- LDAP utility functions and wrappers */
-#ifdef _WIN32
-#include <direct.h> /* for getcwd */
-#else
 #include <sys/socket.h>
 #include <sys/param.h>
 #include <unistd.h>
 #include <pwd.h>
-#endif
 #include <libgen.h>
 #include <pk11func.h>
 #include "slap.h"
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index d68ec33..968f0f5 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -62,11 +62,6 @@
 #include <time.h>
 #include <stdarg.h>
 #include <stdlib.h>
-#if defined( _WIN32 )
-#define R_OK 04
-#include "ntslapdmessages.h"
-#include "proto-ntutil.h"
-#else
 #include <sys/time.h>
 #include <sys/param.h> /* MAXPATHLEN */
 #include <sys/socket.h>
@@ -75,7 +70,6 @@
 #include <netdb.h>
 #include <unistd.h>
 #include <pwd.h> /* pwdnam */
-#endif
 #ifdef USE_SYSCONF
 #include <unistd.h>
 #endif /* USE_SYSCONF */
@@ -87,17 +81,8 @@
 
 #define REMOVE_CHANGELOG_CMD "remove"
 
-/* On UNIX, there's only one copy of slapd_ldap_debug */
-/* On NT, each module keeps its own module_ldap_debug, which */
-/* points to the process' slapd_ldap_debug */
-#ifdef _WIN32
-int		*module_ldap_debug;
-int __declspec(dllexport)    slapd_ldap_debug = LDAP_DEBUG_ANY;
-#else
-int     slapd_ldap_debug = LDAP_DEBUG_ANY;
-#endif
-
-char		*ldap_srvtab = "";
+int slapd_ldap_debug = LDAP_DEBUG_ANY;
+char *ldap_srvtab = "";
 
 /* Note that the 'attrname' arguments are used only for log messages */
 typedef int (*ConfigSetFunc)(const char *attrname, char *value,
@@ -880,7 +865,7 @@ static struct config_get_and_set {
 		NULL, 0,
 		(void**)&global_slapdFrontendConfig.refer_url,
 		CONFIG_STRING, NULL, NULL/* deletion is not allowed */},
-#if !defined(_WIN32) && !defined(AIX)
+#if !defined(AIX)
 	{CONFIG_MAXDESCRIPTORS_ATTRIBUTE, config_set_maxdescriptors,
 		NULL, 0,
 		(void**)&global_slapdFrontendConfig.maxdescriptors,
@@ -1426,15 +1411,11 @@ FrontendConfig_init () {
   init_minssf_exclude_rootdse = cfg->minssf_exclude_rootdse = LDAP_OFF;
   cfg->validate_cert = SLAPD_VALIDATE_CERT_WARN;
 
-#ifdef _WIN32
-  cfg->conntablesize = SLAPD_DEFAULT_CONNTABLESIZE;
-#else
 #ifdef USE_SYSCONF
    cfg->conntablesize  = sysconf( _SC_OPEN_MAX );
 #else /* USE_SYSCONF */
    cfg->conntablesize = getdtablesize();
 #endif /* USE_SYSCONF */
-#endif /* _WIN32 */
 
   init_accesscontrol = cfg->accesscontrol = LDAP_ON;
 #if defined(LINUX)
@@ -1623,20 +1604,10 @@ g_get_global_lastmod()
   return  config_get_lastmod();
 }
 
-
 int g_get_slapd_security_on(){
   return config_get_security();
 }
 
-
-
-#ifdef _WIN32
-void libldap_init_debug_level(int *val_ptr)
-{
-    module_ldap_debug = val_ptr;
-}
-#endif
-
 static struct snmp_vars_t global_snmp_vars;
 
 struct snmp_vars_t * g_get_global_snmp_vars(){
@@ -3751,9 +3722,6 @@ config_set_workingdir( const char *attrname, char *value, char *errorbuf, int ap
   if ( apply) {
 	CFG_LOCK_WRITE(slapdFrontendConfig);
 	slapdFrontendConfig->workingdir = slapi_ch_strdup ( value );
-#ifdef _WIN32
-	dostounixpath(slapdFrontendConfig->workingdir);
-#endif /* _WIN32 */
 	CFG_UNLOCK_WRITE(slapdFrontendConfig);
   }
   return retVal;
@@ -3910,12 +3878,7 @@ config_set_conntablesize( const char *attrname, char *value, char *errorbuf, int
   errno = 0;
   nValue = strtol(value, &endp, 0);
   
-#ifdef _WIN32
-  if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > 0xfffffe ) {
-	PR_snprintf ( errorbuf,  SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table size must range from 1 to 0xfffffe", attrname, value );
-	retVal = LDAP_OPERATIONS_ERROR;
-  }
-#elif !defined(AIX)
+#if !defined(AIX)
 
   if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
 	PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table "
@@ -3945,9 +3908,7 @@ config_set_reservedescriptors( const char *attrname, char *value, char *errorbuf
   int maxVal = 65535;
   long nValue = 0;
   char *endp = NULL;
-#ifndef _WIN32
   struct rlimit rlp;
-#endif
 
   slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 	
@@ -3955,11 +3916,9 @@ config_set_reservedescriptors( const char *attrname, char *value, char *errorbuf
 	return LDAP_OPERATIONS_ERROR;
   }
 
-#ifndef _WIN32
   if ( 0 == getrlimit( RLIMIT_NOFILE, &rlp ) ) {
           maxVal = (int)rlp.rlim_max;
   }
-#endif
 
   errno = 0;
   nValue = strtol(value, &endp, 10);
@@ -4387,12 +4346,7 @@ config_set_errorlog_level( const char *attrname, char *value, char *errorbuf, in
   if ( apply ) {
 	CFG_LOCK_WRITE(slapdFrontendConfig);
 	level |= LDAP_DEBUG_ANY;
-
-#ifdef _WIN32
-	*module_ldap_debug = level;
-#else
 	slapd_ldap_debug = level;
-#endif
 	slapdFrontendConfig->errorloglevel = level;
 	CFG_UNLOCK_WRITE(slapdFrontendConfig);
   }
diff --git a/ldap/servers/slapd/libslapd.def b/ldap/servers/slapd/libslapd.def
index 150147b..7e3c942 100644
--- a/ldap/servers/slapd/libslapd.def
+++ b/ldap/servers/slapd/libslapd.def
@@ -854,8 +854,6 @@ EXPORTS
     slapi_mods2entry @838
 	operation_parameters_new @839
 	operation_parameters_done @840
-	slapi_ch_start_recording @841
-	slapi_ch_stop_recording @842
 	snmp_as_entry @843
 	slapi_filter_compare @844
 ; probably temporary:
diff --git a/ldap/servers/slapd/localhost.c b/ldap/servers/slapd/localhost.c
index c946e8d..38edb2f 100644
--- a/ldap/servers/slapd/localhost.c
+++ b/ldap/servers/slapd/localhost.c
@@ -44,9 +44,6 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <string.h>
-#ifdef _WIN32
-#define MAXHOSTNAMELEN 256
-#else
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -54,7 +51,6 @@
 #include <netdb.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
-#endif
 #include <errno.h>
 #include "slap.h"
 #if defined(USE_SYSCONF) || defined(LINUX)
@@ -99,77 +95,77 @@ find_localhost_DNS()
     char line [MAXHOSTNAMELEN + 8];
 
     if (gethostname (hostname, MAXHOSTNAMELEN)) {
-	int oserr = errno;
+        int oserr = errno;
 
-	LDAPDebug (LDAP_DEBUG_ANY, "gethostname() failed, error %d (%s)\n",
-	    oserr, slapd_system_strerror( oserr ), 0 );
-	return NULL;
+        LDAPDebug (LDAP_DEBUG_ANY, "gethostname() failed, error %d (%s)\n",
+                oserr, slapd_system_strerror( oserr ), 0 );
+        return NULL;
     }
     hp = GETHOSTBYNAME (hostname, &hent, hbuf, sizeof(hbuf), &err);
     if (hp == NULL) {
-	int oserr = errno;
+        int oserr = errno;
 
-	LDAPDebug( LDAP_DEBUG_ANY,
-	    "gethostbyname(\"%s\") failed, error %d (%s)\n",
-	       hostname, oserr, slapd_system_strerror( oserr ));
-	return NULL;
+        LDAPDebug( LDAP_DEBUG_ANY,
+                "gethostbyname(\"%s\") failed, error %d (%s)\n",
+                hostname, oserr, slapd_system_strerror( oserr ));
+        return NULL;
     }
     if (hp->h_name == NULL) {
-	LDAPDebug (LDAP_DEBUG_ANY, "gethostbyname(\"%s\")->h_name == NULL\n", hostname, 0, 0);
-	return NULL;
+        LDAPDebug (LDAP_DEBUG_ANY, "gethostbyname(\"%s\")->h_name == NULL\n", hostname, 0, 0);
+        return NULL;
     }
     if (strchr (hp->h_name, '.') != NULL) {
-	LDAPDebug (LDAP_DEBUG_CONFIG, "h_name == %s\n", hp->h_name, 0, 0);
-	return slapi_ch_strdup (hp->h_name);
+        LDAPDebug (LDAP_DEBUG_CONFIG, "h_name == %s\n", hp->h_name, 0, 0);
+        return slapi_ch_strdup (hp->h_name);
     } else if (hp->h_aliases != NULL) {
-	for (alias = hp->h_aliases; *alias != NULL; ++alias) {
-	    if (strchr  (*alias, '.') != NULL &&
-		strncmp (*alias, hp->h_name, strlen (hp->h_name))) {
-		LDAPDebug (LDAP_DEBUG_CONFIG, "h_alias == %s\n", *alias, 0, 0);
-		return slapi_ch_strdup (*alias);
-	    }
-	}
+        for (alias = hp->h_aliases; *alias != NULL; ++alias) {
+            if (strchr  (*alias, '.') != NULL &&
+                strncmp (*alias, hp->h_name, strlen (hp->h_name))) {
+                LDAPDebug (LDAP_DEBUG_CONFIG, "h_alias == %s\n", *alias, 0, 0);
+                return slapi_ch_strdup (*alias);
+            }
+        }
     }
     /* The following is copied from dns_guess_domain(),
        in ldapserver/lib/base/dnsdmain.c */
     domain = NULL;
     f = fopen (_PATH_RESCONF, "r");  /* This fopen() will fail on NT, as expected */
     if (f != NULL) {
-	while (fgets (line, sizeof(line), f)) {
-	    if (strncasecmp (line, "domain", 6) == 0 && isspace (line[6])) {
-		LDAPDebug (LDAP_DEBUG_CONFIG, "%s: %s\n", _PATH_RESCONF, line, 0);
-		for (cp = &line[7]; *cp && isspace(*cp); ++cp);
-		if (*cp) {
-		    domain = cp;
-		    /* ignore subsequent whitespace: */
-		    for (; *cp && ! isspace (*cp); ++cp);
-		    if (*cp) {
-			*cp = '\0';
-		    }
-		}
-		break;
-	    }
-	}
-	fclose (f);
+        while (fgets (line, sizeof(line), f)) {
+            if (strncasecmp (line, "domain", 6) == 0 && isspace (line[6])) {
+                LDAPDebug (LDAP_DEBUG_CONFIG, "%s: %s\n", _PATH_RESCONF, line, 0);
+                for (cp = &line[7]; *cp && isspace(*cp); ++cp);
+                if (*cp) {
+                    domain = cp;
+                    /* ignore subsequent whitespace: */
+                    for (; *cp && ! isspace (*cp); ++cp);
+                    if (*cp) {
+                        *cp = '\0';
+                    }
+                }
+                break;
+            }
+        }
+        fclose (f);
     }
 #ifndef NO_DOMAINNAME
     if (domain == NULL) {
-	/* No domain found. Try getdomainname. */
-	getdomainname (line, sizeof(line));
-	LDAPDebug (LDAP_DEBUG_CONFIG, "getdomainname(%s)\n", line, 0, 0);
-	if (line[0] != 0) {
-	    domain = &line[0];
-	}
+        /* No domain found. Try getdomainname. */
+        getdomainname (line, sizeof(line));
+        LDAPDebug (LDAP_DEBUG_CONFIG, "getdomainname(%s)\n", line, 0, 0);
+        if (line[0] != 0) {
+            domain = &line[0];
+        }
     }
 #endif
     if (domain == NULL) {
-	return NULL;
+        return NULL;
     }
     PL_strncpyz (hostname, hp->h_name, sizeof(hostname));
     if (domain[0] == '.') ++domain;
     if (domain[0]) {
-	PL_strcatn (hostname, sizeof(hostname), ".");
-	PL_strcatn (hostname, sizeof(hostname), domain);
+        PL_strcatn (hostname, sizeof(hostname), ".");
+        PL_strcatn (hostname, sizeof(hostname), domain);
     }
     LDAPDebug (LDAP_DEBUG_CONFIG, "hostname == %s\n", hostname, 0, 0);
     return slapi_ch_strdup (hostname);
@@ -184,21 +180,21 @@ convert_DNS_to_DN (char* DNS)
     char* dot;
     size_t components;
     if (*DNS == '\0') {
-	return slapi_ch_strdup ("");
+        return slapi_ch_strdup ("");
     }
     components = 1;
     for (dot = strchr (DNS, '.'); dot != NULL; dot = strchr (dot + 1, '.')) {
-	++components;
+        ++components;
     }
     DN = slapi_ch_malloc (strlen (DNS) + (components * strlen(RDN)) + 1);
     strcpy (DN, RDN);
     for (dot = strchr (DNS, '.'); dot != NULL; dot = strchr (dot + 1, '.')) {
-	*dot = '\0';
-	strcat (DN, DNS);
-	strcat (DN, ",");
-	strcat (DN, RDN);
-	DNS = dot + 1;
-	*dot = '.';
+        *dot = '\0';
+        strcat (DN, DNS);
+        strcat (DN, ",");
+        strcat (DN, RDN);
+        DNS = dot + 1;
+        *dot = '.';
     }
     strcat (DN, DNS);
     slapi_dn_normalize (DN);
@@ -210,24 +206,24 @@ static char* localhost_DN = NULL;
 char*
 get_localhost_DNS()
 {
-  char *retVal;
-  if ( (retVal = config_get_localhost()) == NULL) {
-	/* find_localhost_DNS() returns strdup result */
-	retVal = find_localhost_DNS();
-  }
+    char *retVal;
+    if ( (retVal = config_get_localhost()) == NULL) {
+        /* find_localhost_DNS() returns strdup result */
+        retVal = find_localhost_DNS();
+    }
     return retVal;
 }
 
 static void
 set_localhost_DN()
 {
-  char *localhost_DNS = config_get_localhost();
-  
-  if (localhost_DNS != NULL) {
-	localhost_DN = convert_DNS_to_DN (localhost_DNS);
-	LDAPDebug (LDAP_DEBUG_CONFIG, "DNS %s -> DN %s\n", localhost_DNS, localhost_DN, 0);
-  }
-  slapi_ch_free( (void **) &localhost_DNS );
+    char *localhost_DNS = config_get_localhost();
+
+    if (localhost_DNS != NULL) {
+        localhost_DN = convert_DNS_to_DN (localhost_DNS);
+        LDAPDebug (LDAP_DEBUG_CONFIG, "DNS %s -> DN %s\n", localhost_DNS, localhost_DN, 0);
+    }
+    slapi_ch_free_string(&localhost_DNS);
 }
 
 
@@ -238,7 +234,7 @@ get_localhost_DN()
    The caller should _not_ free this pointer. */
 {
     if (localhost_DN == NULL) {
-	set_localhost_DN();
+        set_localhost_DN();
     }
     return localhost_DN;
 }
diff --git a/ldap/servers/slapd/lock.c b/ldap/servers/slapd/lock.c
index c62bbd4..20249ed 100644
--- a/ldap/servers/slapd/lock.c
+++ b/ldap/servers/slapd/lock.c
@@ -44,12 +44,10 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/time.h>
 #include <sys/param.h>
 #include <sys/file.h>
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #ifdef USE_LOCKF
 #include <unistd.h>
@@ -69,30 +67,22 @@ lock_fopen( char *fname, char *type, FILE **lfp )
 	}
 
 	/* acquire the lock */
-#ifdef _WIN32
-	while ( _locking( _fileno( *lfp ), LK_NBLCK, 0xFFFFFFFF ) != 0 ) {
-#else
 #ifdef USE_LOCKF
 	while ( lockf( fileno( *lfp ), F_LOCK, 0 ) != 0 ) {
-#else /* _WIN32 */
+#else
 	while ( flock( fileno( *lfp ), LOCK_EX ) != 0 ) {
 #endif
-#endif /* _WIN32 */
 		;	/* NULL */
 	}
 
 	/* open the log file */
 	if ( (fp = fopen( fname, type )) == NULL ) {
 		LDAPDebug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", fname, 0, 0 );
-#ifdef _WIN32
-	        _locking( _fileno( *lfp ), LK_UNLCK, 0xFFFFFFFF );
-#else /* _WIN32 */
 #ifdef USE_LOCKF
 		lockf( fileno( *lfp ), F_ULOCK, 0 );
 #else
 		flock( fileno( *lfp ), LOCK_UN );
 #endif
-#endif /* _WIN32 */
 		return( NULL );
 	}
 
@@ -103,15 +93,11 @@ int
 lock_fclose( FILE *fp, FILE *lfp )
 {
 	/* unlock */
-#ifdef _WIN32
-        _locking( _fileno( lfp ), LK_UNLCK, 0xFFFFFFFF );
-#else /* _WIN32 */
 #ifdef USE_LOCKF
 	lockf( fileno( lfp ), F_ULOCK, 0 );
 #else
 	flock( fileno( lfp ), LOCK_UN );
 #endif
-#endif /* _WIN32 */
 	fclose( lfp );
 
 	return( fclose( fp ) );
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index f41e319..6279831 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -54,20 +54,9 @@
 
 #include "log.h"
 #include "fe.h"
-#ifndef _WIN32
 #include <pwd.h> /* getpwnam */
-#endif
-
-#if defined( XP_WIN32 )
-#include <fcntl.h>
-#include "ntslapdmessages.h"
-#include "proto-ntutil.h"
-extern HANDLE hSlapdEventSource;
-extern LPTSTR pszServerName;
-#define _PSEP '\\'
-#else
 #define _PSEP '/'
-#endif
+
 /**************************************************************************
  * GLOBALS, defines, and ...
  *************************************************************************/
@@ -163,28 +152,6 @@ slapd_log_error_proc_internal(
  *  flushes the buffer if necessary
  * LOG_CLOSE(fd) closes the logfile
  */
-#ifdef XP_WIN32
-#define LOG_OPEN_APPEND(fd, filename, mode) \
-	(((fd) = fopen((filename), "a")) != NULL)
-#define LOG_OPEN_WRITE(fd, filename, mode) \
-	(((fd) = fopen((filename), "w")) != NULL)
-#define LOG_WRITE(fd, buffer, size, headersize) \
-	if ( fwrite((buffer), (size), 1, (fd)) != 1 ) \
-	{\
-		ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_FAILED_TO_WRITE_LOG, 1, (buffer)); \
-	}
-#define LOG_WRITE_NOW(fd, buffer, size, headersize, err) do {\
-		(err) = 0; \
-		if ( fwrite((buffer), (size), 1, (fd)) != 1 ) \
-		{ \
-			ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_FAILED_TO_WRITE_LOG, 1, (buffer)); \
-			(err) = 1; \
-		}; \
-		fflush((fd)); \
-	} while (0)
-#define LOG_CLOSE(fd) \
-	fclose((fd))
-#else  /* xp_win32 */
 #define LOG_OPEN_APPEND(fd, filename, mode) \
 	(((fd) = PR_Open((filename), PR_WRONLY | PR_APPEND | PR_CREATE_FILE , \
 		mode)) != NULL)
@@ -219,7 +186,6 @@ slapd_log_error_proc_internal(
 	} while (0)
 #define LOG_CLOSE(fd) \
 	PR_Close((fd))
-#endif
 
 
 /******************************************************************************
@@ -247,41 +213,11 @@ void g_set_detached(int val)
 void g_log_init(int log_enabled)
 {
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-#if defined( XP_WIN32 )
-	/* char * instancedir = NULL; obsolete. */
-	/* To port to Windows, need to support FHS. */
-#endif
 
 	ts_time_lock = PR_NewLock();
 	if (! ts_time_lock)
 	    exit(-1);
 
-#if defined( XP_WIN32 )
-	pszServerName = slapi_ch_malloc( MAX_SERVICE_NAME );
-	/* instancedir = config_get_instancedir(); eliminated */
-	unixtodospath(instancedir);
-	if( !SlapdGetServerNameFromCmdline(pszServerName, instancedir, 1) )
-	{
-		MessageBox(GetDesktopWindow(), "Failed to get the Directory"
-			" Server name from the command-line argument.",
-			" ", MB_ICONEXCLAMATION | MB_OK);
-		exit( 1 );
-	}
-	slapi_ch_free((void **)&instancedir);
-
-    /* Register with the NT EventLog */
-    hSlapdEventSource = RegisterEventSource(NULL, pszServerName );
-    if( !hSlapdEventSource  )
-    {
-        char szMessage[256];
-        PR_snprintf( szMessage, sizeof(szMessage), "Directory Server %s is terminating. Failed "
-            "to set the EventLog source.", pszServerName);
-        MessageBox(GetDesktopWindow(), szMessage, " ", 
-            MB_ICONEXCLAMATION | MB_OK);
-        exit( 1 );
-    }
-#endif
-
 	/* ACCESS LOG */
 	loginfo.log_access_state = 0;
 	loginfo.log_access_mode = SLAPD_DEFAULT_FILE_MODE;
@@ -1832,16 +1768,8 @@ vslapd_log_emergency_error(LOGFD fp, const char *msg, int locked)
     int       size;
 
     tnl = current_time();
-#ifdef _WIN32
-    {
-        struct tm *pt = localtime( &tnl );
-        tmsp = &tms;
-        memcpy(&tms, pt, sizeof(struct tm) );
-    }
-#else
     (void)localtime_r( &tnl, &tms );
     tmsp = &tms;
-#endif
 #ifdef BSD_TIME
     tz = tmsp->tm_gmtoff;
 #else /* BSD_TIME */
@@ -1888,16 +1816,8 @@ vslapd_log_error(
     int       err = 0;
 
     tnl = current_time();
-#ifdef _WIN32
-    {
-        struct tm *pt = localtime( &tnl );
-        tmsp = &tms;
-        memcpy(&tms, pt, sizeof(struct tm) );
-    }
-#else
     (void)localtime_r( &tnl, &tms );
     tmsp = &tms;
-#endif
 #ifdef BSD_TIME
     tz = tmsp->tm_gmtoff;
 #else /* BSD_TIME */
@@ -1983,18 +1903,12 @@ slapi_log_error( int severity, char *subsystem, char *fmt, ... )
         return( -1 );
     }
 
-    if (
-#ifdef _WIN32
-         *module_ldap_debug
-#else
-         slapd_ldap_debug
-#endif
-            & slapi_log_map[ severity ] ) {
+    if ( slapd_ldap_debug & slapi_log_map[ severity ] ) {
         va_start( ap1, fmt );
         va_start( ap2, fmt );
         rc = slapd_log_error_proc_internal( subsystem, fmt, ap1, ap2 );
-            va_end( ap1 );
-            va_end( ap2 );
+        va_end( ap1 );
+        va_end( ap2 );
     } else {
         rc = 0;        /* nothing to be logged --> always return success */
     }
@@ -2010,20 +1924,14 @@ slapi_log_error_ext(int severity, char *subsystem, char *fmt, va_list varg1, va_
     if ( severity < SLAPI_LOG_MIN || severity > SLAPI_LOG_MAX ) {
         (void)slapd_log_error_proc( subsystem, "slapi_log_error: invalid severity %d (message %s)\n",
             severity, fmt );
-            return( -1 );
+        return( -1 );
     }
 
-    if (
-    #ifdef _WIN32
-        *module_ldap_debug
-    #else
-        slapd_ldap_debug
-    #endif
-        & slapi_log_map[ severity ] )
+    if ( slapd_ldap_debug & slapi_log_map[ severity ] )
     {
 	    rc = slapd_log_error_proc_internal( subsystem, fmt, varg1, varg2 );
     } else {
-        rc = 0;        /* nothing to be logged --> always return success */
+        rc = 0; /* nothing to be logged --> always return success */
     }
 
     return( rc );
@@ -2032,16 +1940,9 @@ slapi_log_error_ext(int severity, char *subsystem, char *fmt, va_list varg1, va_
 int
 slapi_is_loglevel_set ( const int loglevel )
 {
-    return ( 
-#ifdef _WIN32
-    *module_ldap_debug
-#else
-    slapd_ldap_debug
-#endif
-        & slapi_log_map[ loglevel ] ? 1 : 0);
+    return ( slapd_ldap_debug & slapi_log_map[ loglevel ] ? 1 : 0);
 }
 
-
 /******************************************************************************
 * write in the access log
 ******************************************************************************/ 
@@ -2070,16 +1971,8 @@ static int vslapd_log_access(char *fmt, va_list ap)
         PR_Unlock(ts_time_lock);
     } else {
     /* nope... painstakingly create the new strftime buffer */
-#ifdef _WIN32
-        {
-            struct tm *pt = localtime( &tnl );
-            tmsp = &tms;
-            memcpy(&tms, pt, sizeof(struct tm) );
-        }
-#else
         (void)localtime_r( &tnl, &tms );
         tmsp = &tms;
-#endif
 
 #ifdef BSD_TIME
         tz = tmsp->tm_gmtoff;
@@ -3042,19 +2935,6 @@ log__extract_logheader (FILE *fp, long *f_ctime, PRInt64 *f_size)
 /* using an int implies that all logfiles will be under 2G.  this is 
  * probably a safe assumption for now.
  */
-#ifdef XP_WIN32
-static PRInt64 
-log__getfilesize(LOGFD fp)
-{
-	struct stat	info;
-	int		rv;
-
-	if ((rv = fstat(fileno(fp), &info)) != 0) {
-		return -1;
-	}
-	return (PRInt64)info.st_size;
-} 
-#else
 static PRInt64
 log__getfilesize(LOGFD fp)
 {
@@ -3076,8 +2956,6 @@ log__getfilesize_with_filename(char *filename)
 	}
 	return (PRInt64)info.size;	/* type of size is PROffset64 */
 }
-#endif
-
 
 /******************************************************************************
 * log__enough_freespace
@@ -3090,41 +2968,14 @@ log__getfilesize_with_filename(char *filename)
 static int
 log__enough_freespace(char  *path)
 {
-
-#ifdef _WIN32
-DWORD	sectorsPerCluster, bytesPerSector, freeClusters, totalClusters;
-char rootpath[4];
-#else
 #ifdef LINUX
 	struct  statfs		buf;
 #else
 	struct	statvfs		buf;
 #endif   /* LINUX */
-#endif
 	PRInt64			freeBytes;
 	PRInt64 tmpval;
 
-
-#ifdef _WIN32
-    strncpy(rootpath, path, 3);
-    rootpath[3] = '\0';
-    /* we should consider using GetDiskFreeSpaceEx here someday */
-	if ( !GetDiskFreeSpace(rootpath, &sectorsPerCluster, &bytesPerSector,
-				&freeClusters, &totalClusters)) {
-		LDAPDebug(LDAP_DEBUG_ANY, 
-			  "log__enough_freespace: Unable to get the free space\n",0,0,0);
-		return 1;
-	} else {
-	    LL_UI2L(freeBytes, freeClusters);
-	    LL_UI2L(tmpval, sectorsPerCluster);
-        LL_MUL(freeBytes, freeBytes, tmpval);
-	    LL_UI2L(tmpval, bytesPerSector);
-        LL_MUL(freeBytes, freeBytes, tmpval);
-/*		freeBytes = freeClusters * sectorsPerCluster * bytesPerSector; */
-
-	}
-		
-#else
 #ifdef LINUX
 	if (statfs(path, &buf) == -1)
 #else
@@ -3143,7 +2994,6 @@ char rootpath[4];
 	    LL_MUL(freeBytes, freeBytes, tmpval);
 	  /*		freeBytes = buf.f_bavail * buf.f_bsize; */
 	}
-#endif
 	LL_UI2L(tmpval, loginfo.log_access_minfreespace);
 	if (LL_UCMP(freeBytes, <, tmpval)) {
 	/*	if (freeBytes < loginfo.log_access_minfreespace) { */
@@ -3762,13 +3612,10 @@ log__open_errorlogfile(int logfile_state, int locked)
 	struct logfileinfo	*logp;
 	char			buffer[BUFSIZ];
 	struct passwd	*pw = NULL;
-#ifndef _WIN32
 	int rc = 0;
-#endif
 
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
-#ifndef _WIN32
 	if ( slapdFrontendConfig->localuser != NULL &&
 	     slapdFrontendConfig->localuserinfo != NULL ) {
 		pw = slapdFrontendConfig->localuserinfo;
@@ -3779,7 +3626,6 @@ log__open_errorlogfile(int logfile_state, int locked)
 		log__error_emergency(buffer, 0, locked);
 		return LOG_UNABLE_TO_OPENFILE;
 	}
-#endif
 
 	if (!locked) LOG_ERROR_LOCK_WRITE( );
 
@@ -3857,7 +3703,6 @@ log__open_errorlogfile(int logfile_state, int locked)
 		return LOG_UNABLE_TO_OPENFILE;
 	}
 
-#ifndef _WIN32
 	/* make sure the logfile is owned by the localuser.  If one of the
 	 * alternate ns-slapd modes, such as db2bak, tries to log an error
 	 * at startup, it will create the logfile as root! 
@@ -3876,7 +3721,6 @@ log__open_errorlogfile(int logfile_state, int locked)
 		*/
 		return LOG_UNABLE_TO_OPENFILE;
 	}
-#endif
 
 	loginfo.log_error_fdes = fp;
 	if (logfile_state == LOGFILE_REOPENED) {
@@ -4208,16 +4052,8 @@ log_convert_time (time_t ctime, char *tbuf, int type)
 {
 	struct tm               *tmsp, tms;
 
-#ifdef _WIN32
-	{
-		struct tm *pt = localtime( &ctime );
-		tmsp = &tms;
-		memcpy(&tms, pt, sizeof(struct tm) );
-	}
-#else
 	(void)localtime_r( &ctime, &tms );
 	tmsp = &tms;
-#endif
 	if (type == 1)	/* get the short form */
 		(void) strftime (tbuf, (size_t) TBUFSIZE, "%Y%m%d-%H%M%S",tmsp);
 	else	/* wants the long form */
diff --git a/ldap/servers/slapd/log.h b/ldap/servers/slapd/log.h
index 86e59d9..4f6bed9 100644
--- a/ldap/servers/slapd/log.h
+++ b/ldap/servers/slapd/log.h
@@ -60,14 +60,12 @@
 #include <stdarg.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifndef  _WIN32
 #include <errno.h>
 #ifdef LINUX
 #include <sys/statfs.h>
 #else
 #include <sys/statvfs.h>
 #endif
-#endif
 #include <fcntl.h>
 #include "prio.h"
 #include "prprf.h"
@@ -108,11 +106,7 @@
 #define PREVLOGFILE	"Previous Log File:"
 
 /* see log.c for why this is done */
-#ifdef XP_WIN32
-typedef FILE *LOGFD;
-#else
 typedef PRFileDesc *LOGFD;
-#endif
 
 
 struct logfileinfo {
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index a3ba99b..28f6908 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -49,7 +49,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#if !defined(_WIN32) && !defined(aix)
+#if !defined(aix)
 #include <sys/fcntl.h>
 #else
 #include <fcntl.h>
@@ -58,10 +58,6 @@
 #include <stdarg.h>
 #include <signal.h>
 #include <stdlib.h>
-#if defined( _WIN32 )
-#include "ntslapdmessages.h"
-#include "proto-ntutil.h"
-#else
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -75,13 +71,10 @@ union semun {
     ushort *array;
 };
 #endif
-#endif
-#if !defined(_WIN32)
 #include <unistd.h> /* dup2 */
 #include <sys/ipc.h>
 #include <sys/sem.h>
 #include <sys/param.h> /* MAXPATHLEN */
-#endif
 #if defined(__sun)
 #include <sys/utsname.h>
 #include <sys/systeminfo.h>
@@ -100,10 +93,6 @@ union semun {
 #include "smrtheap.h"
 #endif
 
-#if defined( XP_WIN32 )
-void dostounixpath(char *szText);
-#endif
-
 /* Forward Declarations */
 static void register_objects();
 static void process_command_line(int argc, char **argv, char *myname, char **extraname);
@@ -129,7 +118,6 @@ static int slapd_exemode = SLAPD_EXEMODE_UNKNOWN;
 static int init_cmd_shutdown_detect()
 {
 
-#ifndef _WIN32
   /* First of all, we must reset the signal mask to get rid of any blockages
    * the process may have inherited from its parent (such as the console), which
    * might result in the process not delivering those blocked signals, and thus,
@@ -145,7 +133,6 @@ static int init_cmd_shutdown_detect()
     LDAPDebug( LDAP_DEBUG_TRACE, " %s \n",
                rc ? "Failed to reset signal mask":"....Done (signal mask reset)!!", 0, 0 );
   }
-#endif
 
 #if defined ( HPUX10 )
     PR_CreateThread ( PR_USER_THREAD,
@@ -164,7 +151,7 @@ static int init_cmd_shutdown_detect()
          * thread a chance to run. */
         DS_Sleep(0);
 #endif
-#ifndef _WIN32
+
         (void) SIGNAL( SIGPIPE, SIG_IGN );
         (void) SIGNAL( SIGCHLD, slapd_wait4child );
 #ifndef LINUX
@@ -177,7 +164,7 @@ static int init_cmd_shutdown_detect()
         (void) SIGNAL( SIGTERM, cmd_set_shutdown );
         (void) SIGNAL( SIGHUP,  cmd_set_shutdown );
         (void) SIGNAL( SIGINT,  cmd_set_shutdown );
-#endif /* _WIN32 */
+
         return 0;
 }
 
@@ -191,22 +178,18 @@ cmd_set_shutdown (int sig)
      */
 
     c_set_shutdown();
-#ifndef _WIN32
 #ifndef LINUX
     /* don't mess with USR1/USR2 on linux, used by libpthread */
     (void) SIGNAL( SIGUSR2, cmd_set_shutdown );
 #endif
     (void) SIGNAL( SIGTERM, cmd_set_shutdown );
     (void) SIGNAL( SIGHUP,  cmd_set_shutdown );
-#endif
 }
 
 #ifdef HPUX10
 extern void collation_init();
 #endif
 
-#ifndef WIN32
-
 /* 
    Four cases:
     - change ownership of all files in directory (strip_fn=PR_FALSE)
@@ -311,7 +294,6 @@ fix_ownership()
 		chown_dir_files(slapdFrontendConfig->errorlog, pw, PR_TRUE, PR_TRUE);
 	}
 }
-#endif  
 
 /* Changes identity to the named user 
  * If username == NULL, does nothing.
@@ -319,7 +301,6 @@ fix_ownership()
  */
 static int main_setuid(char *username)
 {
-#ifndef _WIN32
 	if (username != NULL) {
 	    struct passwd *pw;
 	    /* Make sure everything in the log and config directory 
@@ -348,14 +329,13 @@ static int main_setuid(char *username)
 		}
 	    }
 	}
-#endif
 	return 0;
 }
 
 /* set good defaults for front-end config in referral mode */
 static void referral_set_defaults(void)
 {
-#if !defined(_WIN32) && !defined(AIX)
+#if !defined(AIX)
     char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
     config_set_maxdescriptors( CONFIG_MAXDESCRIPTORS_ATTRIBUTE, "1024", errorbuf, 1);
 #endif
@@ -568,12 +548,9 @@ static void slapd_print_version(int verbose)
 
 	printf( SLAPD_VENDOR_NAME "\n%s B%s\n", versionstring, buildnum);
 
-	/* not here in Win32 */
-#if !defined(_WIN32)
 	if (strcmp(buildnum,BUILD_NUM) != 0) {
 	  printf( "ns-slapd: B%s\n", BUILD_NUM);
 	}
-#endif
 
 	slapi_ch_free( (void **)&versionstring);
 	slapi_ch_free( (void **)&buildnum);
@@ -591,29 +568,6 @@ static void slapd_print_version(int verbose)
 	plugin_print_versions();
 }
 
-#if defined( _WIN32 )
-/* On Windows, we signal the SCM when we're still starting up */
-static int
-write_start_pid_file()
-{
-	if( SlapdIsAService() )
-	{
-		/* Initialization complete and successful. Set service to running */
-		LDAPServerStatus.dwCurrentState	= SERVICE_START_PENDING;
-		LDAPServerStatus.dwCheckPoint = 1;
-		LDAPServerStatus.dwWaitHint = 1000;
-
-		if (!SetServiceStatus(hLDAPServerServiceStatus, &LDAPServerStatus)) {
-			ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_START_FAILED, 1,
-				"Could not set Service status.");
-			exit(1);
-		}
-	}
-
-	ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_STARTED, 0, NULL );
-	return 0;
-}
-#else /* WIN32 */
 /* On UNIX, we create a file with our PID in it */
 static int
 write_start_pid_file()
@@ -635,7 +589,6 @@ write_start_pid_file()
 	}
 	return -1;
 }
-#endif /* WIN32 */
 
 #ifdef MEMPOOL_EXPERIMENTAL
 void _free_wrapper(void *ptr)
@@ -689,23 +642,6 @@ main( int argc, char **argv)
 	PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 0 );
 	FrontendConfig_init();
 	
-#ifdef _WIN32
-	/* Break into the debugger if DEBUG_BREAK is set in the environment
-	   to "slapd" */
-	{
-		char *s = getenv( "DEBUG_BREAK" );
-		if ( (s != NULL) && !stricmp(s, "slapd") )
-			DebugBreak();
-	}
-
-	/* do module debug level init for slapd, and libslapd */
-	module_ldap_debug = &slapd_ldap_debug;
-	libldap_init_debug_level(&slapd_ldap_debug);
-  
-	dostounixpath( argv[0] );
-	_strlwr( argv[0] );
-
-#else /* _WIN32 */
 	/* Pause for the debugger if DEBUG_SLEEP is set in the environment */
 	{
 		char *s = getenv( "DEBUG_SLEEP" );
@@ -716,27 +652,13 @@ main( int argc, char **argv)
 		}
 	}
 
-
-/* used to set configfile to the default config file name here */
-
-#endif /* _WIN32 */
-
+	/* used to set configfile to the default config file name here */
 	if ( (myname = strrchr( argv[0], '/' )) == NULL ) {
 		myname = slapi_ch_strdup( argv[0] );
 	} else {
 		myname = slapi_ch_strdup( myname + 1 );
 	}
 
-#if defined( XP_WIN32 )
-	/* Strip ".exe" if it's there */
-	{
-	char *pdot;
-	if ( (pdot = strrchr( myname, '.' )) != NULL ) {
-		*pdot = '\0';
-	}
-	}
-#endif
-
 	process_command_line(argc,argv,myname,&extraname);
 
 	if (NULL == slapdFrontendConfig->configdir) {
@@ -744,7 +666,6 @@ main( int argc, char **argv)
 		exit( 1 );
 	}
 
-
 	/* display debugging level if it is anything other than the default */
 	if ( 0 != ( slapd_ldap_debug & ~LDAP_DEBUG_ANY )) {
 		slapd_debug_level_log( slapd_ldap_debug );
@@ -866,25 +787,6 @@ main( int argc, char **argv)
 	/* Set entry points in libslapd */
 	set_entry_points();
 
-#if defined( XP_WIN32 )
-	if (slapd_exemode == SLAPD_EXEMODE_SLAPD) {
-		/* Register with the NT EventLog */
-		hSlapdEventSource = RegisterEventSource(NULL, pszServerName );
-		if( !hSlapdEventSource  ) {
-			char szMessage[256];
-			PR_snprintf( szMessage, sizeof(szMessage), "Directory Server %s is terminating. Failed "
-						 "to set the EventLog source.", pszServerName);
-			MessageBox(GetDesktopWindow(), szMessage, " ", 
-					   MB_ICONEXCLAMATION | MB_OK);
-			exit( 1 );
-		}
-
-		/* Check to ensure there isn't a copy of this server already running. */
-		if( MultipleInstances() ) 
-			exit( 1 );
-	}
-#endif
-
 	/*
 	 * After we read the config file we should make
 	 * sure that everything we needed to read in has 
@@ -948,15 +850,12 @@ main( int argc, char **argv)
 	}
 
 	/* Now, sockets are open, so we can safely change identity now */
-
-#ifndef _WIN32
 	return_value = main_setuid(slapdFrontendConfig->localuser);
 	if (0 != return_value) {
 		LDAPDebug( LDAP_DEBUG_ANY, "Failed to change user and group identity to that of %s\n",
 				   slapdFrontendConfig->localuser, 0, 0 );
 		exit(1);
 	}
-#endif
 
     /* Do NSS and/or SSL init for those modes other than listening modes */
     if ((slapd_exemode != SLAPD_EXEMODE_REFERRAL) &&
@@ -1158,16 +1057,11 @@ main( int argc, char **argv)
 		}
 
 		/* --ugaston: register the start-tls plugin */
-#ifndef _WIN32		
 		if ( slapd_security_library_is_initialized() != 0 ) {
-	
-		
-				 start_tls_register_plugin();
-			 LDAPDebug( LDAP_DEBUG_PLUGIN, 
-					"Start TLS plugin registered.\n",
-					0, 0, 0 );
+			start_tls_register_plugin();
+			LDAPDebug( LDAP_DEBUG_PLUGIN, "Start TLS plugin registered.\n",
+				0, 0, 0 );
 		} 
-#endif
 		passwd_modify_register_plugin();
 		LDAPDebug( LDAP_DEBUG_PLUGIN, 
 					"Password Modify plugin registered.\n", 0, 0, 0 );
@@ -1215,28 +1109,6 @@ main( int argc, char **argv)
 		} else if (i_port) {
 		} else if ( config_get_security()) {
 		} else {
-#ifdef _WIN32	
-			if( SlapdIsAService() )
-			{
-				LDAPServerStatus.dwCurrentState = SERVICE_STOPPED;
-				LDAPServerStatus.dwCheckPoint = 0;
-				LDAPServerStatus.dwWaitHint = 0;
-				LDAPServerStatus.dwWin32ExitCode = 1;
-				LDAPServerStatus.dwServiceSpecificExitCode = 1;
-
-				SetServiceStatus(hLDAPServerServiceStatus, &LDAPServerStatus);
-
-				/* Log this event */
-				ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_START_FAILED, 1, 
-					"Check server port specification");
-			}
-			else
-			{
-				char szMessage[256];
-				PR_snprintf( szMessage, sizeof(szMessage), "The Directory Server %s is terminating due to an error. Check server port specification", pszServerName);
-				MessageBox(GetDesktopWindow(), szMessage,	" ", MB_ICONEXCLAMATION | MB_OK);
-			}
-#endif
 			LDAPDebug( LDAP_DEBUG_ANY,
                                 "Fatal Error---No ports specified. "
                                 "Exiting now.\n", 0, 0, 0 );
@@ -1276,7 +1148,6 @@ main( int argc, char **argv)
 
 	{
 		time( &starttime );
-
 		slapd_daemon(&ports_info);
 	}
  	LDAPDebug( LDAP_DEBUG_ANY, "slapd stopped.\n", 0, 0, 0 );
@@ -1290,10 +1161,6 @@ cleanup:
 	ndn_cache_destroy();
 	NSS_Shutdown();
 	PR_Cleanup();
-#ifdef _WIN32
-	/* Clean up the mutex used to interlock processes, before we exit */
-	remove_slapd_process();
-#endif
 #if ( defined( hpux ) || defined( irix ) || defined( aix ) || defined( OSF1 ))
 	exit( return_value );
 #else
@@ -1648,20 +1515,11 @@ process_command_line(int argc, char **argv, char *myname,
 			        char *p;
 					/* if LDIF comes through standard input, skip path checking */
 					if ( optarg_ext[0] != '-' || strlen(optarg_ext) != 1) {
-#if defined( XP_WIN32 )
-						if ( optarg_ext[0] != '/' && optarg_ext[0] != '\\'
-						&& (!isalpha( optarg_ext[0] ) || (optarg_ext[1] != ':')) ) {
-							fprintf( stderr, "%s file could not be opened: absolute path "
-							" required.\n", optarg_ext );
-						break;
-						}
-#else
 						if ( optarg_ext[ 0 ] != '/' ) {
 							fprintf( stderr, "%s file could not be opened: absolute path "
 							" required.\n", optarg_ext );
 						break;
 						}
-#endif
 					}
 				p = (char *) slapi_ch_malloc(strlen(optarg_ext) + 1);
 
@@ -2266,9 +2124,7 @@ slapd_exemode_ldif2db()
     pb.pb_ldif_include = db2ldif_include;
     pb.pb_ldif_exclude = db2ldif_exclude;
     pb.pb_task_flags = SLAPI_TASK_RUNNING_FROM_COMMANDLINE;
-#ifndef _WIN32
     main_setuid(slapdFrontendConfig->localuser);
-#endif
     if ( plugin->plg_ldif2db != NULL ) {
         return_value = (*plugin->plg_ldif2db)( &pb );
     } else {
@@ -2339,11 +2195,9 @@ slapd_exemode_db2ldif(int argc, char** argv)
 		}
     }
 
-#ifndef _WIN32
 	/* [622984] db2lidf -r changes database file ownership
 	 * should call setuid before "db2ldif_dump_replica" */
 	main_setuid(slapdFrontendConfig->localuser);
-#endif
 	for (instp = cmd_line_instance_names; instp && *instp; instp++) {
 		int release_me = 0;
 
@@ -2412,13 +2266,8 @@ slapd_exemode_db2ldif(int argc, char** argv)
 	    pb.pb_ldif_file = NULL;
 	    if ( archive_name ) { /* redirect stdout to this file: */
             char *p, *q;
-#if defined( XP_WIN32 )
-			char sep = '\\';
-			if (NULL != strchr(archive_name, '/'))
-				sep = '/';
-#else
 			char sep = '/';
-#endif
+
 			my_ldiffile = archive_name;
 			if (ldif_printkey & EXPORT_APPENDMODE) {
 				if (instp == cmd_line_instance_names) {	/* first export */
@@ -2586,9 +2435,7 @@ static int slapd_exemode_db2index()
     pb.pb_db2index_attrs = db2index_attrs;
     pb.pb_instance_name = cmd_line_instance_name;
     pb.pb_task_flags = SLAPI_TASK_RUNNING_FROM_COMMANDLINE;
-#ifndef _WIN32
     main_setuid(slapdFrontendConfig->localuser);
-#endif
     return_value = (*plugin->plg_db2index)( &pb );
 
     slapi_ch_free( (void**)&myname );
@@ -2645,9 +2492,7 @@ slapd_exemode_db2archive()
 	pb.pb_instance_name = NULL;
 	pb.pb_seq_val = archive_name;
 	pb.pb_task_flags = SLAPI_TASK_RUNNING_FROM_COMMANDLINE;
-#ifndef _WIN32
 	main_setuid(slapdFrontendConfig->localuser);
-#endif
 	return_value = (backend_plugin->plg_db2archive)( &pb );
 	return return_value;
 }
@@ -2702,9 +2547,7 @@ slapd_exemode_archive2db()
 	pb.pb_instance_name = cmd_line_instance_name;
 	pb.pb_seq_val = archive_name;
 	pb.pb_task_flags = SLAPI_TASK_RUNNING_FROM_COMMANDLINE;
-#ifndef _WIN32
 	main_setuid(slapdFrontendConfig->localuser);
-#endif
 	return_value = (backend_plugin->plg_archive2db)( &pb );
 	return return_value;
 }	
@@ -2769,9 +2612,7 @@ slapd_exemode_upgradedb()
     pb.pb_ldif_namespaceid = ldif2db_namespaceid;
     pb.pb_ldif2db_noattrindexes = 0;
     pb.pb_removedupvals = 0;
-#ifndef _WIN32
     main_setuid(slapdFrontendConfig->localuser);
-#endif
     if ( backend_plugin->plg_upgradedb != NULL ) {
         return_value = (*backend_plugin->plg_upgradedb)( &pb );
     } else {
@@ -2846,9 +2687,7 @@ slapd_exemode_upgradednformat()
     pb.pb_ldif_namespaceid = ldif2db_namespaceid;
     pb.pb_ldif2db_noattrindexes = 0;
     pb.pb_removedupvals = 0;
-#ifndef _WIN32
     main_setuid(slapdFrontendConfig->localuser);
-#endif
     if ( backend_plugin->plg_upgradednformat != NULL ) {
         rc  = (*backend_plugin->plg_upgradednformat)( &pb );
     } else {
diff --git a/ldap/servers/slapd/mempool.c b/ldap/servers/slapd/mempool.c
index f990363..e0871b8 100644
--- a/ldap/servers/slapd/mempool.c
+++ b/ldap/servers/slapd/mempool.c
@@ -437,12 +437,6 @@ slapi_ch_malloc( unsigned long	size )
 	PR_INCREMENT_COUNTER(slapi_ch_counter_malloc);
 	PR_INCREMENT_COUNTER(slapi_ch_counter_created);
 	PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		add_memory_record(newmem,size);
-	}
-#endif
 
 	return( newmem );
 }
@@ -526,13 +520,6 @@ slapi_ch_realloc( char *block, unsigned long size )
 		counters_created= 1;
 	}
     PR_INCREMENT_COUNTER(slapi_ch_counter_realloc);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		remove_memory_record(block);
-		add_memory_record(newmem,size);
-	}
-#endif
 
 	return( newmem );
 }
@@ -607,12 +594,7 @@ slapi_ch_calloc( unsigned long nelem, unsigned long size )
     PR_INCREMENT_COUNTER(slapi_ch_counter_calloc);
     PR_INCREMENT_COUNTER(slapi_ch_counter_created);
     PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		add_memory_record(newmem,size);
-	}
-#endif
+
 	return( newmem );
 }
 
@@ -638,12 +620,7 @@ slapi_ch_strdup ( const char* s1 )
     PR_INCREMENT_COUNTER(slapi_ch_counter_strdup);
     PR_INCREMENT_COUNTER(slapi_ch_counter_created);
     PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		add_memory_record(newmem,strlen(s1)+1);
-	}
-#endif
+
     return newmem;
 }
 
@@ -670,15 +647,9 @@ slapi_ch_free(void **ptr)
 	unsigned long size;
 
 	if (ptr==NULL || *ptr == NULL){
-	return;
+		return;
 	}
 
-#if defined(_WIN32) && defined(DEBUG)
-	if(recording)
-	{
-		remove_memory_record(*ptr);
-	}
-#endif
 	realptr = (void *)((char *)*ptr - sizeof(unsigned long));
 	size = *(unsigned long *)realptr;
 	if (size <= 1024) {
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index ab12f56..a452765 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -63,12 +63,10 @@
 #include <time.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "pratom.h"
-#if defined(irix) || defined(aix) || defined(_WIN32)
+#if defined(irix) || defined(aix)
 #include <time.h>
 #endif
 
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index b4658c3..e4efa0c 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -55,9 +55,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "pratom.h"
 
diff --git a/ldap/servers/slapd/modutil.c b/ldap/servers/slapd/modutil.c
index c9beb20..af1d35b 100644
--- a/ldap/servers/slapd/modutil.c
+++ b/ldap/servers/slapd/modutil.c
@@ -46,9 +46,7 @@
 #include <string.h>
 #include <time.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif /* _WIN32 */					 
 #include "slap.h"
 
 #define SIZE_INIT 4	/* initial element size */
diff --git a/ldap/servers/slapd/monitor.c b/ldap/servers/slapd/monitor.c
index 2c15c39..e762885 100644
--- a/ldap/servers/slapd/monitor.c
+++ b/ldap/servers/slapd/monitor.c
@@ -56,9 +56,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <time.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "fe.h"
 
@@ -107,29 +105,13 @@ monitor_info(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *ret
 	val.bv_val = buf;
 	attrlist_replace( &e->e_attrs, "bytessent", vals );
 
-#ifdef _WIN32
-	{
-	struct tm *pt;
-	pt = gmtime( &curtime );
-	memcpy(&utm, pt, sizeof(struct tm) );
-	}
-#else
 	gmtime_r( &curtime, &utm );
-#endif
 	strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", &utm );
 	val.bv_val = buf;
 	val.bv_len = strlen( buf );
 	attrlist_replace( &e->e_attrs, "currenttime", vals );
 
-#ifdef _WIN32
-	{
-	struct tm *pt;
-	pt = gmtime( &starttime );
-	memcpy(&utm, pt, sizeof(struct tm) );
-	}
-#else
 	gmtime_r( &starttime, &utm );
-#endif
 	strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", &utm );
 	val.bv_val = buf;
 	val.bv_len = strlen( buf );
diff --git a/ldap/servers/slapd/operation.c b/ldap/servers/slapd/operation.c
index f27c673..52d17be 100644
--- a/ldap/servers/slapd/operation.c
+++ b/ldap/servers/slapd/operation.c
@@ -45,9 +45,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 #include "fe.h"
 
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index cab911a..9ecebc2 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -201,15 +201,7 @@ modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
 
     /* fill in modifytimestamp */
     curtime = current_time();
-#ifdef _WIN32
-{
-    struct tm *pt;
-    pt = gmtime(&curtime);
-    memcpy(&utm, pt, sizeof(struct tm));
-}
-#else
     gmtime_r(&curtime, &utm);
-#endif
     strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", &utm);
     bv.bv_val = buf;
     bv.bv_len = strlen(bv.bv_val);
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index e54c01d..1500cff 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -2872,18 +2872,6 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 			status = -1;
 			goto PLUGIN_CLEANUP;
 		}
-#ifdef _WIN32
-		{
-			set_debug_level_fn_t fn;
-			/* for Win32 only, attempt to get its debug level init function */
-			if ((fn = (set_debug_level_fn_t)sym_load(plugin->plg_libpath,
-						"plugin_init_debug_level", plugin->plg_name,
-						0 /* do not report errors */ )) != NULL) {
-				/* we hooked the function, so call it */
-				(*fn)(module_ldap_debug); 
-			}
-		}
-#endif
 	}
 
 	if (!status && group) /* uses group's config; see plugin_get_config */
diff --git a/ldap/servers/slapd/protect_db.c b/ldap/servers/slapd/protect_db.c
index 6f8b8fe..40685f1 100644
--- a/ldap/servers/slapd/protect_db.c
+++ b/ldap/servers/slapd/protect_db.c
@@ -45,10 +45,6 @@
  * slapd from clobbering each other
  */
 
-
-
-#ifndef _WIN32
-
 #define LOCK_FILE   "lock"
 #define IMPORT_DIR  "imports"
 #define EXPORT_DIR  "exports"
@@ -66,16 +62,10 @@
 #include <sys/param.h> /* MAXPATHLEN */
 #include <dirent.h>
 #include <pwd.h>
-#endif 
 
 #include "protect_db.h"
-
 #include "slap.h"
 
-
-#ifndef _WIN32
-/* This is the unix version of the code to protect the db. */
-
 static int
 grab_lockfile()
 {
@@ -551,245 +541,3 @@ is_slapd_running() {
   release_lockfile();
   return running;
 }
-
-#else /* _WIN32 */
-
-/* The NT version of this code */
-
-/* Returns 1 if the mutex named 'mutexName' otherwise it
- * returns 0
- */
-int
-mutex_exists( char *mutexName )
-{
-    if ( OpenMutex( SYNCHRONIZE, FALSE, mutexName ) == NULL ) {
-        return( 0 );
-    } else {
-        return( 1 );
-    }        
-}
-
-/* is_slapd_running(): 
- * returns 1 if slapd is running, 0 if not 
- */
-
-int
-is_slapd_running() {
-  char mutexName[ MAXPATHLEN + 1 ];
-  char serverMutexName[ MAXPATHLEN + 1 ];
-  int result = 0;
-  slapdFrontendConfig_t *cfg = getFrontendConfig();
-
-  strncpy( mutexName, cfg->lockdir, MAXPATHLEN );
-  strncpy( serverMutexName, cfg->lockdir, MAXPATHLEN );
-  mutexName[ MAXPATHLEN ] = '\0';
-
-  serverMutexName[ MAXPATHLEN ] = '\0';
-  strcat( serverMutexName, "/server" );
-    
-  return mutex_exists ( serverMutexName );
-}
-
-static void fix_mutex_name(char *name)
-{
-    /* On NT mutex names cannot contain the '\' character.
-     * This functions replaces '\' with '/' in the supplied
-     * name. */
-    int x;
-
-    for (x = 0; name[x] != '\0'; x++) {
-        if ('\\' == name[x]) {
-            name[x] = '/';
-        }
-    }
-}
-
-/*
- * We retain any opened handle to the mutex we create here,
- * to use when we shutdown, to delete the mutex prior to 
- * signaling that we've exited.
- */
-static HANDLE open_mutex = NULL;
-
-/* 
- * Call this to clean up the locks, before signaling
- * that the server is down.
- */
-void
-remove_slapd_process()
-{
-    if (open_mutex) {
-        CloseHandle(open_mutex);
-    }
-}
-
-/* This function makes sure different instances of slapd don't
- * run in conflicting modes at the same time. The WIN32 version
- * uses mutexes as names that the kernel handles.  Basically there
- * is a server mutex, and import mutex, and an export mutex.  If
- * the server mutex exists, then the server is running.  If the 
- * import mutex exists, then either ldif2db or bak2db is running.
- * If the export mutex exists, then one or more of db2ldif or db2bak
- * are running.  There is also a mutex that is actually locked when
- * checking the existence of the other mutexes. The OS will
- * automatically remove a mutex if no process has a handle on it.
- * returns a 0 if it is ok for the process to run 
- * returns a -1 if the process can't run do to a conflict with other
- * slapd processes
- */
-int
-add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
-{
-    char mutexName[ MAXPATHLEN + 1 ];
-    char serverMutexName[ MAXPATHLEN + 1 ];
-    char importMutexName[ MAXPATHLEN + 1 ];
-    char exportMutexName[ MAXPATHLEN + 1 ];
-
-    HANDLE mutex;
-    SECURITY_ATTRIBUTES mutexAttributes;
-    PSECURITY_DESCRIPTOR pSD;
-    LPVOID lpMsgBuf;
-
-    int result = 0;
-
-    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
-    if (skip_flag) {
-        return 0;
-    }
-
-    /* Create the names for the mutexes */
-    PL_strncpyz(mutexName, slapdFrontendConfig->lockdir, sizeof(mutexName));
-
-    /* Make sure the name of the mutex is legal. */
-    fix_mutex_name(mutexName);
-
-    PR_snprintf(serverMutexName, sizeof(serverMutexName), "%s/server", mutexName);
-    PR_snprintf(importMutexName, sizeof(importMutexName), "%s/import", mutexName);
-    PR_snprintf(exportMutexName, sizeof(exportMutexName), "%s/export", mutexName);
-    
-    /* Fill in the security crap for the mutex */
-    pSD = (PSECURITY_DESCRIPTOR)slapi_ch_malloc( sizeof( SECURITY_DESCRIPTOR ) );
-    InitializeSecurityDescriptor( pSD, SECURITY_DESCRIPTOR_REVISION );
-    SetSecurityDescriptorDacl( pSD, TRUE, NULL, FALSE );
-    mutexAttributes.nLength = sizeof( mutexAttributes );
-    mutexAttributes.lpSecurityDescriptor = pSD;
-    mutexAttributes.bInheritHandle = FALSE;
-    
-    /* Get a handle to the main mutex */
-    if ( ( mutex = CreateMutex( &mutexAttributes, FALSE, mutexName ) ) == NULL ) {
-        FormatMessage( 
-            FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-            NULL,
-            GetLastError(),
-            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
-            (LPTSTR) &lpMsgBuf,
-            0,
-            NULL 
-        );
-
-        LDAPDebug( LDAP_DEBUG_ANY, CREATE_MUTEX_ERROR, lpMsgBuf, 0, 0 );
-        LocalFree( lpMsgBuf );
-        exit( 1 );
-    }
-    
-    /* Lock the main mutex */
-    if ( WaitForSingleObject( mutex, INFINITE ) == WAIT_FAILED ) {
-        FormatMessage( 
-            FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-            NULL,
-            GetLastError(),
-            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
-            (LPTSTR) &lpMsgBuf,
-            0,
-            NULL 
-        );
-
-        LDAPDebug( LDAP_DEBUG_ANY, WAIT_ERROR, lpMsgBuf, 0, 0 );
-        LocalFree( lpMsgBuf );
-        exit( 1 );
-    }
-
-
-    switch (exec_mode) {
-        case SLAPD_EXEMODE_SLAPD:
-            if ( mutex_exists( serverMutexName ) ||
-                 mutex_exists( importMutexName ) )  {
-                LDAPDebug( LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_USE, 0, 0, 0);
-                result = -1;
-            } else {
-                open_mutex = CreateMutex( &mutexAttributes, FALSE, serverMutexName );
-                result = 0;
-            }
-            break;
-        case SLAPD_EXEMODE_DB2LDIF:
-            if (r_flag)  {
-                /* When the -r flag is used in db2ldif we need to make sure 
-                 * we get a consistent snapshot of the server.  As a result
-                 * it needs to run by itself, so no other slapd process can
-                 * change the database while it is running. */
-                if ( mutex_exists( serverMutexName ) ||
-                     mutex_exists( importMutexName ) ||
-                     mutex_exists( exportMutexName ) ) {
-                    LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIFR_DUE_TO_USE, 0, 0, 0);
-                    result = -1;
-                } else {
-                    CreateMutex( &mutexAttributes, FALSE, exportMutexName );
-                    result = 0;
-                }
-                break;
-            }
-        case SLAPD_EXEMODE_DB2ARCHIVE:
-            if ( mutex_exists( importMutexName ) )  {
-                LDAPDebug(LDAP_DEBUG_ANY, NO_EXPORT_DUE_TO_IMPORT, 0, 0, 0);
-                result = -1;
-            } else {
-                CreateMutex( &mutexAttributes, FALSE, exportMutexName );
-                result = 0;
-            }
-            break;
-        case SLAPD_EXEMODE_ARCHIVE2DB:
-        case SLAPD_EXEMODE_LDIF2DB:
-            if ( mutex_exists( serverMutexName ) ||
-                 mutex_exists( importMutexName ) ||
-                 mutex_exists( exportMutexName ) ) {
-                    LDAPDebug(LDAP_DEBUG_ANY, NO_IMPORT_DUE_TO_USE, 0, 0, 0);
-                result = -1;
-            } else {
-                CreateMutex( &mutexAttributes, FALSE, importMutexName );
-                result = 0;
-            }
-            break;
-        case SLAPD_EXEMODE_UPGRADEDB:
-            if ( mutex_exists( serverMutexName ) ||
-                 mutex_exists( importMutexName ) ||
-                 mutex_exists( exportMutexName ) ) {
-                    LDAPDebug(LDAP_DEBUG_ANY, NO_UPGRADEDB_DUE_TO_USE, 0, 0, 0);
-                result = -1;
-            } else {
-                CreateMutex( &mutexAttributes, FALSE, importMutexName );
-                result = 0;
-            }
-            break;
-        case SLAPD_EXEMODE_DBTEST:
-            if ( mutex_exists( serverMutexName ) ||
-                 mutex_exists( importMutexName ) ||
-                 mutex_exists( exportMutexName ) ) {
-                    LDAPDebug(LDAP_DEBUG_ANY, NO_DBTEST_DUE_TO_USE, 0, 0, 0);
-                result = -1;
-            } else {
-                CreateMutex( &mutexAttributes, FALSE, importMutexName );
-                result = 0;
-            }
-            break;
-    }
-    
-    /* release the main mutex */
-    ReleaseMutex( mutex );
-
-    slapi_ch_free((void**)&pSD );
-
-    return( result );
-}
-#endif /* _WIN32 */    
-    
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index ea5ff53..dd01999 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -415,13 +415,11 @@ int config_set_malloc_trim_threshold(const char *attrname, char *value, char *er
 int config_set_malloc_mmap_threshold(const char *attrname, char *value, char *errorbuf, int apply);
 #endif
 
-#if !defined(_WIN32) && !defined(AIX)
+#if !defined(AIX)
 int config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, int apply );
-#endif /* !_WIN_32 && !AIX */
+#endif /* !AIX */
 
-#ifndef _WIN32
 int config_set_localuser( const char *attrname, char *value, char *errorbuf, int apply );
-#endif /* !_WIN32 */
 
 #ifdef MEMPOOL_EXPERIMENTAL
 int config_set_mempool_switch( const char *attrname, char *value, char *errorbuf, int apply );
@@ -1390,12 +1388,6 @@ void counters_as_entry(Slapi_Entry* e);
 void counters_to_errors_log(const char *text);
 
 /*
- * ch_malloc.c
- */
-void slapi_ch_start_recording();
-void slapi_ch_stop_recording();
-
-/*
  * snmpcollator.c
  */
 void snmp_as_entry(Slapi_Entry* e);
@@ -1468,11 +1460,8 @@ void handle_closed_connection(Connection *);
 #ifndef LINUX
 void slapd_do_nothing(int);
 #endif
-#ifndef _WIN32
 void slapd_wait4child (int);
-#else
-void *slapd_service_exit_wait();
-#endif
+
 #ifdef ENABLE_NUNC_STANS
 void ns_handle_pr_read_ready(struct ns_job_t *job);
 #endif
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 3e2dd90..ce46604 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -55,12 +55,6 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sechash.h>
-#if defined( _WIN32 )
-#undef DEBUG
-#endif /*  _WIN32 */
-#if defined( _WIN32 )
-#undef LDAPDebug
-#endif	/*  _WIN32 */
 #if defined( USE_MOZLDAP )
 #define LDAP_MOD_OP (0x0007)
 #endif /* USE_MOZLDAP */
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 6ff70e3..ea18a14 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -45,12 +45,10 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <unistd.h>
-#endif
 #include <errno.h>
 #include <signal.h>
 #include "slap.h"
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 3ec9cd8..a9f79ab 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -51,9 +51,7 @@
 #include <fe.h>
 #include <sasl.h>
 #include <saslplug.h>
-#ifndef _WIN32
 #include <unistd.h>
-#endif
 
 static char *serverfqdn;
 
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index dd4fc68..1ab8122 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -76,26 +76,12 @@ static char ptokPBE[34] = "Internal (Software) Token        ";
 #define SLAPD_EXEMODE_DBVERIFY      12
 #define SLAPD_EXEMODE_UPGRADEDNFORMAT     13
 
-#ifdef _WIN32
-#ifndef DONT_DECLARE_SLAPD_LDAP_DEBUG
-extern __declspec(dllimport) int	slapd_ldap_debug;	/* XXXmcs: should eliminate this */
-#endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */
-typedef char *caddr_t;
-void *dlsym(void *a, char *b);
-#define LOG_PID		0x01
-#define LOG_NOWAIT	0x10
-#define LOG_DEBUG	7
-#define POLL_STRUCT PRPollDesc
-#define POLL_FN PR_Poll
-#define RLIM_TYPE  int
-#else /* _WIN32 */
 #define LDAP_SYSLOG
 #include <syslog.h>
 #define RLIM_TYPE int
 #include <poll.h>
 #define POLL_STRUCT PRPollDesc
 #define POLL_FN PR_Poll
-#endif /* _WIN32 */
 
 #include <stdio.h>  /* for FILE */
 #include <stdlib.h>
@@ -112,17 +98,10 @@ void *dlsym(void *a, char *b);
 #define LITTLE_ENDIAN __LITTLE_ENDIAN
 #endif
 #include <cert.h> 
-
-#ifndef _WIN32
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#endif /* _WIN32 */
-
-#ifdef _WIN32
-#define LDAP_IOCP
-#endif
 
 /* Required to get portable printf/scanf format macros */
 #ifdef HAVE_INTTYPES_H
@@ -180,12 +159,8 @@ typedef struct symbol_t {
 #  include <thread.h>
 #  define GET_THREAD_ID() thr_self()
 #else 
-#  if defined(_WIN32)
-#    define GET_THREAD_ID() GetCurrentThreadId()
-#  else
 #    include <pthread.h>
 #    define GET_THREAD_ID() pthread_self()
-#  endif
 #endif
 
 /*
@@ -1553,12 +1528,8 @@ typedef struct conn {
 
 #define START_TLS_OID    "1.3.6.1.4.1.1466.20037"
 
-
-#ifndef _WIN32
 #define SLAPD_POLL_FLAGS	(POLLIN)
-#else
-#define SLAPD_POLL_FLAGS	(PR_POLL_READ)
-#endif
+
 
 /******************************************************************************
  *  * Online tasks interface (to support import, export, etc)
@@ -1836,10 +1807,6 @@ typedef struct daemon_ports_s {
 	int			s_port;
 	PRNetAddr	**n_listenaddr;
 	PRNetAddr	**s_listenaddr;
-#if defined( XP_WIN32 )
-	int		n_socket;
-	int		s_socket_native;
-#else
 	PRFileDesc	**n_socket;
 #if defined(ENABLE_LDAPI)
 	/* ldapi */
@@ -1847,7 +1814,6 @@ typedef struct daemon_ports_s {
 	int             i_port; /* used as a flag only */
 	PRFileDesc      **i_socket;
 #endif
-#endif
 	PRFileDesc	**s_socket;
 } daemon_ports_t;
 
@@ -1949,11 +1915,7 @@ typedef struct _slapdEntryPoints {
     caddr_t	sep_slapd_ssl_init2;
 } slapdEntryPoints;
 
-#if defined( XP_WIN32 )
-#define DLL_IMPORT_DATA _declspec( dllimport )
-#else
 #define DLL_IMPORT_DATA
-#endif
 
 /* Log types */
 #define SLAPD_ACCESS_LOG 0x1
@@ -2397,9 +2359,7 @@ typedef struct _slapdFrontendConfig {
   size_t maxsasliosize;         /* limit incoming SASL IO packet size */
   char *anon_limits_dn;		/* template entry for anonymous resource limits */
   slapi_int_t listen_backlog_size;      /* size of backlog parameter to PR_Listen */
-#ifndef _WIN32
   struct passwd *localuserinfo; /* userinfo of localuser */
-#endif /* _WIN32 */
 #ifdef MEMPOOL_EXPERIMENTAL
   slapi_onoff_t mempool_switch;           /* switch to turn memory pool on/off */
   int mempool_maxfreelist;      /* max free list length per memory pool item */
@@ -2525,7 +2485,6 @@ extern char	*attr_dataversion;
 /* for timing certain operations */
 #ifdef USE_TIMERS
 
-#ifndef _WIN32
 #include <sys/time.h>
 #ifdef LINUX
 #define GTOD(t) gettimeofday(t, NULL)
@@ -2537,15 +2496,6 @@ extern char	*attr_dataversion;
 #define TIMER_STOP(x)   GTOD(&(x##_end))
 #define TIMER_GET_US(x) (unsigned)(((x##_end).tv_sec - (x##_start).tv_sec)  * 100000L + \
                          ((x##_end).tv_usec - (x##_start).tv_usec))
-#else
-#define TIMER_DECL(x)   LARGE_INTEGER x##_freq, x##_start, x##_end
-#define TIMER_START(x)  do { \
-    QueryPerformanceFrequency(&(x##_freq)); \
-    QueryPerformanceCounter(&(x##_start)); \
-} while(0)
-#define TIMER_STOP(x)   QueryPerformanceCounter(&(x##_end))
-#define TIMER_GET_US(x) (unsigned int)((x##_end.QuadPart - x##_start.QuadPart) / x##_freq.QuadPart)
-#endif   /* _WIN32 */
 
 #define TIMER_AVG_DECL(x) \
     TIMER_DECL(x); static unsigned int x##_total, x##_count
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 80fbfb1..f40d867 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -44,17 +44,14 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifndef  _WIN32
 #include <sys/ipc.h>
 #include <sys/msg.h>
 #include <dirent.h>
 #include <semaphore.h>
-#endif
 #include <time.h>
 #include <signal.h>
 #include <string.h>
 #include <errno.h>
-
 #include "agtmmap.h"
 #include "slap.h"
 #include "prthread.h"
@@ -257,7 +254,7 @@ void set_snmp_interaction_row(char *host, int port, int error)
           g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess = 0;
           g_get_global_snmp_vars()->int_tbl[index].dsFailures	          = 0;
           g_get_global_snmp_vars()->int_tbl[index].dsSuccesses		  = 1;
-      }else{
+      } else {
           g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess	  = 0;
           g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess = 1;
           g_get_global_snmp_vars()->int_tbl[index].dsFailures		  = 1;
@@ -265,9 +262,9 @@ void set_snmp_interaction_row(char *host, int port, int error)
       }
       strncpy(g_get_global_snmp_vars()->int_tbl[index].dsURL, dsURL,
               sizeof(g_get_global_snmp_vars()->int_tbl[index].dsURL));		         
-  }else{
-    /* just update the appropriate fields */
-       g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastAttempt	         = time(0);
+  } else {
+      /* just update the appropriate fields */
+      g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastAttempt	         = time(0);
       if(error == 0){
          g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess        = time(0);
          g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess = 0;
@@ -292,9 +289,9 @@ void set_snmp_interaction_row(char *host, int port, int error)
  * 
  *    this should point to root DSE 
 ************************************************************************************/
-static char *make_ds_url(char *host, int port){
-
-  char *url;
+static char *make_ds_url(char *host, int port)
+{
+   char *url;
   
    url = slapi_ch_smprintf("ldap://%s:%d/",host, port);
  
@@ -311,39 +308,37 @@ static char *make_ds_url(char *host, int port){
 
 static int search_interaction_table(char *dsURL, int *isnew)
 {
-  int i;
-  int index = 0;
-  time_t oldestattempt;
-  time_t currentattempt;
-   
-   oldestattempt = g_get_global_snmp_vars()->int_tbl[0].dsTimeOfLastAttempt;
-   *isnew = 1;
+    int i;
+    int index = 0;
+    time_t oldestattempt;
+    time_t currentattempt;
    
-   for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++){
-       if(!strcmp(g_get_global_snmp_vars()->int_tbl[i].dsURL, "Not Available"))
-       {
-           /* found it -- this is new, first time for this row */
-	   index = i;
-	   break;
-       }else  if(!strcmp(g_get_global_snmp_vars()->int_tbl[i].dsURL, dsURL)){
-           /* found it  -- it was already there*/
-	   *isnew = 0;
-	   index = i;
-	   break;
-       }else{
-          /* not found so figure out oldest row */ 
-          currentattempt = g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt;
-	 
-          if(currentattempt <= oldestattempt){
-              index=i;
-	      oldestattempt = currentattempt;
-          }
-       }
-
-   }
+    oldestattempt = g_get_global_snmp_vars()->int_tbl[0].dsTimeOfLastAttempt;
+    *isnew = 1;
    
-   return index;
+    for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++){
+        if(!strcmp(g_get_global_snmp_vars()->int_tbl[i].dsURL, "Not Available"))
+        {
+            /* found it -- this is new, first time for this row */
+            index = i;
+            break;
+        } else if(!strcmp(g_get_global_snmp_vars()->int_tbl[i].dsURL, dsURL)){
+            /* found it  -- it was already there*/
+            *isnew = 0;
+            index = i;
+            break;
+        } else {
+            /* not found so figure out oldest row */
+            currentattempt = g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt;
 
+            if(currentattempt <= oldestattempt){
+                index=i;
+                oldestattempt = currentattempt;
+            }
+        }
+    }
+   
+    return index;
 }
 
 #ifdef DEBUG_SNMP_INTERACTION
@@ -367,43 +362,6 @@ static void print_snmp_interaction_table()
 }
 #endif /* DEBUG_SNMP_INTERACTION */
 
-/*-------------------------------------------------------------------------
- *
- * sc_setevent:  Sets the specified event (NT only).  The input event has
- *               to be created by the subagent during its initialization.
- *
- * Returns:  None
- *
- *-----------------------------------------------------------------------*/
-
-#ifdef _WIN32
-void sc_setevent(char *ev)
-{
-  HANDLE hTrapEvent;
-  DWORD err = NO_ERROR;
-  
-  /*
-   * Set the event handle to force NT SNMP service to call the subagent
-   * DLL to generate a trap.  Any error will be ignored as the subagent
-   * may not have been loaded.
-   */
-  if ((hTrapEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, 
-                              (LPCTSTR) ev)) != NULL)
-  {
-    if (SetEvent(hTrapEvent) == FALSE)
-      err = GetLastError();
-  }
-  else
-    err = GetLastError();
-
-  if (err != NO_ERROR)
-  {
-	  fprintf(stderr, "Failed to set trap (error = %d).\n", err);
-  }
-}
-#endif
-
-
 
 /***********************************************************************************
 *
@@ -494,37 +452,32 @@ int snmp_collator_stop()
 	slapi_eq_cancel(snmp_eq_ctx);
 	snmp_collator_stopped = 1;
 
-   /* acquire the semaphore */
-   snmp_collator_sem_wait();
+	/* acquire the semaphore */
+	snmp_collator_sem_wait();
 
-   /* close the memory map */
-   if ((err = agt_mclose_stats(hdl)) != 0)
-   {
-        fprintf(stderr, "Failed to close stats file (%s) (error = %d).", 
-            AGT_STATS_FILE, err);
-   }
+	/* close the memory map */
+	if ((err = agt_mclose_stats(hdl)) != 0)
+	{
+		fprintf(stderr, "Failed to close stats file (%s) (error = %d).",
+			AGT_STATS_FILE, err);
+	}
 
-   if (remove(tmpstatsfile) != 0)
-   {
-       fprintf(stderr, "Failed to remove (%s) (error =  %d).\n", 
-            tmpstatsfile, errno);
-   }
+	if (remove(tmpstatsfile) != 0)
+	{
+		fprintf(stderr, "Failed to remove (%s) (error =  %d).\n",
+		tmpstatsfile, errno);
+	}
 
-   /* close and delete semaphore */
-   sem_close(stats_sem);
-   sem_unlink(stats_sem_name);
+	/* close and delete semaphore */
+	sem_close(stats_sem);
+	sem_unlink(stats_sem_name);
 
-   /* delete lock */
-   slapi_destroy_mutex(interaction_table_mutex);
+	/* delete lock */
+	slapi_destroy_mutex(interaction_table_mutex);
 
-#ifdef _WIN32
-   /* send the event so server down trap gets set on NT */
-   sc_setevent(MAGT_NSEV_SNMPTRAP);
+	/* stevross: I probably need to free stats too... make sure to add that later */
 
-#endif
-   /* stevross: I probably need to free stats too... make sure to add that later */
-  
-return 0;
+	return 0;
 }
 
 /*
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 198edbc..233622a 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -42,18 +42,6 @@
 
 /* SSL-related stuff for slapd */
 
-#if defined( _WINDOWS )
-#include <windows.h>
-#include <winsock.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "proto-ntutil.h"
-#include <string.h>
-#include <stdlib.h>
-#include <direct.h>
-#include <io.h>
-#endif
-
 #include <stdio.h>
 #include <sys/param.h>
 #include <ssl.h>
@@ -2087,11 +2075,7 @@ slapd_SSL_client_auth (LDAP* ld)
     Slapi_Entry *entry = NULL;
     char cert_name[1024];
     char *token = NULL;
-#ifndef _WIN32
     SVRCOREStdPinObj *StdPinObj;
-#else
-    SVRCOREAltPinObj *AltPinObj;
-#endif
     SVRCOREError err = SVRCORE_Success;
 
     if((family_list = getChildren(configDN))) {
@@ -2203,57 +2187,54 @@ slapd_SSL_client_auth (LDAP* ld)
     /* Free config data */
 
     if (!svrcore_setup()) {
-#ifndef _WIN32
-	StdPinObj = (SVRCOREStdPinObj *)SVRCORE_GetRegisteredPinObj();
-	err =  SVRCORE_StdPinGetPin( &pw, StdPinObj, token );
-#else
-	AltPinObj = (SVRCOREAltPinObj *)SVRCORE_GetRegisteredPinObj();
-	pw = SVRCORE_GetPin( (SVRCOREPinObj *)AltPinObj, token, PR_FALSE);
-#endif
-	if ( err != SVRCORE_Success || pw == NULL) {
-	    errorCode = PR_GetError();
-	    slapd_SSL_warn("SSL client authentication cannot be used "
-			   "(no password). (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)", 
-			   errorCode, slapd_pr_strerror(errorCode));
-	} else {
+        StdPinObj = (SVRCOREStdPinObj *)SVRCORE_GetRegisteredPinObj();
+        err =  SVRCORE_StdPinGetPin( &pw, StdPinObj, token );
+        if ( err != SVRCORE_Success || pw == NULL) {
+            errorCode = PR_GetError();
+            slapd_SSL_warn("SSL client authentication cannot be used "
+                "(no password). (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
+                errorCode, slapd_pr_strerror(errorCode));
+        } else {
 #if defined(USE_OPENLDAP)
-	    rc = ldap_set_option(ld, LDAP_OPT_X_TLS_KEYFILE, SERVER_KEY_NAME);
-	    if (rc) {
-		slapd_SSL_warn("SSL client authentication cannot be used "
-			       "unable to set the key to use to %s", SERVER_KEY_NAME);
-	    }
-	    rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CERTFILE, cert_name);
-	    if (rc) {
-		slapd_SSL_warn("SSL client authentication cannot be used "
-			       "unable to set the cert to use to %s", cert_name);
-	    }
-	    /* not sure what else needs to be done for client auth - don't 
-	       currently have a way to pass in the password to use to unlock
-	       the keydb - nor a way to disable caching */
+            rc = ldap_set_option(ld, LDAP_OPT_X_TLS_KEYFILE, SERVER_KEY_NAME);
+            if (rc) {
+                slapd_SSL_warn("SSL client authentication cannot be used "
+                    "unable to set the key to use to %s", SERVER_KEY_NAME);
+            }
+            rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CERTFILE, cert_name);
+            if (rc) {
+                slapd_SSL_warn("SSL client authentication cannot be used "
+                    "unable to set the cert to use to %s", cert_name);
+            }
+            /*
+             * not sure what else needs to be done for client auth - don't
+             * currently have a way to pass in the password to use to unlock
+             * the keydb - nor a way to disable caching
+             */
 #else /* !USE_OPENLDAP */
-	    rc = ldapssl_enable_clientauth (ld, SERVER_KEY_NAME, pw, cert_name);
-	    if (rc != 0) {
-		errorCode = PR_GetError();
-		slapd_SSL_warn("ldapssl_enable_clientauth(%s, %s) %i ("
-			       SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
-			       SERVER_KEY_NAME, cert_name, rc, 
-			       errorCode, slapd_pr_strerror(errorCode));
-	    } else {
-		/* We cannot allow NSS to cache outgoing client auth connections -
-		   each client auth connection must have it's own non-shared SSL
-		   connection to the peer so that it will go through the
-		   entire handshake protocol every time including the use of its
-		   own unique client cert - see bug 605457
-		*/
-
-		ldapssl_set_option(ld, SSL_NO_CACHE, PR_TRUE);
-	    }
+            rc = ldapssl_enable_clientauth (ld, SERVER_KEY_NAME, pw, cert_name);
+            if (rc != 0) {
+                errorCode = PR_GetError();
+                slapd_SSL_warn("ldapssl_enable_clientauth(%s, %s) %i ("
+                    SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
+                    SERVER_KEY_NAME, cert_name, rc,
+                    errorCode, slapd_pr_strerror(errorCode));
+            } else {
+                /*
+                 * We cannot allow NSS to cache outgoing client auth connections -
+                 * each client auth connection must have it's own non-shared SSL
+                 * connection to the peer so that it will go through the
+                 * entire handshake protocol every time including the use of its
+                 * own unique client cert - see bug 605457
+                 */
+                 ldapssl_set_option(ld, SSL_NO_CACHE, PR_TRUE);
+            }
 #endif
-	}
+        }
     }
 
-    if (token) slapi_ch_free((void**)&token);
-    slapi_ch_free((void**)&pw);
+    slapi_ch_free_string(&token);
+    slapi_ch_free_string(&pw);
 
     LDAPDebug (LDAP_DEBUG_TRACE, "slapd_SSL_client_auth() %i\n", rc, 0, 0);
     return rc;
@@ -2289,10 +2270,6 @@ char* slapd_get_tmp_dir()
 {
 	static char tmp[MAXPATHLEN];
 	char* tmpdir = NULL;;
-#if defined( XP_WIN32 )
-	unsigned ilen;
-	char pch;
-#endif
 
 	tmp[0] = '\0';
 
@@ -2303,43 +2280,10 @@ char* slapd_get_tmp_dir()
 			 "slapd_get_tmp_dir",
 			 "config_get_tmpdir returns NULL Setting tmp dir to default\n");
 
-#if defined( XP_WIN32 )
-		ilen = sizeof(tmp);
-		GetTempPath( ilen, tmp );
-		tmp[ilen-1] = (char)0;
-		ilen = strlen(tmp);
-		/* Remove trailing slash. */
-		pch = tmp[ilen-1];
-		if( pch == '\\' || pch == '/' )
-			tmp[ilen-1] = '\0';
-#else
 		strcpy(tmp, "/tmp");
-#endif
 		return slapi_ch_strdup(tmp);
 	}
 
-#if defined( XP_WIN32 )
-	{
-		char *ptr = NULL;
-		char *endptr = tmpdir + strlen(tmpdir);
-		for(ptr = tmpdir; ptr < endptr; ptr++)
-		{
-			if('/' == *ptr)
-				*ptr = '\\';
-		}
-	}
-#endif
-
-#if defined( XP_WIN32 )
-	if(CreateDirectory(tmpdir, NULL) == 0)
-	{
-		slapi_log_error(
-			 SLAPI_LOG_FATAL,
-			 "slapd_get_tmp_dir",
-			 "CreateDirectory(%s, NULL) Error: %s\n",
-			 tmpdir, strerror(errno));	
-	}
-#else
 	if(mkdir(tmpdir, 00770) == -1)
 	{
 		if (errno == EEXIST) {
@@ -2356,7 +2300,7 @@ char* slapd_get_tmp_dir()
 			 tmpdir, strerror(errno));
 		}
 	}
-#endif
+
 	return ( tmpdir );
 }
 
diff --git a/ldap/servers/slapd/start_tls_extop.c b/ldap/servers/slapd/start_tls_extop.c
index 1efa657..ee86329 100644
--- a/ldap/servers/slapd/start_tls_extop.c
+++ b/ldap/servers/slapd/start_tls_extop.c
@@ -54,8 +54,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <private/pprio.h>
-
-
 #include <prio.h>
 #include <ssl.h>
 #include "slap.h"
@@ -63,8 +61,6 @@
 #include "fe.h"
 
 
-
-
 /* OID of the extended operation handled by this plug-in */
 /* #define START_TLS_OID	"1.3.6.1.4.1.1466.20037" */
 
@@ -160,10 +156,6 @@ start_tls( Slapi_PBlock *pb )
 
 	char		*oid;
 	Connection      *conn;
-#ifdef _WIN32
-	PRFileDesc      *oldsocket;
-	int				oldnativesocket;
-#endif
 	int             ldaprc = LDAP_SUCCESS;
 	char            *ldapmsg = NULL;
 
@@ -211,7 +203,6 @@ start_tls( Slapi_PBlock *pb )
 	conn = pb->pb_conn;
 	PR_Lock( conn->c_mutex );
 	/* cannot call slapi_send_ldap_result with mutex locked - will deadlock if ber_flush returns error */
-#ifndef _WIN32
 	if ( conn->c_prfd == (PRFileDesc *) NULL ) {
 		slapi_log_error( SLAPI_LOG_PLUGIN, "start_tls",
 		                 "Connection socket not available.\n" );
@@ -219,20 +210,8 @@ start_tls( Slapi_PBlock *pb )
 		ldapmsg = "Connection socket not available.";
 		goto unlock_and_return;
 	}
-#else
-	oldnativesocket = conn->c_sd;
-	oldsocket = PR_ImportTCPSocket(oldnativesocket);
-	if ( oldsocket == (PRFileDesc *) NULL ) {
-		slapi_log_error( SLAPI_LOG_PLUGIN, "start_tls",
-		                 "Failed to import NT native socket into NSPR.\n" );
-		ldaprc = LDAP_UNAVAILABLE;
-		ldapmsg = "Failed to import NT native socket into NSPR.";
-		goto unlock_and_return;
-	}
-#endif
 
 	/* Check whether the Start TLS request can be accepted. */
-
 	if ( connection_operations_pending( conn, pb->pb_op,
 				1 /* check for ops where result not yet sent */ )) {
 		slapi_log_error( SLAPI_LOG_PLUGIN, "start_tls", 
@@ -270,7 +249,6 @@ start_tls( Slapi_PBlock *pb )
 		goto unlock_and_return;
 	}
 
-
 	if ( conn->c_flags & CONN_FLAG_CLOSING ) {
 		slapi_log_error( SLAPI_LOG_PLUGIN, "start_tls", 
 				 "Connection being closed at this moment.\n" );
@@ -279,8 +257,6 @@ start_tls( Slapi_PBlock *pb )
 		goto unlock_and_return;
 	}	
 
-
-
 	/* At first sight, there doesn't seem to be any major impediment to start TLS.
 	 * So, we may as well try initialising SSL. */
 
@@ -292,14 +268,13 @@ start_tls( Slapi_PBlock *pb )
 		goto unlock_and_return;
 	}	
 
-
-        /* Enable TLS I/O on the connection */
-        connection_set_io_layer_cb(conn, start_tls_io_enable, NULL, NULL);
+	/* Enable TLS I/O on the connection */
+	connection_set_io_layer_cb(conn, start_tls_io_enable, NULL, NULL);
 
 	/* Since no specific argument for denying the Start TLS request has been found, 
 	 * we send a success response back to the client. */
-        ldapmsg = "Start TLS request accepted.Server willing to negotiate SSL.";
- unlock_and_return:
+	ldapmsg = "Start TLS request accepted.Server willing to negotiate SSL.";
+unlock_and_return:
 	PR_Unlock( conn->c_mutex );
 	slapi_send_ldap_result( pb, ldaprc, NULL, ldapmsg, 0, NULL );
 
@@ -345,7 +320,6 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator )
 	/* First thing to do is to finish with whatever operation may be hanging on the
 	 * encrypted session.
 	 */
-
 	while ( connection_operations_pending( c, pblock->pb_op,
 				0 /* wait for all other ops to full complete */ )) {
 	  slapi_log_error( SLAPI_LOG_PLUGIN, "start_tls",
@@ -361,14 +335,12 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator )
 	slapi_send_ldap_result( pblock, LDAP_OPERATIONS_ERROR, NULL, 
 				"SSL_CLOSE_NOTIFY_ALERT", 0, NULL );
 	
-
 	if ( is_initiator ) {
 	  /* if this call belongs to the initiator of the SSL connection closure, it must first
 	   * wait for the peer to send another close_notify alert back.
 	   */
 	}
 
-
 	PR_Lock( c->c_mutex );
 
 	/* "Unimport" the socket from SSL, i.e. get rid of the upper layer of the 
@@ -388,18 +360,8 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator )
 	ssl_fd = PR_PopIOLayer( c->c_prfd, PR_TOP_IO_LAYER );
 	ssl_fd->dtor( ssl_fd );
 
-
-#ifndef _WIN32
 	secure = 0;
 	ns = configure_pr_socket( &(c->c_prfd), secure, 0 /*never local*/ );
-
-#else
-	ns = PR_FileDesc2NativeHandle( c->c_prfd );
-	c->c_prfd = NULL;
-
-	configure_ns_socket( &ns );
-#endif
-
 	c->c_sd = ns;
         c->c_flags &= ~CONN_FLAG_SSL;
         c->c_flags &= ~CONN_FLAG_START_TLS;
@@ -411,8 +373,6 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator )
 
 	PR_Unlock( c->c_mutex );
 
-
-
 	return ( SLAPI_PLUGIN_EXTENDED_SENT_RESULT );
 }    
 
diff --git a/ldap/servers/slapd/str2filter.c b/ldap/servers/slapd/str2filter.c
index d5bcc1a..9e2823d 100644
--- a/ldap/servers/slapd/str2filter.c
+++ b/ldap/servers/slapd/str2filter.c
@@ -45,9 +45,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 
 static struct slapi_filter	*str2list();
diff --git a/ldap/servers/slapd/stubs.c b/ldap/servers/slapd/stubs.c
index cc613fb..0bbc6e6 100644
--- a/ldap/servers/slapd/stubs.c
+++ b/ldap/servers/slapd/stubs.c
@@ -40,20 +40,11 @@
 #  include <config.h>
 #endif
 
-
-/* Needed because not all functions are currently defined for server3_branch */
-
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
 #include "slap.h"
 
-#if defined( XP_WIN32 ) /* PK*/
-void *dlsym(void *a, char *b) 
-{
-	return 0;
-}
-#endif
 
 int type_to_ACCESS_bit( char *p )
 {
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
index 19a52a3..681e571 100644
--- a/ldap/servers/slapd/task.c
+++ b/ldap/servers/slapd/task.c
@@ -1088,13 +1088,8 @@ static void task_export_thread(void *arg)
         } else {
             if (strcmp(ldif_file, "-")) {    /* not '-' */
                 char *p;
-#if defined( _WIN32 )
-                char sep = '\\';
-                if (NULL != strchr(ldif_file, '/'))
-                    sep = '/';
-#else
                 char sep = '/';
-#endif
+
                 this_ldif_file = (char *)slapi_ch_malloc(strlen(ldif_file) +
                                                      strlen(*inp) + 2);
                 p = strrchr(ldif_file, sep);
diff --git a/ldap/servers/slapd/test-plugins/dllmain.c b/ldap/servers/slapd/test-plugins/dllmain.c
index a302e14..d42d227 100644
--- a/ldap/servers/slapd/test-plugins/dllmain.c
+++ b/ldap/servers/slapd/test-plugins/dllmain.c
@@ -45,97 +45,17 @@
  */
 #include "ldap.h"
 #include "lber.h"
+#include <stdio.h>
 
-#ifdef _WIN32
-/* Lifted from Q125688
- * How to Port a 16-bit DLL to a Win32 DLL
- * on the MSVC 4.0 CD
- */
-BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
-{
-		WSADATA wsadata;
-
-		switch (fdwReason)
-		{
-		case DLL_PROCESS_ATTACH:
-				/* Code from LibMain inserted here.  Return TRUE to keep the
-				   DLL loaded or return FALSE to fail loading the DLL.
-
-				   You may have to modify the code in your original LibMain to
-				   account for the fact that it may be called more than once.
-				   You will get one DLL_PROCESS_ATTACH for each process that
-				   loads the DLL. This is different from LibMain which gets
-				   called only once when the DLL is loaded. The only time this
-				   is critical is when you are using shared data sections.
-				   If you are using shared data sections for statically
-				   allocated data, you will need to be careful to initialize it
-				   only once. Check your code carefully.
-
-				   Certain one-time initializations may now need to be done for
-				   each process that attaches. You may also not need code from
-				   your original LibMain because the operating system may now
-				   be doing it for you.
-				 */
-				/*
-				 * 16 bit code calls UnlockData()
-				 * which is mapped to UnlockSegment in windows.h
-				 * in 32 bit world UnlockData is not defined anywhere
-				 * UnlockSegment is mapped to GlobalUnfix in winbase.h
-				 * and the docs for both UnlockSegment and GlobalUnfix say
-				 * ".. function is oboslete.  Segments have no meaning
-				 *  in the 32-bit environment".  So we do nothing here.
-				 */
-
-				if( errno = WSAStartup(0x0101, &wsadata ) != 0 )
-						return FALSE;
-				
-				break;
-
-		case DLL_THREAD_ATTACH:
-				/* Called each time a thread is created in a process that has
-				   already loaded (attached to) this DLL. Does not get called
-				   for each thread that exists in the process before it loaded
-				   the DLL.
-
-				   Do thread-specific initialization here.
-				 */
-				break;
-
-		case DLL_THREAD_DETACH:
-				/* Same as above, but called when a thread in the process
-				   exits.
-
-				   Do thread-specific cleanup here.
-				 */
-				break;
-
-        case DLL_PROCESS_DETACH:
-				/* Code from _WEP inserted here.  This code may (like the
-				   LibMain) not be necessary.  Check to make certain that the
-				   operating system is not doing it for you.
-				 */
-				WSACleanup();
 
-				break;
-		}
-		/* The return value is only used for DLL_PROCESS_ATTACH; all other
-		   conditions are ignored.
-		 */
-		return TRUE;   // successful DLL_PROCESS_ATTACH
-}
-#else
 int CALLBACK
 LibMain( HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine )
 {
 		/*UnlockData( 0 );*/
 		return( 1 );
 }
-#endif
 
-#ifndef _WIN32
 /* The 16-bit version of the RTL does not implement perror() */
-#include <stdio.h>
-
 void perror( const char *msg )
 {
 		char buf[128];
@@ -143,4 +63,4 @@ void perror( const char *msg )
 		OutputDebugString( buf );
 }
 
-#endif
+
diff --git a/ldap/servers/slapd/test-plugins/testbind.c b/ldap/servers/slapd/test-plugins/testbind.c
index 9e44a31..b363761 100644
--- a/ldap/servers/slapd/test-plugins/testbind.c
+++ b/ldap/servers/slapd/test-plugins/testbind.c
@@ -254,9 +254,6 @@ test_search( Slapi_PBlock *pb )
 }
 
 /* Initialization function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testbind_init( Slapi_PBlock *pb )
 {
diff --git a/ldap/servers/slapd/test-plugins/testdatainterop.c b/ldap/servers/slapd/test-plugins/testdatainterop.c
index 504f785..95cdf84 100644
--- a/ldap/servers/slapd/test-plugins/testdatainterop.c
+++ b/ldap/servers/slapd/test-plugins/testdatainterop.c
@@ -139,9 +139,6 @@ static int nullsuffix_bind( Slapi_PBlock *pb );
 /*
  * Initialization function.
  */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 nullsuffix_init( Slapi_PBlock *pb )
 {
diff --git a/ldap/servers/slapd/test-plugins/testentry.c b/ldap/servers/slapd/test-plugins/testentry.c
index 6d4a62b..30563aa 100644
--- a/ldap/servers/slapd/test-plugins/testentry.c
+++ b/ldap/servers/slapd/test-plugins/testentry.c
@@ -99,9 +99,6 @@ Slapi_PluginDesc entrypdesc = { "test-entry", VENDOR, DS_PACKAGE_VERSION,
 	"sample entry modification plugin" };
 
 /* Entry store plug-in function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testentry_scramble( char **entry, unsigned long *len )
 {
@@ -122,9 +119,6 @@ testentry_scramble( char **entry, unsigned long *len )
 }
 
 /* Entry fetch plug-in function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testentry_unscramble( char **entry, unsigned long *len )
 {
diff --git a/ldap/servers/slapd/test-plugins/testextendedop.c b/ldap/servers/slapd/test-plugins/testextendedop.c
index 2655d55..ddd7a7f 100644
--- a/ldap/servers/slapd/test-plugins/testextendedop.c
+++ b/ldap/servers/slapd/test-plugins/testextendedop.c
@@ -160,9 +160,6 @@ testexop_babs( Slapi_PBlock *pb )
 }
 
 /* Initialization function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testexop_init( Slapi_PBlock *pb )
 {
diff --git a/ldap/servers/slapd/test-plugins/testgetip.c b/ldap/servers/slapd/test-plugins/testgetip.c
index 7e6f530..1a4625a 100644
--- a/ldap/servers/slapd/test-plugins/testgetip.c
+++ b/ldap/servers/slapd/test-plugins/testgetip.c
@@ -71,11 +71,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#endif
 #include "slapi-plugin.h"
 #include "nspr.h"
 
@@ -128,9 +126,6 @@ testgetip( Slapi_PBlock *pb )
 	return( 0 );
 }
 
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testgetip_init( Slapi_PBlock *pb )
 {
diff --git a/ldap/servers/slapd/test-plugins/testpostop.c b/ldap/servers/slapd/test-plugins/testpostop.c
index d91ddd4..cd026e2 100644
--- a/ldap/servers/slapd/test-plugins/testpostop.c
+++ b/ldap/servers/slapd/test-plugins/testpostop.c
@@ -91,11 +91,7 @@
 #define _DEL	2
 #define _MODRDN	3
 
-#ifdef _WIN32
-static char changelogfile[MAX_PATH+1];
-#else
 static char *changelogfile = "/tmp/changelog";
-#endif
 
 Slapi_PluginDesc postoppdesc = { "test-postop", VENDOR, DS_PACKAGE_VERSION,
 	"sample post-operation plugin" };
@@ -234,9 +230,6 @@ testpostop_abandon( Slapi_PBlock *pb )
 }
 
 /* Initialization function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testpostop_init( Slapi_PBlock *pb )
 {
@@ -271,11 +264,7 @@ format_localTime( time_t timeval )
 {
     char* into;
     struct tm t;
-#ifdef _WIN32
-    memcpy (&t, localtime (&timeval), sizeof(t));
-#else
     localtime_r (&timeval, &t);
-#endif
     
     /* Allocate memory for the formatted string.  (slapi_ch_malloc()
        should be used in server plug-ins instead of malloc().)
@@ -319,17 +308,8 @@ write_changelog(
     FILE	*fp;
     int		len, i, j;
     char*	timestr;
-#ifdef _WIN32
-	char szTmpPath[MAX_PATH+1];
-#endif
 
     /* Open the change log file */
-#ifdef _WIN32        
-	GetTempPath( MAX_PATH, szTmpPath ); 
-	strcpy( changelogfile, szTmpPath );
-	strcat( changelogfile, "\\" );
-	strcat( changelogfile, "changelog.txt" );
-#endif
 	if ( changelogfile == NULL ) {
 		return;
 	}
diff --git a/ldap/servers/slapd/test-plugins/testpreop.c b/ldap/servers/slapd/test-plugins/testpreop.c
index 9b3be6c..ebef94b 100644
--- a/ldap/servers/slapd/test-plugins/testpreop.c
+++ b/ldap/servers/slapd/test-plugins/testpreop.c
@@ -244,9 +244,6 @@ testpreop_start( Slapi_PBlock *pb )
 }
 
 /* Initialization function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testpreop_init( Slapi_PBlock *pb )
 {
diff --git a/ldap/servers/slapd/test-plugins/testsaslbind.c b/ldap/servers/slapd/test-plugins/testsaslbind.c
index 0dc20e3..bb0ccba 100644
--- a/ldap/servers/slapd/test-plugins/testsaslbind.c
+++ b/ldap/servers/slapd/test-plugins/testsaslbind.c
@@ -159,9 +159,6 @@ testsasl_bind( Slapi_PBlock *pb )
 }
 
 /* Initialization function */
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
 int
 testsasl_init( Slapi_PBlock *pb )
 {
diff --git a/ldap/servers/slapd/time.c b/ldap/servers/slapd/time.c
index 95ef5fc..33a9e32 100644
--- a/ldap/servers/slapd/time.c
+++ b/ldap/servers/slapd/time.c
@@ -44,13 +44,11 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #ifdef AIX
 #include <time.h>
 #else
 #include <sys/time.h>
 #endif
-#endif /* _WIN32 */
 
 #include "slap.h"
 #include "fe.h"
@@ -128,13 +126,9 @@ get_timestring(time_t *t)
 {
     char	*timebuf;
 
-#if defined( _WIN32 )
-    timebuf = ctime( t );
-#else
     if ( (timebuf = slapi_ch_malloc(32)) == NULL )
-	return("No memory for get_timestring");
+        return("No memory for get_timestring");
     CTIME(t, timebuf, 32);
-#endif
     timebuf[strlen(timebuf) - 1] = '\0';	/* strip out return */
     return(timebuf);
 }
@@ -142,12 +136,8 @@ get_timestring(time_t *t)
 void
 free_timestring(char *timestr)
 {
-#if defined( _WIN32 )
-    return;
-#else
     if ( timestr != NULL )
         slapi_ch_free((void**)&timestr);
-#endif
 }
 
 /*
@@ -195,14 +185,7 @@ time_plus_sec (time_t l, long r)
        perhaps it would be better to implement it that way. */
     struct tm t;
     if (r == 0) return l; /* performance optimization */
-#ifdef _WIN32
-    {
-        struct tm *pt = localtime( &l );
-        memcpy(&t, pt, sizeof(struct tm) );
-    }
-#else
     localtime_r (&l, &t);
-#endif
     /* Conceptually, we want to do: t.tm_sec += r;
        but to avoid overflowing fields: */
     r += t.tm_sec;  t.tm_sec  = r % 60; r /= 60;
@@ -223,17 +206,12 @@ format_localTime (time_t from)
 {
     char* into;
     struct tm t;
-#ifdef _WIN32
-    {
-        struct tm *pt = localtime( &from );
-        memcpy(&t, pt, sizeof(struct tm) );
-    }
-#else
+
     localtime_r (&from, &t);
-#endif
+
     into = slapi_ch_smprintf("%.4li%.2i%.2i%.2i%.2i%.2i",
              1900L + t.tm_year, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.
-tm_sec);
+             tm_sec);
     return into;
 }
 
@@ -297,14 +275,8 @@ format_genTime (time_t from)
 {
     char* into;
     struct tm t;
-#ifdef _WIN32
-    {
-        struct tm *pt = gmtime( &from );
-        memcpy(&t, pt, sizeof(struct tm) );
-    }
-#else
+
     gmtime_r (&from, &t);
-#endif
     into = slapi_ch_malloc (20);
     strftime(into, 20, "%Y%m%d%H%M%SZ", &t);
     return into;
diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c
index b3d9f14..3fe5844 100644
--- a/ldap/servers/slapd/tools/dbscan.c
+++ b/ldap/servers/slapd/tools/dbscan.c
@@ -56,17 +56,9 @@
 #include <errno.h>
 #include "db.h"
 #include "nspr.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#include <winsock.h>
-extern int getopt();
-extern char *optarg; 
-typedef unsigned char uint8_t;
-#else
 #include <netinet/in.h>
 #include <inttypes.h>
-#endif
+
 
 #if ( defined( hpux ) )
 #ifdef _XOPEN_SOURCE_EXTENDED
diff --git a/ldap/servers/slapd/tools/ldaptool-sasl.c b/ldap/servers/slapd/tools/ldaptool-sasl.c
index 3658bda..444a23a 100755
--- a/ldap/servers/slapd/tools/ldaptool-sasl.c
+++ b/ldap/servers/slapd/tools/ldaptool-sasl.c
@@ -61,22 +61,6 @@ typedef struct {
 static int get_default(ldaptoolSASLdefaults *defaults, sasl_interact_t *interact, unsigned flags);
 static int get_new_value(sasl_interact_t *interact, unsigned flags);
 
-/* WIN32 does not have getlogin() so roll our own */
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#include "LMCons.h"
-static char *getlogin()
-{
-	LPTSTR lpszSystemInfo; /* pointer to system information string */
-	DWORD cchBuff = UNLEN;   /* size of user name */
-	static TCHAR tchBuffer[UNLEN + 1]; /* buffer for expanded string */
-
-	lpszSystemInfo = tchBuffer;
-	GetUserName(lpszSystemInfo, &cchBuff);
-
-	return lpszSystemInfo;
-}
-#endif /* _WINDOWS || _WIN32 */
-
 /*
   Note that it is important to use "" (the empty string, length 0) as the default
   username value for non-interactive cases.  This allows the sasl library to find the best
@@ -298,22 +282,6 @@ ldaptool_getpass ( const char *prompt )
 {
     char *pass;
 
-#if defined(_WIN32)
-    char pbuf[257];
-    fputs(prompt,stdout);
-    fflush(stdout);
-    if (fgets(pbuf,256,stdin) == NULL) {
-        pass = NULL;
-    } else {
-        char *tmp;
-
-        tmp = strchr(pbuf,'\n');
-        if (tmp) *tmp = '\0';
-        tmp = strchr(pbuf,'\r');
-        if (tmp) *tmp = '\0';
-        pass = strdup(pbuf);
-    }
-#else
 #if defined(SOLARIS)
     /* 256 characters on Solaris */
     pass = (char *)getpassphrase(prompt);
@@ -365,7 +333,6 @@ ldaptool_getpass ( const char *prompt )
     pass = (char *)getpass(prompt);
 #endif
 #endif
-#endif
 
     return pass;
 }
diff --git a/ldap/servers/slapd/tools/ldclt/data.c b/ldap/servers/slapd/tools/ldclt/data.c
index 590f29a..2a7a651 100644
--- a/ldap/servers/slapd/tools/ldclt/data.c
+++ b/ldap/servers/slapd/tools/ldclt/data.c
@@ -85,21 +85,14 @@ dd/mm/yy | Author	| Comments
 #include <fcntl.h>	/* open(), etc... */
 #include <lber.h>	/* ldap C-API BER declarations */
 #include <ldap.h>	/* ldap C-API declarations */
-#ifndef _WIN32							/*JLS 28-11-00*/
 #include <unistd.h>	/* close(), etc... */
 #include <dirent.h>	/* opendir(), etc... */
 #include <pthread.h>	/* pthreads(), etc... */
 #include <sys/mman.h>	/* mmap(), etc... */
-#endif								/*JLS 28-11-00*/
-
 #include "port.h"	/* Portability definitions */		/*JLS 28-11-00*/
 #include "ldclt.h"	/* This tool's include file */
 
 
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	getExtend
 	PURPOSE :	Get the extension of the given string, i.e. the part
@@ -118,8 +111,6 @@ char *getExtend (
 }
 
 
-
-
 /* ****************************************************************************
 	FUNCTION :	loadImages
 	PURPOSE :	Load the images from the given directory.
@@ -131,15 +122,8 @@ char *getExtend (
 int loadImages (
 	char	*dirpath)
 {
-#ifdef _WIN32
-  WIN32_FIND_DATA	 fileData;	/* Current file */
-  HANDLE		 dirContext;	/* Directory context */
-  char			*findPath = NULL;	/* To build the find path */
-  char			*pt;		/* To read the images */
-#else /* _WIN32 */
   DIR		*dirp = NULL;	/* Directory data */
   struct dirent	*direntp;	/* Directory entry */
-#endif /* _WIN32 */
   char		*fileName;	/* As read from the system */
   char		 name [1024];	/* To build the full path */
   struct stat	 stat_buf;	/* To read the image size */
@@ -166,20 +150,6 @@ int loadImages (
   /*
    * Open the directory
    */
-#ifdef _WIN32
-  findPath = (char *) malloc (strlen (dirpath) + 5);
-  strcpy (findPath, dirpath);
-  strcat (findPath, "/*.*");
-  dirContext = FindFirstFile (findPath, &fileData);
-  if (dirContext == INVALID_HANDLE_VALUE)
-  {
-    fprintf (stderr, "ldlct: cannot load images from %s\n", dirpath);
-    fprintf (stderr, "ldclt: try using -e imagesdir=path\n");	/*JLS 06-03-01*/
-    fflush (stderr);
-    rc = -1;
-    goto exit;
-  }
-#else /* _WIN32 */
   dirp = opendir (dirpath);
   if (dirp == NULL)
   {
@@ -190,21 +160,14 @@ int loadImages (
     rc = -1;
     goto exit;
   }
-#endif /* _WIN32 */
 
   /*
    * Process the directory.
    * We will only accept the .jpg files, as stated by the RFC.
    */
-#ifdef _WIN32
-  fileName = fileData.cFileName;
-  do
-  {
-#else
   while ((direntp = readdir (dirp)) != NULL)
   {
     fileName = direntp->d_name;
-#endif
     if (!strcmp (getExtend (fileName), "jpg"))
     {
       /*
@@ -260,28 +223,6 @@ int loadImages (
       }
       mctx.images[mctx.imagesNb-1].length = stat_buf.st_size;
 
-#ifdef _WIN32
-      /*
-       * Allocate buffer and read the data :-(
-       */
-      mctx.images[mctx.imagesNb-1].data = (char *) malloc (stat_buf.st_size);
-      if (mctx.images[mctx.imagesNb-1].data == NULL)
-      {
-	fprintf (stderr, "Cannot malloc(%d) to load %s\n",
-				stat_buf.st_size, name);
-	fflush (stderr);
-	rc = -1;
-	goto exit;
-      }
-      if (read (fd, mctx.images[mctx.imagesNb-1].data, stat_buf.st_size) < 0)
-      {
-	perror (name);
-	fprintf (stderr, "Cannot read(%s)\n", name);
-	fflush (stderr);
-	rc = -1;
-	goto exit;
-      }
-#else /* _WIN32 */
       /*
        * mmap() the image
        */
@@ -295,7 +236,6 @@ int loadImages (
 	rc = -1;
 	goto exit;
       }
-#endif /* _WIN32 */
 
       /*
        * Close the image. The mmap() will remain available, and this
@@ -312,16 +252,11 @@ int loadImages (
           fd = -1;
       }
     }
-#ifdef _WIN32
-  } while (FindNextFile(dirContext, &fileData) == TRUE);
-#else
   } /* while ((direntp = readdir (dirp)) != NULL) */
-#endif
 exit:
   /*
    * Close the directory
    */
-#ifndef _WIN32
   if (dirp && closedir (dirp) < 0)
   {
     perror (dirpath);
@@ -329,14 +264,11 @@ exit:
     fflush (stderr);
     rc = -1;
   }
-#endif
+
 
   /*
    * Normal end
    */
-#ifdef _WIN32
-  if (findPath) free (findPath);
-#endif
   if(fd != -1)
       close(fd);
 
@@ -344,10 +276,6 @@ exit:
 }
 
 
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	getImage
 	PURPOSE :	Add a random image to the given attribute.
@@ -420,12 +348,6 @@ int getImage (
 }
 
 
-
-
-
-
-
-						/* New */	/*JLS 23-03-01*/
 /* ****************************************************************************
 	FUNCTION :	loadDataListFile
 	PURPOSE :	Load the data list file given in argument.
@@ -492,12 +414,6 @@ loadDataListFile (
 }
 
 
-
-
-
-
-
-						/* New */	/*JLS 23-03-01*/
 /* ****************************************************************************
 	FUNCTION :	dataListFile
 	PURPOSE :	Find the given data_list_file either in the list of
@@ -536,12 +452,3 @@ dataListFile (
    */
   return (dlf);
 }
-
-
-
-
-
-
-
-
-/* End of file */
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index 7308951..69a8d62 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -245,11 +245,8 @@ dd/mm/yy | Author	| Comments
 #ifdef LDAP_H_FROM_QA_WKA
 #include <proto-ldap.h>	/* ldap C-API prototypes */
 #endif
-#ifndef _WIN32							/*JLS 29-11-00*/
 #include <unistd.h>	/* close(), etc... */
 #include <pthread.h>	/* pthreads(), etc... */
-#endif								/*JLS 29-11-00*/
-
 #include "port.h"	/* Portability definitions */		/*JLS 29-11-00*/
 #include "ldclt.h"	/* This tool's include file */
 #include "utils.h"	/* Utilities functions */		/*JLS 14-11-00*/
@@ -298,12 +295,6 @@ my_ldap_err2string (
 }
 
 
-
-
-
-
-
-					/* New function */	/*JLS 14-12-00*/
 /* ****************************************************************************
 	FUNCTION :	dnFromMessage
 	PURPOSE :	Extract the matcheddnp value from an LDAP (error)
@@ -402,15 +393,6 @@ getBindAndPasswdFromFile (
 }
 
 
-
-
-
-
-
-
-
-
-					/* New function */	/*JLS 05-01-01*/
 /* ****************************************************************************
 	FUNCTION :	buildNewBindDN
 	PURPOSE :	Purpose of the fct
@@ -470,11 +452,6 @@ buildNewBindDN (
 }
 
 
-
-
-
-
-
 #if defined(USE_OPENLDAP)
 int 
 refRebindProc(
@@ -538,12 +515,6 @@ refRebindProc (
 #endif /* !USE_OPENLDAP */
 
 
-
-
-
-
-
-					/* New function */	/*JLS 08-03-01*/
 /* ****************************************************************************
 	FUNCTION :	referralSetup
 	PURPOSE :	Initiates referral features. This function is called
@@ -584,13 +555,7 @@ referralSetup (
    *        the same thing !!!!
    */
   if (mctx.referral == REFERRAL_REBIND)
-#ifdef _WIN32							/*JLS 14-03-01*/
-    ldap_set_rebind_proc (tttctx->ldapCtx, 			/*JLS 14-03-01*/
-		(LDAP_REBINDPROC_CALLBACK *)refRebindProc,	/*JLS 14-03-01*/
-		(void *)tttctx);				/*JLS 14-03-01*/
-#else								/*JLS 14-03-01*/
     ldap_set_rebind_proc (tttctx->ldapCtx, refRebindProc, (void *)tttctx);
-#endif								/*JLS 14-03-01*/
 
   /*
    * Normal end
@@ -599,11 +564,6 @@ referralSetup (
 }
 
 
-
-
-
-
-
 #if defined(USE_OPENLDAP)
 /* ****************************************************************************
 	FUNCTION :	dirname
@@ -1226,13 +1186,6 @@ connectToServer (
 }
 
 
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	buildVersatileAttribute
 	PURPOSE :	Build a new attribute value using the definitions of
@@ -1401,14 +1354,6 @@ buildVersatileAttribute (
 }
 
 
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	buildRandomRdnOrFilter
 	PURPOSE :	This function will build a random string (rdn or filter)
@@ -1423,7 +1368,6 @@ int
 buildRandomRdnOrFilter (
 	thread_context	*tttctx)
 {
-
   /*
    * Maybe we will operate with a variable base DN ?
    */
@@ -1534,13 +1478,6 @@ buildRandomRdnOrFilter (
 }
 
 
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	addAttrib
 	PURPOSE :	Add a new attribute to the given LDAPMod array
@@ -1571,9 +1508,6 @@ addAttrib (
 }
 
 
-
-
-
 /* ****************************************************************************
 	FUNCTION :	freeAttrib
 	PURPOSE :	Free an array of addAttrib.
@@ -1606,12 +1540,6 @@ freeAttrib (
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	strList1
 	PURPOSE :	Create a list (array) of two strings
@@ -1638,16 +1566,6 @@ strList1 (
 }
 
 
-
-
-
-
-
-
-
-
-
-					/* New function */	/*JLS 03-08-00*/
 /* ****************************************************************************
 	FUNCTION :	printErrorFromLdap
 	PURPOSE :	Print the error message returned by ldap.
@@ -1716,13 +1634,6 @@ printErrorFromLdap (
 }
 
 
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	buildNewModAttribFile
 	PURPOSE :	Build a new (random or incremental) target DN and the
@@ -1796,8 +1707,6 @@ done:
 }
 
 
-
-/* New function */	/*JLS 21-11-00*/
 /* ****************************************************************************
 	FUNCTION :	buildNewModAttrib
 	PURPOSE :	Build a new (random or incremental) target DN and the
@@ -1847,18 +1756,6 @@ buildNewModAttrib (
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-						/* New */	/*JLS 19-03-01*/
 /* ****************************************************************************
 	FUNCTION :	buildVersatileObject
 	PURPOSE :	Build a new entry using the definitions in the object
@@ -1922,16 +1819,6 @@ buildVersatileObject (
 }
 
 
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	buildNewEntry
 	PURPOSE :	Build a new (random or incremental) entry, to be used
@@ -2082,18 +1969,6 @@ buildNewEntry (
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	createMissingNodes
 	PURPOSE :	Create the missing intermediate nodes.
@@ -2322,14 +2197,6 @@ createMissingNodes (
 }
 
 
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	getPending
 	PURPOSE :	Get the pending results, and perform some basic controls
@@ -2590,19 +2457,6 @@ getPending (
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	doRename
 	PURPOSE :	Perform an ldap_rename() operation.
@@ -2881,12 +2735,6 @@ doRename (
 }
 
 
-
-
-
-
-
-						/* New */	/*JLS 02-04-01*/
 /* ****************************************************************************
 	FUNCTION :	ldclt_write_genldif
 	PURPOSE :	Implements buffered write to speed up -e genldif
@@ -2943,14 +2791,6 @@ ldclt_write_genldif (
 }
 
 
-
-
-
-
-
-
-
-						/* New */	/*JLS 19-03-01*/
 /* ****************************************************************************
 	FUNCTION :	doGenldif
 	PURPOSE :	Create a ldif file from the given parameters.
@@ -3007,16 +2847,6 @@ doGenldif (
 }
 
 
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	doAddEntry
 	PURPOSE :	Perform an ldap_add() operation.
@@ -3239,15 +3069,6 @@ doAddEntry (
 }
 
 
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	doAttrReplace
 	PURPOSE :	Perform an ldap_modify() operation, to replace an
@@ -3403,7 +3224,6 @@ doAttrReplace (
 }
 
 
-
 /* ****************************************************************************
 	FUNCTION :	doAttrFileReplace
 	PURPOSE :	Perform an ldap_modify() operation, to replace an
@@ -3737,13 +3557,6 @@ doDeleteEntry (
 }
 
 
-
-
-
-
-
-
-					/* New function */	/*JLS 04-05-01*/
 /* ****************************************************************************
 	FUNCTION :	doBindOnly
 	PURPOSE :	Perform only bind/unbind operations.
@@ -3777,10 +3590,6 @@ doBindOnly (
 }
 
 
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	doExactSearch
 	PURPOSE :	Perform one exact search operation.
diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.c b/ldap/servers/slapd/tools/ldclt/ldclt.c
index 2ccba82..aab798b 100644
--- a/ldap/servers/slapd/tools/ldclt/ldclt.c
+++ b/ldap/servers/slapd/tools/ldclt/ldclt.c
@@ -287,13 +287,11 @@ dd/mm/yy | Author	| Comments
 #ifdef LDAP_H_FROM_QA_WKA
 #include <proto-ldap.h>		/* ldap C-API prototypes */
 #endif
-#ifndef _WIN32							/*JLS 29-11-00*/
 #include <pthread.h>		/* pthreads(), etc... */
 #include <unistd.h>		/* close(), etc... */
 #include <dlfcn.h>		/* dlopen(), etc... */		/*JLS 07-11-00*/
 #include <sys/resource.h>	/* setrlimit(), etc... */
 #include <sys/time.h>		/* struct rlimit, etc... */
-#endif
 
 #include "nspr.h"
 #include "port.h"		/* Portability definitions */	/*JLS 29-11-00*/
@@ -315,15 +313,6 @@ int 		 masterPort=16000;
 extern char	*ldcltVersion;		/* ldclt version */	/*JLS 18-08-00*/
 
 
-
-
-
-
-
-
-
-
-					/* New function */	/*JLS 18-08-00*/
 /* ****************************************************************************
 	FUNCTION :	ldcltExit
 	PURPOSE :	Print the last data then exit the process.
@@ -372,7 +361,6 @@ ldcltExit (
 }
 
 
-						/* New */	/*JLS 23-03-01*/
 /* ****************************************************************************
 	FUNCTION :	copyVersAttribute
 	PURPOSE :	Copy a versatile object's attribute
@@ -424,13 +412,6 @@ copyVersAttribute (
 }
 
 
-
-
-
-
-
-
-						/* New */	/*JLS 21-03-01*/
 /* ****************************************************************************
 	FUNCTION :	copyVersObject
 	PURPOSE :	Copy a versatile object.
@@ -487,15 +468,6 @@ copyVersObject (
 }
 
 
-
-
-
-
-
-
-
-
-						/* New */	/*JLS 19-03-01*/
 /* ****************************************************************************
 	FUNCTION :	tttctxInit
 	PURPOSE :	Initiates the thread context
@@ -554,10 +526,6 @@ tttctxInit (
 }
 
 
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	runThem
 	PURPOSE :	This function implements the launching of the threads.
@@ -664,12 +632,6 @@ runThem (void)
 }
 
 
-
-
-
-
-
-					/* New function */	/*JLS 17-11-00*/
 /* ****************************************************************************
 	FUNCTION :	shutdownThreads
 	PURPOSE :	This function is targeted to shutdown the threads.
@@ -755,11 +717,6 @@ shutdownThreads (void)
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	monitorThem
 	PURPOSE :	This function will monitor all the client threads.
@@ -938,14 +895,6 @@ monitorThem (void)
 }
 
 
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	printGlobalStatistics
 	PURPOSE :	This function will print the global statistics numbers.
@@ -1099,12 +1048,6 @@ printGlobalStatistics (void)
 }
 
 
-
-
-
-
-
-#ifndef _WIN32							/*JLS 29-11-00*/
 /* ****************************************************************************
 	FUNCTION :	trapVector
 	PURPOSE :	Interruption vector for SIGINT and SIGQUIT
@@ -1130,10 +1073,6 @@ trapVector (
   }
   return;
 }
-#endif	/* _WIN32 */						/*JLS 29-11-00*/
-
-
-
 
 
 /* ****************************************************************************
@@ -1197,13 +1136,6 @@ initMainThread (void)
 }
 
 
-
-
-
-
-
-
-					/* New function */	/*JLS 21-11-00*/
 /* ****************************************************************************
 	FUNCTION :	parseFilter
 	PURPOSE :	This function parse a string in the form abcXXXdef
@@ -1252,17 +1184,6 @@ parseFilter (
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	basicInit
 	PURPOSE :	This function performs the basic initializations of
@@ -1276,9 +1197,7 @@ parseFilter (
 int 
 basicInit (void)
 {
-#ifndef _WIN32							/*JLS 29-11-00*/
   struct rlimit	 rlp;	/* For setrlimit() */
-#endif	/* _WIN32 */						/*JLS 29-11-00*/
   int		 i;	/* For the loops */			/*JLS 21-11-00*/
   int		 ret;	/* Return value */
   int		 oflags;/* open() flags */			/*JLS 05-04-01*/
@@ -1340,7 +1259,7 @@ basicInit (void)
       oflags = O_APPEND|O_WRONLY|O_CREAT;			/*JLS 05-04-01*/
     else							/*JLS 05-04-01*/
       oflags = O_EXCL|O_WRONLY|O_CREAT;				/*JLS 05-04-01*/
-#if !defined(_WIN32) && !defined(OSF1) && !defined(__LP64__) && !defined(_LP64)				/*JLS 05-04-01*/
+#if !defined(OSF1) && !defined(__LP64__) && !defined(_LP64)				/*JLS 05-04-01*/
     oflags |= O_LARGEFILE;					/*JLS 05-04-01*/
 #endif								/*JLS 03-04-01*/
     mctx.genldifFile = open (mctx.genldifName, oflags, 0666);	/*JLS 05-04-01*/
@@ -1372,8 +1291,7 @@ basicInit (void)
 
   /*
    * Set appropriate number of files...
-   */
-#ifndef _WIN32							/*JLS 29-11-00*/
+   */						/*JLS 29-11-00*/
   if (mctx.nbThreads > 54)
   {
     if (getrlimit (RLIMIT_NOFILE, &rlp) < 0)
@@ -1394,7 +1312,6 @@ basicInit (void)
     if (mctx.mode & VERBOSE)
       printf ("Set file number to %u\n", (unsigned int)rlp.rlim_max);
   }
-#endif	/* _WIN32 */						/*JLS 29-11-00*/
 
   /*
    * Maybe an object to read ?
@@ -1742,12 +1659,6 @@ basicInit (void)
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	printModeValues
 	PURPOSE :	This function is targeted to print the bits mask of
@@ -1843,12 +1754,6 @@ dumpModeValues (void)
 }
 
 
-
-
-
-
-
-
 /*
  * Scope parameters (-s sub-options)
  */
@@ -1862,6 +1767,7 @@ char *scopeParams[] = {
 	NULL
 };
 
+
 /* ****************************************************************************
 	FUNCTION :	decodeScopeParams
 	PURPOSE :	Decode the scope parameters (ak asub-options of the 
@@ -1902,10 +1808,6 @@ decodeScopeParams (
 }
 
 
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	saslSetParam
 	PURPOSE :	Sets SASL parameters
@@ -2001,10 +1903,6 @@ saslSetParam (
 }
 
 
-
-
-
-					/* New function */	/*JLS 08-03-01*/
 /* ****************************************************************************
 	FUNCTION :	decodeReferralParams
 	PURPOSE :	Decode -e referral params.
@@ -2034,15 +1932,6 @@ decodeReferralParams (
 }
 
 
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	addAttrToList
 	PURPOSE :	Add attributes in the attribute list.
@@ -2094,12 +1983,6 @@ addAttrToList (
 }
 
 
-
-
-
-
-
-						/* New */	/*JLS 23-03-01*/
 /* ****************************************************************************
 	FUNCTION :	decodeRdnParam
 	PURPOSE :	Decodes a -e rdn=value parameter.
@@ -2147,18 +2030,6 @@ decodeRdnParam (
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
 /*
  * Exec params (-e sub-options)
  */
@@ -2616,11 +2487,6 @@ decodeExecParams (
 }
 
 
-
-
-
-
-					/* New function */	/*JLS 23-04-01*/
 /* ****************************************************************************
 	FUNCTION :	buildArgListString
 	PURPOSE :	Saved the arguments of ldclt into a string.
@@ -2669,12 +2535,6 @@ buildArgListString (
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	main
 	PURPOSE :	Main function of ldclt
diff --git a/ldap/servers/slapd/tools/ldclt/parser.c b/ldap/servers/slapd/tools/ldclt/parser.c
index a02f30d..4386d7b 100644
--- a/ldap/servers/slapd/tools/ldclt/parser.c
+++ b/ldap/servers/slapd/tools/ldclt/parser.c
@@ -80,28 +80,14 @@ dd/mm/yy | Author	| Comments
 #ifdef LDAP_H_FROM_QA_WKA
 #include <proto-ldap.h>	/* ldap C-API prototypes */
 #endif
-#ifndef _WIN32
 #include <unistd.h>	/* close(), etc... */
 #include <pthread.h>	/* pthreads(), etc... */
-#endif
 
 #include "port.h"	/* Portability definitions */
 #include "ldclt.h"	/* This tool's include file */
 #include "utils.h"	/* Utilities functions */
 
 
-
-
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	decodeHow
 	PURPOSE :	Decode the how field
@@ -128,16 +114,6 @@ decodeHow (
 }
 
 
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	parseVariant
 	PURPOSE :	Parse a variant definition.
@@ -358,17 +334,6 @@ parseVariant (
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	parseAttribValue
 	PURPOSE :	Parse the right part of attribname: attribvalue.
@@ -467,16 +432,6 @@ parseAttribValue (
 }
 
 
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	parseLine
 	PURPOSE :	Parse the given line to find an attribute definition.
@@ -546,14 +501,6 @@ parseLine (
 }
 
 
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	readObject
 	PURPOSE :	This function will read an object description from the
@@ -620,9 +567,3 @@ done:
   return rc;
 }
 
-
-
-
-
-
-/* End of file */
diff --git a/ldap/servers/slapd/tools/ldclt/port.c b/ldap/servers/slapd/tools/ldclt/port.c
index f21139b..a7a6af6 100644
--- a/ldap/servers/slapd/tools/ldclt/port.c
+++ b/ldap/servers/slapd/tools/ldclt/port.c
@@ -66,218 +66,12 @@ dd/mm/yy | Author	| Comments
 
 
 #include <stdio.h>		/* EOF, etc... */
-
-#ifdef _WIN32
-#include <windows.h>
-#include <winbase.h>
-#else
 #include <unistd.h>		/* sleep(), etc... */		/*JLS 14-03-01*/
 #include <pthread.h>		/* pthreads(), etc... */
-#endif
-
 #include "port.h"
 
 /************************************************************************/
 /************************************************************************/
-/****************         NT section              ***********************/
-/************************************************************************/
-/************************************************************************/ 
-
-#ifdef _WIN32
-
-int
-ldclt_mutex_init (
-	ldclt_mutex_t	*mutex)
-{
-  InitializeCriticalSection (mutex);
-  return (0);
-}
-
-int
-ldclt_mutex_lock (
-	ldclt_mutex_t	*mutex)
-{
-  EnterCriticalSection(mutex);
-  return (0);
-}
-
-int
-ldclt_mutex_unlock (
-	ldclt_mutex_t	*mutex)
-{
-  LeaveCriticalSection (mutex);
-  return (0);
-}
-
-void
-ldclt_sleep (
-	int	 nseconds)
-{
-  Sleep (1000 * nseconds);
-}
-
-int
-ldclt_thread_create (
-	ldclt_tid	*tid,
-	void		*fct,
-	void		*param)
-{
-  CreateThread (NULL, 0, fct, param, 0, tid);
-  return (0);
-}
-
-long 
-lrand48 (void)
-{
-  return ((rand()<<8)+rand());
-}
-
-/*
- * Implements the Unix getopt function for NT systems
- */
-char	*optarg;
-int	 optind;
-int
-getopt (
-	int	  argc,
-	char	**argv,
-	char	 *optstring)
-{
-  static char	**prevArgv = NULL;	/* Memorize argv to parse */
-  static int	  inOption;		/* In option parsing ? */
-  static int	  cNum;			/* Current char num */
-  int		  c;			/* Current char */
-  int		  i;			/* Loops */
-
-  /*
-   * Initialization - maybe the first time this function is called ?
-   */
-  if (prevArgv != argv)
-  {
-    prevArgv = argv;
-    optind   = 0;
-    inOption = 0;
-  }
-
-  /*
-   * Maybe we processed the last chars of the option in the previous call
-   */
-  if (inOption)
-  {
-    if (argv[optind][cNum] == '\0')
-      inOption = 0;
-  }
-
-  /*
-   * Maybe we should look for '-'
-   */
-  if (!inOption)
-  {
-    optind++;				/* Next option */
-    if (optind == argc)			/* No more option */
-      return (EOF);
-    if (argv[optind][0] != '-')		/* Not an option */
-      return (EOF);
-    if (argv[optind][1] == '\0')	/* Only '-' */
-      return (EOF);
-    cNum = 1;				/* Next char to process */
-    inOption = 0;			/* We are in an option */
-  }
-
-  /*
-   * See if this is a valid option
-   */
-  c = argv[optind][cNum];
-  for (i=0 ; (i<strlen(optstring)) && (c!=optstring[i]) ; i++);
-  if (c != optstring[i])		/* Not an option */
-    return ('?');
-  cNum++;				/* Next char */
-
-  /*
-   * Check if this option requires an argument
-   * Note that for the last char of optstring, it is a valid '\0' != ':'
-   */
-  if (optstring[i+1] != ':')		/* No argument */
-    return (c);
-
-  /*
-   * Need an argument...
-   * The argument is either the end of argv[optind] or argv[++optind]
-   */
-  if (argv[optind][cNum] == '\0')	/* Must return next argument */
-  {
-    optind++;				/* Next argument */
-    if (optind == argc)			/* There is no next argument */
-    {
-      printf ("%s: option requires an argument -- %c\n", argv[0], c);
-      return ('?');
-    }
-    optarg   = argv[optind];	/* Set optarg to teh argument argv[] */
-    inOption = 0;		/* No more in option... */
-    return (c);
-  }
-
-  /*
-   * Return the end of the current argv[optind]
-   */
-  optarg   = &(argv[optind][cNum]);	/* End of argv[optind] */
-  inOption = 0;				/* No more in option */
-  return (c);
-}
-
-
-/*
- * Implement the Unix getsubopt function for NT systems
- */
-int
-getsubopt(
-	char	**optionp,
-	char	**tokens,
-	char	**valuep)
-{
-  int	 i;		/* Loops */
-  char	*curOpt;	/* Current optionp */
-
-  curOpt = *optionp;	/* Begin of current option */
-
-  /*
-   * Find the end of the current option
-   */
-  for (i=0 ; (curOpt[i]!='\0') && (curOpt[i]!=',') ; i++);
-  if (curOpt[i] == '\0')
-    *optionp = &(curOpt[i]);
-  else
-    *optionp = &(curOpt[i+1]);
-  curOpt[i] = '\0';		/* Do not forget to end this string */
-
-  /*
-   * Find if there is a subvalue for this option
-   */
-  for (i=0 ; (curOpt[i]!='\0') && (curOpt[i]!='=') ; i++);
-  if (curOpt[i] == '\0')
-    *valuep = &(curOpt[i]);
-  else
-    *valuep = &(curOpt[i+1]);
-  curOpt[i] = '\0';		/* Do not forget to end this string */
-
-  /*
-   * Find if this option is valid...
-   */
-  for (i=0 ; tokens[i] != NULL ; i++)
-    if (!strcmp (curOpt, tokens[i]))
-      return (i);
-
-  /*
-   * Not found...
-   */
-  return (-1);
-}
-
-
-#else /* NT 4 */
-
-/************************************************************************/
-/************************************************************************/
 /****************         Unix section            ***********************/
 /************************************************************************/
 /************************************************************************/
@@ -318,9 +112,3 @@ ldclt_thread_create (
 {
   return (pthread_create (tid, NULL, fct, param));
 }
-
-#endif /* _WIN32 */
-
-
-
-/* End of file */
diff --git a/ldap/servers/slapd/tools/ldclt/port.h b/ldap/servers/slapd/tools/ldclt/port.h
index 6230ea8..cacbf91 100644
--- a/ldap/servers/slapd/tools/ldclt/port.h
+++ b/ldap/servers/slapd/tools/ldclt/port.h
@@ -85,29 +85,6 @@ dd/mm/yy | Author	| Comments
 #endif								/*JLS 03-04-01*/
 #endif								/*JLS 01-12-00*/
 
-#ifdef _WIN32							/*JLS 01-12-00*/
-#define LDCLT_NO_DLOPEN		1				/*JLS 01-12-00*/
-#endif								/*JLS 01-12-00*/
-
-
-/************************************************************************/
-/************************************************************************/
-/****************         NT section              ***********************/
-/************************************************************************/
-/************************************************************************/
-
-#ifdef _WIN32
-
-typedef CRITICAL_SECTION	 ldclt_mutex_t;
-typedef DWORD			 ldclt_tid;
-
-extern int	 getopt (int argc, char **argv, char *optstring);
-extern int	 getsubopt(char **optionp, char **tokens, char **valuep);
-extern long	 lrand48 (void);
-extern char	*optarg;
-extern int	 optind;
-
-#else /* _WIN32 */
 
 /************************************************************************/
 /************************************************************************/
@@ -118,9 +95,6 @@ extern int	 optind;
 typedef pthread_mutex_t		ldclt_mutex_t;
 typedef pthread_t		ldclt_tid;
 
-#endif /* _WIN32 */
-
-
 /*
  * Portability functions common to all platforms
  */
@@ -129,5 +103,3 @@ extern int	ldclt_mutex_lock   (ldclt_mutex_t *mutex);
 extern int	ldclt_mutex_unlock (ldclt_mutex_t *mutex);
 extern void	ldclt_sleep (int nseconds);
 extern int	ldclt_thread_create (ldclt_tid *tid, void *(*fct)(void *), void *param);
-
-/* End of file */
diff --git a/ldap/servers/slapd/tools/ldclt/scalab01.c b/ldap/servers/slapd/tools/ldclt/scalab01.c
index e64734a..f903c70 100644
--- a/ldap/servers/slapd/tools/ldclt/scalab01.c
+++ b/ldap/servers/slapd/tools/ldclt/scalab01.c
@@ -85,9 +85,7 @@ dd/mm/yy | Author	| Comments
 #include <stdlib.h>	/* malloc(), etc... */
 #include <string.h>	/* strcpy(), etc... */
 #include <errno.h>	/* perror(), etc... */
-#ifndef _WIN32
 #include <pthread.h>	/* pthreads(), etc... */
-#endif
 
 #include <lber.h>	/* ldap C-API BER declarations */
 #include <ldap.h>	/* ldap C-API declarations */
@@ -101,18 +99,12 @@ dd/mm/yy | Author	| Comments
 #include "scalab01.h"	/* Scalab01 specific definitions */
 
 
-
-
-
 /*
  * Private data structures.
  */
 scalab01_context	 s1ctx;
 
 
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01_init
 	PURPOSE :	Initiates the scalab01 scenario.
@@ -162,11 +154,6 @@ scalab01_init (void)
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01Lock
 	PURPOSE :	Lock for single user trying to connect.
@@ -234,12 +221,6 @@ scalab01Lock (
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01Unlock
 	PURPOSE :	Unlock for single user trying to connect.
@@ -292,13 +273,6 @@ scalab01Unlock (
 }
 
 
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01_modemIncr
 	PURPOSE :	Increments the modem nb of cnx
@@ -392,11 +366,6 @@ scalab01_modemDecr (
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01_addLogin
 	PURPOSE :	Add a new user login to the s1ctx structure.
@@ -515,13 +484,6 @@ done:
 }
 
 
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01_connectSuperuser
 	PURPOSE :	Purpose of the fct
@@ -559,12 +521,6 @@ scalab01_connectSuperuser (void)
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	readAttrValue
 	PURPOSE :	This function will ldap_search the given entry for the
@@ -671,11 +627,6 @@ readAttrValue (
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	writeAttrValue
 	PURPOSE :	This function will ldap_modify the given entry to
@@ -729,11 +680,6 @@ writeAttrValue (
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01_unlock
 	PURPOSE :	Unlock the user given in argument.
@@ -814,12 +760,6 @@ scalab01_unlock (
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	scalab01_control
 	PURPOSE :	This function implements the control loop/thread of
@@ -948,11 +888,6 @@ scalab01_control (
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	doScalab01
 	PURPOSE :	Implements the client part of the scalab01 scenario.
@@ -1105,10 +1040,3 @@ TBC - this is done in the next loop... - cf connectToServer()
 
   return (0);
 }
-
-
-
-
-
-
-/* End of file */
diff --git a/ldap/servers/slapd/tools/ldclt/threadMain.c b/ldap/servers/slapd/tools/ldclt/threadMain.c
index 7af76d4..f74759b 100644
--- a/ldap/servers/slapd/tools/ldclt/threadMain.c
+++ b/ldap/servers/slapd/tools/ldclt/threadMain.c
@@ -154,31 +154,15 @@ dd/mm/yy | Author	| Comments
 #include <errno.h>	/* errno, etc... */			/*JLS 06-03-00*/
 #include <lber.h>	/* ldap C-API BER declarations */
 #include <ldap.h>	/* ldap C-API declarations */
-#ifndef _WIN32							/*JLS 29-11-00*/
 #include <unistd.h>	/* close(), etc... */
 #include <pthread.h>	/* pthreads(), etc... */
 #include <signal.h>	/* sigfillset(), etc... */
-#endif								/*JLS 29-11-00*/
-
 #include "port.h"	/* Portability definitions */		/*JLS 29-11-00*/
 #include "ldclt.h"	/* This tool's include file */
 #include "utils.h"	/* Utilities functions */		/*JLS 14-11-00*/
 #include "scalab01.h"	/* Scalab01 specific */			/*JLS 12-01-01*/
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-						/* New */	/*JLS 15-03-01*/
 /* ****************************************************************************
 	FUNCTION :	selectRandomAttrList
 	PURPOSE :	Select a random attr list.
@@ -196,9 +180,6 @@ selectRandomAttrList (
 }
 
 
-
-
-
 /* ****************************************************************************
 	FUNCTION :	randomString
 	PURPOSE :	Return a random string, of length nbDigits.
@@ -219,12 +200,6 @@ randomString (
 }
 
 
-
-
-
-
-
-						/* New */	/*JLS 28-03-01*/
 /* ****************************************************************************
 	FUNCTION :	incrementCommonCounterObject
 	PURPOSE :	Purpose of the fct
@@ -309,11 +284,6 @@ incrementCommonCounterObject (
 }
 
 
-
-
-
-
-						/* New */	/*JLS 14-03-01*/
 /* ****************************************************************************
 	FUNCTION :	incrementCommonCounter
 	PURPOSE :	Purpose of the fct
@@ -373,9 +343,6 @@ incrementCommonCounter (
 }
 
 
-
-
-
 /* ****************************************************************************
 	FUNCTION :	incrementNbOpers
 	PURPOSE :	Increment the counters tttctx->nbOpers and
@@ -434,11 +401,6 @@ incrementNbOpers (
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	ignoreError
 	PURPOSE :	Returns true or false depending on the given error
@@ -468,12 +430,6 @@ ignoreError (
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	addErrorStat
 	PURPOSE :	Add the given error number to the statistics.
@@ -562,10 +518,6 @@ addErrorStat (
 }
 
 
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	msgIdAdd
 	PURPOSE :	Add a new message id to the pending ones.
@@ -630,11 +582,6 @@ msgIdAdd (
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	msgIdAttribs
 	PURPOSE :	Found the requested message id in the pending list.
@@ -662,12 +609,6 @@ msgIdAttribs (
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	msgIdDN
 	PURPOSE :	Found the requested message id in the pending list.
@@ -695,12 +636,6 @@ msgIdDN (
 }
 
 
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	msgIdStr
 	PURPOSE :	Found the requested message id in the pending list.
@@ -728,11 +663,6 @@ msgIdStr (
 }
 
 
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	msgIdDel
 	PURPOSE :	Delete a message id from the pending ones.
@@ -807,13 +737,6 @@ msgIdDel (
 }
 
 
-
-
-
-
-
-
-					/* New function */	/*JLS 17-11-00*/
 /* ****************************************************************************
 	FUNCTION :	getThreadStatus
 	PURPOSE :	Get the value of a given thread's status.
@@ -853,10 +776,6 @@ getThreadStatus (
 }
 
 
-
-
-
-					/* New function */	/*JLS 17-11-00*/
 /* ****************************************************************************
 	FUNCTION :	setThreadStatus
 	PURPOSE :	Set the value of a given thread's status.
@@ -897,17 +816,6 @@ setThreadStatus (
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
 /* ****************************************************************************
 	FUNCTION :	threadMain
 	PURPOSE :	This function is the main function of the client threads
@@ -1252,4 +1160,3 @@ threadMain (
 }
 
 
-/* End of file */
diff --git a/ldap/servers/slapd/tools/ldclt/workarounds.c b/ldap/servers/slapd/tools/ldclt/workarounds.c
index f0b8375..508340d 100644
--- a/ldap/servers/slapd/tools/ldclt/workarounds.c
+++ b/ldap/servers/slapd/tools/ldclt/workarounds.c
@@ -79,16 +79,12 @@ dd/mm/yy | Author	| Comments
 #ifdef SOLARIS_LIBLDAP						/*JLS 19-09-00*/
 #include "ldap-private.h"
 #else								/*JLS 19-09-00*/
-#ifndef _WIN32							/*JLS 01-12-00*/
 #include <pthread.h>						/*JLS 01-12-00*/
-#endif								/*JLS 01-12-00*/
 #include "port.h"	/* Portability definitions */		/*JLS 29-11-00*/
 #include "ldclt.h"						/*JLS 19-09-00*/
 #endif								/*JLS 19-09-00*/
 
 
-
-
 /* ****************************************************************************
 	FUNCTION :	getFdFromLdapSession
 	PURPOSE :	This function is a work-around for the bug 4197228
diff --git a/ldap/servers/slapd/tools/ldif.c b/ldap/servers/slapd/tools/ldif.c
index e4527ba..8ac80df 100644
--- a/ldap/servers/slapd/tools/ldif.c
+++ b/ldap/servers/slapd/tools/ldif.c
@@ -45,14 +45,8 @@
 #include <stdlib.h>
 #include <memory.h>
 #include <sys/types.h>
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#include <windows.h>
-#include <io.h>
-#include <fcntl.h>
-#else
 #include <unistd.h>		/* for read() */
 #include <sys/socket.h>
-#endif
 #include "ldap.h"
 #include "ldif.h"
 
@@ -114,9 +108,6 @@ int main( int argc, char **argv )
 		char    buf[BUFSIZ];
 		char	*val;
 		int	nread, max, cur;
-#if defined( _WINDOWS ) || defined( _WIN32 )
-		_setmode( _fileno( stdin ), _O_BINARY );
-#endif
 
 		if (( val = (char *) malloc( BUFSIZ )) == NULL ) {
 			perror( "malloc" );
diff --git a/ldap/servers/slapd/tools/migratecred.c b/ldap/servers/slapd/tools/migratecred.c
index c1e37bf..3c876f0 100644
--- a/ldap/servers/slapd/tools/migratecred.c
+++ b/ldap/servers/slapd/tools/migratecred.c
@@ -50,9 +50,7 @@
 #include <unistd.h>
 #endif
 
-#ifndef _WIN32
 #include <sys/param.h>  /* MAXPATHLEN */
-#endif
 
 #include "../plugins/rever/rever.h"
 #include "getopt_ext.h"
@@ -63,22 +61,6 @@ static void usage(char *name)
     fprintf(stderr, "New plugin path defaults to [%s] if not given\n", PLUGINDIR);
 	exit(1);
 }
-	
-#ifdef _WIN32
-/* converts '\' chars to '/' */
-static void dostounixpath(char *szText)
-{
-    if(szText)
-    {
-        while(*szText)
-        {
-            if( *szText == '\\' )
-                *szText = '/';
-            szText++;
-        }
-    }
-}
-#endif
 
 /* Script used during migration: replication and
 	chaining backend credentials must be converted.
@@ -118,16 +100,10 @@ main( int argc, char **argv)
 		{
 			case 'o':
 				oldpath = strdup(optarg);
-#ifdef _WIN32
-				dostounixpath(oldpath);
-#endif /* _WIN32 */
 
 				break;
 			case 'n':
 				newpath = strdup(optarg);
-#ifdef _WIN32
-				dostounixpath(newpath);
-#endif /* _WIN32 */
 				break;
 			case 'c':
 				{
@@ -151,10 +127,6 @@ main( int argc, char **argv)
 				break;
 			case 'p':
 				pluginpath = strdup(optarg);
-#ifdef _WIN32
-				dostounixpath(pluginpath);
-#endif /* _WIN32 */
-
 				break;
 			default: 
 				usage(cmd);
@@ -171,9 +143,6 @@ main( int argc, char **argv)
 	}
 
 
-#if defined( XP_WIN32 )
-	shared_lib = ".dll";
-#else
 #ifdef HPUX
 #ifdef __ia64
 	shared_lib = ".so";
@@ -191,13 +160,9 @@ main( int argc, char **argv)
 	shared_lib = ".so";
 #endif
 #endif
-#endif
 
 	if (!pluginpath) {
 		pluginpath = strdup(PLUGINDIR);
-#ifdef _WIN32
-		dostounixpath(pluginpath);
-#endif /* _WIN32 */
 	}
 
 	if (access(pluginpath, R_OK)) {
diff --git a/ldap/servers/slapd/tools/mmldif.c b/ldap/servers/slapd/tools/mmldif.c
index 156d892..68a774c 100644
--- a/ldap/servers/slapd/tools/mmldif.c
+++ b/ldap/servers/slapd/tools/mmldif.c
@@ -47,11 +47,8 @@
 #include	<time.h>
 #include	<stdlib.h>
 #include        <ldap.h>
-#ifndef _WIN32
-#  define	stricmp	strcasecmp
-#else
-#  include	<io.h>
-#endif
+
+#define	stricmp	strcasecmp
 
 #include <nss.h>
 #include <pk11func.h>
@@ -68,11 +65,6 @@
 #define FALSE 0
 #endif
 
-#ifdef _WIN32
-int slapd_ldap_debug = 0;
-int *module_ldap_debug;
-#endif
-
 /*
  * VSTRING was defined in PMDF headers.
  */
@@ -661,11 +653,6 @@ int mm_init(int argc, char * argv[])
         }
     }
 
-#ifdef _WIN32
-    module_ldap_debug = &slapd_ldap_debug;
-    libldap_init_debug_level(&slapd_ldap_debug);
-#endif
-
     if (ofn != NULL) {
         ofp = fopen(ofn, "w");
         if (ofp == NULL) {
diff --git a/ldap/servers/slapd/tools/pwenc.c b/ldap/servers/slapd/tools/pwenc.c
index 6760be4..826a956 100644
--- a/ldap/servers/slapd/tools/pwenc.c
+++ b/ldap/servers/slapd/tools/pwenc.c
@@ -40,12 +40,7 @@
 #  include <config.h>
 #endif
 
-#if defined( _WIN32 )
-#include <sys/stat.h> /* for S_IREAD and S_IWRITE */
-#include <windows.h>
-#include <time.h>
-#include "proto-ntutil.h"
-#else
+
 #include <sys/socket.h>
 #include <sys/errno.h>
 #include <sys/param.h>
@@ -55,7 +50,6 @@
 					* break other builds so far */
 #include <unistd.h>
 #endif
-#endif
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
@@ -70,9 +64,6 @@
 int			ldap_syslog;
 int			ldap_syslog_level;
 int			slapd_ldap_debug = LDAP_DEBUG_ANY;
-#ifdef _WIN32
-int *module_ldap_debug;
-#endif
 int			detached;
 FILE			*error_logfp;
 FILE			*access_logfp;
@@ -176,11 +167,6 @@ main( argc, argv )
     name = argv[ 0 ];
     pwsp = cmppwsp = NULL;
 
-#ifdef _WIN32
-	module_ldap_debug = &slapd_ldap_debug;
-	libldap_init_debug_level(&slapd_ldap_debug);
-#endif
-
 	PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 0 );
 	
 	/* Initialize NSS to make ds_salted_sha1_pw_enc() work */
diff --git a/ldap/servers/slapd/tools/rsearch/addthread.c b/ldap/servers/slapd/tools/rsearch/addthread.c
index a3e5568..457920c 100644
--- a/ldap/servers/slapd/tools/rsearch/addthread.c
+++ b/ldap/servers/slapd/tools/rsearch/addthread.c
@@ -44,9 +44,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef XP_UNIX
 #include <unistd.h>
-#endif
 #include "nspr.h"
 #include <netinet/tcp.h>	/* for TCP_NODELAY */
 #include "ldap.h"
diff --git a/ldap/servers/slapd/tools/rsearch/main.c b/ldap/servers/slapd/tools/rsearch/main.c
index 33bc0a1..a8c17a7 100644
--- a/ldap/servers/slapd/tools/rsearch/main.c
+++ b/ldap/servers/slapd/tools/rsearch/main.c
@@ -48,10 +48,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef XP_UNIX
 #include <unistd.h>
-
-#endif
 #include "nspr.h"
 #include "rsearch.h"
 #include "nametable.h"
diff --git a/ldap/servers/slapd/tools/rsearch/nametable.c b/ldap/servers/slapd/tools/rsearch/nametable.c
index 03a6ae1..9ab1376 100644
--- a/ldap/servers/slapd/tools/rsearch/nametable.c
+++ b/ldap/servers/slapd/tools/rsearch/nametable.c
@@ -56,11 +56,7 @@ struct _nametable {
 
 int get_large_random_number()
 {
-#ifdef _WIN32
-	return rand();
-#else
 	return random();
-#endif
 }
 
 
@@ -133,11 +129,11 @@ int nt_push(NameTable *nt, char *s)
     char **ndata;
 
     if (nt->size >= nt->capacity) {
-	/* expando! */
-	nt->capacity += NT_STEP;
-	ndata = (char **)realloc(nt->data, sizeof(char *) * nt->capacity);
-	if (!ndata) return 0;
-	nt->data = ndata;
+        /* expando! */
+        nt->capacity += NT_STEP;
+        ndata = (char **)realloc(nt->data, sizeof(char *) * nt->capacity);
+        if (!ndata) return 0;
+        nt->data = ndata;
     }
     nt->data[nt->size++] = s;
     return nt->size;
diff --git a/ldap/servers/slapd/tools/rsearch/rsearch.c b/ldap/servers/slapd/tools/rsearch/rsearch.c
index f56da7f..5579467 100644
--- a/ldap/servers/slapd/tools/rsearch/rsearch.c
+++ b/ldap/servers/slapd/tools/rsearch/rsearch.c
@@ -56,9 +56,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
-#ifdef XP_UNIX
 #include <unistd.h>
-#endif
 #include "nspr.h"
 #include "rsearch.h"
 #include "nametable.h"
diff --git a/ldap/servers/slapd/tools/rsearch/searchthread.c b/ldap/servers/slapd/tools/rsearch/searchthread.c
index 9f1d127..e520f71 100644
--- a/ldap/servers/slapd/tools/rsearch/searchthread.c
+++ b/ldap/servers/slapd/tools/rsearch/searchthread.c
@@ -44,9 +44,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef XP_UNIX
 #include <unistd.h>
-#endif
 #include <time.h>
 #include <errno.h>
 #include "nspr.h"
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
index 8cedeec..2392f8a 100644
--- a/ldap/servers/slapd/unbind.c
+++ b/ldap/servers/slapd/unbind.c
@@ -57,9 +57,7 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#ifndef _WIN32
 #include <sys/socket.h>
-#endif
 #include "slap.h"
 
 void
diff --git a/ldap/servers/slapd/uniqueidgen.c b/ldap/servers/slapd/uniqueidgen.c
index dad44df..c7f9976 100644
--- a/ldap/servers/slapd/uniqueidgen.c
+++ b/ldap/servers/slapd/uniqueidgen.c
@@ -43,14 +43,10 @@
 /* uniqueidgen.c  - implementation for uniqueID generator */
 
 #include <string.h>
-
-#ifndef _WIN32			 /* for ntoh* functions */
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/sysinfo.h>
 #include <sys/utsname.h>
-#endif
-
 #include "nspr.h"
 #include "slap.h"
 #include "uuid.h"
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 3690bf7..271f342 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -41,15 +41,11 @@
 #endif
 
 /* util.c   -- utility functions -- functions available form libslapd */
-#ifdef _WIN32
-#include <direct.h> /* for getcwd */
-#else
 #include <sys/socket.h>
 #include <sys/param.h>
 #include <unistd.h>
 #include <pwd.h>
 #include <stdint.h>
-#endif
 #include <fcntl.h>
 #include <libgen.h>
 #include <pk11func.h>
@@ -57,20 +53,15 @@
 #include "prtime.h"
 #include "prinrval.h"
 #include "snmp_collator.h"
+#include <sys/time.h>
 
 #define UTIL_ESCAPE_NONE      0
 #define UTIL_ESCAPE_HEX       1
 #define UTIL_ESCAPE_BACKSLASH 2
 
-#if defined( _WIN32 )
-#define _PSEP "\\"
-#define _PSEP2 "\\\\"
-#define _CSEP '\\'
-#else
 #define _PSEP "/"
 #define _PSEP2 "//"
 #define _CSEP '/'
-#endif
 
 /* slapi_filter_sprintf macros */
 #define ATTRSIZE 256   /* size allowed for an attr name */
@@ -832,16 +823,9 @@ is_abspath(const char *path)
 		return 0; /* empty path is not absolute? */
 	}
 
-#if defined( XP_WIN32 )
-	if (path[0] == '/' || path[0] == '\\' ||
-		(isalpha(path[0]) && (path[1] == ':'))) {
-		return 1; /* Windows abs path */
-	}
-#else
 	if (path[0] == '/') {
 		return 1; /* unix abs path */
 	}
-#endif
 
 	return 0; /* not an abs path */
 }
@@ -930,26 +914,10 @@ rel2abspath_ext( char *relpath, char *cwd )
     char abspath[ MAXPATHLEN + 1 ];
     char *retpath = NULL;
 
-#if defined( _WIN32 )
-   CHAR szDrive[_MAX_DRIVE];
-   CHAR szDir[_MAX_DIR];
-   CHAR szFname[_MAX_FNAME];
-   CHAR szExt[_MAX_EXT];
-#endif
-
     if ( relpath == NULL ) {
         return NULL;
     }
 
-#if defined( _WIN32 )
-    memset (&szDrive, 0, sizeof (szDrive));
-    memset (&szDir, 0, sizeof (szDir));
-    memset (&szFname, 0, sizeof (szFname));
-    memset (&szExt, 0, sizeof (szExt));
-    _splitpath( relpath, szDrive, szDir, szFname, szExt );
-    if( szDrive[0] && szDir[0] )
-        return( slapi_ch_strdup( relpath ));
-#endif
     if ( relpath[ 0 ] == _CSEP ) {     /* absolute path */
         PR_snprintf(abspath, sizeof(abspath), "%s", relpath);
     } else {                        /* relative path */
@@ -1087,30 +1055,11 @@ Description:
 		for the number of milliseconds specified.
 
 ************************************************************************/
-
-
-#if defined(_WIN32)
-
-#include "windows.h"
-
-
-void	DS_Sleep(PRIntervalTime ticks)
-{
-DWORD mSecs = PR_IntervalToMilliseconds(ticks);
-
-	Sleep(mSecs);
-}
-
-#else	/*** UNIX ***/
-
-
-#include <sys/time.h>
-
-
-void	DS_Sleep(PRIntervalTime ticks)
+void
+DS_Sleep(PRIntervalTime ticks)
 {
-long mSecs = PR_IntervalToMilliseconds(ticks);
-struct timeval tm;
+	long mSecs = PR_IntervalToMilliseconds(ticks);
+	struct timeval tm;
 
 	tm.tv_sec = mSecs / 1000;
 	tm.tv_usec = (mSecs % 1000) * 1000;
@@ -1118,7 +1067,6 @@ struct timeval tm;
 	select(0,NULL,NULL,NULL,&tm);
 }
 
-#endif
 
 
 /*****************************************************************************
@@ -1186,7 +1134,6 @@ strarray2str( char **a, char *buf, size_t buflen, int include_quotes )
    Returns 0 upon success or non-zero otherwise, usually -1 if
    some system error occurred
 */
-#ifndef _WIN32
 int
 slapd_chown_if_not_owner(const char *filename, uid_t uid, gid_t gid)
 {
@@ -1213,7 +1160,6 @@ slapd_chown_if_not_owner(const char *filename, uid_t uid, gid_t gid)
         close(fd);
         return result;
 }
-#endif
 
 /*
  * Compare 2 pathes
diff --git a/ldap/servers/slapd/uuid.c b/ldap/servers/slapd/uuid.c
index a514a56..8c167ce 100644
--- a/ldap/servers/slapd/uuid.c
+++ b/ldap/servers/slapd/uuid.c
@@ -67,18 +67,11 @@
 #include <stdlib.h>
 #include <time.h>
 #include <pk11func.h>
-
-#ifdef _WIN32
-#include <sys/stat.h> /* for S_IREAD and S_IWRITE */
-#else
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/sysinfo.h>
 #include <sys/utsname.h>
 #include <unistd.h>     /* gethostname() */
-#endif
-
-
 #include "slap.h"
 #include "uuid.h"
 #include "sechash.h"
diff --git a/ldap/servers/slapd/uuid.h b/ldap/servers/slapd/uuid.h
index a97aeb8..3c5dc67 100644
--- a/ldap/servers/slapd/uuid.h
+++ b/ldap/servers/slapd/uuid.h
@@ -68,13 +68,8 @@
 #define UUID_H
 
 /* Set this to what your compiler uses for 64 bit data type */
-#ifdef _WIN32
-#define unsigned64_t unsigned __int64
-#define I64(C) C
-#else
 #define unsigned64_t unsigned long long
 #define I64(C) C##LL
-#endif
 
 /***** uuid related data types *****/
 /* 
diff --git a/ldap/servers/snmp/ntagt/msrvdefs.mak b/ldap/servers/snmp/ntagt/msrvdefs.mak
index 2072549..1e52dde 100644
--- a/ldap/servers/snmp/ntagt/msrvdefs.mak
+++ b/ldap/servers/snmp/ntagt/msrvdefs.mak
@@ -146,7 +146,7 @@ endif
 	OPTIMIZE_FLAGS  =   -O2
 	CFLAGS		=    $(DLL_CFLAGS) -DSVR4 -D__svr4__ -DSOLARIS \
 				-DHAVE_NIS -DHAS_GETSPNAM -DHAS_FGETPWENT \
-				-DXP_UNIX -DSTATOBJS \
+				-DSTATOBJS \
 				-DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
 				-DOSVERSION=$(OSVERSION) -D_REENTRANT
 	LD_EXTRAS	=   -L/tools/ns/lib -lthread -lsocket -lnsl -lgen -ldl
@@ -177,7 +177,6 @@ endif
 	OPTIMIZE_FLAGS  =   -O -Olimit 4096
 	CFLAGS      =    $(DLL_CFLAGS) -DIRIX -DSTATOBJS \
 				-DHAVE_NIS -DHAS_GETSPNAM -DHAS_FGETPWENT \
-				-DXP_UNIX \
 				-DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
 				-DOSVERSION=$(OSVERSION)
 
@@ -208,7 +207,7 @@ ifeq ($(ARCH), HPUX)
 	DLL_LDFLAGS =   -b
 	OPTIMIZE_FLAGS  =   -O
 	CFLAGS      =   -DHPUX -DSTATOBJS -DHAVE_NIS \
-				-DXP_UNIX -DHAS_FGETPWENT \
+				-DHAS_FGETPWENT \
 				-DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
 				-DOSVERSION=$(OSVERSION)
 	LD_EXTRAS   =   -Wl,+b,/usr/lib,+s \
@@ -234,7 +233,7 @@ ifeq ($(ARCH), OSF1)
 	DLL_CXXFLAGS    =
 	DLL_LDFLAGS =
 	OPTIMIZE_FLAGS  =   -O
-	CFLAGS      =   -DOSF1 -DSTATOBJS -DHAVE_NIS -DXP_UNIX \
+	CFLAGS      =   -DOSF1 -DSTATOBJS -DHAVE_NIS \
 				-DHAS_FGETPWENT \
 				-DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
 				-DOSVERSION=$(OSVERSION)
@@ -272,7 +271,7 @@ ifeq ($(ARCH), AIX)
 	DLL_CXXFLAGS    =
 	OPTIMIZE_FLAGS  =   -O
 	CFLAGS      =   -DAIX -DAIXV3 -DAIXV4 -DSTATOBJS \
-				-DHAVE_NIS -DXP_UNIX -mcpu=common\
+				-DHAVE_NIS -mcpu=common\
 				-DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
 				-DOSVERSION=$(OSVERSION)
 	LD_EXTRAS   =  -L/gnu/install/lib -L/gnu/install/lib/gcc-lib/powerpc-ibm-aix4.1.4.0/2.7.2.1/common -lstdc++ -ls -lsvld -lgcc -lc_r
@@ -293,7 +292,7 @@ endif
 #   DLL_CXXFLAGS    =
 #   OPTIMIZE_FLAGS  =   -O
 #   CFLAGS      =   -DAIX -DAIXV3 -DSTATOBJS \
-#               -DHAVE_NIS -DXP_UNIX \
+#               -DHAVE_NIS \
 #		-DMSRV_RELEASE=\"$(MSRV_RELEASE)\"
 #   LD_EXTRAS   =   -L/tools/ns/lib -liostream -ls
 #   MSRV_INCLUDES   =   -I/tools/ns/lib/g++-include 
diff --git a/ldap/systools/idsktune.c b/ldap/systools/idsktune.c
index e0f485c..f36b780 100644
--- a/ldap/systools/idsktune.c
+++ b/ldap/systools/idsktune.c
@@ -66,7 +66,7 @@ static char *build_date = "23-FEBRUARY-2012";
 #include <sys/time.h>
 #endif
 
-#if !defined(_WIN32) && !defined(__VMS)
+#if !defined(__VMS)
 #include <sys/resource.h>
 #include <unistd.h>
 #endif
@@ -82,12 +82,6 @@ static char *build_date = "23-FEBRUARY-2012";
 #define IDDS_HAVE_STATVFS
 #endif
 
-#if defined(_WIN32)
-#include <windows.h>
-#define MAXPATHLEN 1024
-extern char *optarg;
-#endif
-
 #if defined(IDDS_SYSV_INCLUDE) || defined(IDDS_BSD_INCLUDE)
 #include <sys/utsname.h>
 #include <sys/stat.h>
@@ -1390,16 +1384,15 @@ static void gen_tests (void)
   aix_check_patches();
 #endif
 
-#if !defined(_WIN32)
-  if (access("/usr/sbin/prtconf",X_OK) == 0) {
+
+if (access("/usr/sbin/prtconf",X_OK) == 0) {
     if (flag_debug) printf("DEBUG  : /usr/sbin/prtconf\n");
-    if (iii_pio_procparse("/usr/sbin/prtconf",
-			  III_PIO_SZ(ptb_prtconf),
+    if (iii_pio_procparse("/usr/sbin/prtconf", III_PIO_SZ(ptb_prtconf),
 			  ptb_prtconf) == -1) {
-      perror("/usr/sbin/prtconf");
+        perror("/usr/sbin/prtconf");
     }
-  }
-#endif
+}
+
 
 #if defined(__osf__)
   phys_mb = (idds_osf_get_memk())/1024;
@@ -1532,12 +1525,10 @@ static void gen_tests (void)
     if (flag_debug) printf("DEBUG  : %d MB swap configured\n", swap_mb);
   }
 
-#ifndef _WIN32  
   uid = getuid();
   if (uid != 0) {
     uid = geteuid();
   }
-#endif
 
 #if defined(__sun)
   if (uid != 0) {
@@ -1565,11 +1556,9 @@ static void gen_tests (void)
   sun_check_etcsystem();
 #endif
 
-#ifndef _WIN32
   if (uid != 0) {
     printf("\n");
   }
-#endif
 
   if (flag_html) printf("</P>\n");
 }
@@ -2814,9 +2803,7 @@ static void check_disk_quota(char mntbuf[MAXPATHLEN])
 
 static void disk_tests(void)
 {
-#ifndef _WIN32
   struct rlimit r;
-#endif
   char mntbuf[MAXPATHLEN];
 
   if (client) return;
@@ -2902,7 +2889,6 @@ static void disk_tests(void)
 /* The function hasn't been used. #if 0 to get rid of compiler warning */
 static int get_disk_usage(char *s)
 {
-#ifndef _WIN32
   char cmd[8192];
   char buf[8192];
   FILE *fp;
@@ -2920,15 +2906,11 @@ static int get_disk_usage(char *s)
   fclose (fp);
   i = atoi(buf);
   return (i / 1024);
-#else
-  return 0;
-#endif
 }
 #endif
 
 static void check_mem_size(int ro,char *rn)
 {
-#ifndef _WIN32
   struct rlimit r;
   int rprev;
   long m_mb;
@@ -2968,13 +2950,10 @@ static void check_mem_size(int ro,char *rn)
 #endif
     printf("\n");
   }
-
-#endif
 }
 
 static void limits_tests(void)
 {
-#ifndef _WIN32
   struct rlimit r;
 
 #if defined(RLIMIT_NOFILE)  
@@ -3055,8 +3034,6 @@ static void limits_tests(void)
 #if defined(RLIMIT_AS)
   check_mem_size(RLIMIT_AS,"RLIMIT_AS");
 #endif
-
-#endif
 }
 
 /*
@@ -3068,12 +3045,6 @@ static void ids_get_platform(char *buf)
 #if defined(IDDS_LINUX_INCLUDE) || defined(__osf__) || defined(_AIX) || defined(__hpux) || defined(IDDS_BSD_INCLUDE)
   	struct utsname u;
 #endif
-#if defined(_WIN32)
-	SYSTEM_INFO sysinfo;
-	OSVERSIONINFO osinfo;
-	char osbuf[128];
-
-#endif
 #if defined(__hpux) || defined(_AIX)
 	char model[128];
 	char procstr[128];
@@ -3084,43 +3055,7 @@ static void ids_get_platform(char *buf)
 	long cpuvers, cputype;
 #endif
 
-#if defined(_WIN32)
-	osinfo.dwOSVersionInfoSize = sizeof(osinfo);
-	GetSystemInfo(&sysinfo);
-	sprintf(osbuf,"win32");
-	if (GetVersionEx(&osinfo) != 0) {
-	  if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-	    sprintf(osbuf,"winnt%d.%d.%d",
-		    osinfo.dwMajorVersion,
-		    osinfo.dwMinorVersion,
-		    osinfo.dwBuildNumber);
-	    if (osinfo.szCSDVersion[0]) {
-	      strcat(osbuf," (");
-	      strcat(osbuf,osinfo.szCSDVersion);
-	      strcat(osbuf,")");
-	    }
-	  }
-	}
-	
-	switch(sysinfo.wProcessorArchitecture) {
-	case PROCESSOR_ARCHITECTURE_INTEL:
-	  sprintf(buf,"i%d86-unknown-%s",sysinfo.wProcessorLevel,osbuf);
-	  break;
-	case PROCESSOR_ARCHITECTURE_ALPHA:
-	  sprintf(buf,"alpha%d-unknown-%s",
-		  sysinfo.wProcessorLevel,osbuf);
-	  break;
-	case PROCESSOR_ARCHITECTURE_MIPS:
-	  sprintf(buf,"mips-unknown-%s",osbuf);
-	  break;
-	case PROCESSOR_ARCHITECTURE_PPC:
-	  sprintf(buf,"ppc-unknown-%s",osbuf);
-	  break;
-	case PROCESSOR_ARCHITECTURE_UNKNOWN:
-	  sprintf(buf,"unknown-unknown-%s",osbuf);
-	  break;
-	}
-#else 
+
 #if defined(IDDS_LINUX_INCLUDE)
 	if (uname(&u) == 0) {
 	  sprintf(buf,"%s-unknown-linux%s",
@@ -3247,7 +3182,6 @@ static void ids_get_platform(char *buf)
 #endif /* AIX */
 #endif /* SUN */	
 #endif /* LINUX */
-#endif /* WIN32 */
 }
 
 static int count_processors(void)
@@ -3304,9 +3238,6 @@ int main(int argc,char *argv[])
 {
   int i;
 
-#ifdef _WIN32
-
-#else  
   while((i = getopt(argc,argv,"DvHqcCi:")) != EOF) {
     switch(i) {
     case 'D':
@@ -3336,7 +3267,6 @@ int main(int argc,char *argv[])
       break;
     }
   }
-#endif
 
 #if defined(_AIX)
   if (1) {
diff --git a/lib/base/dns.cpp b/lib/base/dns.cpp
index 62d3e44..8704a39 100644
--- a/lib/base/dns.cpp
+++ b/lib/base/dns.cpp
@@ -48,20 +48,14 @@
 #define DNS_GUESSING
 
 #include "netsite.h"
-#ifdef XP_UNIX
 #include "systems.h"
-#else /* XP_WIN32 */
-#include "base/systems.h"
-#endif /* XP_WIN32 */
 
 /* Under NT, these are taken care of by net.h including winsock.h */
-#ifdef XP_UNIX
 #include <arpa/inet.h>  /* inet_ntoa */
 #include <netdb.h>  /* struct hostent */
 #ifdef NEED_GHN_PROTO
 extern "C" int gethostname (char *name, size_t namelen);
 #endif
-#endif
 #include <stdio.h>
 #include <nspr.h>
 
diff --git a/lib/base/dnsdmain.cpp b/lib/base/dnsdmain.cpp
index 7cbc056..7430077 100644
--- a/lib/base/dnsdmain.cpp
+++ b/lib/base/dnsdmain.cpp
@@ -49,16 +49,11 @@
 #include "netsite.h"
 #include <string.h>
 #include <stdio.h>
-#ifdef XP_UNIX
 #include <unistd.h>
-#endif
 #include <ctype.h>
 #include "util.h"
-
-/* Under NT, this is taken care of by net.h including winsock.h */
-#ifdef XP_UNIX
 #include <netdb.h>  /* struct hostent */
-#endif
+
 extern "C" {
 #include <nspr.h>
 }
@@ -68,7 +63,6 @@ extern "C" {
 /* This is contained in resolv.h on most systems. */
 #define _PATH_RESCONF "/etc/resolv.conf"
 
-#ifdef XP_UNIX
 NSPR_BEGIN_EXTERN_C
 #ifdef Linux
 extern int getdomainname(char *, size_t);
@@ -83,7 +77,6 @@ extern int gethostname (char *name, int namelen);
 #endif
 #endif
 NSPR_END_EXTERN_C
-#endif
 
 
 /* ---------------------------- dns_guess_domain -------------------------- */
diff --git a/lib/base/file.cpp b/lib/base/file.cpp
index 82a1852..b3f7234 100644
--- a/lib/base/file.cpp
+++ b/lib/base/file.cpp
@@ -57,18 +57,7 @@
 #include <stdlib.h>
 #include <signal.h>
 #endif
-#ifdef XP_WIN32
-#include <time.h>  /* time */
-#include <sys/stat.h> /* stat */
-#include <errno.h>
-#include <direct.h>
-#include <base/nterr.h>
-/* Removed for ns security integration
-#include <xp_error.h>
-*/
-#endif
 #include <prerror.h>
-
 #include "private/pprio.h"
 #include "prlock.h"
 
@@ -89,60 +78,8 @@ PRLock *_atomic_write_lock = NULL;
     */
 NSAPI_PUBLIC int system_stat(char *path, struct stat *finfo)
 {
-#ifdef XP_WIN32
-
-    int chop, l;
-
-/* The NT stat is very peculiar about directory names. */
-/* XXX aruna - there is a bug here, maybe in the C runtime.
- * Stating the same path in a separate program succeeds. From
- * jblack's profiling, this needs to be replaced by the Win32
- * calls anyway.*/
-
-    l = strlen(path);
-    if((path[l - 1] == '/') && 
-       (!(isalpha(path[0]) && (!strcmp(&path[1], ":/")))))
-    {
-        chop = 1;
-        path[--l] = '\0';
-    }
-    else chop = 0;
-#endif /* XP_WIN32 */
-
-#ifdef XP_UNIX
     if(stat(path, finfo) == -1)
         return -1;
-#else /* XP_WIN32 */
-
-    if(_stat(path, (struct _stat *)finfo) == -1) {
-        /* XXXMB - this sucks; 
-         * try to convert to an error code we'll expect...
-         */
-        switch(errno) {
-            case ENOENT: PR_SetError(PR_FILE_NOT_FOUND_ERROR, errno); break;
-            default: PR_SetError(PR_UNKNOWN_ERROR, errno); break;
-        }
-        return -1;
-    }
-
-    /* NT sets the time fields to -1 if it thinks that the file
-     * is a device ( like com1.html, lpt1.html etc)	In this case
-     * simply set last modified time to the current time....
-     */
-
-    if (finfo->st_mtime == -1) {
-        finfo->st_mtime = time(NULL);
-    }
-    if (finfo->st_atime == -1) {
-        finfo->st_atime = 0;
-    }
-    if (finfo->st_ctime == -1) {
-        finfo->st_ctime = 0;
-    }
-    if(chop)
-        path[l++] = '/';
-
-#endif /* XP_WIN32 */
 
     if(S_ISREG(finfo->st_mode) && (path[strlen(path) - 1] == '/')) {
         /* File with trailing slash */
@@ -173,7 +110,6 @@ NSAPI_PUBLIC int system_fwrite(SYS_FILE fd, char *buf, int sz) {
 
 /* ---------------------------- Standard UNIX ----------------------------- */
 
-#ifdef XP_UNIX
 
 #include <sys/file.h>   /* flock */
 
@@ -225,20 +161,11 @@ NSAPI_PUBLIC int system_nocoredumps(void)
     return 0;
 #endif
 }
-#endif /* XP_UNIX */
 
 /* --------------------------- file_setinherit ---------------------------- */
 
 NSAPI_PUBLIC int file_setinherit(SYS_FILE fd, int value)
 {
-#if defined(XP_WIN32)
-    int ret;
-
-//    ret = SetHandleInformation((HANDLE)PR_FileDesc2NativeHandle(fd), 0, value?HANDLE_FLAG_INHERIT:0);
-	// This function did nothing before since the mask was set to 0.
-    ret = SetHandleInformation((HANDLE)PR_FileDesc2NativeHandle(fd), HANDLE_FLAG_INHERIT, value?HANDLE_FLAG_INHERIT:0);
-    return ret==0?-1:0;
-#elif defined(XP_UNIX)
     int flags = 0;
     PRInt32 nativeFD;
     PRFileDesc *bottom = fd;
@@ -272,7 +199,6 @@ fprintf(stderr, "\nInfo(file_setinherit): Native file descriptor is %d\n", nativ
     fcntl(PR_FileDesc2NativeHandle(fd), F_SETFD, flags);
     return 0;
     */
-#endif
 }
 
 NSAPI_PUBLIC SYS_FILE system_fopenRO(char *p)
@@ -317,197 +243,14 @@ NSAPI_PUBLIC int system_fclose(SYS_FILE fd)
 }
 
 
-#ifdef FILE_WIN32
-
-int CgiBuffering;
-
-NSAPI_PUBLIC SYS_FILE system_fopen(char *path, int access, int flags)
-{
-    char p2[MAX_PATH];
-    SYS_FILE ret;
-    HANDLE fd;
-
-	if (strlen(path) >= MAX_PATH) {
-		return SYS_ERROR_FD;
-	}
-
-    file_unix2local(path, p2);
-
-    fd = CreateFile(p2, access, FILE_SHARE_READ | FILE_SHARE_WRITE, 
-                    NULL, flags, 0, NULL);
-    ret = PR_ImportFile((int32)fd);
-
-    if(ret == INVALID_HANDLE_VALUE)
-        return SYS_ERROR_FD;
-
-    return ret;
-}
-
-
-
-NSAPI_PUBLIC int system_pread(SYS_FILE fd, char *buf, int BytesToRead) {
-    unsigned long BytesRead = 0;
-    int result = 0;
-    BOOLEAN TimeoutSet = FALSE;
-
-    /* XXXMB - nspr20 should be able to do this; but right now it doesn't
-     * return proper error info.
-     * fix it later...
-     */
-    if(ReadFile((HANDLE)PR_FileDesc2NativeHandle(fd), (LPVOID)buf, BytesToRead, &BytesRead, NULL) == FALSE) {
-        if (GetLastError() == ERROR_BROKEN_PIPE) {
-            return IO_EOF;
-        } else {
-            return IO_ERROR;
-        }
-    }
-    return (BytesRead ? BytesRead : IO_EOF);
-}
-
-NSAPI_PUBLIC int system_pwrite(SYS_FILE fd, char *buf, int BytesToWrite) 
-{
-    unsigned long BytesWritten;
-    
-    if (WriteFile((HANDLE)PR_FileDesc2NativeHandle(fd), (LPVOID)buf, 
-                  BytesToWrite, &BytesWritten, NULL) == FALSE) {
-        return IO_ERROR;
-    }
-    return BytesWritten;
-}
-
-
-NSAPI_PUBLIC int system_fwrite_atomic(SYS_FILE fd, char *buf, int sz) 
-{
-    int ret;
-
-#if 0
-    if(system_flock(fd) == IO_ERROR)
-        return IO_ERROR;
-#endif
-    /* XXXMB - this is technically thread unsafe, but it catches any 
-     * callers of fwrite_atomic when we're single threaded and just coming
-     * to life.
-     */
-    if (!_atomic_write_lock) {
-        _atomic_write_lock = PR_NewLock();
-    }
-    PR_Lock(_atomic_write_lock);
-    ret = system_fwrite(fd,buf,sz);
-    PR_Unlock(_atomic_write_lock);
-#if 0
-     if(system_ulock(fd) == IO_ERROR)
-        return IO_ERROR;
-#endif
-    return ret;
-}
-
-
-NSAPI_PUBLIC void file_unix2local(char *path, char *p2)
-{
-    /* Try to handle UNIX-style paths */
-    if((!strchr(path, FILE_PATHSEP))) {
-        int x;
-
-        for(x = 0; path[x]; x++)
-            p2[x] = (path[x] == '/' ? '\\' : path[x]);
-        p2[x] = '\0';
-    }
-    else
-        strcpy(p2, path);
-}
-
-
-NSAPI_PUBLIC int system_nocoredumps(void)
-{
-    return 0;
-}
-
-/* --------------------------- system_winerr ------------------------------ */
-
-
-#include <winsock.h>
-#include <errno.h>
-#include "util.h"
-
-NSAPI_PUBLIC char *system_winsockerr(void)
-{
-	int errn = WSAGetLastError();
-
-	return FindError(errn);
-}
-
-NSAPI_PUBLIC char *system_winerr(void)
-{
-	int errn = GetLastError();
-
-	if (errn == 0)
-		errn = WSAGetLastError();
-	return FindError(errn);
-}
-
-/* ------------------------- Dir related stuff ---------------------------- */
-
-
-NSAPI_PUBLIC SYS_DIR dir_open(char *pathp)
-{
-    dir_s *ret = (dir_s *) MALLOC(sizeof(dir_s));
-    char path[MAX_PATH];
-    int l;
-
-	if (strlen(pathp) >= MAX_PATH) {
-		return NULL;
-	}
-
-    l = util_sprintf(path, "%s", pathp) - 1;
-	path[strlen(pathp)] = '\0';
-    if(path[strlen(path) - 1] != FILE_PATHSEP)
-        	strcpy (path + strlen(path), "\\*.*");
-	else
-		util_sprintf(path, "%s*.*", path);
-
-    ret->de.d_name = NULL;
-    if( (ret->dp = FindFirstFile(path, &ret->fdata)) != INVALID_HANDLE_VALUE)
-        return ret;
-    FREE(ret);
-    return NULL;
-}
-
-NSAPI_PUBLIC SYS_DIRENT *dir_read(SYS_DIR ds)
-{
-    if(FindNextFile(ds->dp, &ds->fdata) == FALSE)
-        return NULL;
-    if(ds->de.d_name)
-        FREE(ds->de.d_name);
-    ds->de.d_name = STRDUP(ds->fdata.cFileName);
-
-    return &ds->de;
-}
-
-NSAPI_PUBLIC void dir_close(SYS_DIR ds)
-{
-    FindClose(ds->dp);
-    if(ds->de.d_name)
-        FREE(ds->de.d_name);
-    FREE(ds);
-}
-
-#endif /* FILE_WIN32 */
-
 NSAPI_PUBLIC int file_notfound(void)
 {
-#ifdef FILE_WIN32
-    int errn = PR_GetError();
-    return (errn == PR_FILE_NOT_FOUND_ERROR);
-#else
     return (errno == ENOENT);
-#endif
 }
 
-#ifdef XP_UNIX
 #if !defined(SNI) && !defined(LINUX)
 extern char *sys_errlist[];
 #endif /* SNI */
-#endif
 
 #define ERRMSG_SIZE 35
 #ifdef THREAD_ANY
@@ -528,9 +271,6 @@ void system_errmsg_init(void)
 #if defined(THREAD_ANY)
         errmsg_key = systhread_newkey();
 #endif
-#ifdef XP_WIN32
-        HashNtErrors();
-#endif
         if (!_atomic_write_lock)
             _atomic_write_lock = PR_NewLock();
     }
@@ -542,9 +282,6 @@ NSAPI_PUBLIC int system_errmsg_fn(char **buff, size_t maxlen)
     char *lmsg = 0; /* Local message pointer */
     size_t msglen = 0;
     PRErrorCode nscp_error;
-#ifdef XP_WIN32
-    LPTSTR sysmsg = 0;
-#endif
 
     nscp_error = PR_GetError();
 
@@ -566,21 +303,6 @@ NSAPI_PUBLIC int system_errmsg_fn(char **buff, size_t maxlen)
             lmsg = static_error;
         }
     } else {
-#if defined(XP_WIN32)
-        msglen = FormatMessage(
-                    FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_ALLOCATE_BUFFER,
-                    NULL, 
-                    GetLastError(), 
-                    LOCALE_SYSTEM_DEFAULT, 
-                    (LPTSTR)&sysmsg, 
-                    0, 
-                    0);
-        if (msglen > 0)
-            lmsg = sysmsg;
-        else
-            lmsg = system_winerr();
-        SetLastError(0);
-#else
 /* replaced
 #if defined(SNI) || defined(LINUX)
 	/ C++ platform has no definition for sys_errlist /
@@ -589,9 +311,8 @@ NSAPI_PUBLIC int system_errmsg_fn(char **buff, size_t maxlen)
 	lmsg = sys_errlist[errno];
 #endif
 with lmsg =strerror(errno);*/
-	lmsg=strerror(errno);
+        lmsg=strerror(errno);
         errno = 0;
-#endif
     }
 
     /* At this point lmsg points to something. */
@@ -604,12 +325,6 @@ with lmsg =strerror(errno);*/
     else
         msglen = 0;
 
-#ifdef XP_WIN32
-    /* NT's FormatMessage() dynamically allocated the msg; free it */
-    if (sysmsg)
-        LocalFree(sysmsg);
-#endif
-
     return msglen;
 }
 
diff --git a/lib/base/fsmutex.cpp b/lib/base/fsmutex.cpp
index f43f4c0..47eceaf 100644
--- a/lib/base/fsmutex.cpp
+++ b/lib/base/fsmutex.cpp
@@ -54,14 +54,9 @@
 #endif
 
 #include "base/util.h"
-#ifdef XP_WIN32
-typedef HANDLE sys_fsmutex_t;
-#endif
 
-#ifdef XP_UNIX
 #include "base/file.h"
 typedef SYS_FILE sys_fsmutex_t;
-#endif
 
 
 typedef struct {
@@ -78,7 +73,6 @@ typedef struct {
 /* ----------------------------- fsmutex_init ----------------------------- */
 
 
-#ifdef XP_UNIX
 static int 
 _fsmutex_create(fsmutex_s *fsm, char *name, int number)
 {
@@ -99,21 +93,6 @@ _fsmutex_create(fsmutex_s *fsm, char *name, int number)
     fsm->mutex = lfd;
     return 0;
 }
-#endif
-
-#ifdef XP_WIN32
-static int 
-_fsmutex_create(fsmutex_s *fsm, char *name, int number)
-{
-    char tn[256];
-    util_snprintf(tn, sizeof(tn), "%s.%d", name, number);
-
-    fsm->id = NULL;
-    fsm->mutex = CreateMutex(NULL, FALSE, 
-                             (fsm->flags & FSMUTEX_VISIBLE ? tn : NULL));
-    return (fsm->mutex ? 0 : -1);
-}
-#endif
 
 NSAPI_PUBLIC FSMUTEX
 fsmutex_init(char *name, int number, int flags)
@@ -132,20 +111,16 @@ fsmutex_init(char *name, int number, int flags)
     return (FSMUTEX) ret;
 }
 
-#ifdef XP_UNIX
 NSAPI_PUBLIC void 
 fsmutex_setowner(FSMUTEX fsm, uid_t uid, gid_t gid)
 {
     if(!geteuid())
         (void) chown( ((fsmutex_s *)fsm)->id, uid, gid);
 }
-#endif
 
 
 /* -------------------------- fsmutex_terminate --------------------------- */
 
-
-#ifdef XP_UNIX
 static void 
 _fsmutex_delete(fsmutex_s *fsm)
 {
@@ -154,15 +129,6 @@ _fsmutex_delete(fsmutex_s *fsm)
     PERM_FREE(fsm->id);
     PR_Close(fsm->mutex);
 }
-#endif
-
-#ifdef XP_WIN32
-static void 
-_fsmutex_delete(fsmutex_s *fsm)
-{
-    CloseHandle(fsm->mutex);
-}
-#endif
 
 NSAPI_PUBLIC void
 fsmutex_terminate(FSMUTEX id)
@@ -189,7 +155,6 @@ fsmutex_lock(FSMUTEX id)
     if(fsm->flags & FSMUTEX_NEEDCRIT)
         crit_enter(fsm->crit);
 #endif
-#ifdef XP_UNIX
 #ifdef THREAD_NSPR_USER
     /* Poll to avoid blocking. XXXrobm If errno is wrong this may go awry. */
     while(system_tlock(fsm->mutex) == -1)
@@ -197,10 +162,6 @@ fsmutex_lock(FSMUTEX id)
 #else
     system_flock(fsm->mutex );
 #endif
-#endif
-#ifdef XP_WIN32
-    WaitForSingleObject(fsm->mutex, INFINITE);
-#endif
 }
 
 
@@ -211,12 +172,7 @@ NSAPI_PUBLIC void
 fsmutex_unlock(FSMUTEX id)
 {
     fsmutex_s *fsm = (fsmutex_s *) id;
-#ifdef XP_UNIX
     system_ulock(fsm->mutex);
-#endif
-#ifdef XP_WIN32
-    ReleaseMutex(fsm->mutex);
-#endif
 #ifdef THREAD_ANY
     if(fsm->flags & FSMUTEX_NEEDCRIT)
         crit_exit(fsm->crit);
diff --git a/lib/base/net.cpp b/lib/base/net.cpp
index 53c79f3..17f9d14 100644
--- a/lib/base/net.cpp
+++ b/lib/base/net.cpp
@@ -55,13 +55,11 @@
 
 #include "util.h"
 #include <string.h>
-#ifdef XP_UNIX
 #include <arpa/inet.h>  /* inet_ntoa */
 #include <netdb.h>      /* hostent stuff */
 #ifdef NEED_GHN_PROTO
 extern "C" int gethostname (char *name, size_t namelen);
 #endif
-#endif /* XP_UNIX */
 #ifdef LINUX
 #include <sys/ioctl.h> /* ioctl */
 #endif
@@ -71,11 +69,7 @@ extern "C" int gethostname (char *name, size_t namelen);
 /* ---------------------------- util_hostname ----------------------------- */
 
 
-#ifdef XP_UNIX
 #include <sys/param.h>
-#else /* WIN32 */
-#define MAXHOSTNAMELEN 255
-#endif /* XP_UNIX */
 
 /* Defined in dns.cpp */
 char *net_find_fqdn(PRHostEnt *p);
diff --git a/lib/base/shexp.cpp b/lib/base/shexp.cpp
index 11938cb..9783c30 100644
--- a/lib/base/shexp.cpp
+++ b/lib/base/shexp.cpp
@@ -239,11 +239,7 @@ int _shexp_match(char *str, char *exp)
               case '\\':
                 ++y;
               default:
-#ifdef XP_UNIX
                 if(str[x] != exp[y])
-#else /* XP_WIN32 */
-                if(strnicmp(str + x, exp + y, 1))
-#endif /* XP_WIN32 */
                     ret = NOMATCH;
                 break;
             }
@@ -286,11 +282,7 @@ NSAPI_PUBLIC int shexp_cmp(char *str, char *exp)
       case INVALID_SXP:
         return -1;
       case NON_SXP:
-#ifdef XP_UNIX
         return (strcmp(exp,str) ? 1 : 0);
-#else  /* XP_WIN32 */
-        return (stricmp(exp,str) ? 1 : 0);
-#endif /* XP_WIN32 */
       default:
         return shexp_match(str, exp);
     }
diff --git a/lib/base/system.cpp b/lib/base/system.cpp
index c4cbfd0..0138172 100644
--- a/lib/base/system.cpp
+++ b/lib/base/system.cpp
@@ -50,10 +50,6 @@
 #include "prlog.h"
 #include "base/ereport.h"
 
-#ifdef XP_WIN32
-#include <windows.h>
-#endif
-
 #include "base/systems.h"	/* find out if we have malloc pools */
 
 static int thread_malloc_key = -1;
diff --git a/lib/base/systhr.cpp b/lib/base/systhr.cpp
index 87d3252..6bf64bd 100644
--- a/lib/base/systhr.cpp
+++ b/lib/base/systhr.cpp
@@ -67,18 +67,6 @@ int32 PR_SetSysfdTableSize(int table_size);
 #endif
 #include "systems.h"
 
-#ifdef THREAD_WIN32
-#include <process.h>
-
-typedef struct {
-    HANDLE hand;
-    DWORD id;
-} sys_thread_s;
-
-#endif
-
-
-
 #if defined (USE_NSPR)
 
 #if defined(__hpux) && defined(__ia64)
@@ -173,7 +161,6 @@ NSAPI_PUBLIC void systhread_sleep(int milliseconds)
 NSAPI_PUBLIC void systhread_init(char *name)
 {
     PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256);
-#ifdef XP_UNIX
 #ifdef LINUX
     /*
      * NSPR 4.6 does not export PR_SetSysfdTableSize
@@ -192,7 +179,6 @@ NSAPI_PUBLIC void systhread_init(char *name)
 #else 
     PR_SetSysfdTableSize(PR_GetSysfdTableMax());
 #endif
-#endif
 }
 
 
@@ -223,83 +209,5 @@ NSAPI_PUBLIC void systhread_dummy(void)
 
 }
 
-#elif defined(THREAD_WIN32)
-
-#include <nspr/prthread.h>
-#define DEFAULT_STACKSIZE 262144
-
-NSPR_BEGIN_EXTERN_C
-
-NSAPI_PUBLIC 
-SYS_THREAD systhread_start(int prio, int stksz, void (*fn)(void *), void *arg)
-{
-    sys_thread_s *ret = (sys_thread_s *) MALLOC(sizeof(sys_thread_s));
-
-    if ((ret->hand = (HANDLE)_beginthreadex(NULL, stksz, (unsigned (__stdcall *)(void *))fn, 
-	                                        arg, 0, &ret->id)) == 0) {
-        FREE(ret);
-        return NULL;
-    }
-    return (void *)ret;
-}
-
-NSPR_END_EXTERN_C
-
-NSAPI_PUBLIC SYS_THREAD systhread_current(void)
-{
-    /* XXXrobm this is busted.... */
-    return GetCurrentThread();
-}
-
-NSAPI_PUBLIC void systhread_timerset(int usec)
-{
-}
-
-NSAPI_PUBLIC SYS_THREAD systhread_attach(void)
-{
-    return NULL;
-}
-
-NSAPI_PUBLIC void systhread_yield(void)
-{
-    systhread_sleep(0);
-}
-
-NSAPI_PUBLIC void systhread_terminate(SYS_THREAD thr)
-{
-    TerminateThread(((sys_thread_s *)thr)->hand, 0);
-}
-
-
-NSAPI_PUBLIC void systhread_sleep(int milliseconds)
-{
-    /* XXXrobm there must be a better way to do this */
-    HANDLE sem = CreateSemaphore(NULL, 1, 4, "sleeper");
-    WaitForSingleObject(sem, INFINITE);
-    WaitForSingleObject(sem, milliseconds);
-    CloseHandle(sem);
-}
-
-NSAPI_PUBLIC void systhread_init(char *name)
-{
-    PR_Init(PR_USER_THREAD, 1, 0);
-}
-
-
-NSAPI_PUBLIC int systhread_newkey()
-{
-    return TlsAlloc();
-}
-
-NSAPI_PUBLIC void *systhread_getdata(int key)
-{
-    return (void *)TlsGetValue(key);
-}
-
-NSAPI_PUBLIC void systhread_setdata(int key, void *data)
-{
-    TlsSetValue(key, data);
-}
-
 #endif
 
diff --git a/lib/base/util.cpp b/lib/base/util.cpp
index 164d1a0..5ab096a 100644
--- a/lib/base/util.cpp
+++ b/lib/base/util.cpp
@@ -47,18 +47,12 @@
  * Rob McCool
  */
 
-#ifdef XP_UNIX
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <stdlib.h>
 #include "prthread.h"
-#endif /* XP_UNIX */
-
 #include "base/util.h"
-
-#ifdef XP_UNIX
 #include <sys/types.h>
-#endif /* WIN32 */
 
 /* ------------------------------ util_itoa ------------------------------- */
 
@@ -225,12 +219,10 @@ int util_strncasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two, int n)
 static char sccsid[] = "@(#)strftime.c	5.11 (Berkeley) 2/24/91";
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef XP_UNIX
 #include <sys/types.h>
 #include <sys/time.h>
 #include <string.h>
 #include <stdio.h>
-#endif
 
 static const char *afmt[] = {
 	"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
diff --git a/lib/ldaputil/dbconf.c b/lib/ldaputil/dbconf.c
index 1ffdab7..0642d02 100644
--- a/lib/ldaputil/dbconf.c
+++ b/lib/ldaputil/dbconf.c
@@ -431,21 +431,17 @@ int dbconf_read_config_file_sub (const char *file,
 
     buf[0] = 0;
 
-#ifdef XP_WIN32
-    if ((fp = fopen(file, "rt")) == NULL)
-#else
     if ((fp = fopen(file, "r")) == NULL)
-#endif
     {
-	return LDAPU_ERR_CANNOT_OPEN_FILE;
+        return LDAPU_ERR_CANNOT_OPEN_FILE;
     }
 
     /* Allocate DBConfInfo_t */
     conf_info = (DBConfInfo_t *)malloc(sizeof(DBConfInfo_t));
 
     if (!conf_info) {
-	fclose(fp);
-	return LDAPU_ERR_OUT_OF_MEMORY;
+        fclose(fp);
+        return LDAPU_ERR_OUT_OF_MEMORY;
     }
 
     memset((void *)conf_info, 0, sizeof(DBConfInfo_t));
@@ -459,11 +455,11 @@ int dbconf_read_config_file_sub (const char *file,
     }
 
     if (rv != LDAPU_SUCCESS) {
-	dbconf_free_confinfo(conf_info);
-	*conf_info_out = 0;
+        dbconf_free_confinfo(conf_info);
+        *conf_info_out = 0;
     }
     else {
-	*conf_info_out = conf_info;
+        *conf_info_out = conf_info;
     }
 
     fclose(fp);
@@ -489,13 +485,9 @@ int dbconf_read_default_dbinfo_sub (const char *file,
 
     buf[0] = 0;
 
-#ifdef XP_WIN32
-    if ((fp = fopen(file, "rt")) == NULL)
-#else
     if ((fp = fopen(file, "r")) == NULL)
-#endif
     {
-	return LDAPU_ERR_CANNOT_OPEN_FILE;
+        return LDAPU_ERR_CANNOT_OPEN_FILE;
     }
 
     /* Read each db info until eof or dbname == default*/
@@ -504,16 +496,16 @@ int dbconf_read_default_dbinfo_sub (const char *file,
     while(!eof &&
 	  ((rv = read_db_info(fp, buf, &db_info, directive, directive_len, &eof)) == LDAPU_SUCCESS))
     {
-	if (!strcmp(db_info->dbname, DBCONF_DEFAULT_DBNAME)) break;
-	dbconf_free_dbinfo(db_info);
-	db_info = NULL;
+        if (!strcmp(db_info->dbname, DBCONF_DEFAULT_DBNAME)) break;
+        dbconf_free_dbinfo(db_info);
+        db_info = NULL;
     }
 
     if (rv != LDAPU_SUCCESS) {
-	*db_info_out = 0;
+        *db_info_out = 0;
     }
     else {
-	*db_info_out = db_info;
+        *db_info_out = db_info;
     }
 
     fclose(fp);
@@ -533,25 +525,11 @@ NSAPI_PUBLIC int dbconf_read_default_dbinfo (const char *file,
  */
 int ldapu_strcasecmp (const char *s1, const char *s2)
 {
-#ifdef XP_WIN32
-    int ls1, ls2;		/* tolower values of chars in s1 & s2 resp. */
-#endif
 
     if (!s1) return !s2 ? 0 : 0-tolower(*s2);
     else if (!s2) return tolower(*s1);
 
-#ifdef XP_WIN32
-    while(*s1 && *s2 && (ls1 = tolower(*s1)) == (ls2 = tolower(*s2))) { s1++; s2++; }
-
-    if (!*s1)
-	return *s2 ? 0-tolower(*s2) : 0;
-    else if (!*s2)
-	return tolower(*s1);
-    else
-	return ls1 - ls2;
-#else
     return strcasecmp(s1, s2);
-#endif
 }
 
 NSAPI_PUBLIC int ldapu_dbinfo_attrval (DBConfDBInfo_t *db_info,
diff --git a/lib/ldaputil/init.c b/lib/ldaputil/init.c
index ffbde7e..9dbed5f 100644
--- a/lib/ldaputil/init.c
+++ b/lib/ldaputil/init.c
@@ -56,12 +56,6 @@
 
 #include "slapi-plugin.h"
 
-#ifdef XP_WIN32
-#define DLL_SUFFIX ".dll"
-#ifndef FILE_PATHSEP
-#define FILE_PATHSEP '\\'
-#endif
-#else
 #ifndef FILE_PATHSEP
 #define FILE_PATHSEP '/'
 #endif
@@ -74,7 +68,6 @@
 #else
 #define DLL_SUFFIX ".so"
 #endif
-#endif
 
 static int load_server_libs (const char *dir)
 {
@@ -189,9 +182,7 @@ static LDAPUDispatchVector_t __ldapu_vector = {
     ldapu_free
 };
 
-#ifdef XP_UNIX
 LDAPUDispatchVector_t *__ldapu_table = &__ldapu_vector;
-#endif
 
 #if 0
 NSAPI_PUBLIC int CertMapDLLInitFn(LDAPUDispatchVector_t **table)
diff --git a/lib/libaccess/acl.yy.cpp b/lib/libaccess/acl.yy.cpp
index 7f81da0..012d3d0 100644
--- a/lib/libaccess/acl.yy.cpp
+++ b/lib/libaccess/acl.yy.cpp
@@ -474,11 +474,7 @@ char *acltext;
 #include <stdio.h>
 #include <ctype.h>
 #include <libaccess/aclerror.h>
-#ifdef XP_WIN32
-#include <io.h>
-#endif
 #include "plstr.h"
-
 #include "parse.h"
 #include "aclscan.h"
 
diff --git a/lib/libaccess/aclscan.l b/lib/libaccess/aclscan.l
index fc96691..7f8c535 100644
--- a/lib/libaccess/aclscan.l
+++ b/lib/libaccess/aclscan.l
@@ -50,11 +50,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <libaccess/aclerror.h>
-#ifdef XP_WIN32
-#include <io.h>
-#endif
 #include "plstr.h"
-
 #include "parse.h"
 #include "aclscan.h"
 
diff --git a/lib/libaccess/lasdns.cpp b/lib/libaccess/lasdns.cpp
index 93730c7..1958e82 100644
--- a/lib/libaccess/lasdns.cpp
+++ b/lib/libaccess/lasdns.cpp
@@ -47,18 +47,11 @@
 
 #include <stdio.h>
 #include <string.h>
-
-#ifdef	XP_WIN32
-/* #include <winsock2.h> */
-#include <winsock.h>
-#else
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#endif
-
 #include <netsite.h>
 extern "C" {
 #include <prnetdb.h>
diff --git a/lib/libaccess/permhash.h b/lib/libaccess/permhash.h
index e47281c..b661c3f 100644
--- a/lib/libaccess/permhash.h
+++ b/lib/libaccess/permhash.h
@@ -100,11 +100,7 @@ PR_CompareCaseStrings(const void *v1, const void *v2)
     const char *s1 = (const char *)v1;
     const char *s2 = (const char *)v2;
 
-#ifdef XP_WIN32
-    return (util_strcasecmp(s1, s2) == 0);
-#else
     return (strcasecmp(s1, s2) == 0);
-#endif
 }
 #endif /* NO_ACL_HASH_FUNCS */
 
diff --git a/lib/libadmin/error.c b/lib/libadmin/error.c
index a277cd8..b6d6754 100644
--- a/lib/libadmin/error.c
+++ b/lib/libadmin/error.c
@@ -50,10 +50,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef XP_WIN32
-#include <windows.h>
-#include "base/nterr.h"
-#endif
 #include <base/file.h>
 
 #define ERROR_HTML "error.html"
@@ -70,22 +66,9 @@ char *error_headers[MAX_ERROR] =
    "Unexpected Failure",
    "Warning"};
 
-#ifdef XP_UNIX
 #define get_error() errno
 #define verbose_error() system_errmsg()
-#else /* XP_WIN32 */
-int get_error()
-{
-    int error = GetLastError();
-    return(error ? error: WSAGetLastError());
-}
-char *verbose_error()
-{
-    /* Initialize error hash tables */
-    HashNtErrors();
-    return alert_word_wrap(system_errmsg(), WORD_WRAP_WIDTH, "\\n");
-}
-#endif /* XP_WIN32 */
+
 
 void _report_error(int type, char *info, char *details, int shouldexit)
 {
@@ -100,9 +83,6 @@ void _report_error(int type, char *info, char *details, int shouldexit)
     fprintf(stdout, "</SCRIPT>\n");
 
     if(shouldexit)  {
-#ifdef XP_WIN32
-        WSACleanup();
-#endif
         exit(0);
     }
 }
diff --git a/lib/libadmin/util.c b/lib/libadmin/util.c
index bbc6804..e187e05 100644
--- a/lib/libadmin/util.c
+++ b/lib/libadmin/util.c
@@ -51,33 +51,24 @@
 #include "private/pprio.h"
 
 #include <base/file.h>
-#ifdef XP_UNIX
 #include <dirent.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#else
-#include <sys/stat.h>
-#endif /* WIN32? */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 
-#ifdef XP_UNIX
+
 SYS_FILE lf;
-#elif defined(XP_WIN32)
-HANDLE lf;
-#endif
+
 
 char *get_flock_path(void)
 {
     char *result="";
     char *port=getenv("SERVER_PORT");
-#ifdef XP_UNIX
     result=(char *) MALLOC(strlen("/tmp/lock.%%s.")+strlen(port)+4);
     sprintf(result, "/tmp/lock.%%s.%s", port);
-#endif
     return result;
 }
 




More information about the 389-commits mailing list