hopefully remove dependency on vcredist for good

This commit is contained in:
Akash Mozumdar 2021-11-07 05:54:34 -07:00
parent febff243d3
commit e83579ed7c
10 changed files with 55 additions and 73 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "texthook/minhook"]
path = texthook/minhook
url = https://github.com/TsudaKageyu/minhook.git

View File

@ -1,6 +1,12 @@
include_directories(. util)
include_directories(. util minhook/include)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(minhook_src
minhook/src/buffer.c
minhook/src/hook.c
minhook/src/trampoline.c
minhook/src/hde/hde64.c
)
set(texthook_src
main.cc
texthook.cc
@ -12,6 +18,12 @@ set(texthook_src
util/util.cc
)
else()
set(minhook_src
minhook/src/buffer.c
minhook/src/hook.c
minhook/src/trampoline.c
minhook/src/hde/hde32.c
)
set(texthook_src
main.cc
texthook.cc
@ -27,6 +39,12 @@ set(texthook_src
)
endif()
add_library(minhook ${minhook_src})
add_library(texthook MODULE ${texthook_src})
target_precompile_headers(texthook REUSE_FROM pch)
target_precompile_headers(texthook PRIVATE ../include/common.h)
if(NOT CMAKE_BUILD_TYPE MATCHES DEBUG)
target_compile_options(minhook PRIVATE /MT)
target_compile_options(texthook PRIVATE /MT)
target_link_options(texthook PRIVATE /NODEFAULTLIB:MSVCRT)
endif()
target_link_libraries(texthook minhook)

View File

@ -2,6 +2,7 @@
#include "defs.h"
#include "main.h"
#include "util.h"
#include "MinHook.h"
extern const char* HOOK_SEARCH_STARTING;
extern const char* HOOK_SEARCH_INITIALIZING;

View File

@ -9,6 +9,7 @@
#include "texthook.h"
#include "hookfinder.h"
#include "util.h"
#include "MinHook.h"
extern const char* PIPE_CONNECTED;
extern const char* INSERTING_HOOK;

View File

@ -15,49 +15,6 @@ void RemoveHook(uint64_t addr, int maxOffset = 9);
inline SearchParam spDefault;
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);
MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
MH_STATUS WINAPI MH_ApplyQueued(VOID);
const char* WINAPI MH_StatusToString(MH_STATUS status);
}
#define MH_ALL_HOOKS NULL
#define ITH_RAISE (*(int*)0 = 0) // raise C000005, for debugging only
#define ITH_TRY __try
#define ITH_EXCEPT __except(EXCEPTION_EXECUTE_HANDLER)

1
texthook/minhook Submodule

@ -0,0 +1 @@
Subproject commit 8fda4f5481fed5797dc2651cd91e238e9b3928c6

View File

@ -6,6 +6,7 @@
#include "texthook.h"
#include "main.h"
#include "ithsys/ithsys.h"
#include "MinHook.h"
extern const char* FUNC_MISSING;
extern const char* MODULE_MISSING;

Binary file not shown.

Binary file not shown.