Files
SatyandClaude Opus 5.5 03de438346 Os: OsNet TCP layer, command line, named events, file version info
The OsNet TCP layer (OsTcp.cpp, platform OsTcpConn.h; signed send-length
compares and 32-bit IoPump elapsed time per the binary),
CommandLineUTF8 (0x86BDB0), CreateNamedEventA (0x86B4F0) and
OsFileVersionInfo (0x872170), Win32 and Win64. Os links version.lib. The
test tools drop their IoPump stand-in. Anti-cheat (bot check, Warden
loader) is left out.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-27 03:04:04 +02:00

66 lines
1.7 KiB
C++

#if defined(WOWDECOMP_ARCH_32)
#include <cstdint>
#include <cwchar>
#include <malloc.h>
#include <windows.h>
#include "Engine/Source/Os/Path.h"
#include "Engine/Source/Storm/H/storm.h"
// STATIC: 0x00D41618
static CommandLineUTF8 s_commandLineUTF8;
// VERIFY: a5cb9704 manual
// OFFSET: 0x0086BBD0
uint32_t GetModuleFileNameUTF8(void* module, char* path, uint32_t size) {
uint32_t wideSize = size * 3 * sizeof(uint16_t);
uint16_t* wide = static_cast<uint16_t*>(_alloca(wideSize));
wide[0] = 0;
GetModuleFileNameW(static_cast<HMODULE>(module), reinterpret_cast<LPWSTR>(wide), wideSize);
uint32_t written;
SUniConvertUTF16to8(path, size, wide, 0x7FFFFFFF, &written, nullptr);
if (size - 1 >= written) {
path[written] = '\0';
} else {
path[size - 1] = '\0';
}
return written;
}
// VERIFY: b42744df manual
// OFFSET: 0x0086BDB0
CommandLineUTF8::CommandLineUTF8() {
const wchar_t* commandLine = GetCommandLineW();
if (!commandLine) {
commandLine = L"";
}
size_t length = wcslen(commandLine);
if (length + 1 < length || length + 1 > SIZE_MAX / sizeof(uint32_t)) {
commandLine = L"";
length = 0;
}
uint32_t size = static_cast<uint32_t>((length + 1) * sizeof(uint32_t));
m_commandLine = static_cast<char*>(SMemAlloc(size, __FILE__, __LINE__, 0));
uint32_t written;
SUniConvertUTF16to8(m_commandLine, size, reinterpret_cast<const uint16_t*>(commandLine), 0x7FFFFFFF, &written, nullptr);
if (size - 1 >= written) {
m_commandLine[written] = '\0';
} else {
m_commandLine[size - 1] = '\0';
}
}
// INLINED
CommandLineUTF8::~CommandLineUTF8() {
delete[] m_commandLine;
}
#endif