1 #ifndef WIN32_LEAN_AND_MEAN 2 #define WIN32_LEAN_AND_MEAN 3 #endif 4 #undef __CRT__NO_INLINE 5 #define __CRT__NO_INLINE 6 #include <winsock2.h> 7 #include <ws2tcpip.h> 8 gai_strerrorW(int ecode)9WCHAR *gai_strerrorW(int ecode) 10 { 11 DWORD dwMsgLen __attribute__((unused)); 12 static WCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1]; 13 dwMsgLen = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_MAX_WIDTH_MASK, 14 NULL, ecode, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPWSTR)buff, 15 GAI_STRERROR_BUFFER_SIZE, NULL); 16 return buff; 17 } 18