能力值:
( LV7,RANK:110 )
|
-
-
2 楼
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
....
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
|
能力值:
( LV7,RANK:110 )
|
-
-
5 楼
人家不是给了注释掉的使用范例吗!!!!!!!!!!!!!!!!!!!!!!!!!!!
Skip to content
Personal Open source Business Explore
Sign upSign inPricingBlogSupport
Watch 25 Star 72 Fork 73 ThomasKing2014/ELF-ARM-HOOK-Library
Code Issues 1 Pull requests 0 Pulse Graphs
Branch: master Find file Copy pathELF-ARM-HOOK-Library/utils/TKHooklib.h
17b5907 on Nov 9, 2015
Thomas King Fix some bugs
1 contributor
RawBlameHistory 74 lines (60 sloc) 1.77 KB
#ifndef _TKHOOKLIB_H
#define _TKHOOKLIB_H
#define SOINFO_NAME_LEN 128
#define HOOK_SUCCESS 0
#define HOOK_FAILED -1
typedef struct _HookStruct{
char SOName[SOINFO_NAME_LEN];
char FunctionName[SOINFO_NAME_LEN];
void *NewFunc;
void *OldFunc;
void *occPlace;
}HookStruct;
#ifdef __cplusplus
extern "C" {
#endif
void TK_UnHookExportFunction(HookStruct *pHookStruct);
void TK_UnHookImportFunction(HookStruct *pHookStruct);
/*
** Return: HOOK_SUCCESS or HOOK_FAILED
** Example: Hook libfoo.so Import Function: puts
** HookStruct HookPara;
** strncpy(HookPara.SOName, "libfoo.so", strlen("libfoo.so"));
** strncpy(HookPara.FunctionName, "puts", strlen("puts"));
** HookPara.NewFunc = myputs;
** TK_HookImportFunction(&HookPara);
*/
int TK_HookImportFunction(HookStruct *pHookStruct);
/*
[FONT="Arial Black"][SIZE="7"][B][B][COLOR="Red"]** Return: HOOK_SUCCESS or HOOK_FAILED
** Example: Hook libc.so Export Function: puts
** HookStruct HookPara;
** strncpy(HookPara.SOName, "libc.so", strlen("libc.so"));
** strncpy(HookPara.FunctionName, "puts", strlen("puts"));
** HookPara.NewFunc = myputs;
** TK_HookExportFunction(&HookPara);[/COLOR][/B][/B][/SIZE][/FONT]
*/
int TK_HookExportFunction(HookStruct *pHookStruct);
/*
** Return: HOOK_SUCCESS or HOOK_FAILED
** Example: Inline Hook libc.so Function: puts
** void* OldFunc = NULL;
** TK_InlineHookFunction(puts, myputs, &OldFunc);
** ----------------------------------------------
** For the new implementation of HOOK Bridge, I suggest you add some lock to enhance the stability.
**
**
int myputs(const char *string){
// Do sth before calling ori-function
pthread_mutex_lock(&hook_mutex);
puts(string);
pthread_mutex_unlock(&hook_mutex);
// Do sth after calling ori-function
}
**
*/
int TK_InlineHookFunction(void *TargetFunc, void *NewFunc, void** OldFunc);
#ifdef __cplusplus
};
#endif
#endif
Status API Training Shop Blog About
© 2016 GitHub, Inc. Terms Privacy Security Contact Help
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
看到了 谢谢大大
|
能力值:
( LV4,RANK:40 )
|
-
-
7 楼
找king,如何HOOK Register
|
|
|