forked from kubik-jaroslav/ddda-dinput8
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.cpp
More file actions
45 lines (40 loc) · 1.02 KB
/
Copy pathServer.cpp
File metadata and controls
45 lines (40 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "stdafx.h"
#include "Server.h"
string host;
const char *hostPtr;
UINT16 port;
LPVOID oConnect;
void __declspec(naked) HConnect()
{
__asm
{
add esp, 12;
push port;
push hostPtr;
sub esp, 4;
jmp oConnect;
}
}
void Hooks::Server()
{
if (config.getBool("server", "enabled", false))
{
host = config.getStr("server", "host", "dune.dragonsdogma.com");
hostPtr = host.c_str();
port = config.getUInt("server", "port", 12501);
logFile << "Server: using " << host.c_str() << ":" << port << std::endl;
BYTE signature[] =
{
0x83, 0xEC, 0x24, // sub esp, 24h
0x53, // push ebx
0x66, 0x8B, 0x5C, 0x24, 0x30, // mov bx, [esp+28h+port]
0x56, // push esi
0x68 // push offset nulls_string
};
BYTE *pOffset;
if (FindSignature("sDDCaProto::connect", signature, &pOffset))
CreateHook("sDDCaProto::connect", pOffset, &HConnect, &oConnect);
}
else
logFile << "Server: disabled" << std::endl;
}