View previous topic :: View next topic |
Author |
Message |
rb07
Joined: 31 May 2009 Posts: 8
|
Posted: Thu Mar 17, 2011 5:08 pm Post subject: Crash in Windows (built with MinGW) |
|
|
Hi,
Using libminiupnp linked to Transmission has been causing crashes, the fix is simple:
Code: | --- miniupnpc-1.5/miniupnpc.c 2010-12-21 10:14:17.000000000 -0600
+++ miniupnp/miniupnpc.c 2011-03-17 10:04:08.000000000 -0600
@@ -21,16 +21,16 @@
#include <string.h>
#ifdef WIN32
/* Win32 Specific includes and defines */
-#include <winsock2.h>
+#define _WIN32_WINNT 0x0501
#include <ws2tcpip.h>
#include <io.h>
#include <iphlpapi.h>
--- miniupnpc-1.5/miniwget.c 2010-12-21 10:14:17.000000000 -0600
+++ miniupnp/miniwget.c 2011-03-16 18:40:50.000000000 -0600
@@ -11,7 +11,7 @@
#include <ctype.h>
#include "miniupnpc.h"
#ifdef WIN32
-#include <winsock2.h>
+#define _WIN32_WINNT 0x0501
#include <ws2tcpip.h>
#include <io.h>
#define MAXHOSTNAMELEN 64
|
That define means Windows' vesion has to be XP or newer. This is necessary for using freeaddrinfo(), getaddrinfo(), getnameinfo().
ws2tcpip.h includes winsock2.h, so the line taken out was redundant.
The crash is very difficult to debug, its caused by stack corruption, and my guess is that the change in data structures (MIB_IPADDRTABLE, MIB_IPFORWARDROW) is causing it. _________________ R.B. |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Fri Mar 18, 2011 10:25 am Post subject: |
|
|
You mean the code was crashing under Windows 2000 ?
To keep the compatibility with older versions of windows, you can compile the code with -DNO_GETADDRINFO
freeaddrinfo(), getaddrinfo(), getnameinfo() will not be used. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
rb07
Joined: 31 May 2009 Posts: 8
|
Posted: Fri Mar 18, 2011 11:08 pm Post subject: |
|
|
miniupnp wrote: | You mean the code was crashing under Windows 2000 ? |
No, it was crashing with Windows XP sp3, Vista, and 7. _________________ R.B. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
© 2007 Thomas Bernard, author of MiniUPNP.
|