Creating branch tag and allowing WINCE code to live there. NSPR_PRE_4_2_WINCE_BRANCH
authordougt%meer.net
Wed, 20 Apr 2005 23:26:16 +0000
branchNSPR_PRE_4_2_WINCE_BRANCH
changeset 3350 d674a9cca7a252557a943899ea080385a6de43cb
parent 3346 2c6f61be6bca4b6ec3d7f3f270ea7b01e507b24c
push idunknown
push userunknown
push dateunknown
Creating branch tag and allowing WINCE code to live there.
config/Makefile.in
config/rules.mk
configure
configure.in
gmakefile.win
lib/ds/Makefile.in
lib/tests/windows/winevent.c
pr/include/md/prosdep.h
pr/include/private/pprthred.h
pr/src/io/prfile.c
pr/src/io/prio.c
pr/src/io/priometh.c
pr/src/io/prlog.c
pr/src/io/prsocket.c
pr/src/linking/prlink.c
pr/src/md/windows/Makefile.in
pr/src/md/windows/ntgc.c
pr/src/md/windows/ntmisc.c
pr/src/md/windows/ntsec.c
pr/src/md/windows/objs.mk
pr/src/md/windows/w32ipcsem.c
pr/src/md/windows/w32rng.c
pr/src/md/windows/w32shm.c
pr/src/md/windows/w95io.c
pr/src/md/windows/w95thred.c
pr/src/misc/prerror.c
pr/src/misc/prerrortable.c
pr/src/misc/prnetdb.c
pr/src/threads/combined/prucv.c
pr/src/threads/combined/prulock.c
pr/src/threads/combined/pruthr.c
pr/src/threads/prcthr.c
pr/src/threads/prdump.c
pr/src/threads/prtpd.c
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -53,25 +53,28 @@ VISIBILITY_FLAGS =
 # autoconf.mk must be deleted last (from the top-level directory)
 # because it is included by every makefile.
 DIST_GARBAGE	= nsprincl.mk nsprincl.sh nspr-config
 
 RELEASE_BINS	= nspr-config
 
 include $(topsrcdir)/config/config.mk
 
+ifneq ($(OS_TARGET),WINCE)
 CSRCS	= now.c
 
 # This version hasn't been ported for us; the one in mozilla/config has
 ifneq ($(OS_ARCH),OS2)
 CSRCS  += nsinstall.c
- 
+
 PLSRCS	= nfspwd.pl
 endif
 
+endif
+
 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH)))
 PROG_SUFFIX = .exe
 else
 PROG_SUFFIX =
 endif
 
 # Temporary workaround to disable the generation of
 # library build time because now.c uses the 'long long'
@@ -111,27 +114,30 @@ endif
 
 ifeq ($(MOZ_OS2_TOOLS),PGCC)
 XCFLAGS = $(OS_CFLAGS)
 XLDOPTS = -Zlinker /PM:VIO
 endif
 
 include $(topsrcdir)/config/rules.mk
 
+ifneq ($(OS_TARGET),WINCE)
 PROGS	= $(OBJDIR)/now$(PROG_SUFFIX)
 
 ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
 TARGETS = $(PROGS)
 else
 PROGS	+= $(OBJDIR)/nsinstall$(PROG_SUFFIX)
 TARGETS = $(PROGS) $(PLSRCS:.pl=)
 endif
 
+endif
+
 OUTOPTION = -o # end of the line
-ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
+ifeq (,$(filter-out WINNT WIN95 WINCE,$(OS_TARGET)))
 ifndef NS_USE_GCC
 OUTOPTION = /Fe
 endif
 endif
 
 # Redefine MAKE_OBJDIR for just this directory
 define MAKE_OBJDIR
 if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -128,31 +128,43 @@ ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
 SHARED_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a
 else
 ifdef MKSHLIB
 SHARED_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
 endif
 endif
 
 endif
+
+ifeq ($(OS_TARGET),WINCE)
+LIBRARY 		= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+SHARED_LIBRARY	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
+IMPORT_LIBRARY	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+SHARED_LIB_PDB	= $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
 endif
 
+endif # LIBRARY_NAME
+
 ifndef TARGETS
 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 TARGETS		= $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
 ifndef BUILD_OPT
 ifdef MSC_VER
 ifneq (,$(filter-out 1100 1200,$(MSC_VER)))
 TARGETS		+= $(SHARED_LIB_PDB)
 endif
 endif
 endif
 else
 TARGETS		= $(LIBRARY) $(SHARED_LIBRARY)
 endif
+
+ifeq ($(OS_TARGET),WINCE)
+TARGETS		= $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
+endif
 endif
 
 #
 # OBJS is the list of object files.  It can be constructed by
 # specifying CSRCS (list of C source files) and ASFILES (list
 # of assembly language source files).
 #
 
--- a/configure
+++ b/configure
@@ -1062,17 +1062,17 @@ if test -n "$MOZ_DEBUG"; then
 EOF
 
     DEFINES="$DEFINES -UNDEBUG"
 
     case "${target_os}" in
     beos*)
         DEFINES="$DEFINES -DDEBUG_${USER}"
         ;;
-    msvc*|mks*|cygwin*|mingw*|os2*)
+    msvc*|mks*|cygwin*|mingw*|os2*|wince*)
         DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
         ;;
     *) 
         DEFINES="$DEFINES -DDEBUG_`$WHOAMI`"
         ;;
     esac
 else
     cat >> confdefs.h <<\EOF
@@ -2847,17 +2847,17 @@ if test "$OS_TARGET" = "WIN95"; then
 fi
 if test "$OS_TARGET" = "WIN16"; then
     OS_RELEASE=
 fi
 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
 
 
 case "$host" in
-*-mingw*|*-cygwin*|*-msvc*|*-mks*)
+*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*)
     NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
     if test `echo "${PATH}" | grep -c \;` = 0; then
         CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
     fi
     ;;
 *-beos*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
     ;;
@@ -3801,16 +3801,56 @@ EOF
         ;;
     m68k)
         CFLAGS="$CFLAGS -m68020-60"
         CXXFLAGS="$CXXFLAGS -m68020-60"
         ;;
     esac    
     ;;
 
+*-wince*)
+    cat >> confdefs.h <<\EOF
+#define XP_PC 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define WIN32 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define WINCE 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define _PR_GLOBAL_THREADS_ONLY 1
+EOF
+
+
+    AR='lib -NOLOGO -OUT:"$@"'
+    AR_FLAGS=
+
+    OBJ_SUFFIX=obj
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
+
+    PR_MD_ARCH_DIR=windows
+    RESOLVE_LINK_SYMBOLS=1
+    DEFINES="$DEFINES -UWINNT"
+
+    MDCPUCFG_H=_wince.cfg
+    LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+    LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+
+    DLLFLAGS='-OUT:"$@"'
+    _DEBUG_FLAGS=-Z7
+
+;;
+
+
 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
     cat >> confdefs.h <<\EOF
 #define XP_PC 1
 EOF
 
     cat >> confdefs.h <<\EOF
 #define WIN32 1
 EOF
@@ -4272,27 +4312,27 @@ EOF
     if test -z "$GNU_CC"; then
         CC="$CC -std1 -ieee_with_inexact"
         if test "$OS_RELEASE" != "V2.0"; then
             CC="$CC -readonly_strings"
         fi
         _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
         ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4281: checking for machine/builtins.h" >&5
+echo "configure:4321: checking for machine/builtins.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4286 "configure"
+#line 4326 "configure"
 #include "confdefs.h"
 #include <machine/builtins.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4291: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4331: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -4824,63 +4864,63 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 
 
 case $target in
 *-darwin*)
     ;;
 *)
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4833: checking for dlopen in -ldl" >&5
+echo "configure:4873: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4841 "configure"
+#line 4881 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char dlopen();
 
 int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:4869: checking for dlfcn.h" >&5
+echo "configure:4909: checking for dlfcn.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4874 "configure"
+#line 4914 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4879: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -4903,23 +4943,23 @@ fi
     ;;
 esac
 
 
 
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:4912: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4952: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 4918 "configure"
+#line 4958 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -4927,17 +4967,17 @@ else
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 4936 "configure"
+#line 4976 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -4951,22 +4991,22 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
 for ac_func in lchown strerror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4960: checking for $ac_func" >&5
+echo "configure:5000: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4965 "configure"
+#line 5005 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char $ac_func();
@@ -4979,17 +5019,17 @@ int main() {
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
 $ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=no"
 fi
@@ -5020,17 +5060,17 @@ if test "${enable_strip+set}" = set; the
 fi
 
 
 case "${target_os}" in
 hpux*)
 if test -z "$GNU_CC"; then
 
     echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5029: checking for +Olit support" >&5
+echo "configure:5069: checking for +Olit support" >&5
 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
                   ac_cv_hpux_usable_olit_option=no
         rm -f conftest*
         echo 'int main() { return 0; }' | cat > conftest.c
         ${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
         if test $? -eq 0; then
@@ -5054,17 +5094,17 @@ echo "$ac_t""$ac_cv_hpux_usable_olit_opt
 fi
 ;;
 esac
 
 
 
 
 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5063: checking for pthread_create in -lpthreads" >&5
+echo "configure:5103: checking for pthread_create in -lpthreads" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5076,17 +5116,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5085: checking for pthread_create in -lpthread" >&5
+echo "configure:5125: checking for pthread_create in -lpthread" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5098,17 +5138,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5107: checking for pthread_create in -lc_r" >&5
+echo "configure:5147: checking for pthread_create in -lc_r" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5120,17 +5160,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5129: checking for pthread_create in -lc" >&5
+echo "configure:5169: checking for pthread_create in -lc" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5272,17 +5312,17 @@ EOF
     fi
 fi
 
 
 if test -n "$USE_PTHREADS"; then
       rm -f conftest*
    ac_cv_have_dash_pthread=no
    echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:5281: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5321: checking whether ${CC-cc} accepts -pthread" >&5
    echo 'int main() { return 0; }' | cat > conftest.c
    ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
    if test $? -eq 0; then
 	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 	    ac_cv_have_dash_pthread=yes
 		case "$target_os" in
 	    freebsd*)
 # Freebsd doesn't use -pthread for compiles, it uses them for linking
@@ -5295,17 +5335,17 @@ echo "configure:5281: checking whether $
 	fi
     fi
     rm -f conftest*
     echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6
 
 			    ac_cv_have_dash_pthreads=no
     if test "$ac_cv_have_dash_pthread" = "no"; then
 	    echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:5304: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5344: checking whether ${CC-cc} accepts -pthreads" >&5
     	echo 'int main() { return 0; }' | cat > conftest.c
 	    ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
     	if test $? -eq 0; then
 	    	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 			    ac_cv_have_dash_pthreads=yes
 			    CFLAGS="$CFLAGS -pthreads"
 			    CXXFLAGS="$CXXFLAGS -pthreads"
 		    fi
@@ -5494,17 +5534,17 @@ EOF
 *-linux*)
     if test -n "$USE_NSPR_THREADS"; then
         cat >> confdefs.h <<\EOF
 #define _PR_LOCAL_THREADS_ONLY 1
 EOF
 
     fi
     ;;
-*-mingw*|*-cygwin*|*-msvc*|*-mks*)
+*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*)
         USE_PTHREADS=
     _PTHREAD_LDFLAGS=
     USE_USER_PTHREADS=
     ;;
 *-netbsd*|*-openbsd*)
     if test -n "$USE_NSPR_THREADS"; then
         cat >> confdefs.h <<\EOF
 #define _PR_LOCAL_THREADS_ONLY 1
@@ -5605,17 +5645,17 @@ fi
 
 if test -n "$USE_64"; then
     COMPILER_TAG=_64
 fi
 
 RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}"
 
 case "$target_os" in
-mingw*|cygwin*|msvc*|mks*)
+mingw*|cygwin*|msvc*|mks*|wince*)
     CC="\$(CYGWIN_WRAPPER) $CC"
     CXX="\$(CYGWIN_WRAPPER) $CXX"
     RC="\$(CYGWIN_WRAPPER) $RC"
     ;;
 esac
 
 
 
@@ -5827,17 +5867,17 @@ trap 'rm -f $CONFIG_STATUS conftest*; ex
 # Protect against Makefile macro expansion.
 cat > conftest.defs <<\EOF
 s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
 s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
 s%\[%\\&%g
 s%\]%\\&%g
 s%\$%$$%g
 EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '`
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
 rm -f conftest.defs
 
 
 # Without the "./", some shells look in PATH for config.status.
 : ${CONFIG_STATUS=./config.status}
 
 echo creating $CONFIG_STATUS
 rm -f $CONFIG_STATUS
--- a/configure.in
+++ b/configure.in
@@ -9,17 +9,17 @@ dnl Software distributed under the Licen
 dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 dnl implied. See the License for the specific language governing
 dnl rights and limitations under the License.
 dnl 
 dnl The Original Code is the Netscape Portable Runtime (NSPR).
 dnl 
 dnl The Initial Developer of the Original Code is Netscape
 dnl Communications Corporation.  Portions created by Netscape are 
-dnl Copyright (C) 1998o-2000 Netscape Communications Corporation.  All
+dnl Copyright (C) 1998-2000 Netscape Communications Corporation.  All
 dnl Rights Reserved.
 dnl 
 dnl Contributor(s):
 dnl     Christopher Seawood <cls@seawood.org>
 dnl 
 dnl Alternatively, the contents of this file may be used under the
 dnl terms of the GNU General Public License Version 2 or later (the
 dnl "GPL"), in which case the provisions of the GPL are applicable 
@@ -341,17 +341,17 @@ fi
 if test -n "$MOZ_DEBUG"; then
     AC_DEFINE(DEBUG)
     DEFINES="$DEFINES -UNDEBUG"
 
     case "${target_os}" in
     beos*)
         DEFINES="$DEFINES -DDEBUG_${USER}"
         ;;
-    msvc*|mks*|cygwin*|mingw*|os2*)
+    msvc*|mks*|cygwin*|mingw*|os2*|wince*)
         DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
         ;;
     *) 
         DEFINES="$DEFINES -DDEBUG_`$WHOAMI`"
         ;;
     esac
 else
     AC_DEFINE(NDEBUG)
@@ -715,17 +715,17 @@ fi
 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
 
 dnl ========================================================
 
 dnl ========================================================
 dnl Override of system specific host options
 dnl ========================================================
 case "$host" in
-*-mingw*|*-cygwin*|*-msvc*|*-mks*)
+*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*)
     NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
     if test `echo "${PATH}" | grep -c \;` = 0; then
         CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
     fi
     ;;
 *-beos*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
     ;;
@@ -1275,16 +1275,44 @@ case "$target" in
         ;;
     m68k)
         CFLAGS="$CFLAGS -m68020-60"
         CXXFLAGS="$CXXFLAGS -m68020-60"
         ;;
     esac    
     ;;
 
+*-wince*)
+    AC_DEFINE(XP_PC)
+    AC_DEFINE(WIN32)
+    AC_DEFINE(WINCE)
+    AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
+
+    AR='lib -NOLOGO -OUT:"$@"'
+    AR_FLAGS=
+
+    OBJ_SUFFIX=obj
+    LIB_SUFFIX=lib
+    DLL_SUFFIX=dll
+    MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
+
+    PR_MD_ARCH_DIR=windows
+    RESOLVE_LINK_SYMBOLS=1
+    DEFINES="$DEFINES -UWINNT"
+
+    MDCPUCFG_H=_wince.cfg
+    LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+    LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
+
+    DLLFLAGS='-OUT:"$@"'
+    _DEBUG_FLAGS=-Z7
+
+;;
+
+
 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
     AC_DEFINE(XP_PC)
     AC_DEFINE(WIN32)
     PR_MD_ARCH_DIR=windows
     RESOLVE_LINK_SYMBOLS=1
 
     if test -n "$GNU_CC"; then
         CC="$CC -mno-cygwin"
@@ -2362,17 +2390,17 @@ case "$target" in
         fi
     fi
     ;;
 *-linux*)
     if test -n "$USE_NSPR_THREADS"; then
         AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
     fi
     ;;
-*-mingw*|*-cygwin*|*-msvc*|*-mks*)
+*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*)
     dnl win32 does not use pthreads
     USE_PTHREADS=
     _PTHREAD_LDFLAGS=
     USE_USER_PTHREADS=
     ;;
 *-netbsd*|*-openbsd*)
     if test -n "$USE_NSPR_THREADS"; then
         AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
@@ -2452,17 +2480,17 @@ if test -n "$USE_64"; then
 fi
 
 RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}"
 
 dnl ========================================================
 dnl Use cygwin wrapper for win32 builds
 dnl ========================================================
 case "$target_os" in
-mingw*|cygwin*|msvc*|mks*)
+mingw*|cygwin*|msvc*|mks*|wince*)
     CC="\$(CYGWIN_WRAPPER) $CC"
     CXX="\$(CYGWIN_WRAPPER) $CXX"
     RC="\$(CYGWIN_WRAPPER) $RC"
     ;;
 esac
 
 dnl ========================================================
 dnl Substitution of found variables.
--- a/gmakefile.win
+++ b/gmakefile.win
@@ -43,21 +43,29 @@ ifndef MOZ_SRC_FLIPPED
 endif
 
 ifndef MOZ_TOP
 MOZ_TOP=mozilla
 endif
 
 MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist
 
+ifeq ($(OS_TARGET),WINCE)
+ifdef MOZ_DEBUG
+MOZ_OBJDIR = $(OSVERSION)$(TARGETCPU)_D.OBJ
+else
+MOZ_OBJDIR = $(OSVERSION)$(TARGETCPU)_O.OBJ
+endif
+else
 ifdef MOZ_DEBUG
 MOZ_OBJDIR = WIN32_D.OBJ
 else
 MOZ_OBJDIR = WIN32_O.OBJ
 endif
+endif
 
 NSPR_CONFIGURE := ../configure \
 		--with-mozilla \
 		--with-dist-prefix=$(MOZ_DIST_FLIPPED) \
 		--with-dist-bindir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/bin \
 		--with-dist-libdir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/lib
 
 ifeq (,$(MOZ_DEBUG)$(MOZ_TRACE_MALLOC))
@@ -82,15 +90,15 @@ all:: build_all
 
 build_all: $(MOZ_OBJDIR)/config.status check_old
 	gmake -C $(MOZ_OBJDIR)
 
 clobber_all: $(MOZ_OBJDIR)/config.status check_old
 	gmake -C $(MOZ_OBJDIR) clobber_all
 
 distclean: check_old
-	rm -rf WIN32_D.OBJ WIN32_O.OBJ
+	rm -rf WIN32_D.OBJ WIN32_O.OBJ WINCE_D.OBJ WINCE_O.OBJ
 
 check_old:
 	@if test -f Makefile; then gmake distclean; fi
 
 
 
--- a/lib/ds/Makefile.in
+++ b/lib/ds/Makefile.in
@@ -65,16 +65,19 @@ HEADERS := $(addprefix $(srcdir)/, $(HEA
 ifeq ($(OS_ARCH), WINNT)
 ifdef NS_USE_GCC
 DLLBASE=-Wl,--image-base -Wl,0x30000000
 else
 DLLBASE=/BASE:0x30000000
 endif # GCC
 RES=$(OBJDIR)/plds.res
 RESNAME=plds.rc
+ifneq ($(OS_TARGET), WINCE)
+OS_LIBS = user32.lib
+endif
 endif # WINNT
 
 ifeq ($(OS_ARCH), AIX)
 ifeq ($(CLASSIC_NSPR),1)
 OS_LIBS = -lc
 else
 OS_LIBS = -lc_r
 endif
--- a/lib/tests/windows/winevent.c
+++ b/lib/tests/windows/winevent.c
@@ -118,17 +118,21 @@ int WINAPI WinMain(
     
     PR_Init(0, 0, 0);
 
     wndclass.style = CS_HREDRAW | CS_VREDRAW;
     wndclass.lpfnWndProc = WinProc;
     wndclass.cbClsExtra = 0;
     wndclass.cbWndExtra = 0;
     wndclass.hInstance = hInstance;
+#if !defined(WINCE)
     wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
+#else
+    wndclass.hIcon = NULL;
+#endif
     wndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
     wndclass.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
     wndclass.lpszMenuName = NULL;
     wndclass.lpszClassName = appName;
      
     if ( !RegisterClass( &wndclass ))
     {
         MessageBox( NULL, 
--- a/pr/include/md/prosdep.h
+++ b/pr/include/md/prosdep.h
@@ -32,33 +32,35 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef prosdep_h___
 #define prosdep_h___
-
 /*
 ** Get OS specific header information
 */
 #include "prtypes.h"
 
 PR_BEGIN_EXTERN_C
 
 #ifdef XP_PC
 
 #include "md/_pcos.h"
 #ifdef WINNT
 #include "md/_winnt.h"
 #include "md/_win32_errors.h"
 #elif defined(WIN95)
 #include "md/_win95.h"
 #include "md/_win32_errors.h"
+#elif defined(WINCE)
+#include "md/_wince.h"
+#include "md/_win32_errors.h"
 #elif defined(WIN16)
 #include "md/_win16.h"
 #elif defined(OS2)
 #include "md/_os2.h"
 #include "md/_os2_errors.h"
 #else
 #error unknown Windows platform
 #endif
--- a/pr/include/private/pprthred.h
+++ b/pr/include/private/pprthred.h
@@ -130,16 +130,22 @@ NSPR_API(PRInt32) PR_SetCPUAffinityMask(
 */
 NSPR_API(void) PR_ShowStatus(void);
 
 /*
 ** Set thread recycle mode to on (1) or off (0)
 */
 NSPR_API(void) PR_SetThreadRecycleMode(PRUint32 flag);
 
+/*
+** Return the address of thread's last os error variable.
+** Used to implement errno on platforms that lack it.
+*/
+NSPR_API(PRInt32 *) PR_GetOSErrorAddress(void);
+
 
 /*---------------------------------------------------------------------------
 ** THREAD PRIVATE FUNCTIONS FOR GARBAGE COLLECTIBLE THREADS           
 ---------------------------------------------------------------------------*/
 
 /* 
 ** Only Garbage collectible threads participate in resume all, suspend all and 
 ** enumeration operations.  They are also different during creation when
--- a/pr/src/io/prfile.c
+++ b/pr/src/io/prfile.c
@@ -715,17 +715,17 @@ PR_IMPLEMENT(PRStatus) PR_CreatePipe(
     PRFileDesc **readPipe,
     PRFileDesc **writePipe
 )
 {
 #if defined(XP_MAC)
 #pragma unused (readPipe, writePipe)
 #endif
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(WINCE)
     HANDLE readEnd, writeEnd;
     SECURITY_ATTRIBUTES pipeAttributes;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     ZeroMemory(&pipeAttributes, sizeof(pipeAttributes));
     pipeAttributes.nLength = sizeof(pipeAttributes);
     pipeAttributes.bInheritHandle = TRUE;
--- a/pr/src/io/prio.c
+++ b/pr/src/io/prio.c
@@ -50,28 +50,40 @@ void _PR_InitIO(void)
     const PRIOMethods *methods = PR_GetFileMethods();
 
     _PR_InitFdCache();
 
     _pr_flock_lock = PR_NewLock();
     _pr_flock_cv = PR_NewCondVar(_pr_flock_lock);
 
 #ifdef WIN32
+#if !defined(WINCE)
     _pr_stdin = PR_AllocFileDesc((PRInt32)GetStdHandle(STD_INPUT_HANDLE),
             methods);
     _pr_stdout = PR_AllocFileDesc((PRInt32)GetStdHandle(STD_OUTPUT_HANDLE),
             methods);
     _pr_stderr = PR_AllocFileDesc((PRInt32)GetStdHandle(STD_ERROR_HANDLE),
             methods);
 #ifdef WINNT
     _pr_stdin->secret->md.sync_file_io = PR_TRUE;
     _pr_stdout->secret->md.sync_file_io = PR_TRUE;
     _pr_stderr->secret->md.sync_file_io = PR_TRUE;
 #endif
 #else
+    /*
+     * WINCE has some oddity of _getstdfilex to determine stdin, et. al.
+     * As unsure what that code actually does, just get fileno here.
+     *
+     * How odd, _fileno returns a void*, so cast it...
+     */
+    _pr_stdin = PR_AllocFileDesc((PRInt32)_fileno(stdin), methods);
+    _pr_stdout = PR_AllocFileDesc((PRInt32)_fileno(stdout), methods);
+    _pr_stderr = PR_AllocFileDesc((PRInt32)_fileno(stderr), methods);
+#endif
+#else
     _pr_stdin = PR_AllocFileDesc(0, methods);
     _pr_stdout = PR_AllocFileDesc(1, methods);
     _pr_stderr = PR_AllocFileDesc(2, methods);
 #endif
     _PR_MD_INIT_FD_INHERITABLE(_pr_stdin, PR_TRUE);
     _PR_MD_INIT_FD_INHERITABLE(_pr_stdout, PR_TRUE);
     _PR_MD_INIT_FD_INHERITABLE(_pr_stderr, PR_TRUE);
 
--- a/pr/src/io/priometh.c
+++ b/pr/src/io/priometh.c
@@ -360,17 +360,17 @@ PR_IMPLEMENT(PRInt32) PR_EmulateSendFile
     PRUint32 addr_offset, mmap_len;
 
     /* Get file size */
     if (PR_SUCCESS != PR_GetOpenFileInfo(sfd->fd, &info)) {
         count = -1;
         goto done;
     }
     if (sfd->file_nbytes &&
-            (info.size < (sfd->file_offset + sfd->file_nbytes))) {
+            ((PRUint32)info.size < (sfd->file_offset + sfd->file_nbytes))) {
         /*
          * there are fewer bytes in file to send than specified
          */
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
         count = -1;
         goto done;
     }
     if (sfd->file_nbytes)
--- a/pr/src/io/prlog.c
+++ b/pr/src/io/prlog.c
@@ -380,19 +380,20 @@ PR_IMPLEMENT(PRBool) PR_SetLogFile(const
         newLogFile = WIN32_DEBUG_FILE;
     }
     else
 #endif
     {
         newLogFile = fopen(file, "w");
         if (!newLogFile)
             return PR_FALSE;
-
+#ifndef WINCE
         /* We do buffering ourselves. */
         setvbuf(newLogFile, NULL, _IONBF, 0);
+#endif
     }
     if (logFile
         && logFile != stdout
         && logFile != stderr
 #ifdef XP_PC
         && logFile != WIN32_DEBUG_FILE
 #endif
         ) {
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -62,17 +62,17 @@ static PRBool IsValidNetAddrLen(const PR
     /*
      * The definition of the length of a Unix domain socket address
      * is not uniform, so we don't check it.
      */
     if ((addr != NULL)
 #if defined(XP_UNIX) || defined(XP_OS2_EMX)
             && (addr->raw.family != AF_UNIX)
 #endif
-            && (PR_NETADDR_SIZE(addr) != addr_len)) {
+            && (PR_NETADDR_SIZE(addr) != (PRUintn)addr_len)) {
 #if defined(LINUX) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 1
         /*
          * In glibc 2.1, struct sockaddr_in6 is 24 bytes.  In glibc 2.2
          * and in the 2.4 kernel, struct sockaddr_in6 has the scope_id
          * field and is 28 bytes.  It is possible for socket functions
          * to return an addr_len greater than sizeof(struct sockaddr_in6).
          * We need to allow that.  (Bugzilla bug #77264)
          */
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -948,17 +948,21 @@ pr_LoadLibraryByPathname(const char *nam
     }
 #endif /* XP_OS2 */
 
 #if defined(WIN32) || defined(WIN16)
     {
     HINSTANCE h;
 
     h = LoadLibrary(name);
+#ifndef WINCE
     if (h < (HINSTANCE)HINSTANCE_ERROR) {
+#else
+    if (h < (HINSTANCE)0) {
+#endif
         oserr = _MD_ERRNO();
         PR_DELETE(lm);
         goto unlock;
     }
     lm->name = strdup(name);
     lm->dlh = h;
     lm->next = pr_loadmap;
     pr_loadmap = lm;
--- a/pr/src/md/windows/Makefile.in
+++ b/pr/src/md/windows/Makefile.in
@@ -57,16 +57,37 @@ CSRCS = \
     w16io.c  \
     w16gc.c  \
     w16error.c  \
     w16stdio.c  \
     w16callb.c \
     ntinrval.c \
     $(NULL)
 else
+ifeq ($(OS_TARGET), WINCE)
+CSRCS = \
+    ntmisc.c \
+    ntsec.c   \
+    ntsem.c   \
+    ntinrval.c \
+    ntgc.c \
+    w95thred.c \
+    w95io.c \
+    w95cv.c \
+    w32rng.c \
+    w95sock.c \
+    win32_errors.c \
+    w32ipcsem.c \
+    w32poll.c \
+    w32shm.c \
+    w95dllmain.c \
+    w32unicode.c \
+    w32netdb.c \
+    $(NULL)
+else
 ifeq ($(OS_TARGET), WIN95)
 CSRCS =          \
     ntmisc.c \
     ntsec.c   \
     ntsem.c   \
     ntinrval.c \
     ntgc.c \
 	w95thred.c \
@@ -93,16 +114,17 @@ CSRCS =          \
 	win32_errors.c \
     w32ipcsem.c \
     w32poll.c \
     w32rng.c \
     w32shm.c \
     $(NULL)
 endif
 endif
+endif
 
 TARGETS	= $(OBJS)
 
 INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
 
 DEFINES += -D_NSPR_BUILD_
 
 include $(topsrcdir)/config/rules.mk
--- a/pr/src/md/windows/ntgc.c
+++ b/pr/src/md/windows/ntgc.c
@@ -67,17 +67,17 @@ PRWord *_MD_HomeGCRegisters(PRThread *t,
         /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING
          *
          * This code is extremely machine dependant and completely 
          * undocumented by MS.  Its only known to work experimentally.  
          * Ready for a walk on the wild * side?
          *
          * WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
 
-#if !defined WIN95 // Win95 does not have fibers
+#if !defined(WIN95) && !defined(WINCE) /* Win95/WinCE does not have fibers */
         int *fiberData = t->md.fiber_id;
 
         /* I found these offsets by disassembling SwitchToFiber().
          * Are your palms sweating yet?
          */
 
         /* 
         ** EAX is on the stack (ESP+0)
@@ -92,16 +92,18 @@ PRWord *_MD_HomeGCRegisters(PRThread *t,
         t->md.gcContext[5] = fiberData[0x2c];  /* context.Edi */
         t->md.gcContext[6] = fiberData[0x36];  /* context.Esp */
         t->md.gcContext[7] = fiberData[0x32];  /* context.Ebp */
         *np = PR_NUM_GCREGS;
 #endif
     }
     return (PRWord *)&t->md.gcContext;
 #elif defined(_ALPHA_)
+#elif defined(_ARM_)
+    return NULL;
 #endif /* defined(_X86_) */
 }
 
 /* This function is not used right now, but is left as a reference.
  * If you ever need to get the fiberID from the currently running fiber, 
  * this is it.
  */
 void *
@@ -117,10 +119,12 @@ GetMyFiberID()
     __asm {
         mov    EDX, FS:[18h]
         mov    EAX, DWORD PTR [EDX+10h]
         mov    [fiberData], EAX
     }
   
     return fiberData;
 #elif defined(_ALPHA_)
+#elif defined(_ARM_)
+    return NULL;
 #endif /* defined(_X86_) */
 }
--- a/pr/src/md/windows/ntmisc.c
+++ b/pr/src/md/windows/ntmisc.c
@@ -82,22 +82,34 @@ PRIntn _PR_MD_PUT_ENV(const char *name)
  *     Cf. time_t time(time_t *tp)
  *
  *-----------------------------------------------------------------------
  */
 
 PR_IMPLEMENT(PRTime)
 PR_Now(void)
 {
-    PRTime prt;
-    FILETIME ft;
-
-    GetSystemTimeAsFileTime(&ft);
-    _PR_FileTimeToPRTime(&ft, &prt);
-    return prt;       
+    PRInt64 s;
+#if !defined(WINCE)
+    PRInt64 ms, ms2us, s2us;
+    struct timeb b;
+    ftime(&b);
+    LL_I2L(ms2us, PR_USEC_PER_MSEC);
+    LL_I2L(s2us, PR_USEC_PER_SEC);
+    LL_I2L(s, b.time);
+    LL_I2L(ms, b.millitm);
+    LL_MUL(ms, ms, ms2us);
+    LL_MUL(s, s, s2us);
+    LL_ADD(s, s, ms);
+#else
+    SYSTEMTIME sysTime;
+    GetSystemTime(&sysTime);
+    _MD_SYSTEMTIME_2_PRTime(s, sysTime);
+#endif
+    return s;
 }
 
 /*
  * The following code works around a bug in NT (Netscape Bugsplat
  * Defect ID 47942).
  *
  * In Windows NT 3.51 and 4.0, if the local time zone does not practice
  * daylight savings time, e.g., Arizona, Taiwan, and Japan, the global
@@ -113,16 +125,17 @@ PR_Now(void)
  * calling GetTimeZoneInformation().
  */
 
 #include <time.h>     /* for _tzname, _daylight, _timezone */
 
 void
 _PR_Win32InitTimeZone(void)
 {
+#if !defined(WINCE)
     OSVERSIONINFO version;
     TIME_ZONE_INFORMATION tzinfo;
 
     version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
     if (GetVersionEx(&version) != FALSE) {
         /* Only Windows NT needs this hack */
         if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) {
             return;
@@ -153,16 +166,17 @@ void
     WideCharToMultiByte(CP_ACP, 0, tzinfo.DaylightName, -1, _tzname[1],
             32, NULL, NULL);
 
     /* _timezone is in seconds.  tzinfo.Bias is in minutes. */
 
     _timezone = tzinfo.Bias * 60;
     _daylight = tzinfo.DaylightBias ? 1 : 0;
     return;
+#endif
 }
 
 /*
  ***********************************************************************
  ***********************************************************************
  *
  * Process creation routines
  *
@@ -361,16 +375,17 @@ static int compare(const void *arg1, con
 }
 
 PRProcess * _PR_CreateWindowsProcess(
     const char *path,
     char *const *argv,
     char *const *envp,
     const PRProcessAttr *attr)
 {
+#if !defined(WINCE)
     STARTUPINFO startupInfo;
     PROCESS_INFORMATION procInfo;
     BOOL retVal;
     char *cmdLine = NULL;
     char *envBlock = NULL;
     char **newEnvp = NULL;
     const char *cwd = NULL; /* current working directory */
     PRProcess *proc = NULL;
@@ -501,16 +516,67 @@ errorExit:
     }
     if (envBlock) {
         PR_DELETE(envBlock);
     }
     if (proc) {
         PR_DELETE(proc);
     }
     return NULL;
+#else
+    PROCESS_INFORMATION procInfo;
+    BOOL retVal;
+    char *cmdLine = NULL;
+    PRProcess *proc = NULL;
+
+    proc = PR_NEW(PRProcess);
+    if (!proc) {
+        PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
+        goto errorExit;
+    }
+
+    if (assembleCmdLine(argv, &cmdLine) == -1) {
+        PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
+        goto errorExit;
+    }
+
+    retVal =
+             CreateProcess(path,
+                           cmdLine,
+                           NULL,  /* not supported */
+                           NULL,  /* not supported */
+                           FALSE, /* not supported */
+                           0,     /* creation flags */
+                           NULL,  /* not supported */
+                           NULL,  /* not supported */
+                           NULL,  /* not supported */
+                           &procInfo
+                          );
+    if (retVal == FALSE) {
+        /* XXX what error code? */
+        PR_SetError(PR_UNKNOWN_ERROR, GetLastError());
+        goto errorExit;
+    }
+
+    CloseHandle(procInfo.hThread);
+    proc->md.handle = procInfo.hProcess;
+    proc->md.id = procInfo.dwProcessId;
+
+    PR_DELETE(cmdLine);
+    return proc;
+
+errorExit:
+    if (cmdLine) {
+        PR_DELETE(cmdLine);
+    }
+    if (proc) {
+        PR_DELETE(proc);
+    }
+    return NULL;
+#endif
 }  /* _PR_CreateWindowsProcess */
 
 PRStatus _PR_DetachWindowsProcess(PRProcess *process)
 {
     CloseHandle(process->md.handle);
     PR_DELETE(process);
     return PR_SUCCESS;
 }
@@ -660,18 +726,23 @@ PRStatus _MD_CreateFileMap(PRFileMap *fm
     if (fmap->prot == PR_PROT_READONLY) {
         flProtect = PAGE_READONLY;
         fmap->md.dwAccess = FILE_MAP_READ;
     } else if (fmap->prot == PR_PROT_READWRITE) {
         flProtect = PAGE_READWRITE;
         fmap->md.dwAccess = FILE_MAP_WRITE;
     } else {
         PR_ASSERT(fmap->prot == PR_PROT_WRITECOPY);
+#if !defined(WINCE)
         flProtect = PAGE_WRITECOPY;
         fmap->md.dwAccess = FILE_MAP_COPY;
+#else
+        PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, GetLastError());
+        return PR_FAILURE;
+#endif
     }
 
     fmap->md.hFileMap = CreateFileMapping(
         (HANDLE) osfd,
         NULL,
         flProtect,
         dwHi,
         dwLo,
--- a/pr/src/md/windows/ntsec.c
+++ b/pr/src/md/windows/ntsec.c
@@ -64,16 +64,17 @@ static struct {
 /*
  * Initialize the SIDs for owner, primary group, and the Everyone
  * group in the _pr_nt_sids structure.
  *
  * This function needs to be called by NSPR initialization.
  */
 void _PR_NT_InitSids(void)
 {
+#if !defined(WINCE)
     SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
     HANDLE hToken = NULL; /* initialized to an arbitrary value to
                            * silence a Purify UMR warning */
     UCHAR infoBuffer[1024];
     PTOKEN_OWNER pTokenOwner = (PTOKEN_OWNER) infoBuffer;
     PTOKEN_PRIMARY_GROUP pTokenPrimaryGroup
             = (PTOKEN_PRIMARY_GROUP) infoBuffer;
     DWORD dwLength;
@@ -123,16 +124,17 @@ void _PR_NT_InitSids(void)
     PR_ASSERT(rv != 0);
 
     /* Create a well-known SID for the Everyone group. */
     rv = AllocateAndInitializeSid(&SIDAuthWorld, 1,
             SECURITY_WORLD_RID,
             0, 0, 0, 0, 0, 0, 0,
             &_pr_nt_sids.everyone);
     PR_ASSERT(rv != 0);
+#endif /* !WINCE */
 }
 
 /*
  * Free the SIDs for owner, primary group, and the Everyone group
  * in the _pr_nt_sids structure.
  *
  * This function needs to be called by NSPR cleanup.
  */
@@ -140,19 +142,21 @@ void
 _PR_NT_FreeSids(void)
 {
     if (_pr_nt_sids.owner) {
         PR_Free(_pr_nt_sids.owner);
     }
     if (_pr_nt_sids.group) {
         PR_Free(_pr_nt_sids.group);
     }
+#if !defined(WINCE)
     if (_pr_nt_sids.everyone) {
         FreeSid(_pr_nt_sids.everyone);
     }
+#endif
 }
 
 /*
  * Construct a security descriptor whose discretionary access-control
  * list implements the specified mode bits.  The SIDs for owner, group,
  * and everyone are obtained from the global _pr_nt_sids structure.
  * Both the security descriptor and access-control list are returned
  * and should be freed by a _PR_NT_FreeSecurityDescriptorACL call.
@@ -163,16 +167,17 @@ void
  */
 PRStatus
 _PR_NT_MakeSecurityDescriptorACL(
     PRIntn mode,
     DWORD accessTable[],
     PSECURITY_DESCRIPTOR *resultSD,
     PACL *resultACL)
 {
+#if !defined(WINCE)
     PSECURITY_DESCRIPTOR pSD = NULL;
     PACL pACL = NULL;
     DWORD cbACL;  /* size of ACL */
     DWORD accessMask;
 
     if (_pr_nt_sids.owner == NULL) {
         PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
         return PR_FAILURE;
@@ -256,16 +261,20 @@ PRStatus
 failed:
     if (pSD) {
         PR_Free(pSD);
     }
     if (pACL) {
         PR_Free(pACL);
     }
     return PR_FAILURE;
+#else
+    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+    return PR_FAILURE;
+#endif /* !WINCE */
 }
 
 /*
  * Free the specified security descriptor and access-control list
  * previously created by _PR_NT_MakeSecurityDescriptorACL.
  */
 void
 _PR_NT_FreeSecurityDescriptorACL(PSECURITY_DESCRIPTOR pSD, PACL pACL)
--- a/pr/src/md/windows/objs.mk
+++ b/pr/src/md/windows/objs.mk
@@ -46,16 +46,35 @@ CSRCS = ntmisc.c \
 	ntthread.c \
 	ntdllmn.c \
 	win32_errors.c \
 	w32ipcsem.c \
 	w32poll.c \
 	w32rng.c \
 	w32shm.c
 else
+ifeq ($(OS_TARGET),WINCE)
+CSRCS =	ntmisc.c \
+	ntsec.c \
+	ntsem.c \
+	ntinrval.c \
+	ntgc.c \
+	w95thred.c \
+	w95io.c \
+	w95cv.c \
+	w95sock.c \
+	win32_errors.c \
+	w32ipcsem.c \
+	w32poll.c \
+	w32rng.c \
+	w32shm.c \
+	w95dllmain.c \
+	w32unicode.c \
+	w32netdb.c
+else
 ifeq ($(OS_TARGET),WIN95)
 CSRCS =	ntmisc.c \
 	ntsec.c \
 	ntsem.c \
 	ntinrval.c \
 	ntgc.c \
 	w95thred.c \
 	w95io.c \
@@ -78,16 +97,17 @@ CSRCS =	w16null.c \
 	w16io.c \
 	w16gc.c \
 	w16error.c \
 	w16stdio.c \
 	w16callb.c \
 	ntinrval.c
 endif # win16
 endif # win95
+endif # wince
 endif # winnt
 
 CSRCS	+= $(PR_MD_CSRCS)
 ASFILES += $(PR_MD_ASFILES)
 
 OBJS += $(addprefix md/windows/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)))  \
 	$(addprefix md/windows/$(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX)))
 
--- a/pr/src/md/windows/w32ipcsem.c
+++ b/pr/src/md/windows/w32ipcsem.c
@@ -143,31 +143,33 @@ PRSem *_PR_MD_OPEN_SEMAPHORE(
         if (_PR_NT_MakeSecurityDescriptorACL(mode, semAccessTable,
                 &pSD, &pACL) == PR_SUCCESS) {
             sa.nLength = sizeof(sa);
             sa.lpSecurityDescriptor = pSD;
             sa.bInheritHandle = FALSE;
             lpSA = &sa;
         }
         sem->sem = CreateSemaphore(lpSA, value, 0x7fffffff, osname);
+
         if (lpSA != NULL) {
             _PR_NT_FreeSecurityDescriptorACL(pSD, pACL);
         }
         if (sem->sem == NULL) {
             _PR_MD_MAP_DEFAULT_ERROR(GetLastError());
             PR_DELETE(sem);
             return NULL;
         }
         if ((flags & PR_SEM_EXCL) && (GetLastError() == ERROR_ALREADY_EXISTS)) {
             PR_SetError(PR_FILE_EXISTS_ERROR, ERROR_ALREADY_EXISTS);
             CloseHandle(sem->sem);
             PR_DELETE(sem);
             return NULL;
         }
     } else {
+#if !defined(WINCE)
         sem->sem = OpenSemaphore(
                 SEMAPHORE_MODIFY_STATE|SYNCHRONIZE, FALSE, osname);
         if (sem->sem == NULL) {
             DWORD err = GetLastError();
 
             /*
              * If we open a nonexistent named semaphore, NT
              * returns ERROR_FILE_NOT_FOUND, while Win95
@@ -176,16 +178,46 @@ PRSem *_PR_MD_OPEN_SEMAPHORE(
             if (err == ERROR_INVALID_NAME) {
                 PR_SetError(PR_FILE_NOT_FOUND_ERROR, err);
             } else {
                 _PR_MD_MAP_DEFAULT_ERROR(GetLastError());
             }
             PR_DELETE(sem);
             return NULL;
         }
+#else
+        /*
+         * WinCE has odd sematics regarding opening a semaphore.
+         * We create the semaphore.  If it existed previouisly, the
+         *  state is signaled by GetLastError....
+         */
+        sem->sem = CreateSemaphoreA(lpSA, 0, 0x7fffffff, osname);
+        if(NULL != sem->sem)
+        {
+            DWORD lastErr = GetLastError();
+
+            if(ERROR_ALREADY_EXISTS != lastErr)
+            {
+                /*
+                 * We created, not opened.
+                 * Fail....
+                 */
+                CloseHandle(sem->sem);
+                PR_DELETE(sem);
+                PR_SetError(PR_FILE_NOT_FOUND_ERROR, 0);
+                return NULL;
+            }
+        }
+        else
+        {
+            _PR_MD_MAP_DEFAULT_ERROR(GetLastError());
+            PR_DELETE(sem);
+            return NULL;
+        }
+#endif
     }
     return sem;
 }
 
 PRStatus _PR_MD_WAIT_SEMAPHORE(PRSem *sem)
 {
     DWORD rv;
 
--- a/pr/src/md/windows/w32rng.c
+++ b/pr/src/md/windows/w32rng.c
@@ -92,16 +92,20 @@ extern PRSize _PR_MD_GetRandomNoise( voi
     memcpy(((char *)buf) + n, &dwVal, nBytes);
     n += nBytes;
     size -= nBytes;
 
     if (size <= 0)
         return n;
 
     // get the time in seconds since midnight Jan 1, 1970
+#if !defined(WINCE)
     time(&sTime);
+#else
+    sTime = (time_t)(PR_Now() / PR_MSEC_PER_SEC);
+#endif
     nBytes = sizeof(sTime) > size ? size : sizeof(sTime);
     memcpy(((char *)buf) + n, &sTime, nBytes);
     n += nBytes;
 
     return n;
 }
 
--- a/pr/src/md/windows/w32shm.c
+++ b/pr/src/md/windows/w32shm.c
@@ -115,17 +115,19 @@ extern PRSharedMemory * _MD_OpenSharedMe
 
         if (_PR_NT_MakeSecurityDescriptorACL(mode, filemapAccessTable,
                 &pSD, &pACL) == PR_SUCCESS) {
             sa.nLength = sizeof(sa);
             sa.lpSecurityDescriptor = pSD;
             sa.bInheritHandle = FALSE;
             lpSA = &sa;
         }
-        shm->handle = CreateFileMapping(
+        shm->handle =
+            CreateFileMapping
+            (
             (HANDLE)-1 ,
             lpSA,
             flProtect,
             dwHi,
             dwLo,
             shm->ipcname);
         if (lpSA != NULL) {
             _PR_NT_FreeSecurityDescriptorACL(pSD, pACL);
@@ -152,31 +154,88 @@ extern PRSharedMemory * _MD_OpenSharedMe
             } else {
                 PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, 
                     ( "PR_OpenSharedMemory: CreateFileMapping() success: %s, handle: %d",
                         shm->ipcname, shm->handle ));
                 return(shm);
             }
         }
     } else {
+#if !defined(WINCE)
         shm->handle = OpenFileMapping( FILE_MAP_WRITE, TRUE, shm->ipcname );
         if ( NULL == shm->handle ) {
             _PR_MD_MAP_DEFAULT_ERROR( GetLastError());
             PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, 
                 ( "PR_OpenSharedMemory: OpenFileMapping() failed: %s, error: %d",
                     shm->ipcname, PR_GetOSError())); 
             PR_FREEIF( shm->ipcname );
             PR_DELETE( shm );
             return(NULL);
         } else {
             PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, 
                 ( "PR_OpenSharedMemory: OpenFileMapping() success: %s, handle: %d",
                     shm->ipcname, shm->handle )); 
                 return(shm);
         }
+#else
+        dwHi = 0;
+        dwLo = shm->size;
+
+        /*
+         * WinCE has odd sematics regarding opening of an existing file
+         *   mapping.  We use CreateFileMapping and must use GetLastError
+         *   to determine if the the mapping already existed.
+         */
+        shm->handle = CreateFileMappingA(
+            (HANDLE)INVALID_HANDLE_VALUE,
+            NULL,
+            flProtect,
+            dwHi,
+            dwLo,
+            shm->ipcname);
+
+        if(NULL == shm->handle)
+        {
+            PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, 
+                ( "PR_OpenSharedMemory: CreateFileMapping() failed: %s",
+                    shm->ipcname ));
+            _PR_MD_MAP_DEFAULT_ERROR(GetLastError());
+            PR_FREEIF(shm->ipcname);
+            PR_DELETE(shm);
+            return NULL;
+        }
+        else
+        {
+            DWORD dwError = GetLastError();
+
+            /*
+             * Must have existed previously.
+             */
+            if(ERROR_ALREADY_EXISTS != dwError)
+            {
+                CloseHandle(shm->handle);
+                shm->handle = NULL;
+
+                PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, 
+                    ( "PR_OpenSharedMemory: CreateFileMapping() failed: %s",
+                        shm->ipcname ));
+                _PR_MD_MAP_DEFAULT_ERROR(dwError);
+                PR_FREEIF(shm->ipcname);
+                PR_DELETE(shm);
+                return NULL;
+            }
+            else
+            {
+                PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, 
+                    ( "PR_OpenSharedMemory: CreateFileMapping() success: %s, handle: %d",
+                        shm->ipcname, shm->handle )); 
+                return shm;
+            }
+        }
+#endif
     }
     /* returns from separate paths */
 }
 
 extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags )
 {
     PRUint32    access = FILE_MAP_WRITE;
     void        *addr;
@@ -254,16 +313,17 @@ extern PRStatus _MD_DeleteSharedMemory( 
 extern PRLogModuleInfo *_pr_shma_lm;
 
 extern PRFileMap* _md_OpenAnonFileMap( 
     const char *dirName,
     PRSize      size,
     PRFileMapProtect prot
 )
 {
+#if !defined(WINCE)
     PRFileMap   *fm;
     HANDLE      hFileMap;
 
     fm = PR_CreateFileMap( (PRFileDesc*)-1, size, prot );
     if ( NULL == fm )  {
         PR_LOG( _pr_shma_lm, PR_LOG_DEBUG,
             ("_md_OpenAnonFileMap(): PR_CreateFileMap(): failed"));
         goto Finished;
@@ -286,16 +346,24 @@ extern PRFileMap* _md_OpenAnonFileMap(
         fm = NULL;
         goto Finished;
     }
     CloseHandle(fm->md.hFileMap);
     fm->md.hFileMap = hFileMap;
 
 Finished:    
     return(fm);
+#else
+    /*
+    ** WinCE does not have inheritable handles.
+    ** Unsure if this should fail, but here it is....
+    */
+    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+    return NULL;
+#endif
 } /* end md_OpenAnonFileMap() */
 
 /*
 ** _md_ExportFileMapAsString()
 **
 */
 extern PRStatus _md_ExportFileMapAsString(
     PRFileMap *fm,
--- a/pr/src/md/windows/w95io.c
+++ b/pr/src/md/windows/w95io.c
@@ -213,23 +213,24 @@ PRInt32
             flags = OPEN_ALWAYS;
     } else {
         if (osflags & PR_TRUNCATE)
             flags = TRUNCATE_EXISTING;
         else
             flags = OPEN_EXISTING;
     }
 
-    file = CreateFile(name,
-                      access,
-                      FILE_SHARE_READ|FILE_SHARE_WRITE,
-                      NULL,
-                      flags,
-                      flag6,
-                      NULL);
+    file =
+           CreateFile( name,
+                       access,
+                       FILE_SHARE_READ|FILE_SHARE_WRITE,
+                       NULL,
+                       flags,
+                       flag6,
+                       NULL);
     if (file == INVALID_HANDLE_VALUE) {
 		_PR_MD_MAP_OPEN_ERROR(GetLastError());
         return -1; 
 	}
 
     return (PRInt32)file;
 }
 
@@ -455,17 +456,28 @@ PRInt32
     rv = (CloseHandle((HANDLE)osfd))?0:-1;
 	if (rv == -1)
 		_PR_MD_MAP_CLOSE_ERROR(GetLastError());
     return rv;
 }
 
 
 /* --- DIR IO ------------------------------------------------------------ */
+#if !defined(WINCE)
 #define GetFileFromDIR(d)       (d)->d_entry.cFileName
+#else
+char* GetFileFromDIR(_MDDir* d)
+{
+    char* retval = NULL;
+
+    retval = _PR_MD_W2A(d->d_entry.cFileName, d->cFileNameA, sizeof(d->cFileNameA));
+
+    return retval;
+}
+#endif
 #define FileIsHidden(d)	((d)->d_entry.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
 
 void FlipSlashes(char *cp, int len)
 {
     while (--len >= 0) {
         if (cp[0] == '/') {
             cp[0] = PR_DIRECTORY_SEPARATOR;
         }
@@ -480,16 +492,26 @@ void FlipSlashes(char *cp, int len)
 ** by the VC RTL.
 **
 */
 
 PRStatus
 _PR_MD_CLOSE_DIR(_MDDir *d)
 {
     if ( d ) {
+#if defined(WINCE)
+        /*
+        ** Handle case where we faked no more files.
+        ** FindFirstFile likes to return ERROR_NO_MORE_FILES itself.
+        */
+        if (NULL == d->d_hdl) {
+            d->magic = (PRUint32)-1;
+            return PR_SUCCESS;
+        } else
+#endif /* WINCE */
         if (FindClose(d->d_hdl)) {
         d->magic = (PRUint32)-1;
         return PR_SUCCESS;
 		} else {
 			_PR_MD_MAP_CLOSEDIR_ERROR(GetLastError());
         	return PR_FAILURE;
 		}
     }
@@ -517,22 +539,59 @@ PRStatus
      * another backslash.
      */
     if (filename[len - 1] == '/' || filename[len - 1] == '\\') {
         len--;
     }
     strcpy(&filename[len], "\\*.*");
     FlipSlashes( filename, strlen(filename) );
 
+#if !defined(WINCE)
     d->d_hdl = FindFirstFile( filename, &(d->d_entry) );
+#else
+    {
+        WCHAR ceFileName[MAX_PATH];
+        LPWSTR ceResult = _PR_MD_A2W(filename, ceFileName, MAX_PATH);
+
+        if(NULL != ceResult)
+        {
+            d->d_hdl = FindFirstFile( ceFileName, &(d->d_entry) );
+
+            /*
+            ** WINCE likes to report no files on the first call....
+            */
+            if(INVALID_HANDLE_VALUE == d->d_hdl && ERROR_NO_MORE_FILES == GetLastError())
+            {
+                d->d_hdl = NULL;
+                SetLastError(NO_ERROR);
+            }
+        }
+        else
+        {
+            d->d_hdl = INVALID_HANDLE_VALUE;
+        }
+    }
+#endif
     if ( d->d_hdl == INVALID_HANDLE_VALUE ) {
 		_PR_MD_MAP_OPENDIR_ERROR(GetLastError());
         return PR_FAILURE;
     }
+#if !defined(WINCE)
     d->firstEntry = PR_TRUE;
+#else /* WINCE */
+    /*
+    **  If we are having to fake ERROR_NO_MORE_FILES on wince, make sure we
+    **    have _PR_MD_READ_DIR act correctly.
+    */
+    if (NULL != d->d_hdl) {
+        d->firstEntry = PR_TRUE;
+    } else {
+        d->firstEntry = PR_FALSE;
+    }
+#endif /* WINCE */
     d->magic = _MD_MAGIC_DIR;
     return PR_SUCCESS;
 }
 
 char *
 _PR_MD_READ_DIR(_MDDir *d, PRIntn flags)
 {
     PRInt32 err;
@@ -540,31 +599,46 @@ char *
     char *fileName;
 
     if ( d ) {
         while (1) {
             if (d->firstEntry) {
                 d->firstEntry = PR_FALSE;
                 rv = 1;
             } else {
+#if !defined(WINCE)
                 rv = FindNextFile(d->d_hdl, &(d->d_entry));
+#else /* WINCE */
+                if (NULL != d->d_hdl) {
+                    rv = FindNextFile(d->d_hdl, &(d->d_entry));
+                } else {
+                    /*
+                    ** Fake the no more files we'd normally expect.
+                    ** All of this magic started by setting d_hdl to NULL
+                    **   in _PR_MD_OPEN_DIR because FindFirstFile likes to
+                    **   return ERROR_NO_MORE_FILES itself.
+                    */
+                    rv = 0;
+                    SetLastError(ERROR_NO_MORE_FILES);
+                }
+#endif /* WINCE */
             }
             if (rv == 0) {
                 break;
             }
+            if ( (flags & PR_SKIP_HIDDEN) && FileIsHidden(d))
+                 continue;
             fileName = GetFileFromDIR(d);
             if ( (flags & PR_SKIP_DOT) &&
                  (fileName[0] == '.') && (fileName[1] == '\0'))
                  continue;
             if ( (flags & PR_SKIP_DOT_DOT) &&
                  (fileName[0] == '.') && (fileName[1] == '.') &&
                  (fileName[2] == '\0'))
                  continue;
-            if ( (flags & PR_SKIP_HIDDEN) && FileIsHidden(d))
-                 continue;
             return fileName;
         }
         err = GetLastError();
         PR_ASSERT(NO_ERROR != err);
 			_PR_MD_MAP_READDIR_ERROR(err);
         return NULL;
 		}
     PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
@@ -661,16 +735,17 @@ PRInt32
             newfn[len - 1] = '\0';
             rv = _stat(newfn, (struct _stat *)info);
         }
     }
 
     if (-1 == rv) {
         _PR_MD_MAP_STAT_ERROR(errno);
     }
+
     return rv;
 }
 
 #define _PR_IS_SLASH(ch) ((ch) == '/' || (ch) == '\\')
 
 /*
  * IsRootDirectory --
  *
@@ -695,21 +770,23 @@ IsRootDirectory(char *fn, size_t buflen)
     char *p;
     PRBool slashAdded = PR_FALSE;
     PRBool rv = PR_FALSE;
 
     if (_PR_IS_SLASH(fn[0]) && fn[1] == '\0') {
         return PR_TRUE;
     }
 
+#if !defined(WINCE)
     if (isalpha(fn[0]) && fn[1] == ':' && _PR_IS_SLASH(fn[2])
             && fn[3] == '\0') {
         rv = GetDriveType(fn) > 1 ? PR_TRUE : PR_FALSE;
         return rv;
     }
+#endif
 
     /* The UNC root directory */
 
     if (_PR_IS_SLASH(fn[0]) && _PR_IS_SLASH(fn[1])) {
         /* The 'server' part should have at least one character. */
         p = &fn[2];
         if (*p == '\0' || _PR_IS_SLASH(*p)) {
             return PR_FALSE;
@@ -731,16 +808,17 @@ IsRootDirectory(char *fn, size_t buflen)
 
         /* look for the final slash */
         do {
             p++;
         } while (*p != '\0' && !_PR_IS_SLASH(*p));
         if (_PR_IS_SLASH(*p) && p[1] != '\0') {
             return PR_FALSE;
         }
+#if !defined(WINCE)
         if (*p == '\0') {
             /*
              * GetDriveType() doesn't work correctly if the
              * path is of the form \\server\share, so we add
              * a final slash temporarily.
              */
             if ((p + 1) < (fn + buflen)) {
                 *p++ = '\\';
@@ -750,16 +828,22 @@ IsRootDirectory(char *fn, size_t buflen)
                 return PR_FALSE; /* name too long */
             }
         }
         rv = GetDriveType(fn) > 1 ? PR_TRUE : PR_FALSE;
         /* restore the 'fn' buffer */
         if (slashAdded) {
             *--p = '\0';
         }
+#else
+        /*
+         * Assume the path as root.
+         */
+        rv = PR_TRUE;
+#endif
     }
     return rv;
 }
 
 PRInt32
 _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info)
 {
     HANDLE hFindFile;
@@ -775,20 +859,38 @@ PRInt32
      * FindFirstFile() expands wildcard characters.  So
      * we make sure the pathname contains no wildcard.
      */
     if (NULL != _mbspbrk(fn, "?*")) {
         PR_SetError(PR_FILE_NOT_FOUND_ERROR, 0);
         return -1;
     }
 
+#if !defined(WINCE)
     hFindFile = FindFirstFile(fn, &findFileData);
+#else
+    {
+        WCHAR ceFileName[MAX_PATH + 1];
+        LPWSTR ceResult = _PR_MD_A2W(fn, ceFileName, sizeof(ceFileName) / sizeof(WCHAR));
+
+        if(NULL != ceResult)
+        {
+            hFindFile = FindFirstFile(ceFileName, &findFileData);
+        }
+        else
+        {
+            hFindFile = INVALID_HANDLE_VALUE;
+        }
+    }
+#endif
     if (INVALID_HANDLE_VALUE == hFindFile) {
         DWORD len;
+#if !defined(WINCE)
         char *filePart;
+#endif
 
         /*
          * FindFirstFile() does not work correctly on root directories.
          * It also doesn't work correctly on a pathname that ends in a
          * slash.  So we first check to see if the pathname specifies a
          * root directory.  If not, and if the pathname ends in a slash,
          * we remove the final slash and try again.
          */
@@ -796,18 +898,23 @@ PRInt32
         /*
          * If the pathname does not contain ., \, and /, it cannot be
          * a root directory or a pathname that ends in a slash.
          */
         if (NULL == _mbspbrk(fn, ".\\/")) {
             _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
             return -1;
         } 
+#if !defined(WINCE)
         len = GetFullPathName(fn, sizeof(pathbuf), pathbuf,
                 &filePart);
+#else
+        strncpy(pathbuf, fn, sizeof(pathbuf));
+        len = strlen(pathbuf);
+#endif
         if (0 == len) {
             _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
             return -1;
         }
         if (len > sizeof(pathbuf)) {
             PR_SetError(PR_NAME_TOO_LONG_ERROR, 0);
             return -1;
         }
@@ -821,17 +928,33 @@ PRInt32
             info->creationTime = 0;
             return 0;
         }
         if (!_PR_IS_SLASH(pathbuf[len - 1])) {
             _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
             return -1;
         } else {
             pathbuf[len - 1] = '\0';
+#if !defined(WINCE)
             hFindFile = FindFirstFile(pathbuf, &findFileData);
+#else
+            {
+                WCHAR ceFileName[MAX_PATH + 1];
+                LPWSTR ceResult = _PR_MD_A2W(pathbuf, ceFileName, sizeof(ceFileName) / sizeof(WCHAR));
+                
+                if(NULL != ceResult)
+                {
+                    hFindFile = FindFirstFile(ceFileName, &findFileData);
+                }
+                else
+                {
+                    hFindFile = INVALID_HANDLE_VALUE;
+                }
+            }
+#endif
             if (INVALID_HANDLE_VALUE == hFindFile) {
                 _PR_MD_MAP_OPENDIR_ERROR(GetLastError());
                 return -1;
             }
         }
     }
 
     FindClose(hFindFile);
