34 lines
722 B
C
34 lines
722 B
C
|
|
#include <windows.h>
|
||
|
|
|
||
|
|
#include <ntdll.h>
|
||
|
|
#include <ace.h>
|
||
|
|
#include <game.h>
|
||
|
|
#include <tp6.h>
|
||
|
|
#include <utils.h>
|
||
|
|
|
||
|
|
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
|
||
|
|
// Only listen to attach
|
||
|
|
if (reason != DLL_PROCESS_ATTACH) {
|
||
|
|
return TRUE;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Dynamically link functions from ntdll
|
||
|
|
ntdll_link();
|
||
|
|
|
||
|
|
// Detect which game the user is trying to run
|
||
|
|
struct game_data game;
|
||
|
|
game_detect(&game);
|
||
|
|
|
||
|
|
// Create fake ACE driver files
|
||
|
|
ace_fake_driver_files();
|
||
|
|
|
||
|
|
// Load both ACE modules
|
||
|
|
HMODULE baseModule = ace_load_base_module(game.name);
|
||
|
|
ace_load_driver_module();
|
||
|
|
|
||
|
|
// ...magic
|
||
|
|
tp6_setup_patcher(&game, instance, baseModule);
|
||
|
|
|
||
|
|
return TRUE;
|
||
|
|
}
|