From 174db2fd950e702c0f1494e6b28de2ae0419e37e Mon Sep 17 00:00:00 2001 From: Amos <48657826+Mauler125@users.noreply.github.com> Date: Sun, 6 Feb 2022 15:44:39 +0100 Subject: [PATCH] Initialize Winsock --- r5dev/core/init.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index 88dcfb9d..43f9f511 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -68,6 +68,14 @@ void Systems_Init() { + // Initialize winsock system + WSAData wsaData{}; + int nError = ::WSAStartup(MAKEWORD(2, 2), &wsaData); + if (nError != 0) + { + assert(nError != 0 && "Failed to start Winsock via WSAStartup."); + } + // Begin the detour transaction to hook the the process DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); @@ -137,6 +145,13 @@ void Systems_Init() void Systems_Shutdown() { + // Shutdown winsock system + int nError = ::WSACleanup(); + if (nError != 0) + { + assert(nError != 0 && "Failed to stop winsock via WSACleanup.\n"); + } + // Begin the detour transaction to unhook the the process DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread());