diff -ru nss-3.14.3.orig/mozilla/dbm/include/mcom_db.h nss-3.14.3/mozilla/dbm/include/mcom_db.h
--- nss-3.14.3.orig/mozilla/dbm/include/mcom_db.h	2012-11-14 07:51:30.000000000 -0500
+++ nss-3.14.3/mozilla/dbm/include/mcom_db.h	2013-03-10 12:58:49.839881800 -0400
@@ -35,6 +35,15 @@
 #ifndef _DB_H_
 #define	_DB_H_
 
+#ifdef WINDDK_BUILD
+#ifndef stat
+#define stat _stat
+#endif
+#ifndef getpid
+#define getpid GetCurrentProcessId
+#endif
+#endif
+
 #ifndef macintosh
 #include <sys/types.h>
 #endif
diff -ru nss-3.14.3.orig/mozilla/dbm/src/mktemp.c nss-3.14.3/mozilla/dbm/src/mktemp.c
--- nss-3.14.3.orig/mozilla/dbm/src/mktemp.c	2013-01-08 11:19:07.000000000 -0500
+++ nss-3.14.3/mozilla/dbm/src/mktemp.c	2013-03-10 12:58:49.869883500 -0400
@@ -45,13 +45,13 @@
 #include <ctype.h>
 #include "mcom_db.h"
 
-#ifndef _WINDOWS
-#include <unistd.h>
-#endif
-
 #ifdef _WINDOWS
+#ifndef WINDDK_BUILD
 #include <process.h>
+#endif
 #include "winfile.h"
+#else
+#include <unistd.h>
 #endif
 
 static int _gettemp(char *path, register int *doopen, int extraFlags);
diff -ru nss-3.14.3.orig/mozilla/nsprpub/config/config.mk nss-3.14.3/mozilla/nsprpub/config/config.mk
--- nss-3.14.3.orig/mozilla/nsprpub/config/config.mk	2012-03-06 08:13:38.000000000 -0500
+++ nss-3.14.3/mozilla/nsprpub/config/config.mk	2013-03-10 12:58:49.886884500 -0400
@@ -132,6 +132,15 @@
 DEFINES += -DMOZ_UNICODE
 endif
 
+ifdef WINDDK_BUILD
+OS_CFLAGS += -DWINDDK_BUILD
+ifdef USE_64
+OS_LIBS += msvcrt_win2003.obj
+else
+OS_LIBS += msvcrt_winxp.obj
+endif
+endif
+
 ####################################################################
 #
 # Configuration for the release process
diff -ru nss-3.14.3.orig/mozilla/nsprpub/pr/src/Makefile.in nss-3.14.3/mozilla/nsprpub/pr/src/Makefile.in
--- nss-3.14.3.orig/mozilla/nsprpub/pr/src/Makefile.in	2013-01-03 09:49:26.000000000 -0500
+++ nss-3.14.3/mozilla/nsprpub/pr/src/Makefile.in	2013-03-10 12:58:49.911885900 -0400
@@ -167,9 +167,17 @@
 ifdef NS_USE_GCC
 OS_LIBS		= -ladvapi32 -lwsock32 -lwinmm
 else
+ifdef WINDDK_BUILD
+ifdef USE_64
+OS_LIBS = advapi32.lib wsock32.lib winmm.lib msvcrt_win2003.obj
+else
+OS_LIBS = advapi32.lib wsock32.lib winmm.lib msvcrt_winxp.obj
+endif
+else
 OS_LIBS		= advapi32.lib wsock32.lib winmm.lib
 endif
 endif
+endif
 
 ifeq ($(OS_ARCH),WINCE)
 OS_LIBS		= ws2.lib
diff -ru nss-3.14.3.orig/mozilla/nsprpub/pr/src/md/windows/ntmisc.c nss-3.14.3/mozilla/nsprpub/pr/src/md/windows/ntmisc.c
--- nss-3.14.3.orig/mozilla/nsprpub/pr/src/md/windows/ntmisc.c	2012-03-06 08:14:17.000000000 -0500
+++ nss-3.14.3/mozilla/nsprpub/pr/src/md/windows/ntmisc.c	2013-03-10 12:58:49.945887800 -0400
@@ -593,7 +593,11 @@
      */
     hasFdInheritBuffer = (attr && attr->fdInheritBuffer);
     if ((envp == NULL) && hasFdInheritBuffer) {
+#ifdef WINDDK_BUILD
+        envp = getenv;
+#else
         envp = environ;
+#endif
     }
 
     if (envp != NULL) {
diff -ru nss-3.14.3.orig/mozilla/security/coreconf/arch.mk nss-3.14.3/mozilla/security/coreconf/arch.mk
--- nss-3.14.3.orig/mozilla/security/coreconf/arch.mk	2013-01-08 11:19:07.000000000 -0500
+++ nss-3.14.3/mozilla/security/coreconf/arch.mk	2013-03-10 12:58:49.999890900 -0400
@@ -235,7 +235,15 @@
 # the uname.exe in the MSYS toolkit.
 #
 ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH)))
