mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-29 05:41:02 +00:00
Creating a quick get_WSAErrorStr function to act as a wrapper for FormatMessageA so we can string-ify Winsock errors properly
Untested!
This commit is contained in:
parent
0e6c5cf342
commit
ab38e6cebb
1 changed files with 22 additions and 0 deletions
22
src/i_tcp.c
22
src/i_tcp.c
|
@ -262,6 +262,28 @@ static void wattcp_outch(char s)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_WINSOCK
|
||||||
|
// stupid microsoft makes things complicated
|
||||||
|
static inline char *get_WSAErrorStr(int e)
|
||||||
|
{
|
||||||
|
char *buf = NULL;
|
||||||
|
|
||||||
|
FormatMessageA(
|
||||||
|
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
|
NULL,
|
||||||
|
(DWORD)e,
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(LPTSTR)&buf,
|
||||||
|
0, NULL);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#undef strerror
|
||||||
|
#define strerror get_WSAErrorStr
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
#ifdef USE_WINSOCK2
|
||||||
#define inet_ntop inet_ntopA
|
#define inet_ntop inet_ntopA
|
||||||
#define HAVE_NTOP
|
#define HAVE_NTOP
|
||||||
|
|
Loading…
Reference in a new issue