--- libupnp/configure.ac.orig	2011-02-10 23:53:25.000000000 +0100
+++ libupnp/configure.ac	2011-02-10 23:54:23.574454501 +0100
@@ -546,6 +546,7 @@
 AC_SUBST(PTHREAD_CFLAGS)
 AC_SUBST(PTHREAD_CC)
 
+AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0500' for Windows 2000 APIs.])
 #
 # Determine if pthread_rwlock_t is available
 #
--- libupnp/libupnp.pc.in	2010-12-23 21:24:05.000000000 +0100
+++ libupnp.new/libupnp.pc.in	2011-02-13 11:27:23.000000000 +0100
@@ -6,6 +6,6 @@
 Name: libupnp
 Description: Linux SDK for UPnP Devices
 Version: @VERSION@
-Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml 
+Libs: @PTHREAD_CFLAGS@ -L${libdir} -lupnp -lthreadutil -lixml -liphlpapi @PTHREAD_LIBS@ 
 Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
 
--- libupnp/upnp/src/inc/upnputil.h	2010-12-23 21:24:06.000000000 +0100
+++ libupnp.new/upnp/src/inc/upnputil.h	2011-02-13 08:24:24.000000000 +0100
@@ -125,7 +125,7 @@
 		#define strncasecmp		strnicmp
 		#define sleep(a)		Sleep((a)*1000)
 		#define usleep(a)		Sleep((a)/1000)
-		#define strerror_r(a,b,c)	(strerror_s((b),(c),(a)))
+		#define strerror_r(a,b,c)       strncpy( b, strerror(a), c)
 	#else
 		#define max(a, b)   (((a)>(b))? (a):(b))
 		#define min(a, b)   (((a)<(b))? (a):(b))
--- upnp/upnp/inc/UpnpInet.h	2011-04-03 04:50:36.000000000 +0200
+++ upnp.neww/upnp/inc/UpnpInet.h	2011-11-18 01:54:45.418529337 +0100
@@ -15,11 +15,6 @@
 
 #ifdef WIN32
 	#include <stdarg.h>
-	#ifndef UPNP_USE_MSVCPP
-		/* Removed: not required (and cause compilation issues) */
-		#include <winbase.h>
-		#include <windef.h>
-	#endif
 	#include <winsock2.h>
 	#include <iphlpapi.h>
 	#include <ws2tcpip.h>
