Created
February 4, 2013 23:06
-
-
Save ma34s/4710603 to your computer and use it in GitHub Desktop.
toolboxのコールログを取るダミーtoolbox
と、tooxboxのmountを差し替えする場合のサンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char *argv[]) | |
{ | |
char cmd[1024]; | |
int i; | |
int mount_flag=0; | |
FILE f; | |
sprintf(cmd,"%s",argv[0]); | |
for(i=0;i<argc) | |
{ | |
sprintf(cmd,"%s %s",cmd,argv[i]); | |
} | |
f = fopen("/sdcard/xxxxlog.txt","at"); | |
fprintf(f,"%s\n",cmd); | |
#if 0 | |
//差し替えする場合 | |
if( (strcmp( argv[0] ,"toolbox") )==0 || strcmp( argv[0] ,"/system/bin/toolbox")=0 ) | |
{ | |
if( argc >1 ) | |
{ | |
if( strcmp(argv[1],"mount") ) | |
{ | |
mount_flag=1; | |
} | |
} | |
} | |
else if( (strcmp( argv[0] ,"mount") )==0 || strcmp( argv[0] ,"/system/bin/mount")=0 ) | |
{ | |
mount_flag=1; | |
} | |
else | |
{ | |
mount_flag=0; | |
} | |
if(mount_flag==1) | |
{ | |
//sprintf(cmd,"%s ","/system/xbin/busybox"); | |
sprintf(cmd,"%s ","/sbin/busybox"); | |
for(i=1;i<argc) | |
{ | |
sprintf(cmd,"%s %s",cmd,argv[i]);); | |
} | |
} | |
#endif | |
return system( cmd ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これは、マジでコンパイル通らない そして処理もまずいので見ては行けません。