LunaHook-mirror/LunaHook/engine.h

44 lines
1.4 KiB
C
Raw Normal View History

2024-02-07 20:59:24 +08:00
#ifndef __LUNA_ENGINE_H
#define __LUNA_ENGINE_H
2024-07-21 21:04:12 +08:00
extern WCHAR *processName, processPath[MAX_PATH], processName_lower[MAX_PATH]; // cached
2024-02-07 20:59:24 +08:00
extern uintptr_t processStartAddress, processStopAddress;
extern uintptr_t processStartAddress, processStopAddress;
2024-07-21 21:04:12 +08:00
class ENGINE
{
public:
const char *enginename;
bool dontstop; // dont stop even if attached a engine
bool is_engine_certain; // stop when match a engine ,even if not attached
2024-02-07 20:59:24 +08:00
2024-07-21 21:04:12 +08:00
enum class CHECK_BY
{
2024-02-07 20:59:24 +08:00
ALL_TRUE,
2024-07-21 21:04:12 +08:00
FILE,
FILE_ALL,
FILE_ANY,
2024-02-07 20:59:24 +08:00
RESOURCE_STR,
2024-07-21 21:04:12 +08:00
CUSTOM,
2024-02-07 20:59:24 +08:00
};
CHECK_BY check_by;
// const wchar_t* check_by_single;
2024-07-21 21:04:12 +08:00
// std::vector<const wchar_t*>check_by_list;
2024-02-07 20:59:24 +08:00
// std::function<bool()>check_by_custom_function;
2024-07-21 21:04:12 +08:00
typedef std::function<bool()> check_by_custom_function;
typedef std::vector<const wchar_t *> check_by_list;
typedef const wchar_t *check_by_single;
std::variant<check_by_single, check_by_list, check_by_custom_function> check_by_target;
// virtual bool check_by_target(){return false;};
virtual bool attach_function() = 0;
virtual const char *getenginename()
{
if (enginename)
return enginename;
return typeid(*this).name() + 6;
2024-02-07 20:59:24 +08:00
}
2024-07-21 21:04:12 +08:00
ENGINE() : enginename(nullptr), dontstop(false), is_engine_certain(true), check_by(CHECK_BY::ALL_TRUE){};
2024-02-07 20:59:24 +08:00
bool check_function();
};
#endif