Skip to content

Instantly share code, notes, and snippets.

@ma34s
Created February 4, 2013 23:06
Show Gist options
  • Select an option

  • Save ma34s/4710603 to your computer and use it in GitHub Desktop.

Select an option

Save ma34s/4710603 to your computer and use it in GitHub Desktop.
toolboxのコールログを取るダミーtoolbox と、tooxboxのmountを差し替えする場合のサンプルコード
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 );
}
@ma34s
Copy link
Copy Markdown
Author

ma34s commented Feb 5, 2013

これは、マジでコンパイル通らない そして処理もまずいので見ては行けません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment