2016-01-06 00:01:17 +09:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// main.h
|
|
|
|
// 8/23/2013 jichi
|
|
|
|
// Branch: ITH/IHF_DLL.h, rev 66
|
|
|
|
|
2018-08-23 11:53:23 -04:00
|
|
|
#include "common.h"
|
2018-08-24 12:50:20 -04:00
|
|
|
#include "types.h"
|
2016-01-06 00:01:17 +09:00
|
|
|
|
2018-11-10 23:29:12 -05:00
|
|
|
void TextOutput(ThreadParam tp, BYTE* text, int len);
|
2018-12-01 15:53:54 -05:00
|
|
|
void ConsoleOutput(LPCSTR text, ...);
|
2019-06-09 00:48:30 -04:00
|
|
|
void NotifyHookFound(HookParam hp, wchar_t* text);
|
2019-02-27 11:33:17 -05:00
|
|
|
void NotifyHookRemove(uint64_t addr, LPCSTR name);
|
2018-11-10 23:29:12 -05:00
|
|
|
void NewHook(HookParam hp, LPCSTR name, DWORD flag = HOOK_ENGINE);
|
2019-06-10 01:49:11 -04:00
|
|
|
void RemoveHook(uint64_t addr, int maxOffset = 9, bool markRemoved = false);
|
2016-01-06 00:01:17 +09:00
|
|
|
|
2019-02-16 03:17:16 -05:00
|
|
|
extern "C" // minhook library
|
|
|
|
{
|
|
|
|
enum MH_STATUS
|
|
|
|
{
|
|
|
|
MH_OK,
|
|
|
|
MH_ERROR_ALREADY_INITIALIZED,
|
|
|
|
MH_ERROR_NOT_INITIALIZED,
|
|
|
|
MH_ERROR_ALREADY_CREATED,
|
|
|
|
MH_ERROR_NOT_CREATED,
|
|
|
|
MH_ERROR_ENABLED,
|
|
|
|
MH_ERROR_DISABLED,
|
|
|
|
MH_ERROR_NOT_EXECUTABLE,
|
|
|
|
MH_ERROR_UNSUPPORTED_FUNCTION,
|
|
|
|
MH_ERROR_MEMORY_ALLOC,
|
|
|
|
MH_ERROR_MEMORY_PROTECT,
|
|
|
|
MH_ERROR_MODULE_NOT_FOUND,
|
|
|
|
MH_ERROR_FUNCTION_NOT_FOUND
|
|
|
|
};
|
|
|
|
|
|
|
|
MH_STATUS WINAPI MH_Initialize(VOID);
|
|
|
|
MH_STATUS WINAPI MH_Uninitialize(VOID);
|
|
|
|
|
|
|
|
// Creates a Hook for the specified target function, in disabled state.
|
|
|
|
// Parameters:
|
|
|
|
// pTarget [in] A pointer to the target function, which will be
|
|
|
|
// overridden by the detour function.
|
|
|
|
// pDetour [in] A pointer to the detour function, which will override
|
|
|
|
// the target function.
|
|
|
|
// ppOriginal [out] A pointer to the trampoline function, which will be
|
|
|
|
// used to call the original target function.
|
|
|
|
// This parameter can be NULL.
|
|
|
|
MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal);
|
|
|
|
MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
|
|
|
|
MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
|
|
|
|
MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget);
|
2019-06-02 02:09:17 -04:00
|
|
|
MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
|
|
|
|
MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
|
|
|
|
MH_STATUS WINAPI MH_ApplyQueued(VOID);
|
2019-02-16 03:17:16 -05:00
|
|
|
const char* WINAPI MH_StatusToString(MH_STATUS status);
|
|
|
|
}
|
|
|
|
|
2019-06-02 02:09:17 -04:00
|
|
|
#define MH_ALL_HOOKS NULL
|
|
|
|
|
2018-09-22 15:45:54 -04:00
|
|
|
#define ITH_RAISE (*(int*)0 = 0) // raise C000005, for debugging only
|
|
|
|
#define ITH_TRY __try
|
|
|
|
#define ITH_EXCEPT __except(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
#define ITH_WITH_SEH(...) ITH_TRY { __VA_ARGS__; } ITH_EXCEPT {}
|
|
|
|
|
2016-01-06 00:01:17 +09:00
|
|
|
// EOF
|