9 #define __RETSTR( x ) case x: return #x;
11 char *WSAGetErrorString( int err )
21 __RETSTR( WSAEWOULDBLOCK )
22 __RETSTR( WSAEINPROGRESS )
23 __RETSTR( WSAEALREADY )
24 __RETSTR( WSAENOTSOCK )
25 __RETSTR( WSAEDESTADDRREQ )
26 __RETSTR( WSAEMSGSIZE )
27 __RETSTR( WSAEPROTOTYPE )
28 __RETSTR( WSAENOPROTOOPT )
29 __RETSTR( WSAEPROTONOSUPPORT )
30 __RETSTR( WSAESOCKTNOSUPPORT )
31 __RETSTR( WSAEOPNOTSUPP )
32 __RETSTR( WSAEPFNOSUPPORT )
33 __RETSTR( WSAEAFNOSUPPORT )
34 __RETSTR( WSAEADDRINUSE )
35 __RETSTR( WSAEADDRNOTAVAIL )
36 __RETSTR( WSAENETDOWN )
37 __RETSTR( WSAENETUNREACH )
38 __RETSTR( WSAENETRESET )
39 __RETSTR( WSAECONNABORTED )
40 __RETSTR( WSAECONNRESET )
41 __RETSTR( WSAENOBUFS )
42 __RETSTR( WSAEISCONN )
43 __RETSTR( WSAENOTCONN )
44 __RETSTR( WSAESHUTDOWN )
45 __RETSTR( WSAETOOMANYREFS )
46 __RETSTR( WSAETIMEDOUT )
47 __RETSTR( WSAECONNREFUSED )
49 __RETSTR( WSAENAMETOOLONG )
50 __RETSTR( WSAEHOSTDOWN )
51 __RETSTR( WSAEHOSTUNREACH )
52 __RETSTR( WSAENOTEMPTY )
53 __RETSTR( WSAEPROCLIM )
57 __RETSTR( WSAEREMOTE )
58 __RETSTR( WSASYSNOTREADY )
59 __RETSTR( WSAVERNOTSUPPORTED )
60 __RETSTR( WSANOTINITIALISED )
61 __RETSTR( WSAEDISCON )
64 __RETSTR( WSAENOMORE )
65 __RETSTR( WSAECANCELLED )
66 __RETSTR( WSAEINVALIDPROCTABLE )
67 __RETSTR( WSAEINVALIDPROVIDER )
68 __RETSTR( WSASYSCALLFAILURE )
69 __RETSTR( WSASERVICE_NOT_FOUND )
70 __RETSTR( WSATYPE_NOT_FOUND )
71 __RETSTR( WSA_E_NO_MORE )
72 __RETSTR( WSA_E_CANCELLED )
73 __RETSTR( WSAEREFUSED )
74 #endif // HAVE_WINSOCK2
76 __RETSTR( WSAHOST_NOT_FOUND )
77 __RETSTR( WSATRY_AGAIN )
78 __RETSTR( WSANO_RECOVERY )
79 __RETSTR( WSANO_DATA )
84 char *WSAGetLastErrorString( void )
86 return WSAGetErrorString( WSAGetLastError() );
91 #endif /* HAVE_WINSOCK */
94 char *GetErrorString( int err )
96 static char msgBuf[1024];
99 FORMAT_MESSAGE_FROM_SYSTEM,
101 err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
102 msgBuf, 1024, NULL );
107 char *GetLastErrorString( void )
109 return GetErrorString( GetLastError() );