33//
44#include < util.h>
55#include " IOUniformer.h"
6- #include " native_hook.h"
6+ // #include "native_hook.h"
77
8- static list<std::string> ReadOnlyPathMap;
8+ static std:: list<std::string> ReadOnlyPathMap;
99static std::map<std::string/* orig_path*/ , std::string/* new_path*/ > IORedirectMap;
1010static std::map<std::string/* orig_path*/ , std::string/* new_path*/ > RootIORedirectMap;
1111int apiLevel;
@@ -23,11 +23,7 @@ hook_template(void *handle, const char *symbol, void *new_func, void **old_func)
2323 LOGW (" Error: unable to find the Symbol : %s." , symbol);
2424 return ;
2525 }
26- #if defined(__i386__) || defined(__x86_64__)
2726 inlineHookDirect ((unsigned int ) (addr), new_func, old_func);
28- #else
29- GodinHook::NativeHook::registeredHook ((size_t ) addr, (size_t ) new_func, (size_t **) old_func);
30- #endif
3127}
3228
3329static char **patchArgv (char * const *argv) {
@@ -39,7 +35,7 @@ static char **patchArgv(char * const *argv) {
3935 for (j=0 ; j<i; j++) {
4036 res[j] = argv[j];
4137 }
42- if (apiLevel >= 22 ) {
38+ if (apiLevel >= 21 ) {
4339 res[j] = " --compile-pic" ;
4440 j++;
4541 }
@@ -117,7 +113,7 @@ void IOUniformer::readOnly(const char *_path) {
117113
118114bool isReadOnlyPath (const char *_path) {
119115 std::string path (_path);
120- list<std::string>::iterator it;
116+ std:: list<std::string>::iterator it;
121117 for (it = ReadOnlyPathMap.begin (); it != ReadOnlyPathMap.end (); ++it) {
122118 if (startWith (path, *it)) {
123119 return true ;
@@ -643,29 +639,13 @@ void hook_dlopen(int api_level) {
643639
644640void IOUniformer::startUniformer (int api_level, int preview_api_level) {
645641 apiLevel = api_level;
642+ HOOK_SYMBOL (RTLD_DEFAULT, chroot);
646643 HOOK_SYMBOL (RTLD_DEFAULT, kill);
647- HOOK_SYMBOL (RTLD_DEFAULT, __getcwd );
644+ HOOK_SYMBOL (RTLD_DEFAULT, chdir );
648645 HOOK_SYMBOL (RTLD_DEFAULT, truncate);
649- HOOK_SYMBOL (RTLD_DEFAULT, __statfs64);
650646 HOOK_SYMBOL (RTLD_DEFAULT, execve);
651- HOOK_SYMBOL (RTLD_DEFAULT, __open);
652- if ((api_level < 25 ) || (api_level == 25 && preview_api_level == 0 )) {
653- HOOK_SYMBOL (RTLD_DEFAULT, utimes);
654- HOOK_SYMBOL (RTLD_DEFAULT, mkdir);
655- HOOK_SYMBOL (RTLD_DEFAULT, chmod);
656- HOOK_SYMBOL (RTLD_DEFAULT, lstat);
657- HOOK_SYMBOL (RTLD_DEFAULT, link);
658- HOOK_SYMBOL (RTLD_DEFAULT, symlink);
659- HOOK_SYMBOL (RTLD_DEFAULT, mknod);
660- HOOK_SYMBOL (RTLD_DEFAULT, rmdir);
661- HOOK_SYMBOL (RTLD_DEFAULT, chown);
662- HOOK_SYMBOL (RTLD_DEFAULT, rename);
663- HOOK_SYMBOL (RTLD_DEFAULT, stat);
664- HOOK_SYMBOL (RTLD_DEFAULT, chdir);
665- HOOK_SYMBOL (RTLD_DEFAULT, access);
666- HOOK_SYMBOL (RTLD_DEFAULT, readlink);
667- HOOK_SYMBOL (RTLD_DEFAULT, unlink);
668- }
647+
648+ HOOK_SYMBOL (RTLD_DEFAULT, utimes);
669649 HOOK_SYMBOL (RTLD_DEFAULT, fstatat);
670650 HOOK_SYMBOL (RTLD_DEFAULT, fchmodat);
671651 HOOK_SYMBOL (RTLD_DEFAULT, symlinkat);
@@ -680,10 +660,4 @@ void IOUniformer::startUniformer(int api_level, int preview_api_level) {
680660 HOOK_SYMBOL (RTLD_DEFAULT, fchownat);
681661 HOOK_SYMBOL (RTLD_DEFAULT, mknodat);
682662// hook_dlopen(api_level);
683-
684- #if defined(__i386__) || defined(__x86_64__)
685- // Do nothing
686- #else
687- GodinHook::NativeHook::hookAllRegistered ();
688- #endif
689663}
0 commit comments