@@ -913,56 +1036,65 @@ PRInt32
         LL_L2I(info->size, info64.size);
     }
     return rv;
 }
 
 PRStatus
 _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable)
 {
+#if !defined(WINCE)
     BOOL rv;
 
     /*
      * The SetHandleInformation function fails with the
      * ERROR_CALL_NOT_IMPLEMENTED error on Win95.
      */
     rv = SetHandleInformation(
             (HANDLE)fd->secret->md.osfd,
             HANDLE_FLAG_INHERIT,
             inheritable ? HANDLE_FLAG_INHERIT : 0);
     if (0 == rv) {
         _PR_MD_MAP_DEFAULT_ERROR(GetLastError());
         return PR_FAILURE;
     }
     return PR_SUCCESS;
+#else
+    _PR_MD_MAP_DEFAULT_ERROR(ERROR_CALL_NOT_IMPLEMENTED);
+    return PR_FAILURE;
+#endif
 } 
 
 void
 _PR_MD_INIT_FD_INHERITABLE(PRFileDesc *fd, PRBool imported)
 {
     if (imported) {
         fd->secret->inheritable = _PR_TRI_UNKNOWN;
     } else {
         fd->secret->inheritable = _PR_TRI_FALSE;
     }
 }
 
 void
 _PR_MD_QUERY_FD_INHERITABLE(PRFileDesc *fd)
 {
+#if !defined(WINCE)
     DWORD flags;
 
     PR_ASSERT(_PR_TRI_UNKNOWN == fd->secret->inheritable);
     if (GetHandleInformation((HANDLE)fd->secret->md.osfd, &flags)) {
         if (flags & HANDLE_FLAG_INHERIT) {
             fd->secret->inheritable = _PR_TRI_TRUE;
         } else {
             fd->secret->inheritable = _PR_TRI_FALSE;
         }
     }
+#else
+    fd->secret->inheritable = _PR_TRI_FALSE;
+#endif
 }
 
 PRInt32
 _PR_MD_RENAME(const char *from, const char *to)
 {
     /* Does this work with dot-relative pathnames? */
     if (MoveFile(from, to)) {
         return 0;
@@ -970,33 +1102,62 @@ PRInt32
 		_PR_MD_MAP_RENAME_ERROR(GetLastError());
         return -1;
     }
 }
 
 PRInt32
 _PR_MD_ACCESS(const char *name, PRAccessHow how)
 {
-PRInt32 rv;
+    PRInt32 rv = -1;
+
+#if !defined(WINCE)
     switch (how) {
       case PR_ACCESS_WRITE_OK:
         rv = _access(name, 02);
 		break;
       case PR_ACCESS_READ_OK:
         rv = _access(name, 04);
 		break;
       case PR_ACCESS_EXISTS:
         return _access(name, 00);
 	  	break;
       default:
 		PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
 		return -1;
     }
 	if (rv < 0)
 		_PR_MD_MAP_ACCESS_ERROR(errno);
+#else
+    DWORD attribs = 0;
+
+    attribs = GetFileAttributes(name);
+    if((DWORD)-1 != attribs)
+    {
+        switch(how)
+        {
+        case PR_ACCESS_WRITE_OK:
+            if(FILE_ATTRIBUTE_READONLY & attribs)
+            {
+                rv = 0;
+            }
+            break;
+        case PR_ACCESS_READ_OK:
+            rv = 0;
+            break;
+        case PR_ACCESS_EXISTS:
+            rv = 0;
+            break;
+        default:
+            PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
+            break;
+        }
+    }
+#endif
+
     return rv;
 }
 
 PRInt32
 _PR_MD_MKDIR(const char *name, PRIntn mode)
 {
     /* XXXMB - how to translate the "mode"??? */
     if (CreateDirectory(name, NULL)) {
@@ -1044,58 +1205,68 @@ PRInt32
 		_PR_MD_MAP_RMDIR_ERROR(GetLastError());
         return -1;
     }
 }
 
 PRStatus
 _PR_MD_LOCKFILE(PRInt32 f)
 {
+#if !defined(WINCE)
     PRStatus  rc = PR_SUCCESS;
 	DWORD     rv;
 
 	rv = LockFile( (HANDLE)f,
 		0l, 0l,
 		0x0l, 0xffffffffl ); 
 	if ( rv == 0 ) {
         DWORD rc = GetLastError();
         PR_LOG( _pr_io_lm, PR_LOG_ERROR,
             ("_PR_MD_LOCKFILE() failed. Error: %d", rc ));
         rc = PR_FAILURE;
     }
 
     return rc;
+#else
+    PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
+    return PR_FAILURE;
+#endif
 } /* end _PR_MD_LOCKFILE() */
 
 PRStatus
 _PR_MD_TLOCKFILE(PRInt32 f)
 {
     PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
     return PR_FAILURE;
 } /* end _PR_MD_TLOCKFILE() */
 
 
 PRStatus
 _PR_MD_UNLOCKFILE(PRInt32 f)
 {
+#if !defined(WINCE)
 	PRInt32   rv;
     
     rv = UnlockFile( (HANDLE) f,
     		0l, 0l,
             0x0l, 0xffffffffl ); 
             
     if ( rv )
     {
     	return PR_SUCCESS;
     }
     else
     {
 		_PR_MD_MAP_DEFAULT_ERROR(GetLastError());
 		return PR_FAILURE;
     }
+#else
+    PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
+    return PR_FAILURE;
+#endif
 } /* end _PR_MD_UNLOCKFILE() */
 
 PRInt32
 _PR_MD_PIPEAVAILABLE(PRFileDesc *fd)
 {
     if (NULL == fd)
 		PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
 	else
--- a/pr/src/md/windows/w95thred.c
+++ b/pr/src/md/windows/w95thred.c
@@ -86,24 +86,32 @@ PRStatus
         ** Warning:
         ** --------
         ** NSPR requires a real handle to every thread.
         ** GetCurrentThread() returns a pseudo-handle which
         ** is not suitable for some thread operations (e.g.,
         ** suspending).  Therefore, get a real handle from
         ** the pseudo handle via DuplicateHandle(...)
         */
+#if !defined(WINCE)
         DuplicateHandle(
                 GetCurrentProcess(),     /* Process of source handle */
                 GetCurrentThread(),      /* Pseudo Handle to dup */
                 GetCurrentProcess(),     /* Process of handle */
                 &(thread->md.handle),    /* resulting handle */
                 0L,                      /* access flags */
                 FALSE,                   /* Inheritable */
                 DUPLICATE_SAME_ACCESS);  /* Options */
+#else
+        /*
+        ** On WinCE the thread ID is the same as the real thread handle.
+        */
+        thread->md.handle = (HANDLE)GetCurrentThreadId();
+        thread->md.noCloseHandle = PR_TRUE;
+#endif
     }
 
     /* Create the blocking IO semaphore */
     thread->md.blocked_sema = CreateSemaphore(NULL, 0, 1, NULL);
     if (thread->md.blocked_sema == NULL)
         return PR_FAILURE;
 	else
 		return PR_SUCCESS;
@@ -121,41 +129,50 @@ PRStatus
 _PR_MD_CREATE_THREAD(PRThread *thread, 
                   void (*start)(void *), 
                   PRThreadPriority priority, 
                   PRThreadScope scope, 
                   PRThreadState state, 
                   PRUint32 stackSize)
 {
 
-    thread->md.start = start;
-    thread->md.handle = (HANDLE) _beginthreadex(
-                    NULL,
-                    thread->stack->stackSize,
-                    pr_root,
-                    (void *)thread,
-                    CREATE_SUSPENDED,
-                    &(thread->id));
+#if !defined(WINCE)
+  thread->md.start = start;
+  thread->md.handle = (HANDLE) _beginthreadex(NULL,
+                                              thread->stack->stackSize,
+                                              pr_root,
+                                              (void *)thread,
+                                              CREATE_SUSPENDED,
+                                              &(thread->id));
+#else
+  thread->md.handle = CreateThread(NULL,
+                                   (DWORD)thread->stack->stackSize,
+                                   (LPTHREAD_START_ROUTINE)start,
+                                   (LPVOID)thread,
+                                   (DWORD)CREATE_SUSPENDED,
+                                   (LPDWORD)&(thread->id));
+#endif /* !WINCE */
+
     if(!thread->md.handle) {
         return PR_FAILURE;
     }
 
     thread->md.id = thread->id;
     /*
      * On windows, a thread is created with a thread priority of
      * THREAD_PRIORITY_NORMAL.
      */
     if (priority != PR_PRIORITY_NORMAL) {
-        _PR_MD_SET_PRIORITY(&(thread->md), priority);
+      _PR_MD_SET_PRIORITY(&(thread->md), priority);
     }
-
+    
     /* Activate the thread */
     if ( ResumeThread( thread->md.handle ) != -1)
-        return PR_SUCCESS;
-
+      return PR_SUCCESS;
+    
     return PR_FAILURE;
 }
 
 void    
 _PR_MD_YIELD(void)
 {
     /* Can NT really yield at all? */
     Sleep(0);
@@ -201,52 +218,74 @@ void
 
     if (thread->md.blocked_sema) {
         rv = CloseHandle(thread->md.blocked_sema);
         PR_ASSERT(rv);
         thread->md.blocked_sema = 0;
     }
 
     if (thread->md.handle) {
+#if !defined(WINCE)
         rv = CloseHandle(thread->md.handle);
         PR_ASSERT(rv);
+#else
+        if(PR_FALSE == thread->md.noCloseHandle) {
+            rv = CloseHandle(thread->md.handle);
+            PR_ASSERT(rv);
+        }
+        else {
+            thread->md.noCloseHandle = PR_FALSE; /* reused? insurance.... */
+        }
+#endif
         thread->md.handle = 0;
     }
 }
 
 void
 _PR_MD_EXIT_THREAD(PRThread *thread)
 {
     _PR_MD_CLEAN_THREAD(thread);
     _PR_MD_SET_CURRENT_THREAD(NULL);
 }
 
 
 void
 _PR_MD_EXIT(PRIntn status)
 {
+#if !defined(WINCE)
     _exit(status);
+#else
+    TerminateProcess(GetCurrentProcess(), status);
+#endif
 }
 
 PRInt32 _PR_MD_SETTHREADAFFINITYMASK(PRThread *thread, PRUint32 mask )
 {
+#if !defined(WINCE)
     int rv;
 
     rv = SetThreadAffinityMask(thread->md.handle, mask);
 
     return rv?0:-1;
+#else
+    return -1;
+#endif
 }
 
 PRInt32 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask)
 {
+#if !defined(WINCE)
     PRInt32 rv, system_mask;
 
     rv = GetProcessAffinityMask(GetCurrentProcess(), mask, &system_mask);
     
     return rv?0:-1;
+#else
+    return -1;
+#endif
 }
 
 void 
 _PR_MD_SUSPEND_CPU(_PRCPU *cpu) 
 {
     _PR_MD_SUSPEND_THREAD(cpu->thread);
 }
 
