mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +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
cf0c450536
commit
1d40033de6
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
|
||||
|
||||
#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
|
||||
#define inet_ntop inet_ntopA
|
||||
#define HAVE_NTOP
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue