Gets the target process module (. So) load address is parsed /proc/[pid]/maps
.
Can be obtained manually through the ADB shell:
①. First view the PID of the process through the PS command
②. Cat/proc/[pid]/maps
Use the program to implement the following code:
#include <stdio.h>intMainintargcChar*argv[]) { if(ARGC! =3) {printf ("pid or SoName error\r\n"); return 1; } pid_t PID= Atoi (argv[1]); Char*lpszsoname = argv[2]; Charszpath[ the] = {0}; Charszlines[1024x768] = {0}; Char*LPCH =NULL; LongAddr =0; intNfind =0; //If you need to view your own modules, you can use//snprintf (szpath, sizeof (szpath), "/proc/self/maps");snprintf (szpath,sizeof(szpath),"/proc/%d/maps", PID); FILE*FP = fopen (szpath,"R"); if(FP! =NULL) { while(Fgets (Szlines,sizeof(szlines), FP)) { if(Strstr (Szlines, Lpszsoname)) {lpch= Strtok (Szlines,"-"); Addr= Strtoul (lpch, NULL, -); printf ("Find%s Addr:%p\r\n", Lpszsoname, addr); Nfind=1; }} fclose (FP); } Else{printf ("fopen error\r\n"); } if(Nfind = =0) {printf ("No find\r\n"); } return 0;}
The results are as follows:
Android gets other process loaded module base address