Hello,

I've got the 0.100 version which has my code for compilation under Windows 2000. By default, the binary is not built in a compatible way with Win2K (i.e. unconditionnal use of the IPv6 stack).

The attached patch fixes some minor bugs that were stopping the compilation of this file with the IPv4 code path, which it defaults to.

The new binary works under win2k, whereas the one with IPv6 code would build but run only under WinXP. This due to the mingw ws2_32 import lib declaring that the corresponding dll has freeaddrinfo while only the WinXP version of this dll has it.

I have zipped the result of make install and made it available at
http://christophe.gisquet.free.fr/pan-0.100.zip (604K) for people to test and verify if it works under both Win2K and WinXP. If it does, I would suggest to consider using the legacy (IPv4) path. Otherwise, at least a configure option should provide a mean to compile for Win2K.

For the info, it depends on the value of _WIN32_WINNT, which is 0x0500 AFAIK for Win2K.

Best regards,
Christophe GISQUET
--- socket-impl-gio.old Wed Jun 14 23:01:44 2006
+++ socket-impl-gio.cc  Wed Jun 21 00:43:00 2006
@@ -38,7 +38,7 @@
 
 #ifdef G_OS_WIN32
   // this #define is necessary for mingw
-  #define _WIN32_WINNT 0x0501 
+  #define _WIN32_WINNT 0x0500
   #include <ws2tcpip.h>
   #undef gai_strerror
   #define gai_strerror(i) gai_strerror_does_not_link (i)
@@ -67,8 +67,8 @@
       case 11001: msg = "Host not found"; break;
       default: msg = "Connect failed";
     }
-    g_message (a);
-    OutputDebugString (a);
+    g_message (msg);
+    OutputDebugString (msg);
   }
 
 #else
@@ -127,7 +127,7 @@
 
     struct hostent * ans = isalpha (hostbuf[0])
       ? gethostbyname (hostbuf)
-      : gethostbyaddr (hostbuf, host->len, AF_INET);
+      : gethostbyaddr (hostbuf, host.len, AF_INET);
 
     err = WSAGetLastError();
     if (err || !ans) {
@@ -149,7 +149,7 @@
     memset (&server, 0, sizeof(struct sockaddr_in));
     while (err && ans->h_addr_list[i])
     {
-      unsigned char *addr = ans->h_addr_list[i];
+      char *addr = ans->h_addr_list[i];
       memcpy (&server.sin_addr, addr, ans->h_length);
       server.sin_family = AF_INET;
       server.sin_port = htons(port);
@@ -227,6 +227,7 @@
       ::freeaddrinfo (ans);
       return NULL;
     }
+#endif
 
     GIOChannel * channel = g_io_channel_unix_new (sockfd);
 #ifndef G_OS_WIN32
@@ -237,6 +238,7 @@
     g_io_channel_set_buffered (channel, TRUE);
     g_io_channel_set_line_term (channel, "\r\n", 2);
 
+#if !defined(G_OS_WIN32) || _WIN32_WINNT > 0x0500
     ::freeaddrinfo (ans);
 #endif
     return channel;
_______________________________________________
Pan-devel mailing list
Pan-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/pan-devel

Reply via email to