Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarNetImpl.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-07-27 14:09:12 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-07-27 14:09:12 +1000
commit951fe787c437d43982f5eda77e1f19bf83998bfd (patch)
treed2e0c9a57451be75a968fedb6b7c407911ffbef4 /source/core/StarNetImpl.hpp
parent9e7a2e9bb9976a0f23fad5c0c91b151ffa2db24c (diff)
Networking changes (needs P2P testing, requires clients to update unfortunately)
Diffstat (limited to 'source/core/StarNetImpl.hpp')
-rw-r--r--source/core/StarNetImpl.hpp12
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);