void my_init(void) __attribute__((constructor));
int (*old__system_property_get)(const char *name, char *value)=NULL;
int new__system_property_get(const char *name, char *value)
{
printf
(
"new__system_property_get in !!"
);
//
此句执行正常
[COLOR=
"Red"
]
return
old__system_property_get(name,value);[
/COLOR
]
//
执行到这里报错
}
void my_init(void)
{
void* libc=dlopen(
"/system/lib/libc.so"
,0);
void *p__system_property_get=dlsym(libc,
"__system_property_get"
);
if
(registerInlineHook((uint32_t)p__system_property_get,(uint32_t) new__system_property_get,(uint32_t **) &old__system_property_get)!= ELE7EN_OK)
printf
(
"error find __system_property_get "
);
else
if
(inlineHook((uint32_t) p__system_property_get) != ELE7EN_OK)
printf
(
"error hook __system_property_get "
);
}