Revision 306632346634 () - Diff

Link to this snippet: https://friendpaste.com/4egvgn7lOeIVOGkbROCnOC
Embed:
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include "main.h"
#include "detours.h"

typedef void (WINAPI *ctFunc)(void);
typedef char* (WINAPI *gtFunc)(void);
typedef void (WINAPI *atFunc)(const char*, unsigned long, bool);
typedef void* (WINAPI *ftFunc)(int);

ctFunc clear_text = reinterpret_cast<ctFunc>(0x66023a70);
gtFunc get_text = reinterpret_cast<gtFunc>(0x66023a10);
atFunc append_text = reinterpret_cast<atFunc>(0x66028870);
ftFunc find_edit = reinterpret_cast<ftFunc>(0x660231f0);

void Mget_text();
char* Mclear_text();
void Mappend_text(const char*, unsigned long, bool);

extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
{
// __asm("mov eax, 1");
//MessageBox(0, "Attached.", "msg", MB_OK | MB_ICONINFORMATION);
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)get_text, (PVOID) Mget_text);
DetourAttach(&(PVOID&)clear_text, (PVOID) Mclear_text);
DetourAttach(&(PVOID&)append_text, (PVOID) Mappend_text);
DetourTransactionCommit();
}
break;

case DLL_PROCESS_DETACH:
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)get_text, (PVOID) Mget_text);
DetourDetach(&(PVOID&)clear_text, (PVOID) Mclear_text);
DetourDetach(&(PVOID&)append_text, (PVOID) Mappend_text);
DetourTransactionCommit();
}
break;

case DLL_THREAD_ATTACH:
// attach to thread
break;

case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // successful
}

void Mget_text()
{
}

char* Mclear_text()
{
}

void Mappend_text(const char* txt, unsigned long color, bool unk)
{
}

/* Errors:

Z]+0x8)||undefined reference to `_SEH_prolog4'|
Z]+0x72)||undefined reference to `_SEH_epilog4'|
Z]+0x8)||undefined reference to `_SEH_prolog4'|
Z]+0x5e)||undefined reference to `_SEH_epilog4'|
0]+0x56)||undefined reference to `??3@YAXPAX@Z'|
0]+0x83)||undefined reference to `??3@YAXPAX@Z'|
4]+0xf)||undefined reference to `__security_cookie'|
4]+0x1d2)||undefined reference to `??3@YAXPAX@Z'|
4]+0x1ff)||undefined reference to `??3@YAXPAX@Z'|
4]+0x236)||undefined reference to `@__security_check_cookie@4'|
4]+0x20)||undefined reference to `??2@YAPAXI@Z'|
4]+0x46)||undefined reference to `??3@YAXPAX@Z'|
20]+0xbc)||undefined reference to `??2@YAPAXI@Z'|
20]+0x1f0)||undefined reference to `??3@YAXPAX@Z'|
8]+0x56)||undefined reference to `??2@YAPAXI@Z'|
8]+0xed)||undefined reference to `??3@YAXPAX@Z'|
16]+0x7)||undefined reference to `__security_cookie'|
16]+0x39)||undefined reference to `@__security_check_cookie@4'|
||=== Build finished: 18 errors, 0 warnings ===|

*/