diff --git a/unityhook/config.c b/unityhook/config.c index 3fd92899..f0de6568 100644 --- a/unityhook/config.c +++ b/unityhook/config.c @@ -1,6 +1,8 @@ #include "config.h" void unity_config_load(struct unity_config *cfg, const wchar_t *filename) { + cfg->enable = GetPrivateProfileIntW(L"unity",L"enable",1,filename); + GetPrivateProfileStringW( L"unity", L"targetAssembly", diff --git a/unityhook/config.h b/unityhook/config.h index db26b8e5..6fca14a7 100644 --- a/unityhook/config.h +++ b/unityhook/config.h @@ -1,8 +1,11 @@ #pragma once +#include + #include struct unity_config { + bool enable; wchar_t target_assembly[MAX_PATH]; }; diff --git a/unityhook/hook.c b/unityhook/hook.c index aa0deb06..060233b9 100644 --- a/unityhook/hook.c +++ b/unityhook/hook.c @@ -34,6 +34,10 @@ static const struct hook_symbol unity_kernel32_syms[] = { void unity_hook_init(const struct unity_config *cfg, HINSTANCE self) { assert(cfg != NULL); + if (!cfg->enable) { + return; + } + if (unity_hook_initted) { return; }