rodecomp/Source/Network/Connection/ConnectionRuntime.cpp
ragnarok-clanker 1dccbfbae5 Maintenance: Annotate globals on their definitions only; drop annotations from header externs
Batch #904 by ragnarok-clanker: no function's compiled code changes; checked with 3 compiled unit(s), including every includer of Source/Contents/MessageTable.h, Source/Contents/Async/AsyncWorkMgr.h, Source/Contents/Emblems/EmblemDataMgr.h, Source/Contents/Hotkeys/UserHotkeyMgr.h, Source/Contents/Messenger/WhisperBlockMgr.h, Source/Contents/Party/AdventurerAgencyMgr.h, Source/Contents/UserData/AccountLinkedUserDataMgr.h, Source/Contents/UserData/CharacterLinkedUserDataMgr.h, Source/Network/TextEncoding.h, Source/Network/Http/CURLMgr.h, Source/Render/Textures/Texture.h, Source/UI/Layout/SnapMgr.h, Source/UI/Party/UIRequestJoinPartyMgr.h, Source/UI/Window/FrameFocus.h, Source/UI/Window/UIWindow.h, Source/Utility/Async/NMessageMgr.h.
2026-10-26 18:25:54 +00:00

57 lines
1.3 KiB
C++

#include "Network/Connection/ConnectionRuntime.h"
#include <windows.h>
namespace {
// STATIC: 0x016FDC94
// GLOBAL: gl_24393
HMODULE module;
}
// STATIC: 0x016FDC8C
// GLOBAL: gl_24391
int(WSAAPI* g_connectionSend)(SOCKET, const char*, int, int);
// STATIC: 0x016FDC90
// GLOBAL: gl_24392
int(WSAAPI* g_connectionReceive)(SOCKET, char*, int, int);
// OFFSET: 0x00C7C400
// FUNCTION: fn_20387
bool CheckConnectionRuntime() {
HMODULE library = LoadLibraryA("ws2_32.dll");
if (!library) {
return true;
}
static const char* names[] = {"connect", "closesocket", "send", "select"};
for (const char* name : names) {
if (GetProcAddress(library, name) != GetProcAddress(module, name)) {
FreeLibrary(library);
return false;
}
}
FreeLibrary(library);
return true;
}
// OFFSET: 0x00C7D020
// FUNCTION: fn_20408
bool InitializeConnections() {
WSADATA data;
WSAStartup(MAKEWORD(1, 1), &data);
module = LoadLibraryA("ws2_32.dll");
g_connectionSend = reinterpret_cast<decltype(g_connectionSend)>(GetProcAddress(module, "send"));
g_connectionReceive = reinterpret_cast<decltype(g_connectionReceive)>(GetProcAddress(module, "recv"));
CheckConnectionRuntime();
return true;
}
// OFFSET: 0x00C7C4B0
// FUNCTION: fn_20388
void ShutdownConnections() {
WSACleanup();
FreeLibrary(module);
}