--- a/pr/src/misc/prerror.c
+++ b/pr/src/misc/prerror.c
@@ -47,16 +47,22 @@ PR_IMPLEMENT(PRErrorCode) PR_GetError(vo
 }
 
 PR_IMPLEMENT(PRInt32) PR_GetOSError(void)
 {
     PRThread *thread = PR_GetCurrentThread();
     return thread->osErrorCode;
 }
 
+PR_IMPLEMENT(PRInt32 *) PR_GetOSErrorAddress(void)
+{
+    PRThread *thread = PR_GetCurrentThread();
+    return &thread->osErrorCode;
+}
+
 PR_IMPLEMENT(void) PR_SetError(PRErrorCode code, PRInt32 osErr)
 {
     PRThread *thread = PR_GetCurrentThread();
     thread->errorCode = code;
     thread->osErrorCode = osErr;
     thread->errorStringLength = 0;
 }
 
--- a/pr/src/misc/prerrortable.c
+++ b/pr/src/misc/prerrortable.c
@@ -143,17 +143,17 @@ PR_ErrorToString(PRErrorCode code, PRLan
 		if (msg) return msg;
 	    }
     
 	    return(et->table->msgs[code - et->table->base].en_text);
 	}
     }
 
     if (code >= 0 && code < 256) {
-	return strerror(code);
+      return strerror(code);
     }
 
     offset = (int) (code & ((1<<ERRCODE_RANGE)-1));
     table_num = code - offset;
     strcpy (buffer, "Unknown code ");
     if (table_num) {
 	strcat(buffer, error_table_name (table_num));
 	strcat(buffer, " ");
@@ -199,17 +199,17 @@ PR_ErrorLanguages(void)
 PR_IMPLEMENT(PRErrorCode)
 PR_ErrorInstallTable(const struct PRErrorTable *table)
 {
     struct PRErrorTableList * new_et;
 
     new_et = (struct PRErrorTableList *)
 					PR_Malloc(sizeof(struct PRErrorTableList));
     if (!new_et)
-	return errno;	/* oops */
+      return errno;	/* oops */
     new_et->table = table;
     if (callback_newtable) {
 	new_et->table_private = callback_newtable(table, callback_private);
     } else {
 	new_et->table_private = 0;
     }
     new_et->next = Table_List;
     Table_List = new_et;
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -1178,24 +1178,30 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
  * we're not using it. For sure these signatures are different than
  * any usable implementation.
  */
 
 static struct protoent *getprotobyname_r(const char* name)
 {
 #ifdef XP_OS2_VACPP
 	return getprotobyname((char *)name);
+#elif defined(WINCE)
+    return Wingetprotobyname(name);
 #else
 	return getprotobyname(name);
 #endif
 } /* getprotobyname_r */
 
 static struct protoent *getprotobynumber_r(PRInt32 number)
 {
+#if !defined(WINCE)
 	return getprotobynumber(number);
+#else
+    return Wingetprotobynumber(number);
+#endif
 } /* getprotobynumber_r */
 
 #endif /* !defined(_PR_HAVE_GETPROTO_R) */
 
 PR_IMPLEMENT(PRStatus) PR_GetProtoByName(
     const char* name, char* buffer, PRInt32 buflen, PRProtoEnt* result)
 {
 	PRStatus rv = PR_SUCCESS;
--- a/pr/src/threads/combined/prucv.c
+++ b/pr/src/threads/combined/prucv.c
@@ -38,17 +38,17 @@
 
 #include "primpl.h"
 #include "prinrval.h"
 #include "prtypes.h"
 
 #if defined(WIN95)
 /*
 ** Some local variables report warnings on Win95 because the code paths 
-** using them are conditioned on HAVE_CUSTOME_USER_THREADS.
+** using them are conditioned on HAVE_CUSTOM_USER_THREADS.
 ** The pragma suppresses the warning.
 ** 
 */
 #pragma warning(disable : 4101)
 #endif
 
 
 /*
--- a/pr/src/threads/combined/prulock.c
+++ b/pr/src/threads/combined/prulock.c
@@ -35,17 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "primpl.h"
 
 #if defined(WIN95)
 /*
 ** Some local variables report warnings on Win95 because the code paths 
-** using them are conditioned on HAVE_CUSTOME_USER_THREADS.
+** using them are conditioned on HAVE_CUSTOM_USER_THREADS.
 ** The pragma suppresses the warning.
 ** 
 */
 #pragma warning(disable : 4101)
 #endif
 
 
 void _PR_InitLocks(void)
--- a/pr/src/threads/combined/pruthr.c
+++ b/pr/src/threads/combined/pruthr.c
@@ -37,17 +37,17 @@
 
 #include "primpl.h"
 #include <signal.h>
 #include <string.h>
 
 #if defined(WIN95)                                                                         
 /*
 ** Some local variables report warnings on Win95 because the code paths
-** using them are conditioned on HAVE_CUSTOME_USER_THREADS.
+** using them are conditioned on HAVE_CUSTOM_USER_THREADS.
 ** The pragma suppresses the warning.
 **
 */
 #pragma warning(disable : 4101)
 #endif          
 
 #if defined(XP_MAC)
 #include <LowMem.h>
--- a/pr/src/threads/prcthr.c
+++ b/pr/src/threads/prcthr.c
@@ -35,17 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "primpl.h"
 
 #if defined(WIN95)
 /*
 ** Some local variables report warnings on Win95 because the code paths 
-** using them are conditioned on HAVE_CUSTOME_USER_THREADS.
+** using them are conditioned on HAVE_CUSTOM_USER_THREADS.
 ** The pragma suppresses the warning.
 ** 
 */
 #pragma warning(disable : 4101)
 #endif
 
 
 extern PRLock *_pr_sleeplock;  /* allocated and initialized in prinit */
--- a/pr/src/threads/prdump.c
+++ b/pr/src/threads/prdump.c
@@ -35,17 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "primpl.h"
 
 #if defined(WIN95)
 /*
 ** Some local variables report warnings on Win95 because the code paths 
-** using them are conditioned on HAVE_CUSTOME_USER_THREADS.
+** using them are conditioned on HAVE_CUSTOM_USER_THREADS.
 ** The pragma suppresses the warning.
 ** 
 */
 #pragma warning(disable : 4101)
 #endif
 
 /* XXX use unbuffered nspr stdio */
 
--- a/pr/src/threads/prtpd.c
+++ b/pr/src/threads/prtpd.c
@@ -68,17 +68,17 @@
 
 #include "primpl.h"
 
 #include <string.h>
 
 #if defined(WIN95)
 /*
 ** Some local variables report warnings on Win95 because the code paths 
-** using them are conditioned on HAVE_CUSTOME_USER_THREADS.
+** using them are conditioned on HAVE_CUSTOM_USER_THREADS.
 ** The pragma suppresses the warning.
 ** 
 */
 #pragma warning(disable : 4101)
 #endif
 
 #define _PR_TPD_LIMIT 128               /* arbitary limit on the TPD slots */
 static PRInt32 _pr_tpd_length = 0;      /* current length of destructor vector */