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
|
//this cheat was a mistake
#include <thread>
#include <iostream>
#include "hooks.hpp"
#include "console.hpp"
#include "input_system.hpp"
#include "mem.hpp"
HMODULE g_dll;
header_t g_header;
void main_thread( HINSTANCE uh ) {
#ifdef IFACE_DLLMAIN
util::memset( ( uint8_t* )uh, 0x90, 0x1000 );
#endif
g_csgo.initialize( );
while ( !g_csgo.m_panic ) {
std::this_thread::sleep_for( std::chrono::milliseconds( 1 ) );
}
g_csgo.uninitialize( );
ExitThread( 0 );
}
long __stdcall exception_handler( EXCEPTION_POINTERS* e ) {
return EXCEPTION_CONTINUE_EXECUTION;
}
int __stdcall DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) {
HANDLE thread;
uintptr_t wanted_reason;
#ifdef _DEBUG
wanted_reason = DLL_PROCESS_ATTACH;
#else
wanted_reason = DLL_PROCESS_ATTACH;
#endif
if ( reason == wanted_reason
#ifdef IFACE_DLLMAIN
&& !!reserved
#endif
) {
#ifdef IFACE_DLLMAIN
g_factory.init( ( uintptr_t )( reserved ) );
#endif
g_dll = inst;
//yayo
//SetUnhandledExceptionFilter( exception_handler );
#ifdef HEADER_MODULE
memcpy( &g_header, inst, sizeof( g_header ) );
for( size_t i = 1; i < sizeof( header_t ); ++i ) {
*( uint8_t* )( uintptr_t( &g_header ) + i ) ^= g_header.xor_key;
}
#endif
DisableThreadLibraryCalls( inst );
thread = CreateThread( nullptr, 0,
( LPTHREAD_START_ROUTINE )( main_thread ),
inst, 0, nullptr );
if( !thread )
return 0;
CloseHandle( thread );
return 1;
}
#ifdef IFACE_DLLMAIN
else if( !reserved ) {
MessageBoxA( nullptr, "interface data nullptr (loader error?)", "error", MB_OK );
return 1;
}
#endif
if( reason == DLL_PROCESS_DETACH ) {
g_csgo.m_panic = true;
//SetUnhandledExceptionFilter( nullptr );
}
return 0;
}
|