-    OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH))
+    ifdef WINDDK_BUILD
+        ifdef USE_64
+            OS_RELEASE := 5.2
+        else
+            OS_RELEASE := 5.1
+        endif
+    else
+        OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH))
+    endif
     OS_ARCH = WINNT
     USE_MSYS = 1
     ifndef CPU_ARCH
diff -ru nss-3.14.3.orig/mozilla/security/coreconf/WIN32.mk nss-3.14.3/mozilla/security/coreconf/WIN32.mk
--- nss-3.14.3.orig/mozilla/security/coreconf/WIN32.mk	2012-05-03 05:42:56.000000000 -0400
+++ nss-3.14.3/mozilla/security/coreconf/WIN32.mk	2013-03-10 12:58:49.977889700 -0400
@@ -114,6 +114,14 @@
     OS_CFLAGS += -W3 -nologo -D_CRT_SECURE_NO_WARNINGS \
 		 -D_CRT_NONSTDC_NO_WARNINGS
     OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS
+    ifdef WINDDK_BUILD
+        OS_CFLAGS += -DWINDDK_BUILD
+        ifdef USE_64
+            OS_LIBS += msvcrt_win2003.obj
+        else
+            OS_LIBS += msvcrt_winxp.obj
+        endif
+    endif
     ifeq ($(_MSC_VER),$(_MSC_VER_6))
     ifndef MOZ_DEBUG_SYMBOLS
 	OS_DLLFLAGS += -PDB:NONE
diff -ru nss-3.14.3.orig/mozilla/security/nss/cmd/httpserv/httpserv.c nss-3.14.3/mozilla/security/nss/cmd/httpserv/httpserv.c
--- nss-3.14.3.orig/mozilla/security/nss/cmd/httpserv/httpserv.c	2012-06-28 07:11:06.000000000 -0400
+++ nss-3.14.3/mozilla/security/nss/cmd/httpserv/httpserv.c	2013-03-10 13:31:25.843758800 -0400
@@ -12,8 +12,13 @@
 #endif
 
 #if defined(_WINDOWS)
+#ifdef WINDDK_BUILD
+#include <windows.h>
+#define getpid GetCurrentProcessId
+#else
 #include <process.h>	/* for getpid() */
 #endif
+#endif
 
 #include <signal.h>
 #include <stdlib.h>
diff -ru nss-3.14.3.orig/mozilla/security/nss/cmd/platlibs.mk nss-3.14.3/mozilla/security/nss/cmd/platlibs.mk
--- nss-3.14.3.orig/mozilla/security/nss/cmd/platlibs.mk	2012-11-13 20:14:08.000000000 -0500
+++ nss-3.14.3/mozilla/security/nss/cmd/platlibs.mk	2013-03-10 12:58:50.024892300 -0400
@@ -195,3 +195,11 @@
 endif
 
 JAR_LIBS = $(DIST)/lib/$(LIB_PREFIX)jar.$(LIB_SUFFIX)
+
+ifdef WINDDK_BUILD
+ifdef USE_64
+OS_LIBS += msvcrt_win2003.obj
+else
+OS_LIBS += msvcrt_winxp.obj
+endif
+endif
diff -ru nss-3.14.3.orig/mozilla/security/nss/cmd/selfserv/selfserv.c nss-3.14.3/mozilla/security/nss/cmd/selfserv/selfserv.c
--- nss-3.14.3.orig/mozilla/security/nss/cmd/selfserv/selfserv.c	2012-09-27 13:13:34.000000000 -0400
+++ nss-3.14.3/mozilla/security/nss/cmd/selfserv/selfserv.c	2013-03-10 12:58:50.054894100 -0400
@@ -18,8 +18,13 @@
 #endif
 
 #if defined(_WINDOWS)
+#ifdef WINDDK_BUILD
+#include <windows.h>
+#define getpid GetCurrentProcessId
+#else
 #include <process.h>	/* for getpid() */
 #endif
+#endif
 
 #include <signal.h>
 #include <stdlib.h>
