-
Notifications
You must be signed in to change notification settings - Fork 16
/
windows.cpp
66 lines (49 loc) · 1.85 KB
/
windows.cpp
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
#if defined( _WIN64 ) || defined( _WIN32 )
# include <iostream>
# include "src/wrapper.hpp"
DWORD WINAPI Init( HMODULE module )
{
FILE * output;
if ( AllocConsole() )
{
SetConsoleTitleA( "[Aetherim] Debug Console\n" );
freopen_s( &output, "CONOUT$", "w", stdout );
}
printf( "[Aetherim] Initializing\n" );
Il2cpp::initialize();
printf( "[Aetherim] Initialization Complete\n\n" );
printf( "[Aetherim] Dumping Images\n" );
const auto Aetherim = std::make_unique<Wrapper>();
printf( "[Aetherim] Images Dumped\n\n" );
printf( "[Aetherim] Getting Assembly-CSharp Image\n" );
const auto image = Aetherim->get_image( "Assembly-CSharp.dll" );
printf( "\t[Aetherim] Assembly-CSharp -> %s (0x%Ix)\n\n", image->get_name(), reinterpret_cast<uintptr_t>( image ) );
printf( "[Aetherim] Getting PlayerHandler Class & Fields\n" );
const auto player = image->get_class( "PlayerHandler" );
printf( "\t[Aetherim] PlayerHandler -> %s (0x%Ix)\n\n", player->get_name(), reinterpret_cast<uintptr_t>( player ) );
for ( const auto field : player->get_fields() )
{
printf( "\t[Aetherim] PlayerHandler -> %s (0x%zx)\n", field->get_name(), field->get_offset() );
}
const auto player_instance = player->get_field( "Instance" )->get_as_static();
if ( player_instance != nullptr )
printf( "\t[Aetherim] PlayerHandler -> Static Instance (0x%zx)\n", reinterpret_cast<uintptr_t>( player_instance ) );
Sleep( 60000 );
fclose( output );
FreeConsole();
FreeLibraryAndExitThread( module, 0 );
return 0;
}
DWORD WINAPI DllMain( HINSTANCE module, DWORD reason, void * reserved )
{
if ( reason != DLL_PROCESS_ATTACH )
return FALSE;
const auto thread = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) Init, NULL, 0, NULL );
if ( thread )
{
DisableThreadLibraryCalls( module );
CloseHandle( thread );
}
return TRUE;
}
#endif