DW done maybe

This commit is contained in:
Federico Cecchetto
2022-02-26 00:39:54 +01:00
parent 1f885dd588
commit 857f220e06
9 changed files with 71 additions and 24 deletions

View File

@ -82,14 +82,21 @@ namespace auth
return key;
}
// need to move this somewhere else probably
std::string hash_string(const std::string& str)
{
const auto value = game::generateHashValue(str.data());
return utils::string::va("0x%lX", value);
}
int send_connect_data_stub(game::netsrc_t sock, game::netadr_s* adr, const char* format, const int len)
{
std::string connect_string(format, len);
game::SV_Cmd_TokenizeString(connect_string.data());
const auto _ = gsl::finally([]()
{
game::SV_Cmd_EndTokenizedString();
});
{
game::SV_Cmd_EndTokenizedString();
});
const command::params_sv params;
if (params.size() < 3)
@ -98,7 +105,7 @@ namespace auth
}
const utils::info_string info_string{std::string{params[2]}};
const auto challenge = info_string.get("challenge");
const auto challenge = info_string.get(hash_string("challenge"));
connect_string.clear();
connect_string.append(params[0]);
@ -139,8 +146,8 @@ namespace auth
const utils::info_string info_string{std::string{params[2]}};
const auto steam_id = info_string.get("xuid");
const auto challenge = info_string.get("challenge");
const auto steam_id = info_string.get(hash_string("xuid"));
const auto challenge = info_string.get(hash_string("challenge"));
if (steam_id.empty() || challenge.empty())
{
@ -172,17 +179,17 @@ namespace auth
void* get_direct_connect_stub()
{
return utils::hook::assemble([](utils::hook::assembler& a)
{
a.lea(rcx, qword_ptr(rsp, 0x20));
a.movaps(xmmword_ptr(rsp, 0x20), xmm0);
{
a.lea(rcx, qword_ptr(rsp, 0x20));
a.movaps(xmmword_ptr(rsp, 0x20), xmm0);
a.pushad64();
a.mov(rdx, rdi);
a.call_aligned(direct_connect);
a.popad64();
a.pushad64();
a.mov(rdx, rsi);
a.call_aligned(direct_connect);
a.popad64();
a.jmp(0x140488CE2); // H1MP64(1.4)
});
a.jmp(0x140488CE2); // H1MP64(1.4)
});
}
}

View File

@ -488,7 +488,6 @@ namespace demonware
{
if (library == "WS2_32.dll")
{
printf("%s\n", function.data());
if (function == "#3") return io::closesocket_stub;
if (function == "#4") return io::connect_stub;
if (function == "#5") return io::getpeername_stub;
@ -559,6 +558,8 @@ namespace demonware
utils::hook::set(0x140728380, 0xC301B0);
// Checks extended_data and extra_data in json object
utils::hook::set(0x140728E90, 0xC301B0);
// Update check
utils::hook::set(0x1403A5390, 0xC301B0);
}
void pre_destroy() override

View File

@ -268,10 +268,10 @@ namespace network
// increase allowed packet size
const auto max_packet_size = 0x20000;
utils::hook::set<int>(0x1404255F0, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x14042562E, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425521, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425549, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x1404255F1, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425630, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425522, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425545, max_packet_size); // H1MP64(1.4)
// ignore built in "print" oob command and add in our own
utils::hook::set<uint8_t>(0x14025280E, 0xEB); // H1MP64(1.4)