From b980d4bcb3f1c5372b1497157717b747b0ba24ef Mon Sep 17 00:00:00 2001 From: devseed Date: Wed, 16 Oct 2024 15:17:06 +0900 Subject: [PATCH] remove winhook_inlinehook interface --- project/windll_winhook/src/libwinhook.c | 1 - project/windll_winhook/src/libwinhook_test.c | 1 - project/winexe_winloader/src/winloader.c | 1 - src/commdef.h | 6 +++ src/winhook.h | 42 +------------------- 5 files changed, 7 insertions(+), 44 deletions(-) diff --git a/project/windll_winhook/src/libwinhook.c b/project/windll_winhook/src/libwinhook.c index d27518b..5efa171 100644 --- a/project/windll_winhook/src/libwinhook.c +++ b/project/windll_winhook/src/libwinhook.c @@ -1,5 +1,4 @@ #define WINHOOK_IMPLEMENTATION #define WINHOOK_SHARED #define WINHOOK_USEDYNBIND -#define WINHOOK_NO3RDLIB #include "winhook.h" \ No newline at end of file diff --git a/project/windll_winhook/src/libwinhook_test.c b/project/windll_winhook/src/libwinhook_test.c index ae6ce64..5fa838c 100644 --- a/project/windll_winhook/src/libwinhook_test.c +++ b/project/windll_winhook/src/libwinhook_test.c @@ -5,7 +5,6 @@ #define WINHOOK_IMPLEMENTATION #define WINHOOK_USESHELLCODE #endif -#define WINHOOK_NO3RDLIB #include "winhook.h" void test_patchpattern() diff --git a/project/winexe_winloader/src/winloader.c b/project/winexe_winloader/src/winloader.c index ba4e580..cd736f3 100644 --- a/project/winexe_winloader/src/winloader.c +++ b/project/winexe_winloader/src/winloader.c @@ -1,6 +1,5 @@ #include #define WINHOOK_IMPLEMENTATION -#define WINHOOK_NO3RDLIB #include "winhook.h" #ifndef _DEBUG diff --git a/src/commdef.h b/src/commdef.h index f61d034..33826db 100644 --- a/src/commdef.h +++ b/src/commdef.h @@ -20,6 +20,9 @@ #ifndef INLINE #define INLINE __forceinline #endif +#ifndef NOINLINE +#define NOINLINE __declspec(noinline) +#endif #ifndef EXPORT #define EXPORT __declspec(dllexport) #endif @@ -33,6 +36,9 @@ #ifndef INLINE #define INLINE __attribute__((always_inline)) inline #endif +#ifndef NOINLINE +#define NOINLINE __attribute__((noinline)) +#endif #ifndef EXPORT #define EXPORT __attribute__((visibility("default"))) #endif diff --git a/src/winhook.h b/src/winhook.h index a31f5a4..6a3f388 100644 --- a/src/winhook.h +++ b/src/winhook.h @@ -7,7 +7,6 @@ * WINHOOK_SHARED, make function export * WINHOOK_STATIC, make function static * WINHOOK_NOINLINE, don't use inline function - * WINHOOK_NO3RDLIB, don't use 3rd lib for inlinehook * WINHOOK_USEDYNBIND, use dynamic binding for winapi api */ @@ -689,45 +688,6 @@ BOOL winhook_iathookpe(LPCSTR targetDllName, void* mempe, PROC pfnOrg, PROC pfnN return FALSE; } -#ifndef WINHOOK_NO3RDLIB -#ifndef MINHOOK_IMPLEMENTATION -#define MINHOOK_IMPLEMENTATION -#define MINHOOK_STATIC -#endif // MINHOOK_IMPLEMENTATION -#ifdef USECOMPAT -#include "stb_minhook_v1331.h" -#else -#include "stb_minhook.h" -#endif - -int winhook_inlinehooks(PVOID pfnTargets[], PVOID pfnNews[], PVOID pfnOlds[], int n) -{ - int i; - MH_Initialize(); - for(i=0; i