diff --git a/dvbapi.c b/dvbapi.c index c0c8c52..78f2b17 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -47,7 +47,7 @@ #include "hook.h" #include "common.h" -#include "C_support.h" +//#include "C_support.h" #include "tv_info.h" #include "utlist.h" #include "types.h" diff --git a/hook.c b/hook.c index 49ada1f..017b35d 100644 --- a/hook.c +++ b/hook.c @@ -1,4 +1,6 @@ #include "hook.h" +#include "log.h" +#include #include #define cacheflush(from, size) __clear_cache((void*)from, (void*)((unsigned long)from+size)) @@ -7,6 +9,67 @@ #define LUI_T9_0 0x3C190000 #define ORI_T9_0 0x37390000 +typedef union +{ + const void *procs[100]; + const char *names[100]; +} samyGO_CTX_t; + + +int dyn_sym_tab_init(void *h, dyn_fn_t *fn_tab, uint32_t cnt) { + void *sdal=dlopen("libSDAL.so",RTLD_LAZY); + for(int i = 0; i < cnt; i++) { + void *fn=0; + if(sdal) + fn = dlsym(sdal, fn_tab[i].name); + if(!fn) + fn = dlsym(h, fn_tab[i].name); + if(!fn) + { + log("dlsym '%s' failed.\n", fn_tab[i].name); + continue; + //return -1; + } + + log("%s [%p].\n", fn_tab[i].name, fn); + + fn_tab[i].fn = fn; + } + return 0; +} + + + +int samyGO_whacky_t_init(void *h, void *paramCTX, uint32_t cnt) { + samyGO_CTX_t *ctx; + ctx=paramCTX; + void *fn; + void *sdal=dlopen("libSDAL.so",RTLD_LAZY); + for(int i = 0; i < cnt ; i++) { + if(!ctx->procs[i]) + continue; + fn=0; + if(sdal) + fn = dlsym(sdal, ctx->procs[i]); + if(!fn) + fn = dlsym(h, ctx->procs[i]); + + if(!fn && !(fn=C_find(h,ctx->procs[i]))) { + log("dlsym '%s' failed.\n", ctx->procs[i]); + } else { + log("%s [%p].\n", ctx->procs[i], fn); + } + ctx->procs[i] = fn; + } + return 0; +} + + + + + + + void hijack_start( sym_hook_t *sa, void *target, void *_new) { diff --git a/hook.h b/hook.h index ac3fb3d..b173663 100644 --- a/hook.h +++ b/hook.h @@ -3,6 +3,7 @@ #include "common.h" +#include "C_support.h" //#define HIJACK_SIZE 12 @@ -16,8 +17,16 @@ typedef struct } sym_hook_t; + + EXTERN_C_BEGIN +typedef struct +{ + void *fn; + const char *name; +} dyn_fn_t; + void hijack_start( sym_hook_t *sa, void *target, void *_new); @@ -30,6 +39,10 @@ void hijack_resume( void hijack_stop( sym_hook_t *sa); + EXTERN_C_END +int dyn_sym_tab_init(void *h, dyn_fn_t *fn_tab, uint32_t cnt); +int samyGO_whacky_t_init(void *h, void *paramCTX, uint32_t cnt); + #endif //__HOOK_H__ diff --git a/types.h b/types.h index aceee2a..4a46e46 100644 --- a/types.h +++ b/types.h @@ -2,6 +2,17 @@ #define NULL (void *)0 #endif +#define STATIC static + +#define _FILE_OFFSET_BITS 64 + +#ifndef _LARGEFILE64_H +#define _LARGEFILE64_H +#endif + +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE 1 +#endif typedef unsigned char u8; @@ -135,3 +146,6 @@ typedef struct ca_descr_mode { enum ca_descr_algo algo; enum ca_descr_cipher_mode cipher_mode; } ca_descr_mode_t; + + + diff --git a/util.h b/util.h index 7bbafe6..2e77557 100644 --- a/util.h +++ b/util.h @@ -88,38 +88,34 @@ char* getOptArg(char **argv, int argc, char *option) #define cacheflush(from, size) __clear_cache((void*)from, (void*)((unsigned long)from+size)) -typedef struct -{ - void *fn; - const char *name; -} dyn_fn_t; - -STATIC int dyn_sym_tab_init( - void *h, dyn_fn_t *fn_tab, uint32_t cnt) -{ - void *sdal=dlopen("libSDAL.so",RTLD_LAZY); - for(int i = 0; i < cnt; i++) - { - void *fn=0; - if(sdal) - fn = dlsym(sdal, fn_tab[i].name); - if(!fn) - fn = dlsym(h, fn_tab[i].name); - if(!fn) - { - log("dlsym '%s' failed.\n", fn_tab[i].name); - continue; - //return -1; - } - log("%s [%p].\n", fn_tab[i].name, fn); - fn_tab[i].fn = fn; - } - return 0; -} +//STATIC int dyn_sym_tab_init( +// void *h, dyn_fn_t *fn_tab, uint32_t cnt) +//{ +// void *sdal=dlopen("libSDAL.so",RTLD_LAZY); +// for(int i = 0; i < cnt; i++) +// { +// void *fn=0; +// if(sdal) +// fn = dlsym(sdal, fn_tab[i].name); +// if(!fn) +// fn = dlsym(h, fn_tab[i].name); +// if(!fn) +// { +// log("dlsym '%s' failed.\n", fn_tab[i].name); +// continue; +// //return -1; +// } +// +// log("%s [%p].\n", fn_tab[i].name, fn); +// +// fn_tab[i].fn = fn; +// } +// return 0; +//} void log_buf(char *name, unsigned char *buf) { @@ -166,38 +162,7 @@ STATIC int remove_hooks( } } -typedef union -{ - const void *procs[100]; - const char *names[100]; -} samyGO_CTX_t; -//STATIC int samyGO_whacky_t_init(void *h, samyGO_whacky_t *ctx, uint32_t cnt) -STATIC int samyGO_whacky_t_init(void *h, void *paramCTX, uint32_t cnt) -{ - samyGO_CTX_t *ctx; - ctx=paramCTX; - void *fn; - void *sdal=dlopen("libSDAL.so",RTLD_LAZY); - for(int i = 0; i < cnt ; i++) - { - if(!ctx->procs[i]) - continue; - fn=0; - if(sdal) - fn = dlsym(sdal, ctx->procs[i]); - if(!fn) - fn = dlsym(h, ctx->procs[i]); - - if(!fn && !(fn=C_find(h,ctx->procs[i]))) { - log("dlsym '%s' failed.\n", ctx->procs[i]); - } else { - log("%s [%p].\n", ctx->procs[i], fn); - } - ctx->procs[i] = fn; - } - return 0; -} #include void *sgo_shmem_open(