#4353: [COMPATIBILITY BUG] inet_ntop NEEDS TO BE DEFINED on XP [solution inside]
---------------------------------------+-------------------------
        Reporter:  Gevalt              |      Owner:
            Type:  bug                 |     Status:  new
        Priority:  normal              |  Milestone:  unspecified
       Component:  Engine: Networking  |    Version:  3.1.3
Operating System:  Windows XP          |
---------------------------------------+-------------------------
 Trying to start Warzone 3.1.3 at XP SP3 computer causes error "missing
 entry point for procedure inet_ntop in WS2_32.dll." This means the game
 doesn't start at all.
 The solution is extremely simple - define the inet_ntop function, as shown
 in the link below.
 [http://stackoverflow.com/questions/13731243/what-is-the-windows-xp-
 equivalent-of-inet-pton-or-inetpton]
 [https://social.msdn.microsoft.com/Forums/vstudio/en-
 US/e40465f2-41b7-4243-ad33-15ae9366f4e6/winsock2-error-the-procedure-
 entry-point-xxxx-cold-not-be-located-in-ws232dll?forum=vcgeneral]
 [[BR]]
 [[BR]]
 ''In windows XP you can use these functions:''
 ''Note that you will need a call to WSAStartup to initialize winsock2.''
 {{{
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>

 #include <winsock2.h>
 #include <ws2tcpip.h>


 int inet_pton(int af, const char *src, void *dst)
 {
   struct sockaddr_storage ss;
   int size = sizeof(ss);
   char src_copy[INET6_ADDRSTRLEN+1];

   ZeroMemory(&ss, sizeof(ss));
   /* stupid non-const API */
   strncpy (src_copy, src, INET6_ADDRSTRLEN+1);
   src_copy[INET6_ADDRSTRLEN] = 0;

   if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss,
 &size) == 0) {
     switch(af) {
       case AF_INET:
     *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
     return 1;
       case AF_INET6:
     *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
     return 1;
     }
   }
   return 0;
 }

 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
 {
   struct sockaddr_storage ss;
   unsigned long s = size;

   ZeroMemory(&ss, sizeof(ss));
   ss.ss_family = af;

   switch(af) {
     case AF_INET:
       ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
       break;
     case AF_INET6:
       ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
       break;
     default:
       return NULL;
   }
   /* cannot direclty use &size because of strict aliasing rules */
   return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL,
 dst, &s) == 0)?
           dst : NULL;
 }
 }}}
 ''That's it. Link with ws2_32 library.''

 Please build portable executable with this so I can test whenever it will
 fix the issue for me.
 Thanks in advance.

--
Ticket URL: <http://developer.wz2100.net/ticket/4353>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Warzone2100-project mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/warzone2100-project

Reply via email to