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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include "pch.h"
#include "sourceinterface.h"
#include "hooks.h"
#include "hookutils.h"
#include "sourceconsole.h"
// really wanted to do a modular callback system here but honestly couldn't be bothered so hardcoding stuff for now: todo later
CreateInterfaceFn clientCreateInterfaceOriginal;
void* ClientCreateInterfaceHook(const char* pName, int* pReturnCode)
{
void* ret = clientCreateInterfaceOriginal(pName, pReturnCode);
spdlog::info("CreateInterface CLIENT {}", pName);
if (!strcmp(pName, "GameClientExports001"))
InitialiseConsoleOnInterfaceCreation();
return ret;
}
CreateInterfaceFn serverCreateInterfaceOriginal;
void* ServerCreateInterfaceHook(const char* pName, int* pReturnCode)
{
void* ret = serverCreateInterfaceOriginal(pName, pReturnCode);
spdlog::info("CreateInterface SERVER {}", pName);
return ret;
}
CreateInterfaceFn engineCreateInterfaceOriginal;
void* EngineCreateInterfaceHook(const char* pName, int* pReturnCode)
{
void* ret = engineCreateInterfaceOriginal(pName, pReturnCode);
spdlog::info("CreateInterface ENGINE {}", pName);
return ret;
}
ON_DLL_LOAD("client.dll", ClientInterface, (HMODULE baseAddress)
{
HookEnabler hook;
ENABLER_CREATEHOOK(
hook,
GetProcAddress(baseAddress, "CreateInterface"),
&ClientCreateInterfaceHook,
reinterpret_cast<LPVOID*>(&clientCreateInterfaceOriginal));
})
ON_DLL_LOAD("server.dll", ServerInterface, (HMODULE baseAddress)
{
HookEnabler hook;
ENABLER_CREATEHOOK(
hook,
GetProcAddress(baseAddress, "CreateInterface"),
&ServerCreateInterfaceHook,
reinterpret_cast<LPVOID*>(&serverCreateInterfaceOriginal));
})
ON_DLL_LOAD("engine.dll", EngineInterface, (HMODULE baseAddress)
{
HookEnabler hook;
ENABLER_CREATEHOOK(
hook,
GetProcAddress(baseAddress, "CreateInterface"),
&EngineCreateInterfaceHook,
reinterpret_cast<LPVOID*>(&engineCreateInterfaceOriginal));
})
|