2024-02-06 08:24:58 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2024-02-10 22:48:10 +00:00
|
|
|
#include "idmac/config.h"
|
2024-02-06 08:24:58 +00:00
|
|
|
|
|
|
|
#include "hook/process.h"
|
|
|
|
|
|
|
|
#include "hooklib/spike.h"
|
|
|
|
|
|
|
|
#include "platform/clock.h"
|
|
|
|
#include "platform/config.h"
|
|
|
|
#include "platform/ttxsec.h"
|
|
|
|
|
|
|
|
#include "util/dprintf.h"
|
|
|
|
|
|
|
|
static process_entry_t app_startup;
|
|
|
|
|
|
|
|
static DWORD CALLBACK app_pre_startup(void)
|
|
|
|
{
|
|
|
|
struct clock_config clock_cfg;
|
|
|
|
struct ttxsec_config ttxsec_cfg;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
dprintf("--- Begin %s ---\n", __func__);
|
|
|
|
|
|
|
|
clock_config_load(&clock_cfg, L".\\taitools.ini");
|
|
|
|
ttxsec_config_load(&ttxsec_cfg, L".\\taitools.ini");
|
|
|
|
spike_hook_init(L".\\taitools.ini");
|
|
|
|
|
|
|
|
hr = clock_hook_init(&clock_cfg);
|
|
|
|
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ttxsec_hook_init(&ttxsec_cfg, 1);
|
|
|
|
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
dprintf("--- End %s ---\n", __func__);
|
|
|
|
|
|
|
|
return app_startup();
|
|
|
|
|
|
|
|
fail:
|
|
|
|
ExitProcess(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (cause != DLL_PROCESS_ATTACH) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = process_hijack_startup(app_pre_startup, &app_startup);
|
|
|
|
|
|
|
|
if (!SUCCEEDED(hr)) {
|
|
|
|
dprintf("Failed to hijack process startup: %x\n", (int) hr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return SUCCEEDED(hr);
|
|
|
|
}
|