diff options
Diffstat (limited to 'source/core')
-rw-r--r-- | source/core/StarNetImpl.hpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/core/StarNetImpl.hpp b/source/core/StarNetImpl.hpp index a84da6d..b7213e7 100644 --- a/source/core/StarNetImpl.hpp +++ b/source/core/StarNetImpl.hpp @@ -4,6 +4,8 @@ #include <winsock2.h> #include <ws2tcpip.h> #include <stdio.h> + +#include "StarString_windows.hpp" #else #ifdef STAR_SYSTEM_FREEBSD #include <sys/types.h> @@ -42,17 +44,19 @@ static WindowsSocketInitializer g_windowsSocketInitializer; inline String netErrorString() { #ifdef STAR_SYSTEM_WINDOWS - LPVOID lpMsgBuf = NULL; + LPWSTR lpMsgBuf = NULL; + int error = WSAGetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, - WSAGetLastError(), + error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR)&lpMsgBuf, 0, NULL); - String result = String((char*)lpMsgBuf); + String result = strf("{} - {}", error, utf16ToString(lpMsgBuf)); if (lpMsgBuf != NULL) LocalFree(lpMsgBuf); |