Page 1 of 8

Injecting modules into exeDSP

Posted: Thu Aug 26, 2010 9:56 am
by smartsmurf
Since I could not find a solution which fits into my requirements I wrote a little tool which allows injection of a module into exeDSP process space.

I use ptrace() to attach to exePDS and then inject a block of code onto stack. This code calls dlopen, dlsym, the module entry, dlclose and returns control back to exeDSP.

For me this is the most convenient way to attach my stuff to exeDSP.

The syntax (with given example) is

Code: Select all

./injectso `pidof exeDSP` module.so Inject_Main /dtv/
Actually this loads module.so, runs Inject_Main("/dtv") and closes the module afterwards.

Cheers,
SM

Re: Injecting modules into exeDSP

Posted: Thu Aug 26, 2010 12:41 pm
by smartsmurf
bmwskead wrote: for understanding, to load a custom game module the execution line should be like this:

Code: Select all

./injectso `pidof exeDSP` load_custom_module.so Game_Main 
Actually yes, but please be aware that exeDSP opens the module. So if it is not within the search path, you need to specifiy

Code: Select all

./injectso `pidof exeDSP` /full/path/to/load_custom_module.so Game_Main 
Also when your Game_Main() function makes use of the path argument, you need to extend the line and pass it as first argument

Code: Select all

./injectso `pidof exeDSP` /full/path/to/load_custom_module.so Game_Main /full/path/to/ 
Just to avoid confusion.

Re: Injecting modules into exeDSP

Posted: Thu Aug 26, 2010 5:31 pm
by erdem_ua
Thanks, It looks better than GDB way :)

Re: Injecting modules into exeDSP

Posted: Mon Sep 06, 2010 10:22 pm
by smartsmurf
bmwskead wrote:any idea?
Ups. Sorry for the inconvenience...
I don't know what happened - but I did upload an old working copy. It contains a bug in the assembly part of it. The "Game_Main" parameter #1 is passed in R1 whereas it has to be passed in R0. The correct version is updated in the first post. Sorry again - but it seems you were the first one who tried it in depth. ;)

Re: Injecting modules into exeDSP

Posted: Tue Oct 05, 2010 8:57 am
by smartsmurf
Good point. I also thought about speeding up the search. The main issue is the fact, that all memory reads are done through ptrace commands.