diff -ru nss-3.14.3.orig/mozilla/security/nss/lib/freebl/mpi/mpcpucache.c nss-3.14.3/mozilla/security/nss/lib/freebl/mpi/mpcpucache.c
--- nss-3.14.3.orig/mozilla/security/nss/lib/freebl/mpi/mpcpucache.c	2012-11-21 18:26:22.000000000 -0500
+++ nss-3.14.3/mozilla/security/nss/lib/freebl/mpi/mpcpucache.c	2013-03-10 12:58:50.082895700 -0400
@@ -47,7 +47,11 @@
 
 #elif defined(_MSC_VER)
 
+#ifdef WINDDK_BUILD
+#include <ntddk.h>
+#else
 #include <intrin.h>
+#endif
 
 void freebl_cpuid(unsigned long op, unsigned long *eax, 
            unsigned long *ebx, unsigned long *ecx, 
diff -ru nss-3.14.3.orig/mozilla/security/nss/lib/freebl/win_rand.c nss-3.14.3/mozilla/security/nss/lib/freebl/win_rand.c
--- nss-3.14.3.orig/mozilla/security/nss/lib/freebl/win_rand.c	2012-11-14 08:29:09.000000000 -0500
+++ nss-3.14.3/mozilla/security/nss/lib/freebl/win_rand.c	2013-03-10 13:11:45.176228500 -0400
@@ -12,6 +12,11 @@
 #include <io.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef WINDDK_BUILD
+#ifndef stat
+#define stat _stat
+#endif
+#endif
 #include <stdio.h>
 #include "prio.h"
 #include "prerror.h"
diff -ru nss-3.14.3.orig/mozilla/security/nss/lib/softoken/legacydb/config.mk nss-3.14.3/mozilla/security/nss/lib/softoken/legacydb/config.mk
--- nss-3.14.3.orig/mozilla/security/nss/lib/softoken/legacydb/config.mk	2012-11-13 20:14:11.000000000 -0500
+++ nss-3.14.3/mozilla/security/nss/lib/softoken/legacydb/config.mk	2013-03-10 12:58:50.149899500 -0400
@@ -59,3 +59,11 @@
 ifeq ($(OS_TARGET),SunOS)
 OS_LIBS += -lbsm 
 endif
+
+ifdef WINDDK_BUILD
+ifdef USE_64
+OS_LIBS += msvcrt_win2003.obj
+else
+OS_LIBS += msvcrt_winxp.obj
+endif
+endif
diff -ru nss-3.14.3.orig/mozilla/security/nss/lib/sqlite/sqlite3.c nss-3.14.3/mozilla/security/nss/lib/sqlite/sqlite3.c
--- nss-3.14.3.orig/mozilla/security/nss/lib/sqlite/sqlite3.c	2012-12-15 09:02:55.000000000 -0500
+++ nss-3.14.3/mozilla/security/nss/lib/sqlite/sqlite3.c	2013-03-10 12:58:50.358911500 -0400
@@ -14204,7 +14204,8 @@
 ** localtime_s().
 */
 #if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
-     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
+     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE) && \
+     !defined(WINDDK_BUILD)
 #define HAVE_LOCALTIME_S 1
 #endif
 
diff -ru nss-3.14.3.orig/mozilla/security/nss/lib/ssl/sslimpl.h nss-3.14.3/mozilla/security/nss/lib/ssl/sslimpl.h
--- nss-3.14.3.orig/mozilla/security/nss/lib/ssl/sslimpl.h	2012-11-13 20:14:12.000000000 -0500
+++ nss-3.14.3/mozilla/security/nss/lib/ssl/sslimpl.h	2013-03-10 12:58:50.385913000 -0400
@@ -1792,8 +1792,13 @@
 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
 #define SSL_GETPID getpid
 #elif defined(WIN32)
+#ifdef WINDDK_BUILD
+#include <windows.h>
+#define SSL_GETPID GetCurrentProcessId
+#else
 extern int __cdecl _getpid(void);
 #define SSL_GETPID _getpid
+#endif
 #else
 #define SSL_GETPID() 0
 #endif
diff -ru nss-3.14.3.orig/mozilla/security/nss/lib/zlib/config.mk nss-3.14.3/mozilla/security/nss/lib/zlib/config.mk
--- nss-3.14.3.orig/mozilla/security/nss/lib/zlib/config.mk	2012-04-25 10:50:18.000000000 -0400
+++ nss-3.14.3/mozilla/security/nss/lib/zlib/config.mk	2013-03-10 12:58:50.407914300 -0400
@@ -14,3 +14,11 @@
 PROGRAM        =
 
 EXTRA_LIBS     = $(LIBRARY)
+
+ifdef WINDDK_BUILD
+ifdef USE_64
+OS_LIBS += msvcrt_win2003.obj
+else
+OS_LIBS += msvcrt_winxp.obj
+endif
+endif
